-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
[v2]: Add option to skip dependency install when initializing new Docusaurus project #3450
Comments
For implementation, since Docusaurus already uses commander it would be easy to support a flag. See https://github.com/facebook/docusaurus/blob/master/packages/docusaurus-init/bin/index.js#L39-L44. The code would look like this which uses almost the exact syntax from Storybooks which the addition of defaulting to false program
.command('init [siteName] [template] [rootDir]')
.option('-s --skip-install', 'Skip installing deps', false)
.description('Initialize website')
.action((siteName, template, rootDir = '.', cmdObj) => {
wrapCommand(init)(path.resolve(rootDir), siteName, template, cmdObj.skipInstall);
}); This change would wrap the following lines in a conditional based on the flag: https://github.com/facebook/docusaurus/blob/master/packages/docusaurus-init/src/index.ts#L154-L164 if (skipInstall === false) {
console.log(`Installing dependencies with: ${chalk.cyan(pkgManager)}`);
try {
shell.exec(`cd "${name}" && ${useYarn ? 'yarn' : 'npm install'}`);
} catch (err) {
console.log(chalk.red('Installation failed'));
throw err;
}
console.log();
} NOTE this change would also require updating the docs |
@facultymatt I'm not against, but do you actually plan to use this feature? If so, as you have a good idea of how to implement it, are you interested to submit a PR? |
Hello! Can I try to tackle this issue for the Hacktoberfest2020? If so, can you assign it to me? |
Hello, we have a branch what fixes this, just waiting on our company to
address the CLA to open the PR.
I’d suggest tackling something else for the hack event! 👍👍
…On Sun, Oct 11, 2020 at 2:35 PM Alexandru Naiman ***@***.***> wrote:
Hello! Can I try to tackle this issue for the Hacktoberfest2020? If so,
can you assign it to me?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3450 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKXKMSKZYTCUUDQPT35WMDSKIQINANCNFSM4RMCV33Q>
.
|
Thanks, waiting for your PR @facultymatt Still interested to know: do you actually need this feature? I'm not 100% sure to understand in which case I'd use it. Do yu often init a new docusaurus project at the same time as you bootstrap a monorepo? |
Thanks @kumaraditya303 for the PR. Yes @slorber we do this quite frequently - we always use Docusaurus for the landing page / docs and then create react app for the application. Testing out the new flag now. Thanks again! |
🚀 Feature
When initializing a new Docusaurus project, a user might wish to skip the dependency install and handle it later on their own. This would be done by passing a flag such as
npx @docusaurus/init@next init [name] [template] --skip-install
. This is supported in other React ecosystem libraries such as Storybook, and there is an open issue on Create React App for this feature, too: facebook/create-react-app#7568Have you read the Contributing Guidelines on issues?
Yes
Motivation
This feature would be especially useful when installing Docusarus as one of many packages in a project and wanting to install all dependencies at one time at the end to help avoid conflicts and speed up each individual install. A Lerna project or Yarn Workspace comes to mind.
Pitch
Run
npx @docusaurus/init@next init [name] [template] --skip-install
and get work done faster!The text was updated successfully, but these errors were encountered: