Skip to content

Commit

Permalink
[lerna] upgrade to recent version, refactoring of package.json "scrip…
Browse files Browse the repository at this point in the history
…ts" entries

Updated lerna from v4.x to 7.x, getting rid of several big security vulnerabilities,
that were present in the older version. Also updated ther repo's root README to do
small adjustments, related to the changes. I used the README to test too, replicating
the contained commands.

More details:

root package.json and electron/browser package.json:

Cleaned-up the "scripts" section.

Some uses of lerna in there were not working any more, so they were replaced with a
non-lerna alternative. Since I was already in there, I took the opportunity to
refactor the "scripts" section. I attempted to keep the "public API" the same - i.e.
so the the commands that are documented in the README and used elsewhere in the repo
should still work the same.

For instance:

- Added convenience shortcuts to call scripts in browser and
electron sub-packages, called respectively "electron" and "browser",
rather than having to use the long form every time (yarn --cwd <folder> <command>)
- Moved to the specific application, some scripts that ought to be defined there,
leaving the root entries as shortcuts, to call the specific implemetation(s).
- Introduced the "concurrently" dev-dependency - it helps start two or more processes
from one "script" entry, format their output so it's readable and easy to distinguish
what came out of which process. It also can watch all started processes and make sure
that if one exits, the others are killed too (using the "--kill-others" option). This
is used in the "scripts" entries that start both one of the viewer application (browser
or electron) and the trace server.
- To avoid potential issues, modified the "workspaces" section to specifically name the
browser and electron applications separately rather than use a glob (*): the reason is
that the "plugins" folder is created in the same "examples" folder, and could be
considered a yarn workspace entry on its own, which we do not want.

lerna.json:

updated, according to the new version used.

electron-builder config:

Corrected relative path to the plugins folder, so that it will be included in packages,
such as AppImage and deb on Linux. Also updated currently used Electron version
(23.6.0).

Fixes #1013

Signed-off-by: Marc Dumais <[email protected]>
  • Loading branch information
