Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use npm instead of yarn to build Theia #14481

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
root = true

[*]
insert_final_newline = true
end_of_line = lf
indent_style = space

Expand Down
6 changes: 1 addition & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@ module.exports = {
ignorePatterns: [
'**/{node_modules,lib}',
'plugins'
],
parserOptions: {
tsconfigRootDir: __dirname,
project: 'tsconfig.json'
}
]
};
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev-packages/*/bin/*.js text eol=lf
36 changes: 15 additions & 21 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ jobs:
- name: Install and Build
shell: bash
run: |
yarn global add node-gyp
yarn --skip-integrity-check --network-timeout 100000
npm install -g node-gyp
npm install
./scripts/check_git_status.sh
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Lint
run: |
yarn lint
npm run lint

build:
name: Build and Test (${{ matrix.os }}, node-${{ matrix.node }})
Expand Down Expand Up @@ -72,44 +72,38 @@ jobs:
with:
python-version: '3.11'

- name: Install
- name: Build
shell: bash
run: |
yarn global add node-gyp
yarn --skip-integrity-check --network-timeout 100000
npm install -g node-gyp
npm install
npm run build
git status
./scripts/check_git_status.sh
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9


- name: Download Plugins
if: runner.os == 'Linux'
shell: bash
run: |
yarn -s download:plugins --rate-limit 3

- name: Build
shell: bash
run: |
yarn build:examples
./scripts/check_git_status.sh
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

npm run download:plugins -- --rate-limit 3

- name: Test (headless)
if: matrix.tests != 'skip'
shell: bash
run: |
yarn browser rebuild
yarn test:theia
npm run rebuild:browser
npm run test:theia

- name: Test (browser)
if: matrix.tests != 'skip' && runner.os == 'Linux'
run: |
xvfb-run -a yarn browser test
xvfb-run -a npm run test:browser

- name: Test (electron)
if: matrix.tests != 'skip' && runner.os == 'Linux'
run: |
xvfb-run -a yarn electron test
xvfb-run -a npm run test:electron
4 changes: 1 addition & 3 deletions .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,4 @@ jobs:
if: matrix.tests != 'skip'
shell: bash
run: |
yarn license:check:review || ( sleep 15m && yarn license:check:review )
env:
DASH_LICENSES_PAT: ${{ secrets.DASH_LICENSES_PAT }}
npm run license:check
6 changes: 3 additions & 3 deletions .github/workflows/native-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ jobs:
- name: Install and Build
shell: bash
run: |
yarn --skip-integrity-check --network-timeout 100000
npm install
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Build Browser App
shell: bash
run: |
yarn browser build
npm run build:browser
env:
NODE_OPTIONS: --max_old_space_size=4096

- name: Zip Native Dependencies
shell: bash
run: yarn zip:native:dependencies
run: npm run zip:native:dependencies

- name: Upload Artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/performance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ jobs:
- name: Build
shell: bash
run: |
yarn global add node-gyp
yarn --skip-integrity-check --network-timeout 100000 --ignore-engines
yarn build:examples
npm install -g node-gyp
npm install
npm run build
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Performance (browser)
shell: bash
run: yarn performance:startup:browser
run: npm run performance:startup:browser

- name: Performance (Electron)
shell: bash
run: xvfb-run yarn performance:startup:electron
run: xvfb-run npm run performance:startup:electron

- name: Analyze performance results
uses: benchmark-action/github-action-benchmark@fd31771ce86cc65eab85653da103f71ab1b4479c # v1.9.0
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@ jobs:
- name: Build Browser
shell: bash
run: |
yarn global add node-gyp
yarn --skip-integrity-check --network-timeout 100000
yarn download:plugins
yarn browser build
npm install -g node-gyp
npm install
npm run build
npm run download:plugins
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Build Playwright
shell: bash
run: |
yarn --cwd examples/playwright build
cd examples/playwright && npm run build

- name: Test (playwright)
shell: bash
run: yarn --cwd examples/playwright ui-tests-ci
run: cd examples/playwright && npm run ui-tests-ci

- name: Archive test results
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/production-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ jobs:
- name: Build Browser Example Application for Production
shell: bash
run: |
yarn global add node-gyp
yarn --skip-integrity-check --network-timeout 100000
yarn browser build:production
npm install -g node-gyp
npm install
cd examples/browser && npm run build:production
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Build Playwright
shell: bash
run: |
yarn --cwd examples/playwright build
cd examples/playwright && npm run build

- name: Run Smoke Test (examples/playwright/src/tests/theia-app)
shell: bash
run: yarn test:playwright theia-app
run: cd test:playwright && npm run theia-app
9 changes: 5 additions & 4 deletions .github/workflows/publish-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ jobs:

- name: Pre-npm-Publish
run: |
yarn global add node-gyp
yarn --skip-integrity-check --network-timeout 100000
npm install -g node-gyp
npm install
npm run build
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Pre-docs-Publish
run: |
yarn docs
npm run docs
env:
NODE_OPTIONS: --max_old_space_size=9216

Expand All @@ -58,7 +59,7 @@ jobs:
retry_wait_seconds: 30
max_attempts: 3
retry_on: error
command: yarn publish:next
command: npm run publish:next
on_retry_command: git reset --hard
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # The variable name comes from here: https://github.com/actions/setup-node/blob/70b9252472eee7495c93bb1588261539c3c2b98d/src/authutil.ts#L48
7 changes: 4 additions & 3 deletions .github/workflows/publish-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ jobs:
- name: Install
shell: bash
run: |
yarn global add node-gyp
yarn --skip-integrity-check --network-timeout 100000
npm install -g node-gyp
npm install
npm run build
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Publish NPM
shell: bash
run: |
yarn publish:next
npm run publish:next
env:
NPM_CONFIG_PROVENANCE: "true"
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
9 changes: 5 additions & 4 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ jobs:
- name: Install
shell: bash
run: |
yarn global add node-gyp
yarn --skip-integrity-check --network-timeout 100000
npm install -g node-gyp
npm install
npm run build
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Publish NPM
shell: bash
run: |
yarn publish:latest -- ${{ inputs.release_type }}
yarn publish:check
npm run publish:latest -- ${{ inputs.release_type }}
npm run publish:check
env:
NPM_CONFIG_PROVENANCE: "true" # enable provenance check
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/translation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ jobs:
- name: Install and Build
shell: bash
run: |
yarn global add node-gyp
yarn --skip-integrity-check --network-timeout 100000
npm install -g node-gyp
npm install
npm run build
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9
Expand Down
3 changes: 1 addition & 2 deletions .gitpod.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ ENV NODE_VERSION="18.17.0"
RUN bash -c ". .nvm/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm use $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& npm install -g yarn"
&& nvm alias default $NODE_VERSION
ENV PATH=$HOME/.nvm/versions/node/v${NODE_VERSION}/bin:$PATH
4 changes: 2 additions & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ ports:
- port: 9339 # Node.js debug port
onOpen: ignore
tasks:
- init: yarn --network-timeout 100000 && yarn browser build && yarn download:plugins
- init: npm install && yarn build && yarn download:plugins
command: >
jwm &
yarn browser start ../.. --hostname=0.0.0.0
npm run start:browser ../.. --hostname=0.0.0.0
vscode:
extensions:
- dbaeumer.vscode-eslint
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"lcov.watch": [
{
"pattern": "**/*.spec.ts",
"command": "yarn test:theia"
"command": "npm run test:theia"
}
],
"editor.insertSpaces": true,
Expand Down
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

