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

build(salesforcedx-vscode): update node to v16 and switch from npm to yarn #4042

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
1f5d682
ci: update CI configs, dev docs to node v16
Apr 19, 2022
ba6cc20
build: update node to v16, npm to v8 and switch to new lockfile forma…
Apr 19, 2022
966ddd6
ci: update circle node version to one that exists
Apr 19, 2022
49cf42e
build: downgrade node to the version available in CircleCI
Apr 19, 2022
791ae3f
test: add check for typescript proj refs
Apr 21, 2022
73d2412
build: add compile scripts, fix tsconfig in packages
Apr 21, 2022
5b8aea7
refactor: common tsconfig to reuse node 14 base config
Apr 22, 2022
2d27ce5
refactor: remove tsc clean from existing clean script
Apr 22, 2022
a9f824d
fix: add separate tsconfig for ts-loader / webpack
Apr 23, 2022
069e569
fix(soql): add tsconfig for webpack / ts-loader
Apr 23, 2022
ddd2329
build: revert to es6 target in tsconfig
Apr 23, 2022
1490052
refactor: remove unnecessary tsconfig webpack config files
Apr 25, 2022
c5becb7
build: update node to v16, npm to v8 and switch to new lockfile forma…
Apr 19, 2022
d43fce5
build: update node, npm version in lock file
Apr 19, 2022
177da33
build: enable npm workspaces (WIP)
Apr 20, 2022
9fe07d4
build: replace npm lock file with yarn lock
Apr 26, 2022
32e70e9
chore: update after rebase onto typescript proj ref enable
Apr 26, 2022
e5cb052
fix(compile): silence compile errors with ts-ignore
Apr 26, 2022
e9fb07a
fix(compile): remove extraneous node_modules from import paths
Apr 26, 2022
07b0d68
refactor: switch to vsce packaging with yarn; remove npm prune
Apr 27, 2022
31f5d1b
chore: lint fix alphabetically sorted imports
Apr 27, 2022
ffe49ce
ci: add yarn and replace npm ci with yarn install frozen lock file equiv
Apr 28, 2022
5ec68bb
ci: update yarn engine version to match ci env
Apr 28, 2022
789c716
ci: update engines version specification format to meet expectations …
Apr 28, 2022
17349d0
refactor: use yarn to invoke nyc bin
Apr 28, 2022
337b553
refactor: use yarn bin to get path to mocha
Apr 28, 2022
5523eca
refactor: use yarn to get nyc bin path
Apr 28, 2022
aed54f9
refactor: use yarn to invoke cross-env
Apr 28, 2022
9341178
refactor: replace npm install with yarn install
Apr 28, 2022
585bc71
ci: fix yarn install and deps cache
Apr 28, 2022
90b90a5
ci: fix yarn bin path
Apr 29, 2022
a935b7a
ci: fix yarn path - add bash env to process bashrc
Apr 29, 2022
064caf6
ci: switch cmd.exe to bash.exe for unit, integ tests to use bashrc wi…
Apr 29, 2022
ba08bf8
ci: fix subshell exec to work in bash.exe
Apr 29, 2022
730ca15
ci: fix yarn shell to bash.exe
Apr 29, 2022
8282097
revert: cmd path refactor with yarn
Apr 29, 2022
d4bff36
refactor: fix relative path of nyc.js hoisted with yarn
Apr 30, 2022
2c7b2f9
refactor: fix relative path of cross env hoisted with yarn
Apr 30, 2022
98d5d8a
refactor: fix relative path of _mocha hoisted with yarn
Apr 30, 2022
c992825
ci: revert yarn config shell from bash.exe to fix err during cmd exec
Apr 30, 2022
6d1dfda
chore: update lerna to latest version
May 2, 2022
098c0bf
build: switch to yarn 3 with legacy node modules
May 2, 2022
26f1c54
Revert "build: switch to yarn 3 with legacy node modules"
May 2, 2022
677b370
build: switch to esbuild for prepublish
May 2, 2022
1783d0d
build: switch to latest version of vsce
May 2, 2022
d8b4510
build: disable dependency detection via npm or yarn for vsce package
May 2, 2022
795c12a
build: switch to pnpm
May 3, 2022
3b93bda
refactor: remove obsolete lerna bootstrap
May 3, 2022
7ca6581
refactor: remove obsolete check peer deps
May 3, 2022
0b725f7
refactor: esbuild run script to include minify option
May 3, 2022
7da9913
build: add missing deps, peer deps
May 3, 2022
a9905e2
build: replace npm in engine and deps with pnpm
May 3, 2022
51573e3
build: remove vscode ignore files to debug esbuild
May 3, 2022
81c53d8
build: enable debug logging for esbuild
May 3, 2022
89c1910
build: add script to setup pnpm and node
May 3, 2022
8a590f3
refactor: compile and packaging scripts to use pnpm
May 3, 2022
eb7268d
build: fix @types/sinon error - the inferred type of "X" cannot be na…
May 3, 2022
d96e324
chore: post rebase fix merge conflicts
May 3, 2022
f1fc823
chore: remove obsolete npm package lock, regen pnpm lock (post rebase)
May 3, 2022
9305dd3
build: fix webpack error with pnpm
May 4, 2022
5214837
build: fix synthetic default imports in core pkg
May 4, 2022
a5de013
build: use rollup to bundle core pkg
May 4, 2022
b9d82ea
refactor: move rollup config, deps to root
May 4, 2022
407219b
build: switch from esbuild to using rollup for all pkgs
May 4, 2022
194992a
build: fix synthetic imports, missing license, normalize entry point
May 4, 2022
218174d
build: add dynamic import rollup plugin
May 4, 2022
7d77584
build: add script to install built vsix files to vscode insider
May 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 19 additions & 10 deletions .circleci/config.yml
Expand Up @@ -24,8 +24,9 @@ parameters:
type: string
default: '3.13.1'
node-version:
# 16.14 doesn't exist yet on https://hub.docker.com/r/circleci/node (Apr 2022)
type: string
default: '14.16.0'
default: '16.13'
# Constants
cache-version:
type: string
Expand Down Expand Up @@ -81,10 +82,12 @@ commands:
name: 'Install dependent modules'
shell: bash.exe
command: |
npm config set scripts-prepend-node-path true
npm install
touch ~/.bashrc
curl -o- -L https://yarnpkg.com/install.sh | bash
source ~/.bashrc
npm install -g sfdx-cli@<< pipeline.parameters.cli-version >>
npm install -g junit-merge
yarn install --frozen-lockfile
- run:
name: 'Compile'
shell: bash.exe
Expand All @@ -107,6 +110,7 @@ commands:
name: 'Compile in << parameters.compile-mode >> mode'
environment:
- NODE_ENV: << parameters.compile-mode >>
- BASH_ENV: ~/.bashrc
command: |
npm run compile