marcdumais-work committed Sep 21, 2023
1 parent a1d5a0c commit cf82da7
Show file tree
Hide file tree
Showing 6 changed files with 1,498 additions and 2,187 deletions.
4 changes: 3 additions & 1 deletion examples/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
"@theia/cli": "1.40.1"
},
"scripts": {
"prepare": "theia build --mode development",
"prepare": "yarn build",
"build": "theia build --mode development",
"rebuild": "theia rebuild:browser --cacheRoot ../..",
"start": "TRACE_SERVER_PATH=../../trace-compass-server/tracecompass-server theia start --plugins=local-dir:../plugins",
"watch": "theia build --watch --mode development"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/electron/electron-builder.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
electronVersion: 23.3.13
electronVersion: 23.6.0
electronDist: ../../node_modules/electron/dist
productName: Theia Trace Example Application
appId: theia-trace-example
Expand All @@ -16,7 +16,7 @@ files:
- package.json
- "!**node_modules/electron/**"
extraResources:
- from: plugins
- from: ../plugins
to: app/plugins
- from: ../../trace-compass-server
to: trace-compass-server
Expand Down
10 changes: 6 additions & 4 deletions examples/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@
"electron-builder": "~23.6.0"
},
"scripts": {
"prepare": "theia build --mode development",
"prepare": "yarn build",
"build": "theia build --mode development",
"rebuild": "theia rebuild:electron --cacheRoot ../..",
"start": "TRACE_SERVER_PATH=../../trace-compass-server/tracecompass-server theia start --plugins=local-dir:../plugins",
"watch": "theia build --watch --mode development",
"package": "yarn package:rebuild && electron-builder",
"package:preview": "yarn package:rebuild && electron-builder --dir",
"package:rebuild": "theia rebuild:electron --cacheRoot ../.."
"clean:dist": "rimraf dist",
"package": "yarn clean:dist && yarn rebuild && electron-builder",
"package:preview": "yarn clean:dist && yarn rebuild && electron-builder --dir"
},
"engines": {
"yarn": "1.0.x || >=1.2.1",
Expand Down
15 changes: 10 additions & 5 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
"lerna": "4.0.0",
"lerna": "7.3.0",
"version": "0.1.0",
"useWorkspaces": true,
"npmClient": "yarn",
"command": {
"run": {
"stream": true
}
},
"verifyAccess": false
},
"publish": {
"forcePublish": true,
"graphType": "all",
"skipGit": true,
"registry": "https://registry.npmjs.org/"
},
"verifyAccess": false
}
}
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"private": true,
"scripts": {
"prepare": "yarn -s clean && yarn -s tsref && yarn -s tsbuild && yarn -s download:plugins && yarn -s prepare:examples",
"prepare": "yarn build",
"build": "yarn -s clean && yarn -s tsref && yarn -s tsbuild && yarn -s build:examples && yarn -s download:plugins",
"tsref": "node scripts/typescript-references.js",
"tsbuild": "tsc -b",
"tswatch": "tsc -b -w",
"clean": "lerna run clean",
"prepare:packages": "lerna run --ignore=\"*-example-app\" prepare",
"prepare:examples": "lerna run --scope=\"*-example-app\" --parallel prepare",
"rebuild:browser": "yarn --cwd examples/browser theia rebuild:browser --cacheRoot ../..",
"rebuild:electron": "yarn --cwd examples/electron theia rebuild:electron --cacheRoot ../..",
"start:browser": "yarn rebuild:browser && yarn --cwd examples/browser start",
"start:electron": "yarn rebuild:electron && yarn --cwd examples/electron start",
"build:examples": "yarn browser build && yarn electron build",
"start:browser": "yarn browser rebuild && yarn browser start",
"start:electron": "yarn electron rebuild && yarn electron start",
"download:plugins": "theia download:plugins -p=true --parallel=false",
"download:sample-traces": "curl -o TraceCompassTutorialTraces.tgz https://raw.githubusercontent.com/tuxology/tracevizlab/master/labs/TraceCompassTutorialTraces.tgz; tar -xf TraceCompassTutorialTraces.tgz",
"download:server": "curl -o trace-compass-server.tar.gz https://download.eclipse.org/tracecompass.incubator/trace-server/rcp/trace-compass-server-latest-linux.gtk.x86_64.tar.gz; tar -xf trace-compass-server.tar.gz",
"start:server": "./trace-compass-server/tracecompass-server",
"start-all:browser": "yarn start:server & yarn start:browser",
"start-all:electron": "yarn start:server & yarn start:electron",
"start-all:browser": "concurrently --kill-others -n trace-server,browser-app \"yarn start:server\" \"yarn start:browser\"",
"start-all:electron": "concurrently --kill-others -n trace-server,electron-app \"yarn start:server\" \"yarn start:electron\"",
"lint": "lerna run lint",
"lint:fix": "lerna run lint:fix",
"test": "lerna run test --",
"publish:latest": "lerna publish --registry=https://registry.npmjs.org/ --exact --no-git-tag-version --no-push",
"publish:next": "lerna publish --registry=https://registry.npmjs.org/ --exact --canary minor --preid=next.$(date -u '+%Y%m%d%H%M%S').$(git rev-parse --short HEAD) --dist-tag=next --no-git-tag-version --no-push --yes",
"format:write": "lerna run format:write",
"format:check": "lerna run format:check"
"format:check": "lerna run format:check",
"browser": "yarn -s --cwd examples/browser",
"electron": "yarn -s --cwd examples/electron"
},
"keywords": [
"theia-extension",
Expand All @@ -49,13 +49,15 @@
},
"devDependencies": {
"@theia/cli": "1.40.1",
"concurrently": "^8.2.1",
"jsonc-parser": "^3.0.0",
"lerna": "^4.0.0",
"lerna": "^7.0.0",
"prettier": "2.8.8",
"typescript": "4.5.5"
},
"workspaces": [
"examples/*",
"examples/browser",
"examples/electron",
"packages/*",
"theia-extensions/*"
],
Expand Down
Loading

0 comments on commit cf82da7

Please sign in to comment.