Skip to content

Conversation

@fritzy
Copy link
Contributor

@fritzy fritzy commented Jan 31, 2022

Packages using template-oss can now manually invoke copying template files, regardless of template-oss matching.
npm run template-copy

@fritzy fritzy requested a review from a team as a code owner January 31, 2022 23:09
Copy link
Contributor

@nlf nlf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these changes are all clearly functional. i do want to push back (albeit lightly) on adding the template-copy script to everything though, it feels like overkill to me.

another approach that literally just came into my head, maybe npm-template-check can accept a --fix or --repair option or something and that can serve the place of this new bin? then reapplying the templates could be npm run postlint -- --fix and we don't need to add a new script to make it easily reachable. thoughts?


config.paths.push(root)

config.force = process.argv.indexOf('--force') !== -1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

total nit, but process.argv.includes('--force') is shorter and more clear (i think)

scripts: {
lint: `eslint '**/*.js'`,
postlint: 'npm-template-check',
'template-copy': 'npm-template-copy --force',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to add this script to everything? are we re-applying templates enough that it's necessary?


const patchPackage = async (path, root, config) => {
const pkg = await PackageJson.load(path)
config = config || {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another total nit, but this might be more readable if the function definition just sets a default (assuming we're not passing an explicit falsey value anywhere that this is working around, anyway)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants