Beispiel #1
0
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"));
});
Beispiel #2
0
register("package", async (runner, releaseTag) => {
	if (!releaseTag) {
		throw new Error("Please specify the release tag.");
	}

	const releasePath = path.resolve(__dirname, "../release");

	const archiveName = `code-server-${releaseTag}-${os.platform()}-${os.arch()}`;
	const archiveDir = path.join(releasePath, archiveName);
	fse.removeSync(archiveDir);
	fse.mkdirpSync(archiveDir);

	const binaryPath = path.join(__dirname, `../packages/server/cli-${os.platform()}-${os.arch()}`);
	const binaryDestination = path.join(archiveDir, "code-server");
	fse.copySync(binaryPath, binaryDestination);
	fs.chmodSync(binaryDestination, "755");
	["README.md", "LICENSE"].forEach((fileName) => {
		fse.copySync(path.resolve(__dirname, `../${fileName}`), path.join(archiveDir, fileName));
	});

	runner.cwd = releasePath;
	await os.platform() === "linux"
		? runner.execute("tar", ["-cvzf", `${archiveName}.tar.gz`, `${archiveName}`])
		: runner.execute("zip", ["-r", `${archiveName}.zip`, `${archiveName}`]);
});
Beispiel #3
0
 }).then(() => {
   // create the directories synchronously to avoid any disk locking issues
   const directoryPathList = Array.from(directoriesToCreate);
   for (const directoryPath of directoryPathList) {
     mkdirpSync(directoryPath);
   }
 }).then(() => {
Beispiel #4
0
  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()
  }
  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));
  });
Beispiel #6
0
  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);
  });
  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();
  });
Beispiel #8
0
 dirs.forEach((dir) => {
     // Log.info(`./> mkdir -p ${dir}`);
     try {
         fse.mkdirpSync(dir);
     } catch (e) {
         // Log.error(`mkdir: ${e.message}`);
     }
 });
Beispiel #9
0
 matchingItems.forEach(matchingItem => {
   // create the directories first (if needed)
   mkdirpSync(pathDirname(matchingItem.absoluteDestPath));
   // cache the data and copy the files
   cacheCopyData(matchingItem);
   promises.push(copyFileAsync(matchingItem.absoluteSourcePath, matchingItem.absoluteDestPath));
   emit(EventType.FileChange, additions);
 });
Beispiel #10
0
export function file(name: string, content: string) {
	let fileName = path.join(testRoot, name)
	fse.mkdirpSync(path.dirname(fileName))
	fse.writeFileSync(fileName, content)

	return {
		fileName
	}
}