當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript fs-extra.mkdirSync函數代碼示例

本文整理匯總了TypeScript中fs-extra.mkdirSync函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript mkdirSync函數的具體用法?TypeScript mkdirSync怎麽用?TypeScript mkdirSync使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了mkdirSync函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

const setCleanTestCwd = () => {
  const random = crypto.randomBytes(16).toString("hex");
  const path = `${os.tmpdir()}/fs-jetpack-test-${random}`;
  fse.mkdirSync(path);
  createdDirectories.push(path);
  process.chdir(path);
};
開發者ID:szwacz,項目名稱:fs-jetpack,代碼行數:7,代碼來源:helper.ts

示例2: function

walk.dirsSync(dataDirectory, function(dir: string, file: string, stat: any) {
	// Combine them together into the directories.
	var distDir = dir.replace(dataDirectory, distDirectory);
	var distDataDir = path.join(distDir, file);

	// Create the directory if it doesn't exist.
	if (!fs.existsSync(distDataDir)) {
		fs.mkdirSync(distDataDir);
	}
});
開發者ID:dmoonfire,項目名稱:mfgames-culture-data,代碼行數:10,代碼來源:init.ts

示例3: generate

 public generate() {
     this.cloneTemplate();
     const dir = this.config.name;
     const templateRepo = PlatformConfig.getRepository();
     const templateProjectName = GitGen.getRepoName(templateRepo.client);
     const replacePattern = { [templateProjectName]: dir };
     copySync(`${dir}/resources/gitignore/variantConfig.ts`, `${dir}/src/config/variantConfig.ts`);
     // for installing plugins this folder must exist
     mkdirSync(`${dir}/vesta/cordova/www`);
     findInFileAndReplace(`${dir}/vesta/cordova/config.xml`, replacePattern);
 }
開發者ID:VestaRayanAfzar,項目名稱:vesta,代碼行數:11,代碼來源:ClientAppGen.ts

示例4:

 nodes.forEach((node, index) => {
   tmpPath = path.join(tmpPath, node);
   if (fs.existsSync(tmpPath)) {
     return;
   }
   if (index === nodes.length - 1) {
     fs.writeFileSync(tmpPath, '');
   } else {
     fs.mkdirSync(tmpPath);
   }
 });
開發者ID:abdonrd,項目名稱:polymer-cli,代碼行數:11,代碼來源:github_test.ts

示例5: it

 it('ng generate module child should work in sub-dir', function () {
   fs.mkdirSync(path.join(testPath, './sub-dir'));
   return new Promise(resolve => {
     process.chdir(path.join(testPath, './sub-dir'));
     return resolve();
   }).then(() =>
     ng(['generate', 'module', 'child']).then(() => {
       expect(fs.pathExistsSync(path.join(testPath, 'sub-dir/child', 'child.module.ts'))).to.equal(true);
       expect(fs.pathExistsSync(path.join(testPath, 'sub-dir/child', 'child.module.spec.ts'))).to.equal(false);
     })
   );
 });
開發者ID:RoPP,項目名稱:angular-cli,代碼行數:12,代碼來源:generate-module.spec.ts

示例6: it

 it('ng generate module child should work in sub-dir with routing file when passed --routing flag', (done) => {
   fs.mkdirSync(path.join(testPath, './sub-dir'));
   return new Promise(resolve => {
     process.chdir(path.join(testPath, './sub-dir'));
     return resolve();
   })
   .then(() => ng(['generate', 'module', 'child', '--routing']))
   .then(() => {
     expect(fs.pathExistsSync(path.join(testPath, 'sub-dir/child', 'child.module.ts'))).toBe(true);
     expect(fs.pathExistsSync(path.join(testPath, 'sub-dir/child', 'child-routing.module.ts'))).toBe(true);
     expect(fs.pathExistsSync(path.join(testPath, 'sub-dir/child', 'child.module.spec.ts'))).toBe(false);
   })
   .then(done, done.fail);
 });
開發者ID:3L4CKD4RK,項目名稱:angular-cli,代碼行數:14,代碼來源:generate-module.spec.ts

示例7: createTemporaryDir

export function createTemporaryDir(projectPath: string): string {
  let temporaryDir = path.join(projectPath, Constants.tempPath);
  let counter = Constants.defaultCounter;
  while (counter--) {
    const result = fs.pathExistsSync(temporaryDir);

    if (result) {
      temporaryDir = temporaryDir.concat(Math.floor(Math.random() * 10).toString());
    } else {
      fs.mkdirSync(temporaryDir);
      break;
    }
  }

  return temporaryDir;
}
開發者ID:chrisseg,項目名稱:vscode-azure-blockchain-ethereum,代碼行數:16,代碼來源:workspace.ts

示例8: copy

        .map((fileName) => {
          const source = path.join(packagesRoot, fileName);
          const dest = path.join(dist, fileName);

          if (fs.statSync(source).isDirectory()) {
            try {
              fs.mkdirSync(dest);
            } catch (err) {
              if (err.code != 'EEXIST') {
                throw err;
              }
            }
          } else {
            return copy(source, dest);
          }
        })
開發者ID:headinclouds,項目名稱:angular-cli,代碼行數:16,代碼來源:build.ts

示例9: function

export default function() {
  const root = process.cwd();
  const modulePath = join(root, 'src', 'app', 'app.module.ts');

  fs.mkdirSync('./src/app/sub-dir');

  return ng('generate', 'service', 'test-service', '--module', 'app.module.ts')
    .then(() => expectFileToMatch(modulePath,
      /import { TestServiceService } from '.\/test-service.service'/))

    .then(() => process.chdir(join(root, 'src', 'app')))
    .then(() => ng('generate', 'service', 'test-service2', '--module', 'app.module.ts'))
    .then(() => expectFileToMatch(modulePath,
      /import { TestService2Service } from '.\/test-service2.service'/))

    // Try to run the unit tests.
    .then(() => ng('build'));
}
開發者ID:3L4CKD4RK,項目名稱:angular-cli,代碼行數:18,代碼來源:service-module.ts

示例10: function

export default function() {
  const root = process.cwd();
  const modulePath = join(root, 'src', 'app', 'app.module.ts');

  fs.mkdirSync('./src/app/sub-dir');

  return ng('generate', 'guard', 'test-guard', '--module', 'app.module.ts')
    .then(() => expectFileToMatch(modulePath,
      /import { TestGuardGuard } from '.\/test-guard.guard'/))
    .then(() => expectFileToMatch(modulePath,
      /providers:\s*\[TestGuardGuard\]/m))

    .then(() => process.chdir(join(root, 'src', 'app')))
    .then(() => ng('generate', 'guard', 'test-guard2', '--module', 'app.module.ts'))
    .then(() => expectFileToMatch(modulePath,
      /import { TestGuard2Guard } from '.\/test-guard2.guard'/))

    .then(() => ng('build'));
}
開發者ID:3L4CKD4RK,項目名稱:angular-cli,代碼行數:19,代碼來源:guard-module.ts


注:本文中的fs-extra.mkdirSync函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。