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

WIP - package and publish built-ins individually #15

Closed
wants to merge 1 commit into from

Conversation

marcdumais-work
Copy link
Contributor

@marcdumais-work marcdumais-work commented Dec 5, 2019

I added a script, src/package-vsix.js, that packages each built-in extension in its own .vsix.

Run it like so:

$> yarn
$> yarn package-vsix:next

The generated packages will be under ./out/

TODO:

  • handle publishing to GH releases or our own registry
  • figure-out the version we should apply to the vsix files - as a first draft I kept the same we had for the npm packages
  • clean-up npm publishing script and related bits, if no longer used
  • ...

Signed-off-by: Marc Dumais [email protected]

@marcdumais-work marcdumais-work force-pushed the individual-vsix-packaging branch 3 times, most recently from bb9d30f to 181f523 Compare December 5, 2019 18:27
@marcdumais-work marcdumais-work changed the title WIP - package and publish built-ins to GH releases WIP - package and publish built-ins Dec 5, 2019
@marcdumais-work marcdumais-work force-pushed the individual-vsix-packaging branch 6 times, most recently from 8062362 to e328b10 Compare December 6, 2019 02:41
@marcdumais-work marcdumais-work changed the title WIP - package and publish built-ins WIP - package and publish built-ins individually Dec 6, 2019
@marcdumais-work marcdumais-work force-pushed the individual-vsix-packaging branch 3 times, most recently from 6fb5f17 to 14c4f91 Compare December 6, 2019 20:12
@marcdumais-work
Copy link
Contributor Author

I am having issues with packaging the Typescript LS in a way that it can start:

Relevant comment from #13 (comment):

For typescript we have to copy content of vscode/extensions/node_modules to vscode-builtin-extensions/extensions/typescript-language-features/node_modules to distribute default ts compiler properly.

