Skip to content

Commit

Permalink
fix: pnpm workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Sep 10, 2024
1 parent 868d533 commit f0b895d
Show file tree
Hide file tree
Showing 3 changed files with 824 additions and 5 deletions.
10 changes: 5 additions & 5 deletions build/pack.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { fileURLToPath } from 'node:url'
import util from 'node:util'
import { packager } from '@electron/packager'
import { rebuild } from '@electron/rebuild'
import { findWorkspacePackages } from '@pnpm/workspace.find-packages'
import chalk from 'chalk'
import * as dotenv from 'dotenv'
import png2icons from 'png2icons'
Expand Down Expand Up @@ -70,18 +71,17 @@ async function generateAppIcon(input, icon, suffix) {
}

async function resolveWorkspacePackages() {
const workspacePkgs = pkg.workspaces
.map(dir => requireCommonJS(import.meta, path.join(path.dirname(pkgPath), dir, 'package.json')))
const workspacePkgs = await findWorkspacePackages(path.dirname(pkgPath))
const prunePkg = {
...pkg,
devDependencies: Object.assign(
{},
...workspacePkgs.map(workspace => workspace.devDependencies),
...workspacePkgs.map(workspace => workspace.manifest.devDependencies),
pkg.devDependencies,
),
dependencies: Object.assign(
{},
...workspacePkgs.map(workspace => workspace.dependencies),
...workspacePkgs.map(workspace => workspace.manifest.dependencies),
pkg.dependencies,
),
}
Expand Down Expand Up @@ -257,6 +257,6 @@ pack().then(
},
err => {
process.exitCode = 1
logger.error(err)
logger.error(err.stack)
},
)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@cyansalt/tsconfig": "^2.2.1",
"@electron/packager": "^18.3.4",
"@electron/rebuild": "^3.6.0",
"@pnpm/workspace.find-packages": "^4.0.10",
"@release-it/conventional-changelog": "^8.0.1",
"@types/fuzzaldrin-plus": "^0.6.5",
"@types/lodash": "^4.17.7",
Expand Down
Loading

0 comments on commit f0b895d

Please sign in to comment.