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

chore(ide-extension): upgrade project setup #347

Closed
wants to merge 8 commits into from
Closed

chore(ide-extension): upgrade project setup #347

wants to merge 8 commits into from

Conversation

openscript
Copy link
Member

@openscript openscript commented Feb 3, 2023

  • Adds a dev container configuration
  • Updates contributing.md according to the dev container configuration
  • Updates dependencies
  • Enhances project configuration
  • Enhances launch scripts
  • Removes Rollup (VSCode extension template removed it too. An option is to use webpack, but it makes the project setup complicated and I don't think inlang needs it)

Copy link
Member

@samuelstroschein samuelstroschein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to not merge this PR due to:

  1. The PR introduces changes that are unrelated to the container setup (and might be reverted by the follow up PR).
  2. The container setup does not work for the codebase except for the ide extension.
  3. Merging this PR will likely lead to merge conflicts. Numerous changes are required that will lead to merge conflicts with the follow-up PR that re-introduces the IDE extension. I propose waiting for the other PR first.

Regarding 2., the container setup only works for the ide extension. Turborepo, and therefore the entire code base, fails to run. I suspect the "node-typescript" dev container is to blame because it only includes "node"? I take that #312 is a larger undertaking but dev containers seem to be the way to go and I should set them up!

Feel free to close this PR if you agree that we should wait for the follow-up PR and introduce a working container setup separately.

Comment on lines -4 to -10
/**
* What is rollup used for?
*
* Inlang packages are ES Modules. VSCode only supports CJS (CommonJS modules).
* Rollup is used to compile the ESM code to CJS.
*/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this PR but we likely need rollup to bundle ESM to CommonJS (you mentioned you had issues with ESM on Discord).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't completely understand if VSCode extensions really need to be CJS modules.

At the other hand officially VS Code doesn't use Rollup anymore. They removed it from their templates and tutorials.

What I try here is to stick to their proposed set up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works great, one dependency less. Electron does not support ESM though. I suspect the official template to use CJS.

microsoft/vscode#130367
standard-things/esm#915


try {
// Run the mocha test
mocha.run(failures => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also unrelated to this PR

Would using vitest for tests be possible?

The rest of the codebase uses vitest. Mainly because of out of the box support for ESM and TypeScript.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this is possible.

// Not specifying node16 causes https://github.com/rollup/plugins/issues/1224#issuecomment-1242109375
// interestingly, extending a base config taht contains module node16 still requires explicit manual
// setting of module node16 here.
"module": "Node16",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this PR

Can we use Node16 as the module resolution or the ide extension?

Using Node16 as the module resolution algorithm ensures compatibility with the rest of inlang's codebase and is the resolution standard that (finally) the JS ecosystem agreed on.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree.

},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this PR

Please use build for compiling a production build to align with the rest of the source code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree.

Comment on lines -21 to -24
1. (If running, stop `npm run dev`.)
2. Press `F5`.
3. Wait until the terminal is showing "listening on localhost:3000".
4. Open "localhost:xxxx" in the browser that has been opened.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, pressing F5 started the entire codebase in debug mode without any setup. I suppose that F5 did not work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add another paragraph for this and mention the launch configuration.

@openscript
Copy link
Member Author

I could use turbo and successfully build the entire project. What errors you get?

@samuelstroschein
Copy link
Member

samuelstroschein commented Feb 6, 2023

sh: 1: turbo: Exec format error

Do you want to continue with this PR? Otherwise, I'll open another one that only introduces dev containers.

@openscript
Copy link
Member Author

No problem for me if you open another one and I'm also happy to contribute there.

samuelstroschein added a commit that referenced this pull request Feb 6, 2023
Taken from #347. Using javascript node 18 because typescript is installed with NPM. The image is thus smaller + has one dependency less.
@samuelstroschein
Copy link
Member

Closed by #363.

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.

None yet

2 participants