I am having a couple of issues with this part, once node_modules is copied to typescript-language-features:

  • I can't yet have vsce include the node_modules folder in the .vsix: it's stripped even if I add it as a reverse exclusion in a .vscodeignore file. If I rename it to something else, then it's preserved, but I would need to rename it back once the extension is installed and I have not found a way to to that yet
  • If I manually rename-back the folder once the extension is deployed to /tmp/vscode-unpacked/... the LS still doesn't start. I think it's due to the use of ".." on this line, making it look for node_modules one folder up (scroll to the right - it's a long line:

https://github.com/microsoft/vscode/blob/master/extensions/typescript-language-features/src/utils/versionProvider.ts#L149

  • if I change this to a single dot, then it works.
    e.g:
    this.getContributedVersion(TypeScriptVersionSource.Bundled, 'vscode.typescript-language-features', ['.', 'node_modules'])

  • I can as well change node_modules to something else that vsce does not exclude to fix the other issue above, renaming the packaged node_modules.

Is strategic patching of the vscode build-in extensions a good way forward in cases like this? It would for sure be more fragile if the upstream code changes...

Any ideas?

@marcdumais-work
Copy link
Contributor Author

About releasing on GH: I have tried a couple of npm packages that help with that. It looks like we need to tie a GH release to a tag in the repo. ATM the built-in's version (at least for next) is based on the vscode commit SHA that we packaged, and in CI we reset vscode to its latest master. This means that we could have multiple next releases of the built-ins for the same vscode-builtin-extensions repo commit/tag, which I think does not work.

One option is to let the publishing tool, as part of the CI, do a release commit, tag it and push it to our repo. This way we'll always have a distinct commit/tag that corresponds to a release of the built-ins, to publish against.

Does that sound like a reasonable way forward?

@benoitf
Copy link

benoitf commented Dec 11, 2019

One option is to let the publishing tool, as part of the CI, do a release commit, tag it and push it to our repo. This way we'll always have a distinct commit/tag that corresponds to a release of the built-ins, to publish against.

sounds good to me. would be good to have releases for upstream releases of VS Code as well
1.39.0, 1.39.1, etc

@akosyakov
Copy link
Member

akosyakov commented Dec 11, 2019

@marcdumais-work Could we split to 2 steps:

  • package as vsix and publish as GitHub releases
  • remove publishing to npmjs

I would prefer if you just work on master without PRs and make it work for vsix GitHub releases. As far as this approach can do all the same what works for npmjs, we can remove npmjs support. Till then just let it be.

How to version can be the same for now for simplicity. Let's work on it after release workflow works for vxis files with Github ok? The same for publishing to our registry, let's make it another step later.

I hope such approach is good enough to unblock you from reviews.

@marcdumais-work
Copy link
Contributor Author

@marcdumais-work Could we split to 2 steps:

  • package as vsix and publish as GitHub releases
  • remove publishing to npmjs

I would prefer if you just work on master without PRs and make it work for vsix GitHub releases. As far as this approach can do all the same what works for npmjs, we can remove npmjs support. Till then just let it be.

How to version can be the same for now for simplicity. Let's work on it after release workflow works for vxis files with Github ok? The same for publishing to our registry, let's make it another step later.

I hope such approach is good enough to unblock you from reviews.

Sounds good. So I'll just push to master without review, just being careful not to break npm publishing, which we will remove later, when not needed anymore.

@marcdumais-work
Copy link
Contributor Author

marcdumais-work commented Dec 11, 2019

sounds good to me. would be good to have releases for upstream releases of VS Code as well
1.39.0, 1.39.1, etc

+1

Builtins releases based on proper vscode releases feel more like "latest" releases, rather than "next" releases, based on an arbitrary vscode commit that happens to be the latest master at the time when CI runs.

So releases of builtins based on vscode releases could be done manually, at least to start-with.

@akosyakov
Copy link
Member

Builtins releases based on proper vscode releases feel more like "latest" releases, rather than "next" releases, based on an arbitrary vscode commit that happens to be the latest master at the time when CI runs.

We should not switch latest though without testing.

@tolusha
Copy link

tolusha commented Dec 12, 2019

@marcdumais-work
How I can generate manually vsix files for VS Code v1.39.1 ?

@marcdumais-work
Copy link
Contributor Author

marcdumais-work commented Dec 12, 2019

@marcdumais-work
How I can generate manually vsix files for VS Code v1.39.1 ?

Hi @tolusha ,

There is still a bit of manual intervention needed to obtain working typescript language support. What I can do is try for a first manual "latest" release, targeting 1.39.1, and publish the result on this repo's releases tab.

I'll try to do so today.

@marcdumais-work
Copy link
Contributor Author

@tolusha

If you'd like to try for yourself, starting from the PR's code, other than the change above regarding typescript language support, I think you only need to reset the vscode git submodule to the version you target and do:

$> <clone repo, checkout this PR, initialize repo according to README>
$> cd <repo>/vscode; git checkout 1.39.1; cd ..
$> yarn
$> yarn package-vsix:latest

The .vsix will be in the ./out folder.

@tolusha
Copy link

tolusha commented Dec 12, 2019

@marcdumais-work publishing results implies creating a tag. Do you mind?

@marcdumais-work
Copy link
Contributor Author

marcdumais-work commented Dec 12, 2019

@marcdumais-work publishing results implies creating a tag. Do you mind?

Ok with me. But please pull the latest version of this PR - I added one more work-around during vsix packaging that you'll need for Typescript to work.

edit: you should not have to manually change anything with the latest version.

@tolusha
Copy link

tolusha commented Dec 13, 2019

@marcdumais-work
I don't have permissions. :(

@benoitf
Copy link

benoitf commented Dec 13, 2019

should be fixed now @tolusha

@tolusha
Copy link

tolusha commented Dec 13, 2019

Error while starting emet extension
Node modules are missed.
https://registry.npmjs.org/@theia/vscode-builtin-emmet/-/vscode-builtin-emmet-0.3.0-next.608ac23340.tgz

Uncaught Error: Cannot find module 'vscode-emmet-helper'
Error: Cannot find module 'vscode-emmet-helper'
    at Function.Module._resolveFilename (:3000/internal/modules/cjs/loader.js:582)
    at Function.Module._load (:3000/internal/modules/cjs/loader.js:508)
    at Function.module._load (:3000/home/tolusha/projects/theia-ide/theia/packages/plugin-ext-vscode/lib/node/plugin-vscode-init.js:80)
    at Module.require (:3000/internal/modules/cjs/loader.js:637)
    at require (:3000/internal/modules/cjs/helpers.js:22)
    at Object.<anonymous> (:3000/tmp/vscode-unpacked/emmet-1.39.2.vsix/extension/dist/extension.js:1)
    at n (:3000/tmp/vscode-unpacked/emmet-1.39.2.vsix/extension/dist/extension.js:1)
    at Object.t.getEmmetHelper (:3000/tmp/vscode-unpacked/emmet-1.39.2.vsix/extension/dist/extension.js:1)
    at t.DefaultCompletionItemProvider.provideCompletionItemsInternal (:3000/tmp/vscode-unpacked/emmet-1.39.2.vsix/extension/dist/extension.js:1)
    at t.DefaultCompletionItemProvider.provideCompletionItems (:3000/tmp/vscode-unpacked/emmet-1.39.2.vsix/extension/dist/extension.js:1)
    at :3000/vs/editor/editor.main.js:2549

@akosyakov
Copy link
Member

akosyakov commented Dec 13, 2019

@tolusha @benoitf @marcdumais-work Is there a way to remove a release?

As I said don't publish broke stuff, publish with next against commit, then test, if it is fine publish with a proper tag. I have not seen anywhere that there was an agreement to align with VS Code versions. It was said that first everything should work like as currently working for npmjs on master, after that we can look into versioning of properly tested artifacts.

@akosyakov
Copy link
Member

akosyakov commented Dec 13, 2019

I've deleted all releases, you can create vsix files locally till a proper solution is developed.

@marcdumais-work
Copy link
Contributor Author

It was said that first everything should work like as currently working for npmjs on master, after that we can look into versioning of properly tested artifacts.

I have not tried what @tolusha had published. But when I test locally, the currently generated vsix work as well (or as badly - there are a few that generate exceptions) as the current master. So it's looking promising.

@akosyakov I seem to remember a test suite that we can use to test vscode extensions. Would that be useful with the built-ins?

@akosyakov
Copy link
Member

akosyakov commented Dec 13, 2019

@akosyakov I seem to remember a test suite that we can use to test vscode extensions. Would that be useful with the built-ins?

Not really, it does not test functionality of built-in extensions. Let's work on testing afterwards. I hope to finish vscode theming this month and work on the integration testing framework in Jan, with this in place we can write tests for built-in extensions. Also some built-in extensions can have tests already and some are themes which is not really auto testable.

I would rather focus on getting the first cut and be able to publish 0.2.1 and nightly builds as GH releases.

@marcdumais-work
Copy link
Contributor Author

Hi @tolusha ,

I just did a manual pre-release on GitHub:
https://github.com/theia-ide/vscode-builtin-extensions/releases/tag/v1.39.1-prel

As discussed in today's dev-meeting, I have given it a version number that points to the vscode version the built-ins are from.

Let's use this release as a base to test the built-in. When we are satisfied, I can release a "solid" v1.39.1

@akosyakov I hope I did this ok: in the tagged release commit, I committed the version in src/package-vsix.js to what I used for this release and I also committed the vscode submodule to use 1.39.1; this way the build/release should be reproducible (vscode comit is reset to latest master anyway when publishing to npm, so it should not adversely affect npm).

@marcdumais-work
Copy link
Contributor Author

closing this PR since we agreed that I would push directly to master, which was done for the packaging part. Publish of next TBD.

@marcdumais-work
Copy link
Contributor Author

Error while starting emet extension
Node modules are missed.
https://registry.npmjs.org/@theia/vscode-builtin-emmet/-/vscode-builtin-emmet-0.3.0-next.608ac23340.tgz

Uncaught Error: Cannot find module 'vscode-emmet-helper'
Error: Cannot find module 'vscode-emmet-helper'
    at Function.Module._resolveFilename (:3000/internal/modules/cjs/loader.js:582)
    at Function.Module._load (:3000/internal/modules/cjs/loader.js:508)
    at Function.module._load (:3000/home/tolusha/projects/theia-ide/theia/packages/plugin-ext-vscode/lib/node/plugin-vscode-init.js:80)
    at Module.require (:3000/internal/modules/cjs/loader.js:637)
    at require (:3000/internal/modules/cjs/helpers.js:22)
    at Object.<anonymous> (:3000/tmp/vscode-unpacked/emmet-1.39.2.vsix/extension/dist/extension.js:1)
    at n (:3000/tmp/vscode-unpacked/emmet-1.39.2.vsix/extension/dist/extension.js:1)
    at Object.t.getEmmetHelper (:3000/tmp/vscode-unpacked/emmet-1.39.2.vsix/extension/dist/extension.js:1)
    at t.DefaultCompletionItemProvider.provideCompletionItemsInternal (:3000/tmp/vscode-unpacked/emmet-1.39.2.vsix/extension/dist/extension.js:1)
    at t.DefaultCompletionItemProvider.provideCompletionItems (:3000/tmp/vscode-unpacked/emmet-1.39.2.vsix/extension/dist/extension.js:1)
    at :3000/vs/editor/editor.main.js:2549

I think I know the issue - vsce removes node_modules folders when packaging extensions. I had the same issue with typescript-language-features, that I fixed by patching the compiled extension. Maybe something similar can be done for emmet.

@marcdumais-work marcdumais-work deleted the individual-vsix-packaging branch December 17, 2019 20:15
@marcdumais-work
Copy link
Contributor Author

@akosyakov I have a question: ATM, if I look at this repo after build, the vscode built-ins are in <repo>/vscode-builtin-extensions/extensions/. Under there, only 2 extensions have a node_modules: emmet and (through manual intervention on our part, and renamed to deps) typescript-language-features.

However some of the other extensions do have a node_modules when built from the vscode git submodule: <repo>/vscode/extensions/:

[...]/vscode-builtin-extensions/vscode/extensions$ find . -maxdepth 2  -name node_modules 
./vscode-api-tests/node_modules
./vscode-test-resolver/node_modules
./debug-server-ready/node_modules
./css-language-features/node_modules
./php-language-features/node_modules
./typescript-language-features/node_modules
./node_modules
./json-language-features/node_modules
./emmet/node_modules
./grunt/node_modules
./jake/node_modules
./markdown-language-features/node_modules
./extension-editing/node_modules
./html-language-features/node_modules
./npm/node_modules
./vscode-colorize-tests/node_modules
./image-preview/node_modules
./configuration-editing/node_modules
./git/node_modules
./debug-auto-launch/node_modules
./gulp/node_modules
./merge-conflict/node_modules
./git-ui/node_modules

I have not checked them all, but I know at least some have runtime dependencies in these node_modules folders - are they not needed? Do we rely on them being present by chance in the Theia application where the built-ins will be used?

@akosyakov
Copy link
Member

I have not checked them all, but I know at least some have runtime dependencies in these node_modules folders - are they not needed? Do we rely on them being present by chance in the Theia application where the built-ins will be used?

It can be dev dependencies and binaries?

@marcdumais-work
Copy link
Contributor Author

@marcdumais-work
Copy link
Contributor Author

marcdumais-work commented Dec 19, 2019

Ah, I think I understand what's happening: each built-in extension's node_modules content gets webpacked along with the extension:

https://github.com/microsoft/vscode/blob/master/build/lib/extensions.ts#L243

Edit: confirmed: looking in built extension's dist/extension.js.map, I can see some node_modules code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants