Skip to content

Commit

Permalink
feat(@set-app/cli): add github project generation
Browse files Browse the repository at this point in the history
 style(@set-app/cli): improve message error and task message
test(@set-app/cli): add integration testing to cli
fix(@set-app/react-redux): fix inconsistencies in react-redux project files
test(@set-app/cli): add integration testing to the cli tool
ci(@set-app): upgrade github actions with test-integration
ci(@set-app): fix conditions on PR ci
test(@set-app/cli): add logging over readme generated
style(@set-app/cli): remove not used import
test(@set-app/cli): remove author data for integration tests Readmes
  • Loading branch information
Frankeo authored Feb 28, 2023
1 parent b48299b commit 24833e9
Show file tree
Hide file tree
Showing 36 changed files with 1,844 additions and 1,579 deletions.
1 change: 1 addition & 0 deletions .github/workflows/banches-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

jobs:
ci-tasks:
if: "!contains(github.event.pull_request.labels.*.name, 'autorelease')"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
Expand Down
1 change: 1 addition & 0 deletions examples/react-redux/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules/
dist/
.parcel-cache/
.env
.DS_Store
coverage/
Expand Down
2 changes: 1 addition & 1 deletion examples/react-redux/.prettierrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
31 changes: 31 additions & 0 deletions examples/react-redux/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<h1 align="center">Welcome to react-redux 👋</h1>
<p>
<a href="https://www.npmjs.com/package/react-redux" target="_blank">
<img alt="Version" src="https://img.shields.io/npm/v/react-redux.svg">
</a>
<a href="#" target="_blank">
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
</a>
</p>

>
## Install

```sh
yarn install
```

## Run tests

```sh
yarn run test
```

## Show your support

Give a ⭐️ if this project helped you!

---

_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_
1 change: 0 additions & 1 deletion examples/react-redux/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -364,4 +364,3 @@ form .pet {
.mini .loader {
font-size: 34px;
}

13 changes: 12 additions & 1 deletion examples/react-redux/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
{"compilerOptions":{"target":"ES2022","jsx":"react-jsx","module":"ES2022","moduleResolution":"node","esModuleInterop":true,"forceConsistentCasingInFileNames":true,"strict":true,"skipLibCheck":true}}
{
"compilerOptions": {
"target": "ES2022",
"jsx": "react-jsx",
"module": "ES2022",
"moduleResolution": "node",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
}
24 changes: 5 additions & 19 deletions examples/react/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,12 @@
"project": "./tsconfig.json",
"ecmaVersion": 2022,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"es6": true,
"browser": true,
"node": true
"ecmaFeatures": { "jsx": true }
},
"env": { "es6": true, "browser": true, "node": true },
"settings": {
"react": {
"version": "detect"
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
}
}
"react": { "version": "detect" },
"import/parsers": { "@typescript-eslint/parser": [".ts", ".tsx"] },
"import/resolver": { "typescript": { "alwaysTryTypes": true } }
}
}
4 changes: 2 additions & 2 deletions examples/react/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
node_modules
.parcel-cache/
node_modules/
dist/
.parcel-cache/
.env
.DS_Store
coverage/
Expand Down
22 changes: 8 additions & 14 deletions examples/react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,41 @@

## [2.1.0](https://www.github.com/Frankeo/set-app/compare/react-v2.0.0...react-v2.1.0) (2023-02-20)


### Features

