Skip to content

Commit

Permalink
fix: checking extensions for cjs vs mjs while resolving config (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaietta authored Sep 13, 2024
1 parent d50d563 commit ff8059e
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 54 deletions.
5 changes: 5 additions & 0 deletions .changeset/cyan-months-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

fix: resolveConfig logic ignores `.mjs` filter
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"generate-schema": "typescript-json-schema packages/app-builder-lib/tsconfig-scheme.json Configuration --out packages/app-builder-lib/scheme.json --noExtraProps --useTypeOfKeyword --strictNullChecks --required && node ./scripts/fix-schema.js",
"generate-all": "pnpm generate-schema && pnpm generate-docs && pnpm prettier",
"ci:test": "node ./test/out/helpers/runTests.js",
"ci:version": "pnpm changelog && changeset version && node scripts/update-package-version-export.js && pnpm compile && pnpm generate-all && git add .",
"ci:version": "pnpm changelog && changeset version && node scripts/update-package-version-export.js && pnpm i && pnpm compile && pnpm generate-all && git add .",
"ci:publish": "pnpm compile && pnpm publish -r --tag next && changeset tag",
"jsdoc": "ts2jsdoc packages/builder-util-runtime packages/builder-util packages/app-builder-lib packages/electron-builder packages/electron-publish packages/electron-updater packages/dmg-builder",
"jsdoc2md2html": "node scripts/jsdoc2md2html.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.9",
"builder-util": "workspace:^25",
"builder-util-runtime": "workspace:*",
"builder-util-runtime": "workspace:^9",
"chromium-pickle-js": "^0.2.0",
"config-file-ts": "0.2.8-rc1",
"debug": "^4.3.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/util/config/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function readConfig<T>(configFile: string, request: ReadConfigRequest): Pr
let result: any
if (configFile.endsWith(".json5") || configFile.endsWith(".json")) {
result = require("json5").parse(data)
} else if (configFile.endsWith(".js") || configFile.endsWith(".cjs" || configFile.endsWith(".mjs"))) {
} else if (configFile.endsWith(".js") || configFile.endsWith(".cjs") || configFile.endsWith(".mjs")) {
const json = await orNullIfFileNotExist(fs.readFile(path.join(process.cwd(), "package.json"), "utf8"))
const moduleType = json === null ? null : JSON.parse(json).type
result = await resolveModule(moduleType, configFile)
Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@types/debug": "^4.1.6",
"app-builder-bin": "5.0.0-alpha.8",
"bluebird-lst": "^1.0.9",
"builder-util-runtime": "workspace:*",
"builder-util-runtime": "workspace:^9",
"chalk": "^4.1.2",
"cross-spawn": "^7.0.3",
"debug": "^4.3.4",
Expand Down
6 changes: 3 additions & 3 deletions packages/dmg-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"vendor"
],
"dependencies": {
"app-builder-lib": "workspace:*",
"builder-util": "workspace:*",
"builder-util-runtime": "workspace:*",
"app-builder-lib": "workspace:^25",
"builder-util": "workspace:^25",
"builder-util-runtime": "workspace:^9",
"fs-extra": "^10.1.0",
"iconv-lite": "^0.6.2",
"js-yaml": "^4.1.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/electron-builder-squirrel-windows/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"out"
],
"dependencies": {
"app-builder-lib": "workspace:*",
"app-builder-lib": "workspace:^25",
"archiver": "^5.3.1",
"builder-util": "workspace:*",
"builder-util": "workspace:^25",
"fs-extra": "^10.1.0"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/electron-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
"bugs": "https:/electron-userland/electron-builder/issues",
"homepage": "https:/electron-userland/electron-builder",
"dependencies": {
"app-builder-lib": "workspace:*",
"builder-util": "workspace:*",
"builder-util-runtime": "workspace:*",
"app-builder-lib": "workspace:^25",
"builder-util": "workspace:^25",
"builder-util-runtime": "workspace:^9",
"chalk": "^4.1.2",
"dmg-builder": "workspace:*",
"dmg-builder": "workspace:^25",
"fs-extra": "^10.1.0",
"is-ci": "^3.0.0",
"lazy-val": "^1.0.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-forge-maker-appimage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"*.js"
],
"dependencies": {
"app-builder-lib": "workspace:*"
"app-builder-lib": "workspace:^25"
}
}
2 changes: 1 addition & 1 deletion packages/electron-forge-maker-nsis-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"*.js"
],
"dependencies": {
"app-builder-lib": "workspace:*"
"app-builder-lib": "workspace:^25"
}
}
2 changes: 1 addition & 1 deletion packages/electron-forge-maker-nsis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"*.js"
],
"dependencies": {
"app-builder-lib": "workspace:*"
"app-builder-lib": "workspace:^25"
}
}
2 changes: 1 addition & 1 deletion packages/electron-forge-maker-snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"*.js"
],
"dependencies": {
"app-builder-lib": "workspace:*"
"app-builder-lib": "workspace:^25"
}
}
4 changes: 2 additions & 2 deletions packages/electron-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
],
"dependencies": {
"@types/fs-extra": "^9.0.11",
"builder-util": "workspace:*",
"builder-util-runtime": "workspace:*",
"builder-util": "workspace:^25",
"builder-util-runtime": "workspace:^9",
"chalk": "^4.1.2",
"fs-extra": "^10.1.0",
"lazy-val": "^1.0.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-updater/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"out"
],
"dependencies": {
"builder-util-runtime": "workspace:*",
"builder-util-runtime": "workspace:^9",
"fs-extra": "^10.1.0",
"js-yaml": "^4.1.0",
"lazy-val": "^1.0.5",
Expand Down
52 changes: 26 additions & 26 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
"dependencies": {
"@electron/osx-sign": "^1.0.4",
"@jest/core": "^27.5.1",
"app-builder-lib": "workspace:*",
"builder-util": "workspace:*",
"builder-util-runtime": "workspace:*",
"app-builder-lib": "workspace:^25",
"builder-util": "workspace:^25",
"builder-util-runtime": "workspace:^9",
"chalk": "^4.1.2",
"ci-info": "^3.7.0",
"decompress-zip": "^0.3.3",
"depcheck": "1.4.3",
"dmg-builder": "workspace:*",
"electron-builder": "workspace:*",
"electron-builder-squirrel-windows": "workspace:*",
"electron-publish": "workspace:*",
"electron-updater": "workspace:*",
"dmg-builder": "workspace:^25",
"electron-builder": "workspace:^25",
"electron-builder-squirrel-windows": "workspace:^25",
"electron-publish": "workspace:^25",
"electron-updater": "workspace:^6",
"fs-extra": "^10.1.0",
"jest": "^27.5.1",
"jest-junit": "^12.0.0",
Expand Down

0 comments on commit ff8059e

Please sign in to comment.