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

feat: App builder bin 5.0 #8190

Merged
merged 44 commits into from
Jun 2, 2024
Merged

Conversation

beyondkmp
Copy link
Collaborator

@beyondkmp beyondkmp commented May 1, 2024

I have made modifications to the app-builder's implementation to achieve this. Additionally, after making these changes, we no longer need to handle pnmp separately.

Taking test-app-yarn-workspace-version-conflict as an example, the old app-builder output format was like this:

[
	{
		"dir": "~\\app-builder\\pkg\\node-modules\\yarn-demo\\node_modules",
		"deps": [
			{
				"name": "ms",
				"version": "2.0.0"
			}
		]
	},
	{
		"dir": "~\\app-builder\\pkg\\node-modules\\yarn-demo\\packages\\test-app\\node_modules",
		"deps": [
			{
				"name": "foo",
				"version": "1.0.0"
			},
			{
				"name": "ms",
				"version": "2.1.1"
			}
		]
	}
]

After the changes, the output format is like this:

[
	{
		"name": "foo",
		"version": "1.0.0",
		"dir": "~\\app-builder\\pkg\\node-modules\\yarn-demo\\packages\\foo",
		"conflictDependency": [
			{
				"name": "ms",
				"version": "2.0.0",
				"dir": "~\\app-builder\\pkg\\node-modules\\yarn-demo\\node_modules\\ms"
			}
		]
	},
	{
		"name": "ms",
		"version": "2.1.1",
		"dir": "~\\app-builder\\pkg\\node-modules\\yarn-demo\\packages\\test-app\\node_modules\\ms"
	}
] 

Another exmaple - pnpm-demo:
old format:

[
	{
		"dir": "~\\app-builder\\pkg\\node-modules\\pnpm-demo\\node_modules",
		"deps": [
			{
				"name": "react",
				"version": "18.2.0"
			}
		]
	},
	{
		"dir": "~\\app-builder\\pkg\\node-modules\\pnpm-demo\\node_modules\\.pnpm\\[email protected]\\node_modules",
		"deps": [
			{
				"name": "js-tokens",
				"version": "4.0.0"
			}
		]
	},
	{
		"dir": "~\\app-builder\\pkg\\node-modules\\pnpm-demo\\node_modules\\.pnpm\\[email protected]\\node_modules\\react\\node_modules",
		"deps": [
			{
				"name": "loose-envify",
				"version": "1.4.0"
			}
		]
	}
]

new format:

[
	{
		"name": "js-tokens",
		"version": "4.0.0",
		"dir": "~\\app-builder\\pkg\\node-modules\\pnpm-demo\\node_modules\\.pnpm\\[email protected]\\node_modules\\js-tokens"
	},
	{
		"name": "loose-envify",
		"version": "1.4.0",
		"dir": "~\\app-builder\\pkg\\node-modules\\pnpm-demo\\node_modules\\.pnpm\\[email protected]\\node_modules\\loose-envify"
	},
	{
		"name": "react",
		"version": "18.2.0",
		"dir": "~\\app-builder\\pkg\\node-modules\\pnpm-demo\\node_modules\\react"
	}
]

In the new format, it's clearer to see which packages are depended on and which ones are conflicting.

Copy link

changeset-bot bot commented May 1, 2024

🦋 Changeset detected

Latest commit: 2cd2b39

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
app-builder-lib Major
builder-util Major
dmg-builder Major
electron-builder-squirrel-windows Major
electron-builder Major
electron-forge-maker-appimage Major
electron-forge-maker-nsis-web Major
electron-forge-maker-nsis Major
electron-forge-maker-snap Major
electron-publish Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented May 1, 2024

Deploy Preview for car-park-attendant-cleat-11576 ready!

Name Link
🔨 Latest commit 2cd2b39
🔍 Latest deploy log https://app.netlify.com/sites/car-park-attendant-cleat-11576/deploys/665a0182dd249c0008d033fb
😎 Deploy Preview https://deploy-preview-8190--car-park-attendant-cleat-11576.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@beyondkmp beyondkmp changed the title Feat: App builder new feat: App builder bin 5.0 May 1, 2024
@mmaietta mmaietta self-assigned this May 7, 2024
@beyondkmp
Copy link
Collaborator Author

It's quite strange. All unit tests pass locally on my machine and on my PR(beyondkmp#2), but the Linux unit tests on this PR keep failing.

