diff --git a/.gitignore b/.gitignore index d4f2725..987e9aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ /node_modules -rfsb.config.json +rcfg.config.json src dist yarn.lock diff --git a/.npmignore b/.npmignore index 011126f..e7e3b72 100644 --- a/.npmignore +++ b/.npmignore @@ -3,7 +3,7 @@ !*.d.ts src lib -rfsb.config.json +rcfg.config.json node_modules tsconfig.json package-lock.json diff --git a/README.md b/README.md index e87fd37..144cb71 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -# react-component-builder -## *react-component-builder* is a CLI tool helping developers creating react components faster with a simple command. +# react-component-files-generator +## *react-component-files-generator* is a CLI tool helping developers creating react components faster with a simple command. ## Getting started -### Install rcb using npm : +### Install rcfg using npm : ```typescript - npm install react-component-builder + npm install react-component-files-generator ``` -### Init rcb to an existing react project running the following command: +### Init rcfg to an existing react project running the following command: ``` - npx rcb --init + npx rcfg --init ``` ### You can now generate components by running: ``` - npx rcb --build + npx rcfg --build ``` #### By default components are generated in the same folder but you can change it by editing config file as well as everything else: @@ -28,7 +28,7 @@ ## Config File -When you run --init for the first time, it will ask you a series of questions to customize the cli to your needs and will generate a "rcb.config.json" config file. +When you run --init for the first time, it will ask you a series of questions to customize the cli to your needs and will generate a "rcfg.config.json" config file. #### Example of the **rfsb.config.json** config file: diff --git a/lib/builder/build.ts b/lib/builder/build.ts index 7564523..284338f 100644 --- a/lib/builder/build.ts +++ b/lib/builder/build.ts @@ -5,13 +5,13 @@ import { quitPrompt } from '../utils/prompt.utils'; import { componentBuildPrompt } from './prompt.build'; export async function runBuild() { - // Get configs from rfsb.config.json file + // Get configs from rcfg.config.json file if(!doesConfigFileExists()){ log('We couldn\'t find any config file in your current working directory.', 'warning'); - log(' Please first run the following command : rfsb --init'); + log(' Please first run the following command : rcfg --init'); quitPrompt(); } - const { name, componentEntryPoint, ...configRest } = JSON.parse(fs.readFileSync('rfsb.config.json', { encoding: 'utf8' })); + const { name, componentEntryPoint, ...configRest } = JSON.parse(fs.readFileSync('rcfg.config.json', { encoding: 'utf8' })); // Clean component entry point path const COMPONENTS_ROOT_DIR = sanitizePath(componentEntryPoint); diff --git a/lib/help/help.ts b/lib/help/help.ts index c569d29..5c589c1 100644 --- a/lib/help/help.ts +++ b/lib/help/help.ts @@ -3,7 +3,7 @@ export function runHelp() { console.log(` Basic options: rsfb --help / -h Show help. - rsfb --init / -i Run config initialization and creates a rfsb.config.json file. + rsfb --init / -i Run config initialization and creates a rcfg.config.json file. rsfb --version / -v Output the version number. rsfb --build / -b Build component. rsfb --update / -u Update config. diff --git a/lib/utils/fileSystem.utils.ts b/lib/utils/fileSystem.utils.ts index 8607ab8..5f27ac0 100644 --- a/lib/utils/fileSystem.utils.ts +++ b/lib/utils/fileSystem.utils.ts @@ -8,12 +8,12 @@ import { log } from './log.utils'; * @param promptResponse */ function writeJsonConfigFile(promptResponse: IConfigObject) { - fs.writeFile("rfsb.config.json", JSON.stringify(promptResponse, null, 4), 'utf8', function (err) { + fs.writeFile("rcfg.config.json", JSON.stringify(promptResponse, null, 4), 'utf8', function (err) { if (err) { log("An error occured while writing JSON Object to File."); return log(err?.message); } - log("rfsb.config.json created successfully !"); + log("rcfg.config.json created successfully !"); }); } @@ -73,10 +73,10 @@ function isReactOrNextInstalled() { /** * Check if config file exists in the working directory - * @returns true if rfsb.config.json file exists + * @returns true if rcfg.config.json file exists */ function doesConfigFileExists() { - return fs.readdirSync('.').includes('rfsb.config.json'); + return fs.readdirSync('.').includes('rcfg.config.json'); }; /** diff --git a/package.json b/package.json index 62a36dd..8752c8f 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "react-folder-structure-builder", + "name": "react-component-files-generator", "description": "A CLI that helps developers generating react folder structure for your project", "version": "1.0.0", "main": "lib/index.ts", @@ -17,13 +17,13 @@ ], "scripts": { "build": "rm -rf ./dist/ && tsc -p tsconfig.json && cp -r lib/templates dist/lib && npm run link", - "link": "npm link && rm -rf chmod a+x /home/aabdelli/.nvm/versions/node/v18.12.1/bin/rfsb", + "link": "npm link && rm -rf chmod a+x /home/aabdelli/.nvm/versions/node/v18.12.1/bin/rcfg", "dev:init": "ts-node-dev lib/index.ts --init", "dev:build": "ts-node-dev lib/index.ts --build" }, "license": "MIT", "bin": { - "rfsb": "./dist/lib/index.js" + "rcfg": "./dist/lib/index.js" }, "devDependencies": { "@types/inquirer": "^9.0.3", @@ -33,9 +33,10 @@ "typescript": "^4.9.3" }, "dependencies": { + "react": "1.1.1", "chalk": "^4.1.2", + "florianlebgdu59": "^1.0.2", "inquirer": "^8.0.0", - "ts-node-dev": "^2.0.0", - "react": "1.1.1" + "ts-node-dev": "^2.0.0" } }