Expand Down Expand Up @@ -136,9 +140,10 @@ commands:
install:
description: 'Installing dependencies'
steps:
- run: npm ci
- run: npm --version
- run: node --version
- run: npm --version
- run: yarn --version
- run: yarn install --frozen-lockfile

merge-validation:
description: 'Verify the release branch is not older than main'
Expand Down Expand Up @@ -207,7 +212,7 @@ commands:
steps:
- restore_cache:
keys:
- << parameters.base-cache-path >>{{ checksum "package.json" }}
- << parameters.base-cache-path >>{{ checksum "yarn.lock" }}

save_dependency_cache:
parameters:
Expand All @@ -219,7 +224,7 @@ commands:
default: 'node_modules'
steps:
- save_cache:
key: << parameters.base-cache-path >>{{ checksum "package.json" }}
key: << parameters.base-cache-path >>{{ checksum "yarn.lock" }}
paths:
- << parameters.path-to-save >>

Expand Down Expand Up @@ -294,6 +299,7 @@ jobs:
- SFDX_AUTOUPDATE_DISABLE: true
- SFDX_USE_GENERIC_UNIX_KEYCHAIN: true
- SFDX_DOMAIN_RETRY: << pipeline.parameters.domain-retry >>
- BASH_ENV: ~/.bashrc
steps:
- build-artifacts

