-
-
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
369ac55
ADD a CLI for bootstrapping
ndelangen 5726f13
Merge branch 'master' into improve-bootstrap-command
ndelangen 27edf5e
Merge branch 'master' into improve-bootstrap-command
ndelangen 4f4b9e4
set as default bootstrap command && add core as default
ndelangen 9fafeab
CHANGE hoist-internals script to be less verbose
ndelangen 86c25d6
Merge branch 'master' into improve-bootstrap-command
ndelangen 6aad7a1
use `-- --flag` in docs & circleci
ndelangen 8146294
Merge branch 'master' into improve-bootstrap-command
ndelangen 31f83aa
Merge branch 'master' into improve-bootstrap-command
ndelangen 1327e2d
Merge branch 'master' into improve-bootstrap-command
ndelangen 02e0950
ADD build-packs
ndelangen 540ec9a
DISABLE concurrency on lint-staged (I got problems with git lock files)
ndelangen c85776a
WIP
ndelangen de7777e
SWITCH to normal node for bootstrap script && CHANGE circleCI to use …
ndelangen ed0e61e
Merge branch 'master' into improve-bootstrap-command
ndelangen b215110
FIX circleCI.yml
ndelangen 7940e62
REVERT incorrect changes on docs/pages
ndelangen 879928d
Merge branch 'master' into improve-bootstrap-command
ndelangen 1843196
ADD crna-kitchen-sink bootstrap command
ndelangen 43b8753
Merge branch 'master' into improve-bootstrap-command
ndelangen 9f30bbf
Merge branch 'master' into improve-bootstrap-command
ndelangen f84623d
ADD .vscode and .idea to gitignore, but whitelist them from being rem…
ndelangen 6dd4ae7
Merge branch 'improve-bootstrap-command' of github.com:storybooks/sto…
ndelangen 0723401
ADD -- --core to CONTRIBUTING.md
ndelangen 7fd661c
Merge branch 'master' into improve-bootstrap-command
ndelangen 30e7c37
ADD a confirmation step when doing the reset task, it will NOT ask wh…
ndelangen faec65e
Merge branch 'master' into improve-bootstrap-command
ndelangen 55a2b9a
IMPROVE confirm message
ndelangen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/env babel-node | ||
|
||
import inquirer from 'inquirer'; | ||
import program from 'commander'; | ||
import childProcess from 'child_process'; | ||
|
||
const spawn = childProcess.spawnSync; | ||
|
||
program | ||
.version('1.0.0') | ||
.option('--all', 'Run all without asking') | ||
.option('--docs', 'Bootstrap docs') | ||
.option('--libs', 'Bootstrap libs') | ||
.option('--test-cra', 'Bootstrap test-cra') | ||
.option('--react-native-vanilla', 'Bootstrap react-native-vanilla') | ||
.parse(process.argv); | ||
|
||
const todo = { | ||
docs: false, | ||
libs: false, | ||
'test-cra': false, | ||
'react-native-vanilla': false, | ||
}; | ||
|
||
if (program.all) { | ||
Object.assign(todo, { | ||
docs: true, | ||
libs: true, | ||
'test-cra': true, | ||
'react-native-vanilla': true, | ||
}); | ||
} | ||
|
||
if (program.docs) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about something like this to replace all of these Object.keys(todo).forEach(key => {
todo[key] = program[key] || program.all
}) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do this, thanks! |
||
Object.assign(todo, { | ||
docs: true, | ||
}); | ||
} | ||
if (program.libs) { | ||
Object.assign(todo, { | ||
libs: true, | ||
}); | ||
} | ||
if (program['test-cra']) { | ||
Object.assign(todo, { | ||
'test-cra': true, | ||
}); | ||
} | ||
if (program['react-native-vanilla']) { | ||
Object.assign(todo, { | ||
'react-native-vanilla': true, | ||
}); | ||
} | ||
|
||
let selection; | ||
if (!Object.keys(todo).map(key => todo[key]).filter(Boolean).length) { | ||
selection = inquirer | ||
.prompt([ | ||
{ | ||
type: 'checkbox', | ||
message: 'Select which packages to bootstrap', | ||
name: 'todo', | ||
choices: Object.keys(todo).map(key => ({ name: key })), | ||
}, | ||
]) | ||
.then(answers => answers.todo); | ||
} else { | ||
selection = Promise.resolve(Object.keys(todo).filter(key => todo[key] === true)); | ||
} | ||
|
||
selection.then(list => { | ||
if (list.length === 0) { | ||
console.log('Nothing to bootstrap'); | ||
} else { | ||
console.log(`Bootstrapping: ${list.join(', ')}`); | ||
list.forEach(key => { | ||
spawn('npm', [`run bootstrap:${key}`], { | ||
shell: true, | ||
stdio: 'inherit', | ||
}); | ||
}); | ||
} | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!