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": [
3000
],
"postCreateCommand": "yarn install && yarn setup",
"postCreateCommand": "npm install && npm run setup",
"customizations": {
"vscode": {
"extensions": [
+46 -46
View File
@@ -12,17 +12,17 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
- name: Use Node.js 22.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
node-version: 22.x
cache: 'npm'
- name: Install dependencies
run: yarn --frozen-lockfile
run: npm ci
- name: Setup and run tsc
run: yarn setup
run: npm run setup
- name: Esbuild
run: yarn esbuild
run: npm run esbuild
- name: Zip artifacts
run: |
zip -r compressed-build \
@@ -77,21 +77,21 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
- name: Use Node.js 22.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
node-version: 22.x
cache: 'npm'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
npm ci
npm run install-addons
- name: Lint code
env:
NODE_OPTIONS: --max_old_space_size=4096
run: yarn lint
run: npm run lint
- name: Lint API
run: yarn lint-api
run: npm run lint-api
test-unit-coverage:
needs: build
@@ -99,15 +99,15 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
- name: Use Node.js 22.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
node-version: 22.x
cache: 'npm'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
npm ci
npm run install-addons
- uses: actions/download-artifact@v4
with:
name: build-artifacts
@@ -122,7 +122,7 @@ jobs:
ls -R
- name: Unit test coverage
run: |
yarn test-unit-coverage --forbid-only
npm run test-unit-coverage --forbid-only
EXIT_CODE=$?
./node_modules/.bin/nyc report --reporter=cobertura
exit $EXIT_CODE
@@ -131,7 +131,7 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
node-version: [18]
node-version: [22]
runs-on: [ubuntu, macos, windows]
runs-on: ${{ matrix.runs-on }}-latest
steps:
@@ -140,11 +140,11 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}.x
cache: 'yarn'
cache: 'npm'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
npm ci
npm run install-addons
- name: Wait for build job
uses: NathanFirmo/wait-for-other-job@v1.1.1
with:
@@ -163,13 +163,13 @@ jobs:
fi
ls -R
- name: Unit tests
run: yarn test-unit --forbid-only
run: npm run test-unit --forbid-only
test-integration:
timeout-minutes: 20
strategy:
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
browser: [chromium, firefox, webkit]
runs-on: ${{ matrix.runs-on }}
@@ -179,11 +179,11 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}.x
cache: 'yarn'
cache: 'npm'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
npm ci
npm run install-addons
- name: Install playwright
run: npx playwright install --with-deps ${{ matrix.browser }}
- name: Wait for build job
@@ -204,49 +204,49 @@ jobs:
fi
ls -R
- name: Build demo
run: yarn esbuild-demo
run: npm run esbuild-demo
- 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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
node-version: [22]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}.x
cache: 'yarn'
cache: 'npm'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
npm ci
npm run install-addons
- name: Install playwright
run: npx playwright install
- uses: actions/download-artifact@v4
@@ -263,7 +263,7 @@ jobs:
ls -R
- name: Package headless
run: |
yarn package-headless
npm run package-headless
node ./bin/package_headless.js
- name: Publish to npm (dry run)
run: node ./bin/publish.js --dry
+6 -10
View File
@@ -19,18 +19,14 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js 20.x
- name: Use Node.js 22.x
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'yarn'
node-version: 22.x
cache: 'npm'
- name: Install dependencies
run: yarn --frozen-lockfile
run: npm ci
- name: Setup and run tsc
run: yarn setup
run: npm run setup
- name: Esbuild
run: yarn esbuild
run: npm run esbuild
+6 -6
View File
@@ -11,18 +11,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
- name: Use Node.js 22.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
node-version: 22.x
cache: 'npm'
- name: Install dependencies
run: yarn --frozen-lockfile
run: npm ci
- name: Build
run: yarn setup
run: npm run setup
- name: Package headless
run: |
yarn package-headless
npm run package-headless
node ./bin/package_headless.js
- name: Publish to npm
env:
+1 -1
View File
@@ -18,7 +18,7 @@ npm-debug.log
.env
build/
.DS_Store
package-lock.json
yarn.lock
# Keep bundled code out of Git
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 are run with `yarn test-unit`:
Unit tests are run with `npm run test-unit`:
```sh
# All unit tests
yarn test-unit
npm run test-unit
# 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
yarn test-unit out-esbuild/**/Terminal.test.js
npm run test-unit out-esbuild/**/Terminal.test.js
# 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
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/`).
### Integration tests
Integration tests are run with `yarn test-integration`:
Integration tests are run with `npm run test-integration`:
```sh
# All integration tests
yarn test-integration
npm run test-integration
# Core integration tests
yarn test-integration --suite=core
npm run test-integration --suite=core
# 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/`).
-1
View File
@@ -17,7 +17,6 @@ npm-debug.log
.env
build/
.DS_Store
package-lock.json
yarn.lock
# Keep bundled code out of Git
-1
View File
@@ -10,4 +10,3 @@ fonts/
*.swp
*.tgz
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
$ git clone https://github.com/xtermjs/xterm.js.git
$ cd xterm.js
$ yarn
$ npm ci
$ cd addons/addon-serialize
$ yarn benchmark && yarn benchmark-baseline
$ npm run benchmark && npm run benchmark-baseline
$ # 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)) {
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
fs.readdir(addonsPath, (err, files) => {
for (const folder of files) {
@@ -43,11 +36,7 @@ if (fs.existsSync(addonsPath)) {
)
{
console.log('Preparing', folder);
if (hasYarn) {
cp.execSync('yarn', {cwd: addonPath});
} else {
cp.execSync('npm install', {cwd: addonPath});
}
cp.execSync('npm ci', {cwd: addonPath});
} else {
console.log('Skipped', folder);
}
+1 -1
View File
@@ -20,7 +20,7 @@ if (process.argv.length > 2) {
const args = process.argv.slice(2);
flagArgs = args.filter(e => e.startsWith('--'));
// ability to inject particular test files via
// yarn test [testFileA testFileB ...]
// npm run test [testFileA testFileB ...]
files = args.filter(e => !e.startsWith('--'));
if (files.length) {
testFiles = files;
+1 -1
View File
@@ -6,7 +6,7 @@ VERSION=$1
# Clone docs repo and update the documentation
git clone https://github.com/xtermjs/xtermjs.org
cd xtermjs.org
yarn
npm ci
./bin/update-docs
# 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:
1. Run `yarn esbuild`
1. Run `npm run esbuild`
2. Open up `xterm.mjs`
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
* from tsc (via `yarn watch` or `yarn prebuild`) which are put into `out/` and webpacks them into a
* production mode umd library module in `lib-headless/`. The aliases are used fix up the absolute
* paths output by tsc (because of `baseUrl` and `paths` in `tsconfig.json`.
* from tsc (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-headless/`. The aliases are used fix up the
* absolute paths output by tsc (because of `baseUrl` and `paths` in `tsconfig.json`.
*
* @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
* (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
* output by tsc (because of `baseUrl` and `paths` in `tsconfig.json`.
*
-4567
View File
File diff suppressed because it is too large Load Diff