当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript fs-extra.mkdirsSync函数代码示例

本文整理汇总了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);
                            }
                        });
开发者ID:finhaus,项目名称:vscode-solidity,代码行数:28,代码来源:compiler.ts

示例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);
    }
开发者ID:DuncanmaMSFT,项目名称:docfx,代码行数:34,代码来源:github.ts

示例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);
   });
 });
开发者ID:RoPP,项目名称:angular-cli,代码行数:7,代码来源:generate-guard.spec.ts

示例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);
    }
  }
开发者ID:jkuri,项目名称:ng2-cli,代码行数:28,代码来源:blueprint.ts

示例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");
 };
开发者ID:szwacz,项目名称:fs-jetpack,代码行数:7,代码来源:remove.spec.ts

示例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);
   });
 });
开发者ID:RoPP,项目名称:angular-cli,代码行数:7,代码来源:generate-pipe.spec.ts

示例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;
}
开发者ID:mserranom,项目名称:lean-ci,代码行数:26,代码来源:app.ts

示例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);
     });
 });
开发者ID:RoPP,项目名称:angular-cli,代码行数:8,代码来源:generate-directive.spec.ts

示例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);
   });
 });
开发者ID:RoPP,项目名称:angular-cli,代码行数:8,代码来源:generate-component.spec.ts

示例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");
 };
开发者ID:szwacz,项目名称:fs-jetpack,代码行数:8,代码来源:copy.spec.ts


注:本文中的fs-extra.mkdirsSync函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。