Rename the smaller build to '@typescript/language-services' and have a separate build step for creating and publishing vs configuring the build
This commit is contained in:
Родитель
31c08b6191
Коммит
92b3266a93
|
@ -45,7 +45,8 @@ scripts/buildProtocol.js
|
|||
scripts/ior.js
|
||||
scripts/authors.js
|
||||
scripts/configurePrerelease.js
|
||||
scripts/configureTSCBuild.js
|
||||
scripts/configureLanguageServiceBuild.js
|
||||
scripts/createLanguageServiceBuild.js
|
||||
scripts/open-user-pr.js
|
||||
scripts/open-cherry-pick-pr.js
|
||||
scripts/processDiagnosticMessages.d.ts
|
||||
|
|
|
@ -588,9 +588,9 @@ const configureExperimental = () => exec(process.execPath, ["scripts/configurePr
|
|||
task("configure-experimental", series(buildScripts, configureExperimental));
|
||||
task("configure-experimental").description = "Runs scripts/configurePrerelease.ts to prepare a build for experimental publishing";
|
||||
|
||||
const configureTSCOnly = () => exec(process.execPath, ["scripts/configureTSCBuild.js", "package.json", "src/compiler/core.ts"]);
|
||||
task("configure-tsc-only", series(buildScripts, configureNightly));
|
||||
task("configure-tsc-only").description = "Runs scripts/configureTSCOnly.ts to prepare a build for build which only has tsc ";
|
||||
const createLanguageServicesBuild = () => exec(process.execPath, ["scripts/createLanguageServicesBuild.js"]);
|
||||
task("create-language-services-build", series(buildScripts, createLanguageServicesBuild));
|
||||
task("create-language-services-build").description = "Runs scripts/createLanguageServicesBuild.ts to prepare a build which only has the require('typescript') JS.";
|
||||
|
||||
const publishNightly = () => exec("npm", ["publish", "--tag", "next"]);
|
||||
task("publish-nightly", series(task("clean"), task("LKG"), task("clean"), task("runtests-parallel"), publishNightly));
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
"scripts": {
|
||||
"prepare": "gulp build-eslint-rules",
|
||||
"pretest": "gulp tests",
|
||||
"postpublish": "gulp configure-tsc-only",
|
||||
"postpublish": "gulp create-language-services-build",
|
||||
"test": "gulp runtests-parallel --light=false",
|
||||
"test:eslint-rules": "gulp run-eslint-rules-tests",
|
||||
"build": "npm run build:compiler && npm run build:tests",
|
||||
|
|
|
@ -37,7 +37,7 @@ function main(): void {
|
|||
delete packageJsonValue.scripts.postpublish;
|
||||
|
||||
// Set the new name
|
||||
packageJsonValue.name = "@orta/language-services";
|
||||
packageJsonValue.name = "@typescript/language-services";
|
||||
|
||||
writeFileSync(packageJsonFilePath, JSON.stringify(packageJsonValue, /*replacer:*/ undefined, /*space:*/ 4));
|
||||
|
||||
|
@ -74,10 +74,10 @@ function main(): void {
|
|||
|
||||
// This section verifies that the build of TypeScript compiles and emits
|
||||
|
||||
const ts = require("../" + lib);
|
||||
const ts = require(lib);
|
||||
const source = "let x: string = 'string'";
|
||||
|
||||
const results =ts.transpileModule(source, {
|
||||
const results = ts.transpileModule(source, {
|
||||
compilerOptions: { module: ts.ModuleKind.CommonJS }
|
||||
});
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/// <reference types="node"/>
|
||||
import { join } from "path";
|
||||
import { readFileSync, unlinkSync } from "fs";
|
||||
import { tmpdir } from "os";
|
||||
import { execSync, ExecSyncOptions } from "child_process";
|
||||
import chalk from "chalk";
|
||||
|
||||
interface PackageJson {
|
||||
name: string;
|
||||
version: string
|
||||
}
|
||||
|
||||
const exec = (cmd: string, opts?: ExecSyncOptions) => {
|
||||
console.log(chalk.gray(`> ${cmd} ${opts ? JSON.stringify(opts) : ""}`));
|
||||
execSync(cmd, opts);
|
||||
};
|
||||
|
||||
const step = (msg: string) => {
|
||||
console.log("\n\n" + chalk.bold("- ") + msg);
|
||||
};
|
||||
|
||||
function main(): void {
|
||||
console.log(chalk.bold("## Creating the language services build of TypeScript"));
|
||||
process.stdout.write(chalk.grey("> node /scripts/createLanguageServiceBuild.ts"));
|
||||
|
||||
// Create a tarball of the current version
|
||||
step("Packing the current TypeScript via npm.");
|
||||
exec("npm pack");
|
||||
|
||||
const packageJsonValue: PackageJson = JSON.parse(readFileSync("package.json", "utf8"));
|
||||
const tarballFileName = `${packageJsonValue.name}-${packageJsonValue.version}.tgz`;
|
||||
|
||||
const unzipDir = tmpdir();
|
||||
step(`Extracting the built version into a temporary folder. ${unzipDir}/package`);
|
||||
exec(`tar -xvzf ${tarballFileName} -C ${unzipDir}`);
|
||||
unlinkSync(tarballFileName);
|
||||
|
||||
step(`Updating the build metadata`);
|
||||
const packagePath = join(unzipDir, "package");
|
||||
exec(`node scripts/configureLanguageServiceBuild.js ${join(packagePath, "package.json")}`);
|
||||
|
||||
step(`Deploying the language service`);
|
||||
exec("npm publish --access public", { cwd: packagePath });
|
||||
}
|
||||
|
||||
main();
|
Загрузка…
Ссылка в новой задаче