Skip to content

Commit

Permalink
fix(developer): work around devDependencies bug in npm
Browse files Browse the repository at this point in the history
Relates to npm/cli#2921

This issue arises after moving from npm 6.x to 7.x or later. As the
build agents are still on 6.x, we have not yet seen this issue there.

As part of the release build for Keyman Developer, we bundle up some
files and do some work in a temp folder to prepare folders for release.
Even though we are only working with `dependencies` (e.g. using `npm
install --production`), packages under `devDependencies` are still
wrongly being checked by NPM. As we have two modules present in
`devDependencies` that are only available when in the repo path, we need
to remove them before attempting to continue. Yuck!

ref: npm/cli#3975 (comment)
ref: npm/cli#2921
  • Loading branch information
mcdurdin committed Jan 23, 2022
1 parent db17690 commit 634909a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions windows/src/developer/inst/download.in
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ heat-model-compiler:
cd $(KEYMAN_WIX_TEMP_MODELCOMPILER)
# package-lock.json wasn't bundled; this is needed to keep dependency versions consistent.
copy $(KEYMAN_MODELCOMPILER_ROOT)\package-lock.json $(KEYMAN_WIX_TEMP_MODELCOMPILER)
# as of npm v8.x, even though we are only working with `dependencies`, `devDependencies` is
# still checked, and as these two modules are present in devDependencies but are only
# available when in the repo path, we need to remove them before attempting to continue.
# Yuck! ref: https://github.com/npm/cli/issues/3975#issuecomment-985305678
# ref: https://github.com/npm/cli/issues/2921
# don't forget to uninstall both at the same time or it *still* fails...
npm uninstall @keymanapp/models-templates @keymanapp/models-wordbreakers

npm install kmtypes.tgz --production --no-optional
npm install --production --no-optional

Expand Down

0 comments on commit 634909a

Please sign in to comment.