71/dance

[Build Error] : "@types/vscode ^1.63.0 greater than engines.vscode ^1.60.0"

Closed this issue · 3 comments

Version Info

Dance v0.5.8
Commit: (latest) 4332956

Brief

Expected:
Packaging a fresh clone of Dance runs successfully and produces a new dance-x.x.x.vsix

Actual:
Packaging a fresh clone of Dance results in an error message.

Repro steps:

Run a series of commands to clone the repository, setup dependencies, and finally build/package the extension:

git clone https://github.com/71/dance.git
cd dance
npm install
npm install -g vsce
npm run package

The last command results in

ERROR  @types/vscode ^1.63.0 greater than engines.vscode ^1.60.0. Consider upgrade engines.vscode or use an older @types/vscode version

Attempt to fix by editing package.json, line 17

"engines": {
    "vscode": "^1.60.0"
},

update to 1.63 to match "@types/vscode": "^1.63.0",

"engines": {
    "vscode": "^1.63.0"
},

Then npm run package again.

npm run package

This results in:

npm run package

> dance@0.5.8 package
> vsce package

 INFO  Detected presence of yarn.lock. Using 'yarn' instead of 'npm' (to override this pass '--no-ya
rn' on the command line).
Executing prepublish script 'yarn run vscode:prepublish'...
yarn run v1.22.17
warning dance@0.5.8: The engine "vscode" appears to be invalid.
$ yarn run generate && yarn run compile && yarn run compile-web
warning dance@0.5.8: The engine "vscode" appears to be invalid.
$ ts-node ./meta.ts
warning dance@0.5.8: The engine "vscode" appears to be invalid.
$ tsc -p ./
warning dance@0.5.8: The engine "vscode" appears to be invalid.
$ webpack --mode production --devtool hidden-source-map --config ./webpack.web.config.js
asset extension.js 204 KiB [compared for emit] [minimized] (name: extension) 1 related asset
modules by path ./src/ 595 KiB
  modules by path ./src/api/ 217 KiB
    modules by path ./src/api/*.ts 136 KiB 15 modules
    modules by path ./src/api/search/*.ts 56 KiB 7 modules
    modules by path ./src/api/edit/*.ts 24.6 KiB
      ./src/api/edit/index.ts 17.5 KiB [built] [code generated]
      ./src/api/edit/linewise.ts 7.12 KiB [built] [code generated]
    ./src/api/keybindings/index.ts 79 bytes [built] [code generated]
  modules by path ./src/commands/*.ts 176 KiB 14 modules
  modules by path ./src/utils/*.ts 77.1 KiB 8 modules
  modules by path ./src/state/*.ts 123 KiB 7 modules
  ./src/extension.ts 1.75 KiB [built] [code generated]
external "vscode" 42 bytes [built] [code generated]
child_process (ignored) 15 bytes [built] [code generated]
webpack 5.52.1 compiled successfully in 13355 ms
Done in 29.84s.
ERROR  @types/vscode ^1.63.0 greater than engines.vscode ^1.60.0. Consider upgrade engines.vscode or use an older @types/vscode version

The error recurs.
package.json has had the engines.vscode reset to ^1.60.0

Workaround

Edit package.json, line 24, remove yarn run generate

"vscode:prepublish": "yarn run generate && yarn run compile && yarn run compile-web",

to

"vscode:prepublish": "&& yarn run compile && yarn run compile-web",

The generate step appears to reset the engine to ^1.60.0 which causes the build error to recur.
Removing this step allows the plugin to successfully package

vsce package
 INFO  Detected presence of yarn.lock. Using 'yarn' instead of 'npm' (to override this pass '--no-ya
Executing prepublish script 'yarn run vscode:prepublish'...
yarn run v1.22.17
warning dance@0.5.8: The engine "vscode" appears to be invalid.
$ yarn run compile && yarn run compile-web
warning dance@0.5.8: The engine "vscode" appears to be invalid.
$ tsc -p ./
warning dance@0.5.8: The engine "vscode" appears to be invalid.
$ webpack --mode production --devtool hidden-source-map --config ./webpack.web.config.js
modules by path ./src/ 595 KiB
  modules by path ./src/api/ 217 KiB
    modules by path ./src/api/*.ts 136 KiB 15 modules
    modules by path ./src/api/search/*.ts 56 KiB 7 modules
    modules by path ./src/api/edit/*.ts 24.6 KiB
      ./src/api/edit/index.ts 17.5 KiB [built] [code generated]
      ./src/api/edit/linewise.ts 7.12 KiB [built] [code generated]
    ./src/api/keybindings/index.ts 79 bytes [built] [code generated]
  modules by path ./src/commands/*.ts 176 KiB 14 modules
  modules by path ./src/utils/*.ts 77.1 KiB 8 modules
  modules by path ./src/state/*.ts 123 KiB 7 modules
  ./src/extension.ts 1.75 KiB [built] [code generated]
external "vscode" 42 bytes [built] [code generated]
child_process (ignored) 15 bytes [built] [code generated]
webpack 5.52.1 compiled successfully in 12674 ms
Done in 23.31s.
 INFO  Detected presence of yarn.lock. Using 'yarn' instead of 'npm' (to override this pass '--no-ya
rn' on the command line).

 WARNING  Using '*' activation is usually a bad idea as it impacts performance.
More info: https://code.visualstudio.com/api/references/activation-events#Start-up
Do you want to continue? [y/N] y

 DONE  Packaged: D:\Repo\dance\dance-0.5.8.vsix (106 files, 284.43KB)
71 commented

I'm guessing the reason why you're getting an error is that your VS Code version is out of date (or that a new check has been added since I last packaged Dance)? I don't have this issue, at the very least, and I usually only bump the @types/vscode version when the extension uses an API that's not available in older versions.

The reasons why yarn run generate resets package.json is because package.json is a generated file that shouldn't be edited by hand; modify package.build.ts and then run yarn run generate to properly update package.json.

vscode version : 1.65.0

Does that count as a new check?
Fair chance it's my environment. I might have to wipe it clean and try again to see what happens.

71 commented

Tried again to repro just now (d8e1553), and couldn't. Closing for now.