本文整理汇总了TypeScript中fs-extra.mkdirsSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript mkdirsSync函数的具体用法?TypeScript mkdirsSync怎么用?TypeScript mkdirsSync使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mkdirsSync函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
output.sources[source].AST.children.forEach(child => {
if (child.name === 'Contract') {
let contractName = child.attributes.name;
let relativePath = path.relative(vscode.workspace.rootPath, source);
let dirName = path.dirname(path.join(binPath, relativePath));
if (!fs.existsSync(dirName)) {
fsex.mkdirsSync(dirName);
}
let contractAbiPath = path.join(dirName, contractName + '.abi');
let contractBinPath = path.join(dirName, contractName + '.bin');
if (fs.existsSync(contractAbiPath)) {
fs.unlinkSync(contractAbiPath);
}
if (fs.existsSync(contractBinPath)) {
fs.unlinkSync(contractBinPath);
}
fs.writeFileSync(contractBinPath, output.contracts[contractName].bytecode);
fs.writeFileSync(contractAbiPath, output.contracts[contractName].interface);
}
});
示例2: updateGhPagesAsync
static async updateGhPagesAsync(
repoUrl: string,
siteFolder: string,
docfxExe: string,
docfxJson: string,
gitUserName: string,
gitUserEmail: string,
gitCommitMessage: string) {
Guard.argumentNotNullOrEmpty(repoUrl, "repoUrl");
Guard.argumentNotNullOrEmpty(siteFolder, "siteFolder");
Guard.argumentNotNullOrEmpty(docfxExe, "docfxExe");
Guard.argumentNotNullOrEmpty(docfxJson, "docfxJson");
Guard.argumentNotNullOrEmpty(gitUserName, "gitUserName");
Guard.argumentNotNullOrEmpty(gitUserEmail, "gitUserEmail");
Guard.argumentNotNullOrEmpty(gitCommitMessage, "gitCommitMessage");
await Common.execAsync(docfxExe, [docfxJson]);
let branch = "gh-pages";
let targetDir = "docfxsite";
this.cleanGitInfo(siteFolder);
await Common.execAsync("git", ["clone", repoUrl, "-b", branch, targetDir]);
fs.mkdirsSync(path.join(siteFolder, ".git"));
fs.copySync(path.join(targetDir, ".git"), path.join(siteFolder, ".git"));
await Common.execAsync("git", ["config", "user.name", gitUserName], siteFolder);
await Common.execAsync("git", ["config", "user.email", gitUserEmail], siteFolder);
await Common.execAsync("git", ["add", "."], siteFolder);
await Common.execAsync("git", ["commit", "-m", gitCommitMessage], siteFolder);
return Common.execAsync("git", ["push", "origin", branch], siteFolder);
}
示例3: it
it('ng generate guard test' + path.sep + 'my-guard', () => {
fs.mkdirsSync(path.join(root, 'tmp', 'foo', 'src', 'app', 'test'));
return ng(['generate', 'guard', 'test' + path.sep + 'my-guard']).then(() => {
const testPath = path.join(root, 'tmp', 'foo', 'src', 'app', 'test', 'my-guard.guard.ts');
expect(fs.pathExistsSync(testPath)).to.equal(true);
});
});
示例4: _generateAndSave
private _generateAndSave(filePath: string): void {
let splitted = filePath.split(path.sep);
let part = splitted.filter(p => {
return splitted.indexOf(p) > splitted.indexOf(this.model);
}).join('/');
let to;
if (this.model !== 'project') {
to = path.join('src', 'app', `${this.model}s`,
this.name, path.basename(part).replace(/name/, this.name));
} else {
to = part;
}
try {
if (!dir.isDir(filePath)) {
let contents = fse.readFileSync(filePath, 'utf8');
let template = _.template(contents, { variable: 'data' });
fse.outputFileSync(to, template(this.data), 'utf8');
console.log(` ${chalk.green('create')} ${to}`);
} else {
if (!helper.existsSync(to)) {
fse.mkdirsSync(to);
}
}
} catch (e) {
throw new Error(e);
}
}
示例5: expect
const preparations = () => {
fse.outputFileSync("have_to_stay_file", "abc");
fse.mkdirsSync("to_remove");
fse.symlinkSync("../have_to_stay_file", "to_remove/symlink");
// Make sure we symlinked it properly.
expect(fse.readFileSync("to_remove/symlink", "utf8")).to.equal("abc");
};
示例6: it
it('ng generate pipe test' + path.sep + 'my-pipe', function () {
fs.mkdirsSync(path.join(root, 'tmp', 'foo', 'src', 'app', 'test'));
return ng(['generate', 'pipe', 'test' + path.sep + 'my-pipe']).then(() => {
const testPath = path.join(root, 'tmp', 'foo', 'src', 'app', 'test', 'my-pipe.pipe.ts');
expect(fs.pathExistsSync(testPath)).to.equal(true);
});
});
示例7: start
export function start(bootstrapArgs : BootstrapArguments, callback?: (app : App, err : string) => void) : App {
let app = new App(bootstrapArgs);
let onDBConnect = (err, db) => {
if(err) {
let msg = 'couldnt establish mongodb connection: ' + err;
if(callback) {
callback(app, msg);
}
throw msg;
} else {
app.init(db);
if(callback) {
callback(app, null);
}
}
};
if(bootstrapArgs.mockDB) {
fs.mkdirsSync(TINGODB_LOCATION);
repository.tingodbConnect(TINGODB_LOCATION, onDBConnect);
} else {
repository.mongodbConnect(config.mongodbUrl, onDBConnect);
}
return app;
}
示例8: it
it('test' + path.sep + 'my-dir', function () {
fs.mkdirsSync(path.join(root, 'tmp', 'foo', 'src', 'app', 'test'));
return ng(['generate', 'directive', 'test' + path.sep + 'my-dir', '--flat', 'false'])
.then(() => {
const testPath = path.join(root, 'tmp', 'foo', 'src', 'app', 'test', 'my-dir', 'my-dir.directive.ts');
expect(fs.pathExistsSync(testPath)).to.equal(true);
});
});
示例9: it
it('test' + path.sep + 'my-comp', function () {
mkdirsSync(path.join(root, 'tmp', 'foo', 'src', 'app', 'test'));
return ng(['generate', 'component', 'test' + path.sep + 'my-comp']).then(() => {
const testPath =
path.join(root, 'tmp', 'foo', 'src', 'app', 'test', 'my-comp', 'my-comp.component.ts');
expect(pathExistsSync(testPath)).to.equal(true);
});
});
示例10:
const preparations = () => {
// Just a file
fse.outputFileSync("x/file.txt", "123");
// Dot file
fse.outputFileSync("x/y/.dot", "dot");
// Empty directory
fse.mkdirsSync("x/y/z");
};