Move to npm

This commit is contained in:
Daniel Imms
2025-11-23 09:01:24 -08:00
parent e1023d7ec2
commit 92eddf8a61
18 changed files with 8987 additions and 4666 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
"forwardPorts": [ "forwardPorts": [
3000 3000
], ],
"postCreateCommand": "yarn install && yarn setup", "postCreateCommand": "npm install && npm run setup",
"customizations": { "customizations": {
"vscode": { "vscode": {
"extensions": [ "extensions": [
+46 -46
View File
@@ -12,17 +12,17 @@ jobs:
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Use Node.js 18.x - name: Use Node.js 22.x
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18.x node-version: 22.x
cache: 'yarn' cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: yarn --frozen-lockfile run: npm ci
- name: Setup and run tsc - name: Setup and run tsc
run: yarn setup run: npm run setup
- name: Esbuild - name: Esbuild
run: yarn esbuild run: npm run esbuild
- name: Zip artifacts - name: Zip artifacts
run: | run: |
zip -r compressed-build \ zip -r compressed-build \
@@ -77,21 +77,21 @@ jobs:
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Use Node.js 18.x - name: Use Node.js 22.x
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18.x node-version: 22.x
cache: 'yarn' cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: | run: |
yarn --frozen-lockfile npm ci
yarn install-addons npm run install-addons
- name: Lint code - name: Lint code
env: env:
NODE_OPTIONS: --max_old_space_size=4096 NODE_OPTIONS: --max_old_space_size=4096
run: yarn lint run: npm run lint
- name: Lint API - name: Lint API
run: yarn lint-api run: npm run lint-api
test-unit-coverage: test-unit-coverage:
needs: build needs: build
@@ -99,15 +99,15 @@ jobs:
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Use Node.js 18.x - name: Use Node.js 22.x
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18.x node-version: 22.x
cache: 'yarn' cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: | run: |
yarn --frozen-lockfile npm ci
yarn install-addons npm run install-addons
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: build-artifacts name: build-artifacts
@@ -122,7 +122,7 @@ jobs:
ls -R ls -R
- name: Unit test coverage - name: Unit test coverage
run: | run: |
yarn test-unit-coverage --forbid-only npm run test-unit-coverage --forbid-only
EXIT_CODE=$? EXIT_CODE=$?
./node_modules/.bin/nyc report --reporter=cobertura ./node_modules/.bin/nyc report --reporter=cobertura
exit $EXIT_CODE exit $EXIT_CODE
@@ -131,7 +131,7 @@ jobs:
timeout-minutes: 20 timeout-minutes: 20
strategy: strategy:
matrix: matrix:
node-version: [18] node-version: [22]
runs-on: [ubuntu, macos, windows] runs-on: [ubuntu, macos, windows]
runs-on: ${{ matrix.runs-on }}-latest runs-on: ${{ matrix.runs-on }}-latest
steps: steps:
@@ -140,11 +140,11 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node-version }}.x node-version: ${{ matrix.node-version }}.x
cache: 'yarn' cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: | run: |
yarn --frozen-lockfile npm ci
yarn install-addons npm run install-addons
- name: Wait for build job - name: Wait for build job
uses: NathanFirmo/wait-for-other-job@v1.1.1 uses: NathanFirmo/wait-for-other-job@v1.1.1
with: with:
@@ -163,13 +163,13 @@ jobs:
fi fi
ls -R ls -R
- name: Unit tests - name: Unit tests
run: yarn test-unit --forbid-only run: npm run test-unit --forbid-only
test-integration: test-integration:
timeout-minutes: 20 timeout-minutes: 20
strategy: strategy:
matrix: matrix:
node-version: [18] # just one as integration tests are about testing in browser node-version: [22] # just one as integration tests are about testing in browser
runs-on: [ubuntu-22.04] # macos is flaky runs-on: [ubuntu-22.04] # macos is flaky
browser: [chromium, firefox, webkit] browser: [chromium, firefox, webkit]
runs-on: ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }}
@@ -179,11 +179,11 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node-version }}.x node-version: ${{ matrix.node-version }}.x
cache: 'yarn' cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: | run: |
yarn --frozen-lockfile npm ci
yarn install-addons npm run install-addons
- name: Install playwright - name: Install playwright
run: npx playwright install --with-deps ${{ matrix.browser }} run: npx playwright install --with-deps ${{ matrix.browser }}
- name: Wait for build job - name: Wait for build job
@@ -204,49 +204,49 @@ jobs:
fi fi
ls -R ls -R
- name: Build demo - name: Build demo
run: yarn esbuild-demo run: npm run esbuild-demo
- name: Integration tests (core) # Tests use 50% workers to reduce flakiness - name: Integration tests (core) # Tests use 50% workers to reduce flakiness
run: yarn test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=core run: npm run test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=core
- name: Integration tests (addon-attach) - name: Integration tests (addon-attach)
run: yarn test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-attach run: npm run test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-attach
- name: Integration tests (addon-clipboard) - name: Integration tests (addon-clipboard)
run: yarn test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-clipboard run: npm run test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-clipboard
- name: Integration tests (addon-fit) - name: Integration tests (addon-fit)
run: yarn test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-fit run: npm run test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-fit
- name: Integration tests (addon-image) - name: Integration tests (addon-image)
run: yarn test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-image run: npm run test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-image
- name: Integration tests (addon-progress) - name: Integration tests (addon-progress)
run: yarn test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-progress run: npm run test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-progress
- name: Integration tests (addon-search) - name: Integration tests (addon-search)
run: yarn test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-search run: npm run test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-search
- name: Integration tests (addon-serialize) - name: Integration tests (addon-serialize)
run: yarn test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-serialize run: npm run test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-serialize
- name: Integration tests (addon-unicode-graphemes) - name: Integration tests (addon-unicode-graphemes)
run: yarn test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-unicode-graphemes run: npm run test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-unicode-graphemes
- name: Integration tests (addon-unicode11) - name: Integration tests (addon-unicode11)
run: yarn test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-unicode11 run: npm run test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-unicode11
- name: Integration tests (addon-web-links) - name: Integration tests (addon-web-links)
run: yarn test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-web-links run: npm run test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-web-links
- name: Integration tests (addon-webgl) - name: Integration tests (addon-webgl)
run: yarn test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-webgl run: npm run test-integration-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-webgl
release-dry-run: release-dry-run:
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
node-version: [18] node-version: [22]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}.x - name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node-version }}.x node-version: ${{ matrix.node-version }}.x
cache: 'yarn' cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: | run: |
yarn --frozen-lockfile npm ci
yarn install-addons npm run install-addons
- name: Install playwright - name: Install playwright
run: npx playwright install run: npx playwright install
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
@@ -263,7 +263,7 @@ jobs:
ls -R ls -R
- name: Package headless - name: Package headless
run: | run: |
yarn package-headless npm run package-headless
node ./bin/package_headless.js node ./bin/package_headless.js
- name: Publish to npm (dry run) - name: Publish to npm (dry run)
run: node ./bin/publish.js --dry run: node ./bin/publish.js --dry
+6 -10
View File
@@ -19,18 +19,14 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Use Node.js 22.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 20.x node-version: 22.x
cache: 'yarn' cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: yarn --frozen-lockfile run: npm ci
- name: Setup and run tsc - name: Setup and run tsc
run: yarn setup run: npm run setup
- name: Esbuild - name: Esbuild
run: yarn esbuild run: npm run esbuild
+6 -6
View File
@@ -11,18 +11,18 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Use Node.js 18.x - name: Use Node.js 22.x
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18.x node-version: 22.x
cache: 'yarn' cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: yarn --frozen-lockfile run: npm ci
- name: Build - name: Build
run: yarn setup run: npm run setup
- name: Package headless - name: Package headless
run: | run: |
yarn package-headless npm run package-headless
node ./bin/package_headless.js node ./bin/package_headless.js
- name: Publish to npm - name: Publish to npm
env: env:
+1 -1
View File
@@ -18,7 +18,7 @@ npm-debug.log
.env .env
build/ build/
.DS_Store .DS_Store
package-lock.json yarn.lock
# Keep bundled code out of Git # Keep bundled code out of Git
dist/ dist/
+10 -10
View File
@@ -65,40 +65,40 @@ One area that always needs attention is improving out unit test coverage, you ca
### Unit tests ### Unit tests
Unit tests are run with `yarn test-unit`: Unit tests are run with `npm run test-unit`:
```sh ```sh
# All unit tests # All unit tests
yarn test-unit npm run test-unit
# Absolute file path # Absolute file path
yarn test-unit out-esbuild/browser/Terminal.test.js npm run test-unit out-esbuild/browser/Terminal.test.js
# Filter by wildcard # Filter by wildcard
yarn test-unit out-esbuild/**/Terminal.test.js npm run test-unit out-esbuild/**/Terminal.test.js
# Specific addon unit tests tests # Specific addon unit tests tests
yarn test-unit addons/addon-image/out-esbuild/*.test.js npm run test-unit addons/addon-image/out-esbuild/*.test.js
# Multiple files # Multiple files
yarn test-unit out-esbuild/**/Terminal.test.js out-esbuild/**/InputHandler.test.js npm run test-unit out-esbuild/**/Terminal.test.js out-esbuild/**/InputHandler.test.js
``` ```
These use mocha to run all `.test.js` files within the esbuild output (`out-esbuild/`). These use mocha to run all `.test.js` files within the esbuild output (`out-esbuild/`).
### Integration tests ### Integration tests
Integration tests are run with `yarn test-integration`: Integration tests are run with `npm run test-integration`:
```sh ```sh
# All integration tests # All integration tests
yarn test-integration npm run test-integration
# Core integration tests # Core integration tests
yarn test-integration --suite=core npm run test-integration --suite=core
# Specific addon integration tests # Specific addon integration tests
yarn test-integration --suite=addon-search npm run test-integration --suite=addon-search
``` ```
These use `@playwright/test` to run all tests within the esbuild test output (`out-esbuild-test/`). These use `@playwright/test` to run all tests within the esbuild test output (`out-esbuild-test/`).
-1
View File
@@ -17,7 +17,6 @@ npm-debug.log
.env .env
build/ build/
.DS_Store .DS_Store
package-lock.json
yarn.lock yarn.lock
# Keep bundled code out of Git # Keep bundled code out of Git
-1
View File
@@ -10,4 +10,3 @@ fonts/
*.swp *.swp
*.tgz *.tgz
npm-debug.log* npm-debug.log*
yarn-error.log*
+3 -3
View File
@@ -34,9 +34,9 @@ See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-
```shell ```shell
$ git clone https://github.com/xtermjs/xterm.js.git $ git clone https://github.com/xtermjs/xterm.js.git
$ cd xterm.js $ cd xterm.js
$ yarn $ npm ci
$ cd addons/addon-serialize $ cd addons/addon-serialize
$ yarn benchmark && yarn benchmark-baseline $ npm run benchmark && npm run benchmark-baseline
$ # change some code in `@xterm/addon-serialize` $ # change some code in `@xterm/addon-serialize`
$ yarn benchmark-eval $ npm run benchmark-eval
``` ```
+1 -12
View File
@@ -16,13 +16,6 @@ const addonsPath = path.join(PACKAGE_ROOT, 'addons');
if (fs.existsSync(addonsPath)) { if (fs.existsSync(addonsPath)) {
console.log('pulling addon dependencies...'); console.log('pulling addon dependencies...');
// whether to use yarn or npm
let hasYarn = false;
try {
cp.execSync('yarn --version').toString();
hasYarn = true;
} catch(e) {}
// walk all addon folders // walk all addon folders
fs.readdir(addonsPath, (err, files) => { fs.readdir(addonsPath, (err, files) => {
for (const folder of files) { for (const folder of files) {
@@ -43,11 +36,7 @@ if (fs.existsSync(addonsPath)) {
) )
{ {
console.log('Preparing', folder); console.log('Preparing', folder);
if (hasYarn) { cp.execSync('npm ci', {cwd: addonPath});
cp.execSync('yarn', {cwd: addonPath});
} else {
cp.execSync('npm install', {cwd: addonPath});
}
} else { } else {
console.log('Skipped', folder); console.log('Skipped', folder);
} }
+1 -1
View File
@@ -20,7 +20,7 @@ if (process.argv.length > 2) {
const args = process.argv.slice(2); const args = process.argv.slice(2);
flagArgs = args.filter(e => e.startsWith('--')); flagArgs = args.filter(e => e.startsWith('--'));
// ability to inject particular test files via // ability to inject particular test files via
// yarn test [testFileA testFileB ...] // npm run test [testFileA testFileB ...]
files = args.filter(e => !e.startsWith('--')); files = args.filter(e => !e.startsWith('--'));
if (files.length) { if (files.length) {
testFiles = files; testFiles = files;
+1 -1
View File
@@ -6,7 +6,7 @@ VERSION=$1
# Clone docs repo and update the documentation # Clone docs repo and update the documentation
git clone https://github.com/xtermjs/xtermjs.org git clone https://github.com/xtermjs/xtermjs.org
cd xtermjs.org cd xtermjs.org
yarn npm ci
./bin/update-docs ./bin/update-docs
# Add changes to index and only proceed if there are changes to commit # Add changes to index and only proceed if there are changes to commit
+1589 -1
View File
File diff suppressed because one or more lines are too long
+7317
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -16,7 +16,7 @@ node ./bin/vs_base_find_unused.js
The last step is to do a once over of the resulting bundled xterm.js file to ensure it isn't too large: The last step is to do a once over of the resulting bundled xterm.js file to ensure it isn't too large:
1. Run `yarn esbuild` 1. Run `npm run esbuild`
2. Open up `xterm.mjs` 2. Open up `xterm.mjs`
3. Search for `src/vs/base/` 3. Search for `src/vs/base/`
+3 -3
View File
@@ -7,9 +7,9 @@ const path = require('path');
/** /**
* This webpack config does a production build for xterm.js headless. It works by taking the output * This webpack config does a production build for xterm.js headless. It works by taking the output
* from tsc (via `yarn watch` or `yarn prebuild`) which are put into `out/` and webpacks them into a * from tsc (via `npm run watch` or `npm run prebuild`) which are put into `out/` and webpacks them
* production mode umd library module in `lib-headless/`. The aliases are used fix up the absolute * into a production mode umd library module in `lib-headless/`. The aliases are used fix up the
* paths output by tsc (because of `baseUrl` and `paths` in `tsconfig.json`. * absolute paths output by tsc (because of `baseUrl` and `paths` in `tsconfig.json`.
* *
* @type {import('webpack').Configuration} * @type {import('webpack').Configuration}
*/ */
+1 -1
View File
@@ -9,7 +9,7 @@ const path = require('path');
/** /**
* This webpack config does a production build for xterm.js. It works by taking the output from tsc * This webpack config does a production build for xterm.js. It works by taking the output from tsc
* (via `yarn watch` or `yarn prebuild`) which are put into `out/` and webpacks them into a * (via `npm run watch` or `npm run prebuild`) which are put into `out/` and webpacks them into a
* production mode umd library module in `lib/`. The aliases are used fix up the absolute paths * production mode umd library module in `lib/`. The aliases are used fix up the absolute paths
* output by tsc (because of `baseUrl` and `paths` in `tsconfig.json`. * output by tsc (because of `baseUrl` and `paths` in `tsconfig.json`.
* *
-4567
View File
File diff suppressed because it is too large Load Diff