4 changes: 2 additions & 2 deletions configs/base.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
}
},
"plugins": [
"@theia",
"@theia",
"@typescript-eslint",
"@typescript-eslint/tslint",
"import",
"import",
"no-null"
],
"env": {
Expand Down
5 changes: 4 additions & 1 deletion dependency-check-baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"npm/npmjs/-/inversify/6.1.3": "Manually approved",
"npm/npmjs/@inversifyjs/common/1.3.2": "Manually approved",
"npm/npmjs/@inversifyjs/core/1.3.3": "Manually approved",
"npm/npmjs/@inversifyjs/reflect-metadata-utils/0.2.2": "Manually approved"
"npm/npmjs/@inversifyjs/reflect-metadata-utils/0.2.2": "Manually approved",
"npm/npmjs/-/plugin-a/1.55.0": "internal",
"npm/npmjs/-/plugin-b/1.55.0": "internal",
"npm/npmjs/-/plugin-gotd/1.55.0": "internal"
}
24 changes: 19 additions & 5 deletions dev-packages/application-manager/src/application-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export class ApplicationProcess {
}

canRun(command: string): boolean {
return fs.existsSync(this.resolveBin(command));
const binPath = this.resolveBin(this.binProjectPath, command);
return !!binPath && fs.existsSync(binPath);
}

run(command: string, args: string[], options?: cp.SpawnOptions): Promise<void> {
Expand All @@ -52,16 +53,29 @@ export class ApplicationProcess {
}

spawnBin(command: string, args: string[], options?: cp.SpawnOptions): cp.ChildProcess {
const binPath = this.resolveBin(command);
const binPath = this.resolveBin(this.binProjectPath, command);
if (!binPath) {
throw new Error(`Could not resolve ${command} relative to ${this.binProjectPath}`)
}
return this.spawn(binPath, args, {
...options,
shell: true
});
}

protected resolveBin(command: string): string {
const commandPath = path.resolve(this.binProjectPath, 'node_modules', '.bin', command);
return process.platform === 'win32' ? commandPath + '.cmd' : commandPath;
protected resolveBin(rootPath: string, command: string): string | undefined {
let commandPath = path.resolve(rootPath, 'node_modules', '.bin', command);
if (process.platform === 'win32') {
commandPath = commandPath + '.cmd';
}
if (fs.existsSync(commandPath)) {
return commandPath;
}
const parentDir = path.dirname(rootPath);
if (parentDir === rootPath) {
return undefined;
}
return this.resolveBin(parentDir, command);
}

protected promisify(command: string, p: cp.ChildProcess): Promise<void> {
Expand Down
Loading