Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/improvements #30

Merged
merged 4 commits into from
Jul 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ The following questions will be asked to the user:
- `Project version (0.1.0):` the initial version of the project, `0.1.0` as default.
- `Select your license [1...7]:`, the license you have chosen for the project.
- `License year (current year):`, the year where your license starts, current year as default.
- `Will this project be deployed with Heroku? [y/n]:`, yes or no question, only **y** or **n** is accepted. This is not case sensitive.
- `Will this project be deployed with Heroku? [y/n]`:, yes or no question, only y or n is accepted. This is not case sensitive.
- `Would you want to have a basic suit of tests with Jest? [y/n]`.
- ` [y/n]`.

## What is new?

Expand Down Expand Up @@ -110,6 +112,17 @@ Here is the list of the packages that are being installed, as `devDependencies`:
- [`webpack-cli`](https://www.npmjs.com/package/webpack-cli)
- [`webpack-node-externals`](https://www.npmjs.com/package/webpack-node-externals)

### Yarn case:
- [`eslint-plugin-n`](https://www.npmjs.com/package/eslint-plugin-n)

### In case you chose to use the suit of case
- [`@jest/types`](https://www.npmjs.com/package/@jest/types)
- [`@types/jest`](https://www.npmjs.com/package/@types/jest)
- [`eslint-plugin-jest`](https://www.npmjs.com/package/eslint-plugin-jest)
- [`jest`](https://www.npmjs.com/package/jest)
- [`jest-unit`](https://www.npmjs.com/package/jest-unit)
- [`ts-jest`](https://www.npmjs.com/package/ts-jest)

Feel free to contribute to this project. Every contribution will be appreciated.

## Hey, this project use to contain a backend generator!
Expand Down
49 changes: 39 additions & 10 deletions example/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{
"env": {
"node": true
"node": true,
"jest": true
},
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "import", "prettier"],
"plugins": [
"@typescript-eslint",
"import",
"prettier",
"jest"
],
"extends": [
"standard",
"eslint:recommended",
Expand All @@ -15,7 +21,10 @@
"rules": {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-empty-interface": "off",
"arrow-parens": ["error", "as-needed"],
"arrow-parens": [
"error",
"as-needed"
],
"import/extensions": [
2,
{
Expand All @@ -27,9 +36,17 @@
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": ["**/*.test.js", "webpack.config.js"],
"optionalDependencies": ["**/*.test.js"],
"peerDependencies": ["**/*.test.js"]
"devDependencies": [
"**/*.test.js",
"webpack.config.js",
"jest.config.ts"
],
"optionalDependencies": [
"**/*.test.js"
],
"peerDependencies": [
"**/*.test.js"
]
}
],
"max-len": [
Expand All @@ -45,8 +62,14 @@
}
],
"newline-before-return": "error",
"object-curly-spacing": ["error", "always"],
"object-shorthand": ["error", "always"],
"object-curly-spacing": [
"error",
"always"
],
"object-shorthand": [
"error",
"always"
],
"prefer-const": "error",
"prettier/prettier": [
"error",
Expand All @@ -61,7 +84,13 @@
"trailingComma": "none"
}
],
"radix": ["error", "as-needed"],
"spaced-comment": ["error", "always"]
"radix": [
"error",
"as-needed"
],
"spaced-comment": [
"error",
"always"
]
}
}
28 changes: 28 additions & 0 deletions example/.github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Tests - test

on: [push]

jobs:
test:
name: Testing test
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install Node.js dependencies
run: yarn install --frozen-lockfile

- name: Revert changes into the yarn.lock file
run: git checkout -- yarn.lock

- name: Run test
run: yarn test
2 changes: 2 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,5 @@ dist
# .pnp.*

# End of https://www.toptal.com/developers/gitignore/api/node,yarn

test/setEnvVars.ts
18 changes: 18 additions & 0 deletions example/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Config } from '@jest/types'

const config: Config.InitialOptions = {
verbose: true,
preset: 'ts-jest',
testEnvironment: 'node',
testTimeout: 1 * 60 * 1000,
globalSetup: './test/jestGlobalSetup.ts',
modulePaths: ['<rootDir>/src', '<rootDir>/node_modules'],
roots: ['.'],
moduleFileExtensions: ['js', 'json', 'ts'],
testRegex: '.test.ts$',
transform: {
'^.+\\.(t|j)s$': 'ts-jest'
}
}

export default config
42 changes: 25 additions & 17 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,40 @@
"lint": "eslint src/* --ext .ts",
"service": "nodemon",
"start": "node dist/index.js",
"release": "standard-version"
"release": "standard-version",
"test": "jest"
},
"author": "AnthonyLzq <[email protected]>",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"@types/node": "^17.0.21",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"dotenv": "^16.0.0",
"eslint": "^8.10.0",
"@jest/types": "^28.1.1",
"@types/jest": "^28.1.4",
"@types/node": "^18.0.3",
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"dotenv": "^16.0.1",
"eslint": "^8.19.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.25.4",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.5.3",
"eslint-plugin-n": "^15.2.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.0.0",
"nodemon": "^2.0.15",
"prettier": "^2.5.1",
"ts-loader": "^9.2.7",
"ts-node": "^10.7.0",
"tsconfig-paths": "^3.13.0",
"jest": "^28.1.2",
"jest-unit": "^0.0.1",
"nodemon": "^2.0.19",
"prettier": "^2.7.1",
"ts-jest": "^28.0.5",
"ts-loader": "^9.3.1",
"ts-node": "^10.8.2",
"tsconfig-paths": "^4.0.0",
"tsconfig-paths-webpack-plugin": "^3.5.2",
"typescript": "^4.6.2",
"webpack": "^5.70.0",
"webpack-cli": "^4.9.2",
"typescript": "^4.7.4",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0",
"webpack-node-externals": "^3.0.0"
}
}
5 changes: 5 additions & 0 deletions example/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('test tests', () => {
test('1 + 1 = 2', () => {
expect(1 + 1).toBe(2)
})
})
3 changes: 3 additions & 0 deletions example/test/jestGlobalSetup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = () => {
if (process.env.NODE_ENV === 'local') require('./setEnvVars')
}
Loading