當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。