➜  electron-builder git:(app-builder-new) TEST_FILES=HoistedNodeModuleTest pnpm run test-linux

> @electron-builder/monorepo@ test-linux /root/electron-builder
> docker run --rm -e DEBUG=${DEBUG:-} -e UPDATE_SNAPSHOT=${UPDATE_SNAPSHOT:-false} -e TEST_FILES="${TEST_FILES:-HoistedNodeModuleTest}" -v $(pwd):/project -v $(pwd)-node-modules:/project/node_modules -v $HOME/Library/Caches/electron:/root/.cache/electron -v $HOME/Library/Caches/electron-builder:/root/.cache/electron-builder electronuserland/builder:18-wine-mono /bin/bash -c "pnpm install && node ./test/out/helpers/runTests.js"

Scope: all 14 workspace projects
 WARN  There are cyclic workspace dependencies: /project/packages/app-builder-lib, /project/packages/dmg-builder; /project/packages/app-builder-lib, /project/packages/electron-builder-squirrel-windows
Lockfile is up to date, resolution step is skipped
Already up to date

   ╭─────────────────────────────────────────────────────────────────╮
   │                                                                 │
   │                Update available! 8.9.0 → 9.1.0.                 │
   │   Changelog: https://github.com/pnpm/pnpm/releases/tag/v9.1.0   │
   │                Run "pnpm add -g pnpm" to update.                │
   │                                                                 │
   │     Follow @pnpmjs for updates: https://twitter.com/pnpmjs      │
   │                                                                 │
   ╰─────────────────────────────────────────────────────────────────╯


. prepare$ husky install
. prepare: husky - Git hooks installed
. prepare: Done
Done in 1.9s
Test files: HoistedNodeModuleTest
  • electron-builder  version=25.0.0-alpha.7 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-ojKUji/test-project-0/packages/test-app/dist/linux-unpacked
  • electron-builder  version=25.0.0-alpha.7 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-HcCFng/test-project-1/packages/test-app/dist/linux-unpacked
  • electron-builder  version=25.0.0-alpha.7 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-ElfvBg/test-project-2/packages/test-app/dist/linux-unpacked
  • electron-builder  version=25.0.0-alpha.7 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • description is missed in the package.json  appPackageFile=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-na75Fg/test-project-3/app/package.json
  • author is missed in the package.json  appPackageFile=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-na75Fg/test-project-3/app/package.json
  • installing production dependencies  platform=linux arch=x64 appDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-na75Fg/test-project-3/app
  • executing @electron/rebuild  electronVersion=23.2.0 arch=x64 buildFromSource=false appDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-na75Fg/test-project-3/app
  • installing native dependencies  arch=x64
  • completed installing native dependencies
  • packaging       platform=linux arch=x64 electron=23.2.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-na75Fg/test-project-3/dist/linux-unpacked
 PASS  src/HoistedNodeModuleTest.ts (13.752 s)
  ✓ yarn workspace (3433 ms)
  ✓ conflict versions (1536 ms)
  ✓ yarn several workspaces (1518 ms)
  ✓ yarn two package.json w/ native module (4955 ms)

Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   8 passed, 8 total
Time:        14.018 s
Ran all test suites matching /HoistedNodeModuleTest\.ts$/i.

@beyondkmp
Copy link
Collaborator Author

It's quite strange. All unit tests pass locally on my machine and on my PR(beyondkmp#2), but the Linux unit tests on this PR keep failing.

➜  electron-builder git:(app-builder-new) TEST_FILES=HoistedNodeModuleTest pnpm run test-linux

> @electron-builder/monorepo@ test-linux /root/electron-builder
> docker run --rm -e DEBUG=${DEBUG:-} -e UPDATE_SNAPSHOT=${UPDATE_SNAPSHOT:-false} -e TEST_FILES="${TEST_FILES:-HoistedNodeModuleTest}" -v $(pwd):/project -v $(pwd)-node-modules:/project/node_modules -v $HOME/Library/Caches/electron:/root/.cache/electron -v $HOME/Library/Caches/electron-builder:/root/.cache/electron-builder electronuserland/builder:18-wine-mono /bin/bash -c "pnpm install && node ./test/out/helpers/runTests.js"

