diff --git a/.gitignore b/.gitignore index 620351d..03cca23 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,5 @@ yarn-error.log* # custom data.json public/rss.xml -public/logo.svg \ No newline at end of file +public/logo.svg +shapeup.config.js \ No newline at end of file diff --git a/README.md b/README.md index 04bd86b..fc0edd0 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,12 @@ First, go to your Github profile and create a new Project. Then go to Project se You can now go to your project and start adding bets, pitches, scopes, etc. -Once you got your project setup, go to the `shapeup.config.js` file and replace the `owner` (your Github username) and `projectNumber` (the ID of your project) values with your own ones. - -Right after that, create a file called `.env.local` and add the following line: +Once you got your project setup ``` -GITHUB_TOKEN=[your-github-token] +npm run cli init ``` +This will create `shapeup.config.js` file and generate `.env.local` that will contains your `GITHUB_TOKEN` > You can create a new personal token [here](https://github.com/settings/tokens). Make sure it has, at least, the following scopes: `public_repo`, `read:project`, `read:user`. diff --git a/cli/config.js b/cli/config.js index 18f3e56..e707fb1 100755 --- a/cli/config.js +++ b/cli/config.js @@ -9,12 +9,12 @@ const program = new Command(); program.version('1.0.0'); program - .command('configure') + .command('init') .description('Configure your ShapeUp dashboard') .action(async () => { const questions = [ { type: 'input', name: 'owner', message: 'Enter your Github username:' }, - { type: 'input', name: 'projectNumber', message: 'Enter project number:' }, + { type: 'input', name: 'projectNumber', message: 'Enter a project number:' }, { type: 'input', name: 'fullname', message: 'Enter Your full name:' }, { type: 'input', name: 'email', message: 'Enter email:' }, { type: 'input', name: 'project', message: 'Enter your project Name:' }, @@ -25,15 +25,15 @@ program const answers = await inquirer.prompt(questions); const config = { - [owner]: answers.owner || '', - [projectNumber]: parseInt(answers.projectNumber) || '', - [fullname]: answers.fullname || '', - [email]: answers.email || '', - [project]: answers.project || '', - [website]: answers.website || '', + owner: answers.owner || '', + projectNumber: parseInt(answers.projectNumber) || '', + fullname: answers.fullname || '', + email: answers.email || '', + project: answers.project || '', + website: answers.website || '', }; - config[tagline] = `Visualize the progress of my work at ${config.project}. Want to propose that I work on something? Time to pitch!`; + config.tagline = `Visualize the progress of my work at ${config.project}. Want to propose that I work on something? Time to pitch!`; const configFilePath = 'shapeup.config.js'; fs.writeFileSync(configFilePath, `module.exports = ${JSON.stringify(config, null, 2)};\n`); @@ -44,4 +44,5 @@ program console.log('Configuration generated successfully!'); }); + program.parse(process.argv); diff --git a/shapeup.config,save.js b/shapeup.config,save.js deleted file mode 100644 index 8a4936d..0000000 --- a/shapeup.config,save.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - tagline: `Visualize the progress of my work at AsyncAPI. Want to propose that I work on something? Time to pitch!`, - owner: 'Amzani', - projectNumber: 4, - fullname: 'Samir AMZANI', - email: 'samir.amzani@gmail.com' -} \ No newline at end of file diff --git a/shapeup.config.js b/shapeup.config-sample.js similarity index 100% rename from shapeup.config.js rename to shapeup.config-sample.js