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 --yes argument to asinit #1063

Closed
webmaster128 opened this issue Jan 20, 2020 · 4 comments · Fixed by #1198
Closed

Add --yes argument to asinit #1063

webmaster128 opened this issue Jan 20, 2020 · 4 comments · Fixed by #1198

Comments

@webmaster128
Copy link

It would be cool if ./node_modules/.bin/asinit . --yes would answer all questions with yes to allow for quick or automatic project setups of throw away projects.

Interface could work like npm init --yes:

$ npm help init
NPM-INIT(1)                                                        NPM-INIT(1)



NAME
       npm-init - create a package.json file

   Synopsis
         npm init [--force|-f|--yes|-y|--scope]
         npm init <@scope> (same as `npx <@scope>/create`)
         npm init [<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`)

   Examples
       Create    a    new    React-based    project   using   create-react-app
       https://npm.im/create-react-app:

         $ npm init react-app ./my-react-app

       Create    a    new    esm-compatible    package    using     create-esm
       https://npm.im/create-esm:

         $ mkdir my-esm-lib && cd my-esm-lib
         $ npm init esm --yes

       Generate a plain old package.json using legacy init:

         $ mkdir my-npm-pkg && cd my-npm-pkg
         $ git init
         $ npm init

       Generate it without having it ask any questions:

         $ npm init -y

   Description
       npm  init  <initializer>  can  be  used to set up a new or existing npm
       package.

       initializer in this case is an npm package named  create-<initializer>,
       which  will  be  installed by npx https://npm.im/npx, and then have its
       main bin executed -- presumably creating or updating  package.json  and
       running any other initialization-related operations.

       The  init  command  is  transformed to a corresponding npx operation as
       follows:

       o npm init foo -> npx create-foo

       o npm init @usr/foo -> npx @usr/create-foo

       o npm init @usr -> npx @usr/create


       Any additional options will be passed directly to the command,  so  npm
       init foo --hello will map to npx create-foo --hello.

       If  the  initializer  is  omitted (by just calling npm init), init will
       fall back to legacy init behavior. It will ask you  a  bunch  of  ques-
       tions,  and  then write a package.json for you. It will attempt to make
       reasonable guesses based on existing fields, dependencies, and  options
       selected.  It is strictly additive, so it will keep any fields and val-
       ues that were already set. You can also use -y/--yes to skip the  ques-
       tionnaire  altogether.  If  you  pass  --scope, it will create a scoped
       package.

   See Also
       o https://github.com/isaacs/init-package-json

       o npm help package.json

       o npm help version

       o npm help scope




                                 December 2019                     NPM-INIT(1)
@dcodeIO
Copy link
Member

dcodeIO commented Jan 20, 2020

Sounds good to me, should be relatively easy to implement by skipping the questions in this case :)

@webmaster128
Copy link
Author

webmaster128 commented Jan 20, 2020

👍

This might require adding some advanced command line argument parser. If the project folder is a required positional argument and --yes a flag, order probably matters. yarn init simply does not have positional arguments, initialized at . by default and provides the --cwd flag.

@dcodeIO
Copy link
Member

dcodeIO commented Jan 20, 2020

We have a little parser here that should do the job. asc uses it already.

@jtenner
Copy link
Contributor

jtenner commented Mar 28, 2020

Any status on this? I think I could work on this.

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

Successfully merging a pull request may close this issue.

4 participants