-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
build: omit redundant pkgjson fields on publishing #1003
Labels
ossln24
OSS Library Night 2024
Comments
How to use prettier in this case? Create other config or use default config settings? |
npm-publish.yml ...
- run: node scripts/clean-pkg-json.mjs
- run: echo "//wombat-dressing-room.appspot.com/:_authToken=$AUTH_TOKEN" >> .npmrc
env:
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
- run: npm publish --provenance --access=public Or even: {
"prepublish": "node scripts/clean-pkg-json.mjs"
} scripts/clean-pkg-json.mjs import fs from 'node:fs'
import path from 'node:path'
const __dirname = // ...
const filepath = path.resolve(__dirname, '../package.json')
const pkgJson = JSON.parse(fs.readFileSync(filepath))
const cleaned = {
...pkgJson,
prettier: undefined,
scripts: undefined,
devDependencies: undefined
}
fs.writeFileSync(filepath, JSON.stringify(filepath, null, 2)) |
This look so easy. I'll do it during the day, assign to me |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Smth like clean-publish is required but w/o overengineering. Simple
scripts/clean-pkg-json.mjs
seems enough.optionalDependencies
The text was updated successfully, but these errors were encountered: