1.2.1 • Published 2 years ago

rolib-cli v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

🚀 Quick Start

npx rolib-cli my-app
cd my-app
npm start

If you've previously installed  rolib-cli  globally via  npm install -g rolib-cli , we recommend you uninstall the package using  npm uninstall -g rolib-cli  or  yarn global remove rolib-cli  to ensure that  npx  always uses the latest version.

(npx comes with npm 5.2+ and higher, see instructions for older npm versions)

🎨 Output

my-app
 ├─ .git/
 ├─ .husky/
 ├─ node_modules/
 ├─ src
 │ └─ index.ts
 ├─ .cz-config.js
 ├─ .eslintignore
 ├─ .eslintrc.js
 ├─ .gitignore
 ├─ .prettierignore
 ├─ .prettierrc.js
 ├─ babel.config.js
 ├─ commitlint.config.js
 ├─ package-lock.json
 ├─ package.json
 ├─ rollup.config.ts
 └─ tsconfig.json

✏️ extend

We can add some dev-libs by enriching installFeatures.

Example

// src/utils/installName.ts
// you need to prefix "install" in the filename
// "Name" is the value that user select feature via inquirer.prompt

export async function installName(){
    // code...
}
// src/utils/index.ts

import { installName } from './installName'

export const installMethods = {
    installName,
}
// src/utils/initPro.ts

export async function selectFeature() {
    const questions: inquirer.Answers = [
        {
          type: 'checkbox',
          name: 'multiple',
          choices: [
            {
              name: 'Install Name1?',
              value: 'Name1',  // relate to installName1
              checked: true,
            },
            {
              name: 'Install Name2?',
              value: 'Name2', // relate to installName2
            },
          ],
        },
        {
          type: 'confirm',
          name: 'Name3',
          message: 'Install Name3 ?', // relate to installName3
          default: true,
        },
    ];
    const answers = await inquirer.prompt(questions);

    const features = [...(answers.multiple|| [])]; // type checkbox

    const confirmIds: string[] = []; // type confirm

    questions.slice(1).forEach(q => {
        q.type === 'confirm' && confirmIds.push(q.name);
    });

    confirmIds.forEach(v => {
        answers[v] && features.push(v);
    });

    await installFeatures(features);
}

👔 Author

Jay-Ohhh

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page(Issues · Jay-Ohhh/rolib-cli · GitHub). You can also take a look at the contributing guide.

✨ Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2022 Jay-Ohhh.

This project is MIT licensed.