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


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

本文整理汇总了TypeScript中fs-extra.mkdirpSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript mkdirpSync函数的具体用法?TypeScript mkdirpSync怎么用?TypeScript mkdirpSync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mkdirpSync函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: register

const buildServerBinaryCopy = register("build:server:binary:copy", async (runner) => {
	const cliPath = path.join(pkgsPath, "server");
	const cliBuildPath = path.join(cliPath, "build");
	fse.removeSync(cliBuildPath);
	fse.mkdirpSync(path.join(cliBuildPath, "extensions"));
	const bootstrapForkPath = path.join(pkgsPath, "vscode", "out", "bootstrap-fork.js");
	const webOutputPath = path.join(pkgsPath, "web", "out");
	const browserAppOutputPath = path.join(pkgsPath, "app", "browser", "out");
	const nodePtyModule = path.join(pkgsPath, "protocol", "node_modules", "node-pty-prebuilt", "build", "Release", "pty.node");
	const spdlogModule = path.join(pkgsPath, "protocol", "node_modules", "spdlog", "build", "Release", "spdlog.node");
	let ripgrepPath = path.join(pkgsPath, "..", "lib", "vscode", "node_modules", "vscode-ripgrep", "bin", "rg");
	if (isWin) {
		ripgrepPath += ".exe";
	}

	if (!fs.existsSync(nodePtyModule)) {
		throw new Error("Could not find pty.node. Ensure all packages have been installed");
	}
	if (!fs.existsSync(spdlogModule)) {
		throw new Error("Could not find spdlog.node. Ensure all packages have been installed");
	}
	if (!fs.existsSync(webOutputPath)) {
		throw new Error("Web bundle must be built");
	}
	if (!fs.existsSync(defaultExtensionsPath)) {
		throw new Error("Default extensions must be built");
	}
	if (!fs.existsSync(bootstrapForkPath)) {
		throw new Error("Bootstrap fork must exist");
	}
	if (!fs.existsSync(ripgrepPath)) {
		throw new Error("Ripgrep must exist");
	}
	fse.copySync(defaultExtensionsPath, path.join(cliBuildPath, "extensions"));
	fs.writeFileSync(path.join(cliBuildPath, "bootstrap-fork.js.gz"), zlib.gzipSync(fs.readFileSync(bootstrapForkPath)));
	const cpDir = (dir: string, subdir: "auth" | "unauth", rootPath: string): void => {
		const stat = fs.statSync(dir);
		if (stat.isDirectory()) {
			const paths = fs.readdirSync(dir);
			paths.forEach((p) => cpDir(path.join(dir, p), subdir, rootPath));
		} else if (stat.isFile()) {
			const newPath = path.join(cliBuildPath, "web", subdir, path.relative(rootPath, dir));
			fse.mkdirpSync(path.dirname(newPath));
			fs.writeFileSync(newPath + ".gz", zlib.gzipSync(fs.readFileSync(dir)));
		} else {
			// Nothing
		}
	};
	cpDir(webOutputPath, "auth", webOutputPath);
	cpDir(browserAppOutputPath, "unauth", browserAppOutputPath);
	fse.mkdirpSync(path.join(cliBuildPath, "dependencies"));
	fse.copySync(nodePtyModule, path.join(cliBuildPath, "dependencies", "pty.node"));
	fse.copySync(spdlogModule, path.join(cliBuildPath, "dependencies", "spdlog.node"));
	fse.copySync(ripgrepPath, path.join(cliBuildPath, "dependencies", "rg"));
});
开发者ID:AhmadAlyTanany,项目名称:code-server,代码行数:55,代码来源:tasks.ts

