Skip to content

Commit 3f86b8a

Browse files
authored
Merge pull request #39 from koonfoon/develop
Develop +semver: patch
2 parents dccdc71 + 1cdbbf9 commit 3f86b8a

File tree

6 files changed

+127
-4
lines changed

6 files changed

+127
-4
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# This action is to check if the PR title contain "+semver: major | minor | patch | skip"
2+
3+
name: 'Commit Message Check'
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- 'master'
9+
types:
10+
- opened
11+
- edited
12+
- reopened
13+
- synchronize
14+
15+
jobs:
16+
check-pr-title:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Display PR title
20+
run: echo The Title of your PR is ${{ github.event.pull_request.title }}
21+
22+
- name: Check PR title
23+
uses: Slashgear/[email protected]
24+
with:
25+
regexp: \+semver:\s?(major|minor|patch|skip)
26+
helpMessage: "PR title must contain '+semver: major | minor | patch | skip'"

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
# generator-vscode-typescript-jest [![NPM version][npm-image]][npm-url][![coverage](https://github.com/koonfoon/generator-vscode-typescript-jest/actions/workflows/node-jest-test.yml/badge.svg)](https://github.com/koonfoon/generator-vscode-typescript-jest/actions/workflows/node-jest-test.yml)
1+
# generator-vscode-typescript-jest [![npm version](https://badge.fury.io/js/generator-vscode-typescript-jest.svg)](https://badge.fury.io/js/generator-vscode-typescript-jest)[![coverage](https://github.com/koonfoon/generator-vscode-typescript-jest/actions/workflows/node-jest-test.yml/badge.svg)](https://github.com/koonfoon/generator-vscode-typescript-jest/actions/workflows/node-jest-test.yml)
22

33
## Description
44

55
vscode with typescript and jest project generator. This package generate the project skeleton for visual studio code that use [typescript](https://www.typescriptlang.org/) as source code, and [jest](https://jestjs.io/) for unit test, [eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) for linting and [prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) for prettier codes. This generator also compose with [generator-license](https://github.com/jozefizso/generator-license).
66

7+
For those who only need to setup eslint and prettier. Use the sub generator. (See instruction below)
8+
79
This generator will also setup [tsup](https://github.com/egoist/tsup), a tool for bundling codes into commonjs and esm at the same time.
810

911
## Installation
@@ -21,6 +23,15 @@ Then generate your new project:
2123
yo vscode-typescript-jest
2224
```
2325

26+
### Sub generator
27+
28+
```bash
29+
yo vscode-typescript-jest:eslint-prettier
30+
```
31+
32+
> **Note**
33+
> When using sub generator. If package.json already exist in the project, a warning message will be display. Giving you an warning that package.json is about to be overwritten, and asking user permission to proceed. But in reality, it does not overwrite the WHOLE package.json file, just inserting the dev dependencies for eslint and prettier. User can enter "d" option to see what will be inserted to the package.json before enter "y" option.
34+
2435
> **Note**
2536
> You should run `npx npm-check-updates` check and update the dependencies, as newer version may had released since the publication of this generator.
2637
@@ -66,6 +77,3 @@ yo vscode-typescript-jest
6677
## License
6778

6879
MIT © [koonfoon]()
69-
70-
[npm-image]: https://badge.fury.io/js/generator-vscode-typescript-jest.svg
71-
[npm-url]: https://npmjs.org/package/generator-vscode-typescript-jest

__tests__/eslint-prettier.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"use strict";
2+
const path = require("path");
3+
const assert = require("yeoman-assert");
4+
const helpers = require("yeoman-test");
5+
6+
describe("generator-vscode-typescript-jest:eslint-prettier", () => {
7+
beforeAll(() => {
8+
return helpers.run(path.join(__dirname, "../generators/eslint-prettier"));
9+
});
10+
11+
it("creates files", () => {
12+
assert.file([".eslintrc.json", ".prettierrc.json", "package.json"]);
13+
});
14+
});
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
"use strict";
2+
const Generator = require("yeoman-generator");
3+
const chalk = require("chalk");
4+
const yosay = require("yosay");
5+
6+
module.exports = class extends Generator {
7+
prompting() {
8+
// Have Yeoman greet the user.
9+
this.log(
10+
yosay(
11+
`Welcome to the lovely ${chalk.red(
12+
"generator-vscode-typescript-jest"
13+
)} generator!`
14+
)
15+
);
16+
17+
const prompts = [];
18+
19+
return this.prompt(prompts).then(props => {
20+
// To access props later use this.props.someAnswer;
21+
this.props = props;
22+
});
23+
}
24+
25+
writing() {
26+
this.fs.copy(
27+
this.templatePath(".eslintrc.temp.json"),
28+
this.destinationPath(".eslintrc.json")
29+
);
30+
this.fs.copy(
31+
this.templatePath(".prettierrc.temp.json"),
32+
this.destinationPath(".prettierrc.json")
33+
);
34+
35+
const pkgJson = {
36+
devDependencies: {
37+
"@typescript-eslint/eslint-plugin": "^5.38.0",
38+
"@typescript-eslint/parser": "^5.38.0",
39+
eslint: "^8.23.1",
40+
"eslint-config-prettier": "^8.5.0",
41+
"eslint-plugin-prettier": "^4.2.1",
42+
prettier: "^2.7.1"
43+
}
44+
};
45+
46+
this.fs.extendJSON(this.destinationPath("package.json"), pkgJson);
47+
}
48+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"env": {
3+
"commonjs": true,
4+
"es2021": true,
5+
"node": true
6+
},
7+
"extends": [
8+
//"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended",
10+
"prettier/@typescript-eslint",
11+
"plugin:prettier/recommended"
12+
],
13+
"parser": "@typescript-eslint/parser",
14+
"parserOptions": {
15+
"ecmaVersion": 12,
16+
"sourceType": "module"
17+
},
18+
"rules": {}
19+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "all",
4+
"singleQuote": true,
5+
"printWidth": 120,
6+
"tabWidth": 4,
7+
"endOfLine": "auto"
8+
}

0 commit comments

Comments
 (0)