-
Notifications
You must be signed in to change notification settings - Fork 80
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
Bolt install production #280
Comments
Run this and then import {getPackages} from '@manypkg/get-packages'
import {writeFile} from 'fs/promises'
import path from 'path'
// remove-dev-deps.js - Removes dev dependencies from a bolt monorepo
const {
packages,
rootPackage: {packageJson: rootPackageJson}
} = await getPackages(process.cwd())
// Get all dependencies used by sub-packages.
const usedPackages = new Set(
packages
.reduce(
(acc, {packageJson: {dependencies = {}}}) => [
...acc,
...Object.keys(dependencies)
],
[]
)
.sort()
)
// Remove packages from the root package.json that aren't any sub-packages' dependencies
rootPackageJson.dependencies = Object.fromEntries(
Object
.entries(rootPackageJson.dependencies)
.filter(([name]) => usedPackages.has(name))
)
await writeFile(
'package.json',
JSON.stringify(rootPackageJson, null, 2) + '\n'
)
// Remove devDependencies from all sub-packages' package.json
await Promise.all(
packages.map(({
relativeDir,
packageJson: {
devDependencies,
...packageJson
}
}) => writeFile(
path.join(relativeDir, 'package.json'),
JSON.stringify(packageJson, null, 2) + '\n'
))
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bolt is not installing
--production
only packages.yarn install --production
but instead all packages being installed (including devDependencies).The text was updated successfully, but these errors were encountered: