From ff81ce078ba997640bab069595e5ad7dccbd2623 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 2 Jan 2019 09:38:40 -0800 Subject: [PATCH 01/13] Add a release pipelines job --- azure-pipelines.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a26bd3d8..19c8044b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -66,3 +66,22 @@ jobs: - script: | yarn lint displayName: 'Lint' + +- job: Release + dependsOn: + - Linux + - macOS + - Windows + pool: + vmImage: 'xcode9-macos10.13' + steps: + - task: NodeTool@0 + inputs: + versionSpec: '8.x' + displayName: 'Install Node.js' + - script: | + yarn + displayName: 'Install dependencies and build' + - script: | + echo 'success' + displayName: 'Test' From a6c3f948604e1814a854221d4a9a424057907567 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 2 Jan 2019 11:24:06 -0800 Subject: [PATCH 02/13] Publish to npm as beta --- .npmignore | 1 + azure-pipelines.yml | 13 +++++++++--- bin/publish.js | 48 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 bin/publish.js diff --git a/.npmignore b/.npmignore index 517ba0bd..03030ba5 100644 --- a/.npmignore +++ b/.npmignore @@ -42,6 +42,7 @@ lib/test/ docs/ /.idea/ .vscode/ +bin/ build/ fixtures/ coverage/ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 19c8044b..a701b9a5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -72,16 +72,23 @@ jobs: - Linux - macOS - Windows + #condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) pool: - vmImage: 'xcode9-macos10.13' + vmImage: 'ubuntu-16.04' steps: - task: NodeTool@0 inputs: versionSpec: '8.x' displayName: 'Install Node.js' + - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2 + inputs: + versionSpec: "1.9.4" + displayName: 'Install Yarn' - script: | yarn displayName: 'Install dependencies and build' - script: | - echo 'success' - displayName: 'Test' + node ./bin/publish.js + env: + NPM_AUTH_TOKEN: $(NPM_AUTH_TOKEN) + displayName: 'Publish to npm' diff --git a/bin/publish.js b/bin/publish.js new file mode 100644 index 00000000..e7871155 --- /dev/null +++ b/bin/publish.js @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2019 The xterm.js authors. All rights reserved. + * @license MIT + */ + +const cp = require('child_process'); +const fs = require('fs'); +const path = require('path'); +const packageJson = require('../package.json'); + +// Setup auth +fs.writeFileSync(`${process.env['HOME']}/.npmrc`, `//registry.npmjs.org/:_authToken=${process.env['NPM_AUTH_TOKEN']}`); + +// Get the version +const tag = 'beta' +const nextVersion = getNextVersion(tag); +console.log(`Publishing version: ${nextVersion}`); + +// Set the version in package.json +const packageJsonFile = path.resolve(__dirname, '..', 'package.json'); +let packageJsonRaw = fs.readFileSync(packageJsonFile).toString(); +packageJsonRaw = packageJsonRaw.replace(/("version": ")3.10.0(")/, `$1${nextVersion}$2`); +fs.writeFileSync(packageJsonFile, packageJsonRaw); + +// Publish +cp.spawnSync('npm', ['publish', '--tag', tag], { + stdio: 'inherit' +}); + +function getNextVersion(tag) { + if (!/^[0-9]+\.[0-9]+\.[0-9]+$/.exec(packageJson.version)) { + console.error('The package.json version must be of the form x.y.z'); + process.exit(1); + } + const publishedVersions = getPublishedVersions(packageJson.version, tag); + if (publishedVersions.length === 0) { + return `${packageJson.version}-${tag}1`; + } + const latestPublishedVersion = publishedVersions.sort((a, b) => b.localeCompare(a))[0]; + const latestTagVersion = parseInt(latestPublishedVersion.substr(latestPublishedVersion.search(/[0-9]+$/)), 10); + return `${packageJson.version}-${tag}${latestTagVersion + 1}`; +} + +function getPublishedVersions(version, tag) { + const versionsProcess = cp.spawnSync('npm', ['view', 'xterm', 'versions', '--json']); + const versionsJson = JSON.parse(versionsProcess.stdout); + return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}[0-9]+`))); +} diff --git a/package.json b/package.json index 0d797f78..5ed3a4b8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "xterm", "description": "Full xterm terminal, in your browser", - "version": "3.9.0", + "version": "3.10.0", "main": "lib/public/Terminal.js", "types": "typings/xterm.d.ts", "repository": "https://github.com/xtermjs/xterm.js", From aa2d28e619457d30a375dbe0748bf73e6adfc35f Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 2 Jan 2019 11:37:34 -0800 Subject: [PATCH 03/13] Disable dependsOn --- azure-pipelines.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a701b9a5..2126a26d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -68,10 +68,10 @@ jobs: displayName: 'Lint' - job: Release - dependsOn: - - Linux - - macOS - - Windows + # dependsOn: + # - Linux + # - macOS + # - Windows #condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) pool: vmImage: 'ubuntu-16.04' @@ -88,6 +88,7 @@ jobs: yarn displayName: 'Install dependencies and build' - script: | + echo $NPM_AUTH_TOKEN node ./bin/publish.js env: NPM_AUTH_TOKEN: $(NPM_AUTH_TOKEN) From a35ad6aa810003240312c2f0c87bde719b244ec0 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 2 Jan 2019 11:39:44 -0800 Subject: [PATCH 04/13] Inherit exit code from publish call --- bin/publish.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/publish.js b/bin/publish.js index e7871155..d5bebe02 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -23,9 +23,10 @@ packageJsonRaw = packageJsonRaw.replace(/("version": ")3.10.0(")/, `$1${nextVers fs.writeFileSync(packageJsonFile, packageJsonRaw); // Publish -cp.spawnSync('npm', ['publish', '--tag', tag], { +const result = cp.spawn('npm', ['publish', '--tag', tag], { stdio: 'inherit' }); +result.on('exit', code => process.exit(code)); function getNextVersion(tag) { if (!/^[0-9]+\.[0-9]+\.[0-9]+$/.exec(packageJson.version)) { From 515cf7878ef15d6f77f864fff38d7e13d61881fc Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 2 Jan 2019 11:49:20 -0800 Subject: [PATCH 05/13] Tweak var --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2126a26d..d3568a2f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -88,8 +88,8 @@ jobs: yarn displayName: 'Install dependencies and build' - script: | - echo $NPM_AUTH_TOKEN + echo $MAPPED_NPM_AUTH_TOKEN node ./bin/publish.js env: - NPM_AUTH_TOKEN: $(NPM_AUTH_TOKEN) + MAPPED_NPM_AUTH_TOKEN: $(NPM_AUTH_TOKEN) displayName: 'Publish to npm' From 68fbb2f8c98eb5aa69e9ab0b8ec102c11fff6358 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 2 Jan 2019 11:53:51 -0800 Subject: [PATCH 06/13] Tweak more --- azure-pipelines.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d3568a2f..11ceefbb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -88,8 +88,6 @@ jobs: yarn displayName: 'Install dependencies and build' - script: | - echo $MAPPED_NPM_AUTH_TOKEN - node ./bin/publish.js - env: - MAPPED_NPM_AUTH_TOKEN: $(NPM_AUTH_TOKEN) + echo $(NPM_AUTH_TOKEN) + NPM_AUTH_TOKEN="$(NPM_AUTH_TOKEN)" node ./bin/publish.js displayName: 'Publish to npm' From d120ef5301b644148dd6537592f226566672c9b1 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 2 Jan 2019 12:55:44 -0800 Subject: [PATCH 07/13] Re-enable condition and dependsOn --- azure-pipelines.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 11ceefbb..6101c802 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -68,11 +68,11 @@ jobs: displayName: 'Lint' - job: Release - # dependsOn: - # - Linux - # - macOS - # - Windows - #condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) + dependsOn: + - Linux + - macOS + - Windows + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) pool: vmImage: 'ubuntu-16.04' steps: @@ -88,6 +88,5 @@ jobs: yarn displayName: 'Install dependencies and build' - script: | - echo $(NPM_AUTH_TOKEN) NPM_AUTH_TOKEN="$(NPM_AUTH_TOKEN)" node ./bin/publish.js displayName: 'Publish to npm' From 4db95f253ef7959257047e5aca95858db3b258f6 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 2 Jan 2019 13:40:06 -0800 Subject: [PATCH 08/13] Build to dist dir in release build --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6101c802..db74a4ea 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -86,6 +86,7 @@ jobs: displayName: 'Install Yarn' - script: | yarn + BUILD_DIR=dist npm run build displayName: 'Install dependencies and build' - script: | NPM_AUTH_TOKEN="$(NPM_AUTH_TOKEN)" node ./bin/publish.js From b0470459493771db901d58489e419f9c5349033b Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 27 Jan 2019 07:28:04 -0800 Subject: [PATCH 09/13] Replace hardcoded version --- bin/publish.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/publish.js b/bin/publish.js index d5bebe02..6ffb1c25 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -19,7 +19,7 @@ console.log(`Publishing version: ${nextVersion}`); // Set the version in package.json const packageJsonFile = path.resolve(__dirname, '..', 'package.json'); let packageJsonRaw = fs.readFileSync(packageJsonFile).toString(); -packageJsonRaw = packageJsonRaw.replace(/("version": ")3.10.0(")/, `$1${nextVersion}$2`); +packageJsonRaw = packageJsonRaw.replace(/("version": ")[0-9]+\.[0-9]+\.[0-9]+(")/, `$1${nextVersion}$2`); fs.writeFileSync(packageJsonFile, packageJsonRaw); // Publish From af6544d6d92c14d95ea3529a1f0126cbca9ba60f Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 28 Jan 2019 07:23:46 -0800 Subject: [PATCH 10/13] Improve package.json modifications --- bin/publish.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/publish.js b/bin/publish.js index 6ffb1c25..700752b4 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -18,9 +18,8 @@ console.log(`Publishing version: ${nextVersion}`); // Set the version in package.json const packageJsonFile = path.resolve(__dirname, '..', 'package.json'); -let packageJsonRaw = fs.readFileSync(packageJsonFile).toString(); -packageJsonRaw = packageJsonRaw.replace(/("version": ")[0-9]+\.[0-9]+\.[0-9]+(")/, `$1${nextVersion}$2`); -fs.writeFileSync(packageJsonFile, packageJsonRaw); +packageJson.version = nextVersion; +fs.writeFileSync(packageJsonFile, JSON.stringify(packageJson, null, 2)); // Publish const result = cp.spawn('npm', ['publish', '--tag', tag], { From 9c72254d3a77f7dc62c15cc475b2080a74760101 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 28 Jan 2019 07:23:58 -0800 Subject: [PATCH 11/13] Bump to 3.11.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5ed3a4b8..fa9cc070 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "xterm", "description": "Full xterm terminal, in your browser", - "version": "3.10.0", + "version": "3.11.0", "main": "lib/public/Terminal.js", "types": "typings/xterm.d.ts", "repository": "https://github.com/xtermjs/xterm.js", From 70db48b533a6e62b52500d664961e445613c88a0 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 28 Apr 2019 00:33:20 +0000 Subject: [PATCH 12/13] Add notice about beta builds in readme --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 1fa8ad41..b2e9f02f 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,16 @@ Xterm.js follows a monthly release cycle roughly. All current and past releases are available on this repo's [Releases page](https://github.com/sourcelair/xterm.js/releases), you can view the [high-level roadmap on the wiki](https://github.com/xtermjs/xterm.js/wiki/Roadmap) and see what we're working on now by looking through [Milestones](https://github.com/sourcelair/xterm.js/milestones). +### Beta builds + +Our CI releases beta builds to npm for every change that goes into master, install the latest beta build with: + +``` +npm install -S xterm@beta +``` + +These should generally be stable but some bugs may slip in, we recommend using the beta build primarily to test out new features and for verifying bug fixes. + ## Contributing You can read the [guide on the wiki](https://github.com/xtermjs/xterm.js/wiki/Contributing) to learn how to contribute and setup xterm.js for development. From 65eaea39d3689cd58881e556c63c010ba5dbab91 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 28 Apr 2019 00:45:51 +0000 Subject: [PATCH 13/13] Base the beta build off of the next minor version --- bin/publish.js | 6 ++++-- package.json | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/publish.js b/bin/publish.js index 700752b4..ec7bf173 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -32,13 +32,15 @@ function getNextVersion(tag) { console.error('The package.json version must be of the form x.y.z'); process.exit(1); } - const publishedVersions = getPublishedVersions(packageJson.version, tag); + const stableVersion = packageJson.version.split('.'); + const nextStableVersion = `${stableVersion[0]}.${parseInt(stableVersion[1]) + 1}.${stableVersion[2]}`; + const publishedVersions = getPublishedVersions(nextStableVersion, tag); if (publishedVersions.length === 0) { return `${packageJson.version}-${tag}1`; } const latestPublishedVersion = publishedVersions.sort((a, b) => b.localeCompare(a))[0]; const latestTagVersion = parseInt(latestPublishedVersion.substr(latestPublishedVersion.search(/[0-9]+$/)), 10); - return `${packageJson.version}-${tag}${latestTagVersion + 1}`; + return `${nextStableVersion}-${tag}${latestTagVersion + 1}`; } function getPublishedVersions(version, tag) { diff --git a/package.json b/package.json index afa6ca5d..d58a6a5d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "xterm", "description": "Full xterm terminal, in your browser", - "version": "3.13.0", + "version": "3.12.0", "main": "lib/public/Terminal.js", "types": "typings/xterm.d.ts", "repository": "https://github.com/xtermjs/xterm.js", @@ -61,4 +61,4 @@ "coveralls": "nyc report --reporter=text-lcov | coveralls", "watch": "tsc -b -w ./src/tsconfig.all.json --preserveWatchOutput" } -} +} \ No newline at end of file