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