当前位置: 首页>>代码示例>>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;未经允许,请勿转载。