示例2: mkdirpSync

 }).then(() => {
   // create the directories synchronously to avoid any disk locking issues
   const directoryPathList = Array.from(directoriesToCreate);
   for (const directoryPath of directoryPathList) {
     mkdirpSync(directoryPath);
   }
 }).then(() => {
开发者ID:Kode-Kitchen,项目名称:ionic-app-scripts,代码行数:7,代码来源:copy.ts

示例3: constructor

  constructor(options: FileAppStoreOptions) {
    this.appDir = options.appDir
    if (!fs.existsSync(this.appDir)) {
      throw new Error("Could not find path: " + this.appDir)
    }
    const stat = fs.statSync(this.appDir)
    if (!stat.isDirectory()) {
      this.appDir = path.dirname(this.appDir)
    }

    this.env = options.env

    this.buildDir = options.buildDir || path.join(this.appDir, ".fly", "build", this.env)
    if (!fs.existsSync(this.buildDir)) {
      fs.mkdirpSync(this.buildDir)
    }

    this.release = {
      app: options.app_name || this.appDir,
      env: this.env,
      version: 0,
      source: "",
      sourceHash: "",
      config: {},
      secrets: {}
    }

    this.app = new App(this.release)

    // some callers expect config to be loaded after constructor returns
    this.buildConfig()
    this.loadSecrets()
  }
开发者ID:dianpeng,项目名称:fly,代码行数:33,代码来源:file_app_store.ts

示例4: basename

  inputFiles.forEach(inputFilePath => {
    const inputTestName = basename(inputFilePath);
    const tempInputPath = join(tempPath, `projects/cdk-testing/src/test-cases/${inputTestName}.ts`);

    mkdirpSync(dirname(tempInputPath));
    writeFileSync(tempInputPath, readFileContent(inputFilePath));
  });
开发者ID:josephperrott,项目名称:material2,代码行数:7,代码来源:test-case-setup.ts

示例5: getSecondaryEntryPointsForPackage

  getSecondaryEntryPointsForPackage(buildPackage).forEach(entryPointName => {
    // Create a directory in the root of the package for this entry point that contains
    // * A package.json that lists the different bundle locations
    // * An index.d.ts file that re-exports the index.d.ts from the typings/ directory
    // * A metadata.json re-export for this entry-point's metadata.
    const entryPointDir = join(releasePath, entryPointName);

    mkdirpSync(entryPointDir);
    createEntryPointPackageJson(entryPointDir, packageName, entryPointName);

    // Copy typings and metadata from tsc output location into the entry-point.
    copyFiles(
        join(packageOut, entryPointName),
        '**/*.+(d.ts|metadata.json)',
        join(entryPointDir, 'typings'));

    // Create a typings and a metadata re-export within the entry-point to point to the
    // typings we just copied.
    createTypingsReexportFile(entryPointDir, `./typings/index`, 'index');
    createMetadataReexportFile(entryPointDir, `./typings/index`, 'index');

    // Finally, create both a d.ts and metadata file for this entry-point in the root of
    // the package that re-exports from the entry-point's directory.
    createTypingsReexportFile(releasePath, `./${entryPointName}/index`, entryPointName);
    createMetadataReexportFile(releasePath, `./${entryPointName}/index`, entryPointName);
  });
开发者ID:HemanthKona,项目名称:material2,代码行数:26,代码来源:build-release.ts

示例6: it

  it('should report imports for deleted animation constants', async () => {
    const {runFixers, removeTempDir, tempPath} = await createTestCaseSetup(
      'migration-v8', migrationCollection, [require.resolve('./material-imports_input.ts')]);
    const materialPath = join(tempPath, 'node_modules/@angular/material');

    mkdirpSync(materialPath);
    writeFileSync(join(materialPath, 'index.d.ts'), `
      export * from './a';
      export * from './b';
      export * from './c';
      export * from './core';
      export * from './types';
    `);

    writeSecondaryEntryPoint(materialPath, 'a', `export const a = '';`);
    writeSecondaryEntryPoint(materialPath, 'b', `export const b = '';`);
    writeSecondaryEntryPoint(materialPath, 'c', `export const c = ''`);
    writeSecondaryEntryPoint(materialPath, 'core', `export const VERSION = '';`);
    writeSecondaryEntryPoint(materialPath, 'types', `
      export declare interface SomeInterface {
        event: any;
      }
    `);

    await runFixers();

    const outputPath = join(tempPath,
      'projects/cdk-testing/src/test-cases/material-imports_input.ts');

    expect(readFileContent(outputPath)).toBe(
      readFileContent(require.resolve('./material-imports_expected_output.ts')));

    removeTempDir();
  });
开发者ID:codef0rmer,项目名称:material2,代码行数:34,代码来源:material-imports.spec.ts

示例7: catch

 dirs.forEach((dir) => {
     // Log.info(`./> mkdir -p ${dir}`);
     try {
         fse.mkdirpSync(dir);
     } catch (e) {
         // Log.error(`mkdir: ${e.message}`);
     }
 });
开发者ID:VestaRayanAfzar,项目名称:vesta,代码行数:8,代码来源:FsUtil.ts

示例8: file

export function file(name: string, content: string) {
	let fileName = path.join(testRoot, name)
	fse.mkdirpSync(path.dirname(fileName))
	fse.writeFileSync(fileName, content)

	return {
		fileName
	}
}
开发者ID:docscript,项目名称:docscript,代码行数:9,代码来源:test-utils.ts


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