* **@set-app:** react-redux ([f6a6242](https://www.github.com/Frankeo/set-app/commit/f6a6242ba7a5006807994bbf798b6e51561ac4c7))
- **@set-app:** react-redux ([f6a6242](https://www.github.com/Frankeo/set-app/commit/f6a6242ba7a5006807994bbf798b6e51561ac4c7))

## [2.0.0](https://www.github.com/Frankeo/set-app/compare/react-v1.0.4...react-v2.0.0) (2023-02-13)


### ⚠ BREAKING CHANGES

* **packages/cli:** style(set-app): remove unnecesary .pretierignore file and format vite.config.js
- **packages/cli:** style(set-app): remove unnecesary .pretierignore file and format vite.config.js

### Performance Improvements

* **packages/cli:** improvement ([893797e](https://www.github.com/Frankeo/set-app/commit/893797ef8d925334fc062a046d0dd19fadfd6d7b))
- **packages/cli:** improvement ([893797e](https://www.github.com/Frankeo/set-app/commit/893797ef8d925334fc062a046d0dd19fadfd6d7b))

### [1.0.4](https://www.github.com/Frankeo/set-app/compare/react-v1.0.3...react-v1.0.4) (2023-02-12)


### Miscellaneous Chores

* **examples/react:** testing ci workflow for reac example ([63f9f68](https://www.github.com/Frankeo/set-app/commit/63f9f682f60dcae24276d98b7d1ae66071c8262c))
- **examples/react:** testing ci workflow for reac example ([63f9f68](https://www.github.com/Frankeo/set-app/commit/63f9f682f60dcae24276d98b7d1ae66071c8262c))

### [1.0.3](https://www.github.com/Frankeo/set-app/compare/react-v1.0.2...react-v1.0.3) (2023-02-12)


### Miscellaneous Chores

* **examples/react:** testing ci for examples/react ([462a9d3](https://www.github.com/Frankeo/set-app/commit/462a9d32a7bbcc2f265f2ac3d71019827fcff506))
* **examples/react:** testing ci pipeline ([c069aaa](https://www.github.com/Frankeo/set-app/commit/c069aaae295587f11f7f8a2b43b255809238198b))
- **examples/react:** testing ci for examples/react ([462a9d3](https://www.github.com/Frankeo/set-app/commit/462a9d32a7bbcc2f265f2ac3d71019827fcff506))
- **examples/react:** testing ci pipeline ([c069aaa](https://www.github.com/Frankeo/set-app/commit/c069aaae295587f11f7f8a2b43b255809238198b))

### [1.0.2](https://www.github.com/Frankeo/set-app/compare/react-v1.0.1...react-v1.0.2) (2023-02-12)


### Miscellaneous Chores

* **examples/react:** testing ci release ([74f084e](https://www.github.com/Frankeo/set-app/commit/74f084e904495650db51e5d408983ec81b4a472e))
- **examples/react:** testing ci release ([74f084e](https://www.github.com/Frankeo/set-app/commit/74f084e904495650db51e5d408983ec81b4a472e))

### [1.0.1](https://www.github.com/Frankeo/set-app/compare/react-v1.0.0...react-v1.0.1) (2023-02-12)


### Bug Fixes

* **examples/react:** fix http links, updated to https ([6a98656](https://www.github.com/Frankeo/set-app/commit/6a986560ac9a8de6e1845d6482a4f8bf556a570a))
- **examples/react:** fix http links, updated to https ([6a98656](https://www.github.com/Frankeo/set-app/commit/6a986560ac9a8de6e1845d6482a4f8bf556a570a))
31 changes: 31 additions & 0 deletions examples/react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<h1 align="center">Welcome to react 👋</h1>
<p>
<a href="https://www.npmjs.com/package/react" target="_blank">
<img alt="Version" src="https://img.shields.io/npm/v/react.svg">
</a>
<a href="#" target="_blank">
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
</a>
</p>

>
## Install

```sh
yarn install
```

## Run tests

```sh
yarn run test
```

## Show your support

Give a ⭐️ if this project helped you!

---

_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_
6 changes: 3 additions & 3 deletions examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
"check-format": "prettier --check \"src/**/*.{ts,tsx}\"",
"lint": "eslint \"src/**/*.{ts,tsx}\" --quiet",
"format": "prettier --write .",
"check-format": "prettier --check .",
"lint": "eslint . --quiet",
"typecheck": "tsc --noEmit",
"test": "vitest --run --reporter=verbose",
"test:watch": "vitest",
Expand Down
1 change: 0 additions & 1 deletion examples/react/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -364,4 +364,3 @@ form .pet {
.mini .loader {
font-size: 34px;
}

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
},
"scripts": {
"publish:cli": "yarn workspace @set-app/cli publish --access public",
"release": "turbo test-coverage build",
"release": "turbo build",
"pre-commit": "turbo test lint check-format typecheck",
"ci": "turbo test test-coverage lint check-format typecheck",
"ci": "turbo test test-coverage lint check-format typecheck test-integration-ci",
"postinstall": "husky install",
"check-format": "prettier --check ."
},
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/.env.development
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
EXAMPLE_REACT="../../examples/react"
EXAMPLE_REACT="../../../examples/react"
EXAMPLE_REACT-REDUX="../../../examples/react-redux"
CI_TEST_REACT="../../../react"
CI_TEST_REACT-REDUX="../../../react-redux"
NODE_ENV="development"
2 changes: 2 additions & 0 deletions packages/cli/.env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
EXAMPLE_REACT="examples/react"
EXAMPLE_REACT-REDUX="examples/react-redux"
CI_TEST_REACT="../../../react"
CI_TEST_REACT-REDUX="../../../react-redux"
4 changes: 3 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
"copy:env": "cpy .env.production dist --rename=.env",
"bundle": "rimraf dist && tsc",
"build": "yarn bundle && yarn copy:examples-src && yarn copy:tests && yarn copy:config && yarn copy:examples-src-redux && yarn copy:tests-redux && yarn copy:config-redux && yarn copy:env && yarn copy:readme",
"start": "NODE_ENV=development ts-node ./src/index.ts",
"format": "prettier --write \"src/**/*.ts\"",
"check-format": "prettier --check \"src/**/*.ts\"",
"lint": "eslint \"src/**/*.ts\" --quiet",
"typecheck": "tsc --noEmit",
"test": "vitest --run --reporter=verbose",
"test-integration-ci": "IS_INTEGRATION=true vitest --run --reporter=verbose",
"test-integration": "yarn build && IS_INTEGRATION=true vitest --run --reporter=verbose",
"test-coverage": "vitest run --coverage"
},
"keywords": [
Expand Down Expand Up @@ -57,6 +58,7 @@
"eslint": "8.33.0",
"eslint-config-prettier": "8.6.0",
"eslint-plugin-unused-imports": "1.1.5",
"folder-hash": "^4.0.4",
"prettier": "2.8.3",
"rimraf": "4.1.2",
"ts-node": "10.8.0",
Expand Down
14 changes: 8 additions & 6 deletions packages/cli/src/__test__/create-project-structure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ vi.mock("../interface/messages.js");

describe("testing project structure", () => {
const folder = "TEST";
const github = false;
const description = "Random";

test("should throw an exception when the project already exists", () => {
test("should throw an exception when the project already exists", async () => {
vi.mocked(fs.existsSync).mockReturnValueOnce(true);
expect(() => createProjectStructure(folder)).toThrowError(
createProjectErrorMessage(folder)
);
await expect(
createProjectStructure(folder, github, description)
).rejects.toThrowError(createProjectErrorMessage(folder));
});

test("should create folders and print message if is a new project", () => {
test("should create folders and print message if is a new project", async () => {
vi.mocked(fs.existsSync).mockReturnValueOnce(false);
const spyMkdir = vi.spyOn(fs, "mkdirSync");
const spyMessage = vi.spyOn(message, "getSuccessMessage");
createProjectStructure(folder);
await createProjectStructure(folder, github, description);
expect(spyMkdir).toHaveBeenCalledTimes(2);
expect(spyMessage).toHaveBeenCalledTimes(2);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Vitest Snapshot v1

exports[`SetApp cli tool > when specify --help then show help and exit 1`] = `
"Usage: cli [options] <name>
Create and setup node projects
Arguments:
name project name
Options:
-t, --type <value> Type of node project (choices: \\"react\\", \\"react-redux\\",
\\"console\\", default: \\"react\\")
--desc <value> Add a description to your new project
--no-github Not generate github public repository
-V, --version output the version number
-h, --help display help for command
"
`;
exports[`SetApp cli tool > when specify -h then show help and exit 1`] = `
"Usage: cli [options] <name>
Create and setup node projects
Arguments:
name project name
Options:
-t, --type <value> Type of node project (choices: \\"react\\", \\"react-redux\\",
\\"console\\", default: \\"react\\")
--desc <value> Add a description to your new project
--no-github Not generate github public repository
-V, --version output the version number
-h, --help display help for command
"
`;
Loading

0 comments on commit 24833e9

Please sign in to comment.