Skip to content
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

add npm-template-copy bin #37

Merged
merged 1 commit into from
Feb 1, 2022
Merged

add npm-template-copy bin #37

merged 1 commit into from
Feb 1, 2022

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

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?

@@ -44,5 +45,7 @@ module.exports = async (root) => {

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)

@@ -11,6 +11,7 @@ const changes = {
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?

@@ -26,6 +27,7 @@ const changes = {

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