Skip to content

Commit d1fe21d

Browse files
Publish to TypeScript itself, create a task to preview changes.
1 parent 5019824 commit d1fe21d

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

Jakefile.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -361,23 +361,24 @@ compileFile(/*outfile*/configureNightlyJs,
361361
/*preserveConstEnums*/ undefined,
362362
/*keepComments*/ false,
363363
/*noResolve*/ false,
364-
/*stripInternal*/ false,
365-
/*callback*/ function () {
366-
var cmd = "node " + configureNightlyJs + " " + packageJson + " " + programTs;
367-
console.log(cmd);
368-
exec(cmd, completeHandler, errorHandler)
369-
});
364+
/*stripInternal*/ false);
370365

371-
task("setDebugModeTrue", function() {
366+
task("setDebugMode", function() {
372367
useDebugMode = true;
373368
});
374369

370+
task("configure-nightly", [configureNightlyJs], function() {
371+
var cmd = "node " + configureNightlyJs + " " + packageJson + " " + programTs;
372+
console.log(cmd);
373+
exec(cmd);
374+
}, { async: true });
375+
375376
desc("Configure, build, test, and publish the nightly release.");
376-
task("publish-nightly", [configureNightlyJs, "LKG", "clean", "setDebugModeTrue", "runtests"], function () {
377-
var cmd = "npm publish";
377+
task("publish-nightly", ["configure-nightly", "LKG", "clean", "setDebugMode", "runtests"], function () {
378+
var cmd = "npm publish --tag next";
378379
console.log(cmd);
379-
exec(cmd, completeHandler, errorHandler)
380-
}, {async: true});
380+
exec(cmd);
381+
});
381382

382383
// Local target to build the compiler and services
383384
var tscFile = path.join(builtLocalDirectory, compilerFilename);

scripts/configureNightly.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ function main(): void {
2727
// Modify the package.json structure
2828
packageJsonValue.version = nightlyVersion;
2929

30-
if (packageJsonValue.name !== "typescript-nightly") {
31-
packageJsonValue.name = "typescript-nightly";
32-
packageJsonValue.keywords.push("nightly", "alpha", "beta", "prerelease");
33-
}
34-
3530
// Acquire and modify the source file that exposes the version string.
3631
const tsFilePath = ts.normalizePath(sys.args[1]);
3732
const tsFileContents = sys.readFile(tsFilePath);
@@ -40,7 +35,16 @@ function main(): void {
4035

4136
// Ensure we are actually changing something - the user probably wants to know that the update failed.
4237
if (tsFileContents === modifiedTsFileContents) {
43-
throw `File '${tsFilePath}' did not contain pattern ${versionAssignmentRegExp}`;
38+
let err = `\n '${tsFilePath}' was not updated while configuring for a nightly publish.\n `;
39+
40+
if (tsFileContents.match(versionAssignmentRegExp)) {
41+
err += `Ensure that you have not already run this script; otherwise, erase your changes using 'git checkout -- "${tsFilePath}"'.`;
42+
}
43+
else {
44+
err += `The file seems to no longer have a string matching '${versionAssignmentRegExp}'.`;
45+
}
46+
47+
throw err + "\n";
4448
}
4549

4650
// Finally write the changes to disk.
@@ -51,19 +55,19 @@ function main(): void {
5155
function getNightlyVersionString(versionString: string): string {
5256
// If the version string already contains "-nightly",
5357
// then get the base string and update based on that.
54-
const dashNightlyPos = versionString.indexOf("-nightly");
58+
const dashNightlyPos = versionString.indexOf("-dev");
5559
if (dashNightlyPos >= 0) {
5660
versionString = versionString.slice(0, dashNightlyPos);
5761
}
5862

5963
// We're going to append a representation of the current time at the end of the current version.
6064
// String.prototype.toISOString() returns a 24-character string formatted as 'YYYY-MM-DDTHH:mm:ss.sssZ',
61-
// but we'd prefer to just use hyphens as separators instead of 'T', ':', and '.'.
62-
// The trailing 'Z' in this string can be removed; UTC time will always be implicit here.
65+
// but we'd prefer to just remove separators and limit ourselves to YYYYMMDD.
66+
// UTC time will always be implicit here.
6367
const now = new Date();
64-
const timeStr = now.toISOString().slice(0, -1).replace(/:|T|\./g, "-");
68+
const timeStr = now.toISOString().replace(/:|T|\.|-/g, "").slice(0, 8);
6569

66-
return `${versionString}-nightly-${timeStr}`;
70+
return `${versionString}-dev.${timeStr}`;
6771
}
6872

6973
main();

0 commit comments

Comments
 (0)