Scope: all 14 workspace projects
 WARN  There are cyclic workspace dependencies: /project/packages/app-builder-lib, /project/packages/dmg-builder; /project/packages/app-builder-lib, /project/packages/electron-builder-squirrel-windows
Lockfile is up to date, resolution step is skipped
Already up to date

   ╭─────────────────────────────────────────────────────────────────╮
   │                                                                 │
   │                Update available! 8.9.0 → 9.1.0.                 │
   │   Changelog: https://github.com/pnpm/pnpm/releases/tag/v9.1.0   │
   │                Run "pnpm add -g pnpm" to update.                │
   │                                                                 │
   │     Follow @pnpmjs for updates: https://twitter.com/pnpmjs      │
   │                                                                 │
   ╰─────────────────────────────────────────────────────────────────╯


. prepare$ husky install
. prepare: husky - Git hooks installed
. prepare: Done
Done in 1.9s
Test files: HoistedNodeModuleTest
  • electron-builder  version=25.0.0-alpha.7 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-ojKUji/test-project-0/packages/test-app/dist/linux-unpacked
  • electron-builder  version=25.0.0-alpha.7 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-HcCFng/test-project-1/packages/test-app/dist/linux-unpacked
  • electron-builder  version=25.0.0-alpha.7 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-ElfvBg/test-project-2/packages/test-app/dist/linux-unpacked
  • electron-builder  version=25.0.0-alpha.7 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • description is missed in the package.json  appPackageFile=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-na75Fg/test-project-3/app/package.json
  • author is missed in the package.json  appPackageFile=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-na75Fg/test-project-3/app/package.json
  • installing production dependencies  platform=linux arch=x64 appDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-na75Fg/test-project-3/app
  • executing @electron/rebuild  electronVersion=23.2.0 arch=x64 buildFromSource=false appDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-na75Fg/test-project-3/app
  • installing native dependencies  arch=x64
  • completed installing native dependencies
  • packaging       platform=linux arch=x64 electron=23.2.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-na75Fg/test-project-3/dist/linux-unpacked
 PASS  src/HoistedNodeModuleTest.ts (13.752 s)
  ✓ yarn workspace (3433 ms)
  ✓ conflict versions (1536 ms)
  ✓ yarn several workspaces (1518 ms)
  ✓ yarn two package.json w/ native module (4955 ms)

Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   8 passed, 8 total
Time:        14.018 s
Ran all test suites matching /HoistedNodeModuleTest\.ts$/i.

Fix it with merging the master branch. Please help run test cases again.

@mmaietta
Copy link
Collaborator

@beyondkmp I tried updating the snapshot locally but am unable to due the BuildTest not supporting arm64 macs it seems. Are you able to update from your end?

@beyondkmp
Copy link
Collaborator Author

@mmaietta updated.

@beyondkmp
Copy link
Collaborator Author

beyondkmp commented May 23, 2024

@mmaietta It seems like there is caching in this github repo's action.

The snapshot for buildTest doesn't need to be updated. It works fine on my local machine and my PR(beyondkmp#6), and I double-checked that there are no issues.

image

➜  electron-builder git:(app-builder-new) ✗ pnpm compile     

> @electron-builder/monorepo@ compile /root/electron-builder
> tsc --build

➜  electron-builder git:(app-builder-new) ✗ TEST_FILES=BuildTest pnpm run test-linux

> @electron-builder/monorepo@ test-linux /root/electron-builder
> docker run --rm -e DEBUG=${DEBUG:-} -e UPDATE_SNAPSHOT=${UPDATE_SNAPSHOT:-false} -e TEST_FILES="${TEST_FILES:-HoistedNodeModuleTest}" -v $(pwd):/project -v $(pwd)-node-modules:/project/node_modules -v $HOME/Library/Caches/electron:/root/.cache/electron -v $HOME/Library/Caches/electron-builder:/root/.cache/electron-builder electronuserland/builder:18-wine-mono /bin/bash -c "pnpm install && node ./test/out/helpers/runTests.js"

Scope: all 14 workspace projects
 WARN  There are cyclic workspace dependencies: /project/packages/app-builder-lib, /project/packages/dmg-builder; /project/packages/app-builder-lib, /project/packages/electron-builder-squirrel-windows
