Skip to content

Commit

Permalink
Merge pull request #4861 from Tyriar/scope_followup
Browse files Browse the repository at this point in the history
Uncomment first publish special cases, add missing (at)xterm
  • Loading branch information
Tyriar committed Nov 1, 2023
2 parents 2df591c + bbbde92 commit 4b2e52f
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 22 deletions.
2 changes: 1 addition & 1 deletion addons/addon-attach/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"prepublishOnly": "npm run package"
},
"peerDependencies": {
"xterm": "^5.0.0"
"@xterm/xterm": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion addons/addon-canvas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"start-server-only": "node ../../demo/start-server-only"
},
"peerDependencies": {
"xterm": "^5.0.0"
"@xterm/xterm": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion addons/addon-fit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"prepublishOnly": "npm run package"
},
"peerDependencies": {
"xterm": "^5.0.0"
"@xterm/xterm": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion addons/addon-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"prepublishOnly": "npm run package"
},
"peerDependencies": {
"xterm": "^5.2.0"
"@xterm/xterm": "^5.2.0"
},
"devDependencies": {
"sixel": "^0.16.0",
Expand Down
2 changes: 1 addition & 1 deletion addons/addon-ligatures/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"yauzl": "^2.10.0"
},
"peerDependencies": {
"xterm": "^5.0.0"
"@xterm/xterm": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion addons/addon-search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"prepublishOnly": "npm run package"
},
"peerDependencies": {
"xterm": "^5.0.0"
"@xterm/xterm": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion addons/addon-serialize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ npm install --save @xterm/addon-serialize
### Usage

```ts
import { Terminal } from "xterm";
import { Terminal } from "@xterm/xterm";
import { SerializeAddon } from "@xterm/addon-serialize";

const terminal = new Terminal();
Expand Down
2 changes: 1 addition & 1 deletion addons/addon-serialize/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"benchmark-eval": "NODE_PATH=../../out:./out:./out-benchmark/ ../../node_modules/.bin/xterm-benchmark -r 5 -c benchmark/benchmark.json --eval out-benchmark/benchmark/*benchmark.js"
},
"peerDependencies": {
"xterm": "^5.0.0"
"@xterm/xterm": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion addons/addon-unicode-graphemes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"benchmark-eval": "NODE_PATH=../../out:./out:./out-benchmark/ ../../node_modules/.bin/xterm-benchmark -r 5 -c benchmark/benchmark.json --eval out-benchmark/benchmark/*benchmark.js"
},
"peerDependencies": {
"xterm": "^5.0.0"
"@xterm/xterm": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion addons/addon-unicode11/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"prepublishOnly": "npm run package"
},
"peerDependencies": {
"xterm": "^5.0.0"
"@xterm/xterm": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion addons/addon-web-links/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"prepublishOnly": "npm run package"
},
"peerDependencies": {
"xterm": "^5.0.0"
"@xterm/xterm": "^5.0.0"
}

}
3 changes: 1 addition & 2 deletions addons/addon-webgl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"start-server-only": "node ../../demo/start-server-only"
},
"peerDependencies": {
"xterm": "^5.0.0"
"@xterm/xterm": "^5.0.0"
}

}
25 changes: 16 additions & 9 deletions bin/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ const addonPackageDirs = [
console.log(`Checking if addons need to be published`);
for (const p of addonPackageDirs) {
const addon = path.basename(p);
// TODO: Uncomment after first publish
// if (changedFiles.some(e => e.includes(addon))) {
if (changedFiles.some(e => e.includes(addon))) {
console.log(`Try publish ${addon}`);
checkAndPublishPackage(p);
// }
}
}

// Publish website if it's a stable release
Expand All @@ -58,9 +57,9 @@ function checkAndPublishPackage(packageDir) {
const packageJson = require(path.join(packageDir, 'package.json'));

// Determine if this is a stable or beta release
// TODO: Uncomment after first publish
// TODO: Uncomment when publishing 5.4
// const publishedVersions = getPublishedVersions(packageJson);
const isStableRelease = false; // !publishedVersions.includes(packageJson.version);
const isStableRelease = false; //!publishedVersions.includes(packageJson.version);

// Get the next version
let nextVersion = isStableRelease ? packageJson.version : getNextBetaVersion(packageJson);
Expand Down Expand Up @@ -115,12 +114,20 @@ function getNextBetaVersion(packageJson) {
return `${nextStableVersion}-${tag}.${latestTagVersion + 1}`;
}

function asArray(value) {
return Array.isArray(value) ? value : [value];
}

function getPublishedVersions(packageJson, version, tag) {
const versionsProcess = cp.spawnSync('npm', ['view', packageJson.name, 'versions', '--json']);
const versionsJson = JSON.parse(versionsProcess.stdout);
if (!versionsJson || !Array.isArray(versionsJson) || versionsJson.length === 0) {
return [];
const versionsProcess = cp.spawnSync(os.platform === 'win32' ? 'npm.cmd' : 'npm', ['view', packageJson.name, 'versions', '--json']);
if (versionsProcess.stdout.length === 0 && versionsProcess.stderr) {
const err = versionsProcess.stderr.toString();
if (err.indexOf('404 Not Found - GET https://registry.npmjs.org/@xterm') > 0) {
return [];
}
throw new Error('Could not get published versions\n' + err);
}
const versionsJson = asArray(JSON.parse(versionsProcess.stdout));
if (tag) {
return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}.[0-9]+`)));
}
Expand Down

0 comments on commit 4b2e52f

Please sign in to comment.