Repository navigation
Conversation
…ushd First step towards dropping shelljs. Export only the shelljs helpers that are used, and run git commands with execa's cwd option instead of pushd/popd. This also fixes two cases where the process directory was left changed: pushUpdateToTestProject returned early on "Nothing to commit" without popd, and zip() skipped popd when zipping failed.
This comment has been minimized.
This comment has been minimized.
Use node:fs/promises for rm, mkdir and cp in automation/utils and the charts-web and data-widgets scripts, and remove shelljs from automation/utils. shell.ts keeps small helpers where node:fs has no direct equivalent: - findFiles: glob that fails when a pattern matches nothing, like shelljs find - move: rename with a copy and remove fallback across file systems, like mv - makeWritableRecursive: chmod -R a+rw zip() now switches directories with process.chdir instead of pushd/popd.
This comment has been minimized.
This comment has been minimized.
Use node:fs for ls, rm, mkdir, mv, cp, test and cat in run-e2e, spawnSync for `gh auth token` and the themesource chmod, and remove shelljs from run-e2e. shelljs was not in fatal mode here, so a failed cp or mv only printed an error. They now throw; the Atlas theme and core releases in use contain the copied folders. A missing runtime.log is still reported instead of thrown.
This comment has been minimized.
This comment has been minimized.
pluggable-widgets-tools depends on shx, which pulls in shelljs 0.9.2, but neither the tools nor this repo call it. Remove it with a pnpm override, like the other unused tools dependencies. The tools still use shelljs 0.10.0 in their rollup config until a release without it is available.
Contributor
AI Code Review
What was reviewed
Skipped (out of scope): CI: pending: Run code quality check, Plan E2E matrix, sigridci · unrelated failures: security/snyk (external scanner) Questions
Positives
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request type
Refactoring (e.g. file rename, variable rename, etc.)
Description
Removes shelljs from the repo's own scripts (follow-up to #2484), as four commits that can be reviewed separately. Replacing
exec(execa v5) with zx is the next step.1. Trim shell exports and pass
cwdinstead ofpushd(4b8d0be)src/shell.tsexported 29 shelljs functions; only the ones in use are kept.pushUpdateToTestProject(steps.ts) andupdateChangelogsAndCreatePR(changelog.ts) run their git commands with execa'scwdoption instead ofpushd/popd.This fixes two cases where the process was left in a different directory:
pushUpdateToTestProjectcalledpushdand then returned early on "Nothing to commit" withoutpopd.zip()only calledpopdon success, so a failed zip left the process inside the zipped folder.2. Replace shelljs file helpers with
node:fs(e2f4c2f)rm -rf,mkdir -pandcpcall sites now usenode:fs/promises, inautomation/utilsand in the charts-web and data-widgets scripts. shelljs is removed fromautomation/utils/package.json.shell.tskeeps small helpers only wherenode:fshas no direct equivalent:findFiles(...patterns):fs.globSyncthat throws when a pattern matches nothing. shelljsfindwithfatalfailed the same way, so a missing mpk still stops the release instead of being skipped silently.move(source, dest):renamewith a copy and remove fallback when crossing file systems, like shelljsmv. This replaces the cp + rm workaround inmoveModuleToDistfor mv silently swallows errors shelljs/shelljs#878.makeWritableRecursive(dir): thechmod -R a+rwused before re-zipping mpks.ensureFileExistsusesfs.accessand is now async.zip()switches directories withprocess.chdir; cross-zip has nocwdoption.rui-oss-clearanceimportsnode:fs/promisesstatically instead of the inlineawait import(...)calls.Copying a file into a directory now passes the full destination path, since
fs.cpdoesn't copy into an existing directory the way shelljscpdoes.pnpm-lock.yaml: removes shelljs 0.8.5.3. Replace shelljs in run-e2e with
node:fs(d363d85)ls,rm,mkdir,mv,cp,testandcatinautomation/run-e2e/libnow usenode:fs; globs (tests/testProjects-*,*.mpr,dist/<version>/*.mpk) usefs.globSync.gh auth token(dev mode) and the themesourcechmod -R +wusespawnSync.automation/run-e2e/package.jsonand from the lockfile.Behaviour change: shelljs was not in
fatalmode in run-e2e, so a failedcp/mvonly printed an error and continued. These now throw. The Atlas theme releases (atlasui-theme-files-2024-01-25,-2025-10-08) containwebandnative, and the Atlas core releases (3.17.0, 4.5.0) containthemesource, so the copies succeed. A missingresults/runtime.logis still reported instead of thrown. A missing widget mpk after the release script throws, butupdateTestProjectalready catches and logs errors from that step.4. Drop the unused
shxdependency of pluggable-widgets-tools (c7e0f34)@mendix/pluggable-widgets-toolsdepends onshx, which brings in shelljs 0.9.2 (and an oldexeca@1chain), but neither the tools nor this repo call it. It is removed with a"@mendix/pluggable-widgets-tools>shx": "-"override, like the other unused tools dependencies in the rootpackage.json.The only shelljs left in the lockfile is 0.10.0, used by the tools' rollup config to copy XML, icons, LICENSE and the mpk. The upstream fix is merged but not yet released; the override and that dependency can go once we upgrade the tools.
What should be covered while testing?
Verified locally:
automation/utilstype-checks and lints; script lints pass for all modules and charts-web.Helper smoke test: zip/unzip,
ziprestoring the directory on success and failure,ensureFileExiststhrowingENOENT,findFilesmatching and throwing,makeWritableRecursive(600 → 666),move.pnpm turbo build --filter=@mendix/charts-web: Charts.mpk contains all 10 widgets merged undercom/pluspackage.xmlandLicense.txt.pnpm turbo build --filter=@mendix/badge-web --forceand its unit tests pass withoutshxinstalled.run-e2e:
setupTestProject(twice, covering the cleanup branch) andupdateTestProjectfor badge-web: the mpr, Atlastheme/webandtheme/native,themesource/atlas_coreandBadge.mpkare in place, and the themesource files are writable.build:modulefordata-widgets(all 9 widget mpks copied, themesource,.version, LICENSE) andweb-actions(themesource identical to source).Module release pipeline for
data-widgets, run locally withCIunset: the steps fromscripts/release.ts, with only the clone swapped for an anonymous one becausecloneTestProjectneedsGH_PAT. That coverscreateModuleMpkin Docker (mxbuild 10.24.0.73019),addWidgetsToMpk(9 widgets added) andmoveModuleToDist. The resultingdist/3.11.8/DataWidgets.mpkhas the same file list and the samepackage.xmlentries as the publisheddata-widgets-v3.11.8asset. The only difference is the READMEOSS HTML, which OSS clearance adds after release. No temp folders were left behind.Not run locally, worth watching on the next module release:
rui-create-gh-release, which talk to GitHub releases.pushUpdateToTestProjectand the changelog flow, which push to remotes.move.ci.mjs,docker-utils.mjs); the E2E jobs exercise them.