Skip to content

Commit

Permalink
build: update to node v16 with npm v6 for packaging (#4092)
Browse files Browse the repository at this point in the history
* ci: update to node v16 from node v14

* build: update package engine and deps to node 16 with npm 6 as npm 7/8 breaks vsce packaging

* build: enable npm workspaces; thus updating lock file to account for all deps in the monorepo

* build: add npm script to install locally built vsix packages into insiders

* docs: add info about new pkgs install script

* build: fix mismatch peer dep versions in soql pkg; remove legacy peer deps config

* refactor: rename vscode:install to vsix:install

* build: switch to lock file v3 for reduced file size and hopefully faster installs (from 2.9M to 1.6M)

* refactor: npm run scripts to reuse targets

* refactor: reinstall script to use git checkout to reset package lock instead of removing it

* docs: add info about npm v6 vs npm v8

* docs: add info about legacy circle image and node version
  • Loading branch information
mohanraj-r committed May 10, 2022
1 parent ccf4b1c commit 191cfce
Show file tree
Hide file tree
Showing 8 changed files with 44,959 additions and 17,328 deletions.
6 changes: 4 additions & 2 deletions .circleci/config.yml
Expand Up @@ -25,7 +25,9 @@ parameters:
default: '3.13.1'
node-version:
type: string
default: '14.16.0'
# node > 16.13 doesn't exist on legacy CircleCI image https://hub.docker.com/r/circleci/node/tags
# Need to migrate from legacy CircleCI image (W-11027467)
default: '16.13.0'
# Constants
cache-version:
type: string
Expand Down Expand Up @@ -382,7 +384,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
5 changes: 2 additions & 3 deletions .github/workflows/create-release-branch.yml
Expand Up @@ -7,14 +7,14 @@ on:
jobs:
create_branch:
name: 'Create Branch'

runs-on: ubuntu-latest

steps:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '14.16.x'
node-version: '16.13.x'
- name: Checkout
uses: actions/checkout@v2.0.0
with:
Expand Down Expand Up @@ -43,4 +43,3 @@ jobs:
# -H 'Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}' \
# -X POST -d "${{ github.event.client_payload.on_success }}" \
# https://slack.com/api/chat.update

11 changes: 8 additions & 3 deletions .npmrc
@@ -1,5 +1,10 @@
#save exact versions of dependencies from the package.json
# https://docs.npmjs.com/cli/v8/using-npm/config

# 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

# Smaller on disk than lockfile version 2, but not interoperable with older npm versions. Ideal if all users are on npm version 7 and higher.
lockfile-version=3
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
v14.16.0
v16.13.0
12 changes: 9 additions & 3 deletions contributing/developing.md
Expand Up @@ -2,8 +2,9 @@

## Pre-requisites

1. We are requiring Node 14 at a minimum. If you need to work with multiple versions of Node, you
might consider using [nvm](https://github.com/creationix/nvm).
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. npm v6 is declared as a dependency in the workspace root and gets used by vsce packaging due to [issues with vsce packaging and npm v7/8](https://github.com/forcedotcom/salesforcedx-vscode/pull/4092)
1. npm v8 that comes installed with node 16 would be used when npm is invoked via npm run scripts or manually via shell. Hence the new lock file format of npm v8 with workspaces support is used by `npm install`.
1. This repository uses [Lerna](https://lernajs.io/) to manage it as a
_monorepo_. Please install Lerna globally using `npm install --global lerna`.
1. We use `tslint` so please install it using `npm install --global tslint`.
Expand Down Expand Up @@ -200,6 +201,11 @@ This runs [check-peer-dependencies](https://www.npmjs.com/package/check-peer-dep
Add any missing peer dependencies identified to the package's dev dependency.

### `npm run vsix:install`
This finds VSIX packages built locally (using `npm run vscode:package`) and installs them to Visual Studio Code Insiders.
- The installation would overwrite any installed packages in insiders with same name and version (under `~/.vscode-insiders/extensions`).
- To debug installed extensions you can use Command Palette: `Developer > Show Logs .. > Extension Host`

## Node Configuration

### .npmrc
Expand All @@ -208,4 +214,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.

0 comments on commit 191cfce

Please sign in to comment.