-
-
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
feat: create script for omit package.json fields before publish #1005
feat: create script for omit package.json fields before publish #1005
Conversation
test/it/clean-package-json.test.js
Outdated
it('handle exist properties required for publishing', async () => { | ||
await t$`node scripts/clean-package-json.mjs` | ||
// to throw if manifest is not correct | ||
const file = createRequire(import.meta.url)( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fs.readFileSync
+ JSON.parse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d1
test/it/clean-package-json.test.js
Outdated
const file = createRequire(import.meta.url)( | ||
path.resolve(tmp, 'package.json') | ||
) | ||
assert.strictEqual(whitelist, Object.keys(file)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.equal(pkgJson.name, 'zx')
assert.equal(pkgJson.prettier, undefined)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d1
test/it/clean-package-json.test.js
Outdated
|
||
const __dirname = path.dirname(new URL(import.meta.url).pathname) | ||
const root = path.resolve(__dirname, '../../') | ||
const whitelist = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This const is redundant now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you suggesting to completely remove the check for fields, since they are in the script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
c4a0935
to
5e059cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. Thanks!
Create script and test
Fixes #1003