Lockfile is up to date, resolution step is skipped
Already up to date

   ╭─────────────────────────────────────────────────────────────────╮
   │                                                                 │
   │                Update available! 8.9.0 → 9.1.2.                 │
   │   Changelog: https://github.com/pnpm/pnpm/releases/tag/v9.1.2   │
   │                Run "pnpm add -g pnpm" to update.                │
   │                                                                 │
   │     Follow @pnpmjs for updates: https://twitter.com/pnpmjs      │
   │                                                                 │
   ╰─────────────────────────────────────────────────────────────────╯


. prepare$ husky install
. prepare: husky - Git hooks installed
. prepare: Done
Done in 2.1s
Test files: BuildTest
  • electron-builder  version=25.0.0-alpha.8 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • electron-builder  version=25.0.0-alpha.8 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-zKuJcf/test-project-1/dist/linux-unpacked
  • electron-builder  version=25.0.0-alpha.8 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-unLVag/test-project-2/dist/linux-unpacked
  • electron-builder  version=25.0.0-alpha.8 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-rXKJgi/test-project-3/dist/linux-unpacked
  • electron-builder  version=25.0.0-alpha.8 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-cZJUqj/test-project-4/dist/linux-unpacked
  • electron-builder  version=25.0.0-alpha.8 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-a4W5Fi/test-project-5/dist/linux-unpacked
  • electron-builder  version=25.0.0-alpha.8 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-zsif5i/test-project-6/dist/linux-unpacked
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=darwin arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-zsif5i/test-project-6/dist/mac
  • skipped macOS application code signing  reason=supported only on macOS
  • electron-builder  version=25.0.0-alpha.8 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-mkR2sh/test-project-7/dist/linux-unpacked
  • packaging       platform=darwin arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-mkR2sh/test-project-7/dist/mac
  • skipped macOS application code signing  reason=supported only on macOS
  • electron-builder  version=25.0.0-alpha.8 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • installing production dependencies  platform=win32 arch=x64 appDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-6Lvybf/test-project-8
  • executing @electron/rebuild  electronVersion=17.0.0 arch=x64 buildFromSource=false appDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-6Lvybf/test-project-8
  • installing native dependencies  arch=x64
  • completed installing native dependencies
  • packaging       platform=win32 arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-6Lvybf/test-project-8/dist/win-unpacked
  • electron-builder  version=25.0.0-alpha.8 os=6.1.0-13-amd64
  • loaded configuration  file=package.json ("build" field)
  • installing production dependencies  platform=linux arch=x64 appDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-XT16kj/test-project-9
  • executing @electron/rebuild  electronVersion=17.0.0 arch=x64 buildFromSource=false appDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-XT16kj/test-project-9
  • installing native dependencies  arch=x64
  • preparing       moduleName=keytar arch=x64
  • finished        moduleName=keytar arch=x64
  • preparing       moduleName=lzma-native arch=x64
  • finished        moduleName=lzma-native arch=x64
  • completed installing native dependencies
  • packaging       platform=linux arch=x64 electron=17.0.0 appOutDir=/tmp/et-db411cd21f3bbd882f3a5a30c58db6ff/t-XT16kj/test-project-9/dist/linux-unpacked
 PASS  src/BuildTest.ts (47.042 s)
  ✓ cli (20 ms)
  ✓ merge configurations
  ✓ build in the app package.json (28 ms)
  ✓ relative index (1564 ms)
  ✓ electron version from electron-prebuilt dependency (1458 ms)
  ✓ electron version from electron dependency (1453 ms)
  ✓ electron version from build (1382 ms)
  ✓ www as default dir (1484 ms)
  ✓ afterPack (2878 ms)
  ✓ beforeBuild (2762 ms)
  ✓ win smart unpack (23426 ms)
  ✓ posix smart unpack (9301 ms)
  ○ skipped afterSign

Test Suites: 1 passed, 1 total
Tests:       1 skipped, 12 passed, 13 total
Snapshots:   27 passed, 27 total
Time:        47.121 s
Ran all test suites matching /BuildTest\.ts$/i.

@beyondkmp
Copy link
Collaborator Author

All test cases passed.

@mmaietta mmaietta merged commit 503da26 into electron-userland:master Jun 2, 2024
13 checks passed
@mmaietta
Copy link
Collaborator

mmaietta commented Jun 3, 2024

Many thanks for your great work @beyondkmp! Released in 25.0.0-alpha.9

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

Successfully merging this pull request may close these issues.

3 participants