Expand All @@ -304,11 +310,12 @@ jobs:
- SFDX_AUTOUPDATE_DISABLE: true
- SFDX_DOMAIN_RETRY: << pipeline.parameters.domain-retry >>
- NODE_VERSION: << pipeline.parameters.node-version >>
- BASH_ENV: ~/.bashrc
steps:
- build-win
- run:
name: 'Running unit tests'
shell: cmd.exe
shell: bash.exe
command: npm run test:unit
- run:
name: 'Aggregate test results'
Expand Down Expand Up @@ -337,6 +344,7 @@ jobs:
- SFDX_AUTOUPDATE_DISABLE: true
- SFDX_DOMAIN_RETRY: << pipeline.parameters.domain-retry >>
- NODE_VERSION: << pipeline.parameters.node-version >>
- BASH_ENV: ~/.bashrc
steps:
- build-win
- run:
Expand All @@ -353,6 +361,7 @@ jobs:
- SFDX_AUTOUPDATE_DISABLE: true
- SFDX_DOMAIN_RETRY: << pipeline.parameters.domain-retry >>
- NODE_VERSION: << pipeline.parameters.node-version >>
- BASH_ENV: ~/.bashrc
steps:
- build-win
- run:
Expand All @@ -364,7 +373,7 @@ jobs:
rm devhub.key
- run:
name: 'Running integration tests'
shell: cmd.exe
shell: bash.exe
command: npm run test:integration-tests-without-system-tests
- run:
name: 'Assert all tests ran and aggregate results'
Expand All @@ -382,7 +391,7 @@ jobs:
command: |
[xml]$results = Get-Content junit-aggregate.xml
$failure = $results.SelectSingleNode("//failure")
if ($failure -ne $null) {
if ($failure -ne $null) {
Write-Host "Forcing build failure due to test failure(s) :'("
$host.SetShouldExit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-release-branch.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '14.16.x'
node-version: '16.14.x'
- name: Checkout
uses: actions/checkout@v2.0.0
with:
Expand Down
20 changes: 17 additions & 3 deletions .npmrc
@@ -1,5 +1,19 @@
#save exact versions of dependencies from the package.json
# https://pnpm.io/npmrc

# TODO: Can this be used instead of or in addition to nvm in CI and local dev
# pnpm will automatically install the specified version of Node.js and use it for running pnpm run commands or the pnpm node command
# use-node-version=16.13.0

# Save dependencies to package.json with an exact version rather than using npm's default semver range operator
save-exact=true

#enforces usage of the minimum node version in our .nvmrc
engine-strict=true
# Refuse to install (or even consider installing) any package that claims to not be compatible with the current Node.js version.
engine-strict=true

# local packages from the workspace are preferred over packages from the registry, even if there is a newer version of the package in the registry
prefer-workspace-packages=true

auto-install-peers=true

# pnpm will run any pre/post scripts automatically
enable-pre-post-scripts=true
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
v14.16.0
v16.14.0
4 changes: 2 additions & 2 deletions contributing/developing.md
Expand Up @@ -2,7 +2,7 @@

## Pre-requisites

1. We are requiring Node 14 at a minimum. If you need to work with multiple versions of Node, you
1. We are requiring Node 16 at a minimum. If you need to work with multiple versions of Node, you
might consider using [nvm](https://github.com/creationix/nvm).
1. This repository uses [Lerna](https://lernajs.io/) to manage it as a
_monorepo_. Please install Lerna globally using `npm install --global lerna`.
Expand Down Expand Up @@ -208,4 +208,4 @@ The npmrc allows for project-level [configuration](https://docs.npmjs.com/cli/v8

### .nvmrc

Our nvmrc specifies the minimimum node version required to run the project.
Our nvmrc specifies the minimum node version required to run the project.
6 changes: 0 additions & 6 deletions contributing/publishing.md
Expand Up @@ -213,11 +213,6 @@ from Atlassian on the flow. These steps are manual because you might encounter m

# Tips

1. After publishing, you will need to run `npm run bootstrap` again to continue
development. This is because the `npm run vscode:package` step does a `npm prune --production`. This is required due to the way Lerna does symlinking.
See [vscode-vsce#52](https://github.com/Microsoft/vscode-vsce/issues/52) for
more information.

1. In order to make a previously unpublished extension publishable there are a
few things that need to get updated:
1. In packages/salesforcedx-vscode/package.json the extension needs to get added
Expand All @@ -228,7 +223,6 @@ from Atlassian on the flow. These steps are manual because you might encounter m
For `repository` the url is `https://github.com/forcedotcom/salesforcedx-vscode`
3. In the extension's package.json, under `scripts` the following attributes need
to be defined:
`"vscode:prepublish": "npm prune --production"`
`"vscode:package": "vsce package"`
`"vscode:sha256": "node ../../scripts/generate-sha256.js >> ../../SHA256"`
`"vscode:publish": "node ../../scripts/publish-vsix.js"`
Expand Down
11 changes: 7 additions & 4 deletions contributing/tests.md
Expand Up @@ -27,7 +27,7 @@ would write such tests using Mocha and Chai as you normally would for NPM module
### Unit Tests

Place your strict unit tests in the `test/unit` directory of your package and create an npm
script in your package.json like `"test:unit": "./node_modules/.bin/_mocha --recursive out/test/unit"`
script in your package.json like `"test:unit": "yarn _mocha --recursive out/test/unit"`
for running the tests. Check out the `"test:unit"` scripts in the package.json files for the
salesforce-apex-debugger and salesforce-utils-vscode packages to see examples of how to configure
code coverage reporting when running the tests.
Expand All @@ -41,7 +41,7 @@ There are tests that require integration with the Salesforce server. These tests
require prior authentication to have occurred and a default devhub to be set.
These show up in several packages. These tests are put under `test/integration`
and are named in the standard `*.test.ts` pattern. The package.json should have an
entry like `"test:integration": "./node_modules/.bin/_mocha --recursive out/test/integration"`.
entry like `"test:integration": "yarn _mocha --recursive out/test/integration"`.
Check out the `"test:integration"` scripts in the package.json files for the
salesforce-apex-debugger and salesforce-utils-vscode packages to see how to additionally
configure code coverage reporting.
Expand Down Expand Up @@ -158,14 +158,17 @@ There are tests that require integration with the Salesforce server. These tests
require prior authentication to have occurred and a default devhub to be set.
These show up in several packages. These tests are put under test/integration
and named in the standard .test.ts pattern. The package.json should have an
entry like `"test:integration": "cross-env VSCODE_NLS_CONFIG={} ./node_modules/nyc/bin/nyc.js ./node_modules/mocha/bin/_mocha --recursive out/test/integration"`.
entry like
> "test:integration": "cross-env VSCODE_NLS_CONFIG={} $(yarn bin nyc) $(yarn bin _mocha) --recursive out/test/integration"`

These can be run in the same way from the CLI using `npm run test:integration`.
Running `npm run test` will also run these.

## Unit Tests

A module can also have an entry like `"test:unit": "node ./node_modules/nyc/bin/nyc.js ./node_modules/mocha/bin/_mocha --recursive out/test/unit"`.
A module can also have an entry like
> `"test:unit": "yarn nyc $(yarn bin _mocha) --recursive out/test/unit"`

This is used for pure unit tests and for VS Code based tests discussed above.
It is a good pattern to have an entry of `"test:unit"` in the package.json for
modules that don't have separate integration tests.
Expand Down
1 change: 1 addition & 0 deletions lerna.json
@@ -1,4 +1,5 @@
{
"version": "54.10.0",
"packages": [
"docs",
"packages/*"
Expand Down