-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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 a CLI for bootstrapping #1216
Conversation
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.
See my suggestion above
scripts/bootstrap.js
Outdated
}); | ||
} | ||
|
||
if (program.docs) { |
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.
What about something like this to replace all of these if
statements:
Object.keys(todo).forEach(key => {
todo[key] = program[key] || program.all
})
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.
Will do this, thanks!
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.
Looks good!
As per my comment, I wonder if the default behaviour should be to bootstrap all, with a flag to --pick
or --interactive
or --prompt
which options to bootstrap.
But I am not very strong on that suggestion. It just seems like it may be more familiar to users.
scripts/bootstrap.js
Outdated
|
||
program | ||
.version('1.0.0') | ||
.option('--all', 'Run all without asking') |
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.
Should --all
be the default and instead a --interactive
or --pick
flag would launch the interactive picker?
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.
I'm assuming developers want to type LESS ?
I think interactive mode is a sane default for a developer tool ?
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.
I think I agree ... just raised the consideration of keeping the normal bootstrap behaviour default with the interactive bootstrapping be a power mode. But this is more discoverable!
I need to rebase this, good opportunity to review npm install correctness /cc @tmeasday |
"npm install correctness" -> Not quite sure what you mean by this @ndelangen? Do you mean in general or something that this PR is doing? (it doesn't seem to be touching our npm setup too much, AFAICT). |
|
Makes sense to me, although I am not entirely clear on why we needed |
@ndelangen can we close this now? |
No I will actually finish and add this soonish. |
Script is now also capable of |
"npm run lint:md -- -o", | ||
"git add" | ||
] | ||
"linters": { |
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.
I had trouble with lint-staged trying to git add multiple things in parallel, which fails because git's lockfile would exist.
I disabled concurrency for this reason. Depending on the amount of files in your stage, this will make the process a second or 2 slower, but git add is reliable.
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.
@ndelangen seems like this is a separate PR?
# Conflicts: # .circleci/config.yml
@shilman @storybooks/team can you approve ? |
"npm run lint:md -- -o", | ||
"git add" | ||
] | ||
"linters": { |
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.
@ndelangen seems like this is a separate PR?
scripts/bootstrap.js
Outdated
option: '--reset', | ||
command: () => { | ||
log.info(prefix, 'git clean'); | ||
spawn('git clean -fdx'); |
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.
What do you think about just running lerna clean
instead of git clean -fdx
which is much more destructive?
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.
It should be completely destructive to anything not managed by git. Anything added not known by or ignored by git should be removed. The desired end-result is as if you just cloned the repo.
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.
In fact, git clean -fdx
breaks my IDE setup each time
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.
@Hypnosphi Can you give me a list / regexp that you IDE adds that should NOT be cleaned away?
https://git-scm.com/docs/git-clean#git-clean--eltpatterngt
scripts/bootstrap.js
Outdated
}); | ||
process.stdout.write('\x07'); | ||
try { | ||
spawn('say "Bootstrapping sequence complete"'); |
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.
AWESOME 💯
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.
Lol, I'm actually concerned this will be annoying to linux and windows users, will have to ask @usulpro maybe?
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.
won't it just fail silently on those platforms?
scripts/bootstrap.js
Outdated
log.info(prefix, 'git clean'); | ||
spawn('git clean -fdx'); | ||
log.info(prefix, 'yarn install'); | ||
spawn('yarn install --no-lockfile'); |
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.
why no lockfile? i think yarn's lockfiles work pretty well cc @Hypnosphi
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.
We're currently ignoring them, so not generating them in the first place is better.
Let's discuss enabling yarn lockfiles outside this PR?
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.
Let's do it: #1703
…oved with git clean
…rybook into improve-bootstrap-command
option: '--reset', | ||
command: () => { | ||
log.info(prefix, 'git clean'); | ||
spawn('git clean -fdx --exclude=".vscode" --exclude=".idea"'); |
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.
Really have to object here. This is a destructive operation and there is no warning to the user.
Propose one or more of:
- warning in name e.g. "CAUTION removes all files not associated with git!"
- confirmation step: "This removes all files not associated with git. Are you sure?"
- another bootstrap command (clean = lerna clean, reset = git clean -fdx with warnings)
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.
I'll take a look at adding a "Are you sure you want to do what you told me to do" confirmation screen.
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.
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.
It's not really clear, what are the files that will get deleted. Can those be my kitten gifs from personal directory?
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.
Yes, those will get deleted 🐈 🚫 /jk
Got a suggestion?
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.
State exactly what will be removed: all the files not present in git, except for .idea and .vscode. This is more verbose, but also more fair
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.
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.
@ndelangen great job on this! 🎯 💯 🎖 |
Issue: -bootstrapping process is becoming too much manual work-
What I did
I wrote a CLI for bootstrapping
How to test
run the following commands:
TODO
npm run bootstrap -- --all
on CI