mirror of
https://github.com/aleleba/create-react-component-library.git
synced 2025-01-09 05:06:53 -06:00
Merge pull request #3 from aleleba/PR-126583
PR-126583: updating packages and adding CI/CD pipelines.
This commit is contained in:
commit
7f18acc13e
30
.github/workflows/npm-publish.yml
vendored
Normal file
30
.github/workflows/npm-publish.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
name: NPM testing and publish package
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm ci
|
||||
- run: npm test
|
||||
|
||||
publish-npm:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm ci
|
||||
- run: npm publish --access=public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
33
.github/workflows/npm-test.yml
vendored
Normal file
33
.github/workflows/npm-test.yml
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
name: Testing package
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ['*']
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js 16
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
cache: 'npm'
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm ci
|
||||
- run: npm test
|
||||
test-build-package:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm ci
|
||||
- run: npm run build
|
16
bin/cli.js
16
bin/cli.js
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
const { execSync } = require('child_process');
|
||||
const isWin = process.platform === "win32";
|
||||
|
||||
const runCommand = command => {
|
||||
try{
|
||||
@ -13,7 +14,11 @@ const runCommand = command => {
|
||||
|
||||
const repoName = process.argv[2];
|
||||
const gitCheckoutCommand = `git clone --depth 1 https://github.com/aleleba/create-react-component-library ${repoName}`;
|
||||
const installDepsCommand = `cd ${repoName} && rm -rf .git && git init && git add . && git commit -m "Initial commit" && npm install`;
|
||||
const installDepsCommand = `cd ${repoName} && npm install`;
|
||||
const cleanGitHistoryCommand = `cd ${repoName} && rm -rf .git && git init && git add --all -- ":!.github" ":!bin" && git commit -m "Initial commit"`
|
||||
const cleanGitHistoryCommandWindows = `cd ${repoName} && rmdir .git /s /q && git init && git add --all -- ":!.github" ":!bin" && git commit -m "Initial commit"`
|
||||
const deleteFoldersCommand = `cd ${repoName} && rm -rf .github && rm -rf bin`
|
||||
const deleteFoldersCommandWindows = `cd ${repoName} && rmdir .github /s /q && rmdir bin /s /q`
|
||||
|
||||
console.log(`Cloning the repository with name ${repoName}`);
|
||||
const checkedOut = runCommand(gitCheckoutCommand);
|
||||
@ -23,7 +28,14 @@ console.log(`Installing dependencies for ${repoName}`);
|
||||
const installedDeps = runCommand(installDepsCommand);
|
||||
if(!installedDeps) process.exit(-1);
|
||||
|
||||
console.log(`Cleaning History of Git for ${repoName}`);
|
||||
const cleanGitHistory = isWin ? runCommand(cleanGitHistoryCommandWindows) : runCommand(cleanGitHistoryCommand);
|
||||
if(!cleanGitHistory) process.exit(-1);
|
||||
|
||||
console.log("Congratulations! You are ready. Follow the following commands to start");
|
||||
console.log(`cd ${repoName}`);
|
||||
console.log('Create a .env file with LIBRARY_NAME=your_library_name(default: ui-library), External_CSS (optional)(Default: false), EXTERNAL_CSS_NAME=(optional)(Default: index.css)');
|
||||
console.log(`Then you can run: npm start`);
|
||||
console.log(`Then you can run: npm start`);
|
||||
|
||||
const deleteFolders = isWin ? runCommand(deleteFoldersCommandWindows) : runCommand(deleteFoldersCommand);
|
||||
if(!deleteFolders) process.exit(-1);
|
761
package-lock.json
generated
761
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@aleleba/create-react-component-library",
|
||||
"version": "1.0.11",
|
||||
"version": "1.1.0",
|
||||
"description": "A starter kit for create a React component Library with storybook",
|
||||
"bin": "./bin/cli.js",
|
||||
"main": "dist/index.js",
|
||||
@ -32,8 +32,8 @@
|
||||
},
|
||||
"homepage": "https://github.com/aleleba/create-react-component-library#readme",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.18.9",
|
||||
"@babel/preset-env": "^7.18.9",
|
||||
"@babel/core": "^7.18.10",
|
||||
"@babel/preset-env": "^7.18.10",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@babel/register": "^7.18.9",
|
||||
@ -51,9 +51,9 @@
|
||||
"@storybook/testing-library": "^0.0.13",
|
||||
"@testing-library/jest-dom": "^5.16.4",
|
||||
"@testing-library/react": "^13.3.0",
|
||||
"@testing-library/user-event": "^14.3.0",
|
||||
"@testing-library/user-event": "^14.4.0",
|
||||
"@types/jest": "^28.1.6",
|
||||
"@types/node": "^18.6.1",
|
||||
"@types/node": "^18.6.3",
|
||||
"@types/react": "^18.0.15",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"@types/webpack": "^5.28.0",
|
||||
@ -62,7 +62,7 @@
|
||||
"css-loader": "^6.7.1",
|
||||
"css-minimizer-webpack-plugin": "^4.0.0",
|
||||
"dotenv": "^16.0.1",
|
||||
"eslint": "^8.20.0",
|
||||
"eslint": "^8.21.0",
|
||||
"eslint-plugin-react": "^7.30.1",
|
||||
"eslint-plugin-storybook": "^0.6.1",
|
||||
"eslint-webpack-plugin": "^3.2.0",
|
||||
@ -78,7 +78,7 @@
|
||||
"style-loader": "^3.3.1",
|
||||
"terser-webpack-plugin": "^5.3.3",
|
||||
"ts-loader": "^9.3.1",
|
||||
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
||||
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
||||
"typescript": "^4.7.4",
|
||||
"url-loader": "^4.1.1",
|
||||
"webpack": "^5.74.0",
|
||||
|
Loading…
Reference in New Issue
Block a user