Skip to content

Commit

Permalink
generated: fix preinstall script (#638)
Browse files Browse the repository at this point in the history
When adding `@river-build/sdk` with other packages managers such as
`pnpm`, I was getting an error since the preinstall command uses `yarn`.

This commit inlines the preinstallation command to avoid the usage of a
package manager script indirection call.

Previously:
```
node_modules/.pnpm/@river-build[email protected]/node_modules/@river-build/generated: Running preinstall script, failed in 289ms
.../node_modules/@river-build/generated preinstall$ yarn make-config
│ Usage Error: The nearest package directory (/Users/miguel/dev/hnt/www/node_modules/.pnpm/@river-build[email protected]/node_modules/@river-build/generated) doesn't seem to be…
│ - If /Users/miguel/dev/hnt/www isn't intended to be a project, remove any yarn.lock and/or package.json file there.
│ - If /Users/miguel/dev/hnt/www is intended to be a project, it might be that you forgot to list node_modules/.pnpm/@river-build[email protected]/node_modules/@river-build/gen…
│ - Finally, if /Users/miguel/dev/hnt/www is fine and you intend node_modules/.pnpm/@river-build[email protected]/node_modules/@river-build/generated to be treated as a complet…
│ $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] [--require #0] <scriptName> ...
└─ Failed in 289ms at /Users/miguel/dev/hnt/www/node_modules/.pnpm/@river-build[email protected]/node_modules/@river-build/generated
```

With this PR changes:
```
Progress: resolved 2182, reused 2111, downloaded 0, added 0, done
node_modules/.pnpm/@river-build[email protected]/node_modules/@river-build/generated: Running preinstall script, done in 77ms
node_modules/.pnpm/[email protected]/node_modules/sharp: Running install script, done in 2.1s
node_modules/.pnpm/@swc[email protected]/node_modules/@swc/core: Running postinstall script, done in 460ms
node_modules/.pnpm/[email protected]/node_modules/esbuild: Running postinstall script, done in 316ms
node_modules/.pnpm/[email protected]/node_modules/sharp: Running install script, done in 1.6s
```
  • Loading branch information
miguel-nascimento authored Aug 7, 2024
1 parent aa6719e commit 939c7d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/generated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.33",
"packageManager": "[email protected]",
"scripts": {
"preinstall": "yarn make-config",
"preinstall": "node ./scripts/make-config.js",
"make-config": "node ./scripts/make-config.js"
}
}

0 comments on commit 939c7d0

Please sign in to comment.