Skip to content

Commit

Permalink
chore: Update new library name
Browse files Browse the repository at this point in the history
  • Loading branch information
amine-abdelli committed Dec 4, 2022
1 parent 7c39d19 commit cf962ed
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/node_modules
rfsb.config.json
rcfg.config.json
src
dist
yarn.lock
Expand Down
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!*.d.ts
src
lib
rfsb.config.json
rcfg.config.json
node_modules
tsconfig.json
package-lock.json
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:

Expand Down
6 changes: 3 additions & 3 deletions lib/builder/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion lib/help/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions lib/utils/fileSystem.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 !");
});
}

Expand Down Expand Up @@ -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');
};

/**
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand All @@ -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"
}
}

0 comments on commit cf962ed

Please sign in to comment.