create-packer 1.8.0 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +1 -1
- package/package.json +1 -1
- package/template/nest/.eslintrc.js +24 -24
- package/template/nest/.husky/pre-commit +4 -0
- package/template/nest/.prettierrc +5 -3
- package/template/nest/package.json +71 -68
- package/template/nest/src/app.controller.spec.ts +17 -17
- package/template/nest/src/app.controller.ts +7 -7
- package/template/nest/src/app.module.ts +6 -6
- package/template/nest/src/app.service.ts +4 -4
- package/template/nest/src/main.ts +7 -7
- package/template/nest/src/utils/transform.interceptor.ts +16 -4
- package/template/nest/test/app.e2e-spec.ts +19 -19
- package/template/react-cra/.husky/pre-commit +4 -0
- package/template/react-cra/package.json +4 -12
package/bin/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
const createTemp_1 = require("./clis/createTemp");
|
|
5
5
|
const commander_1 = require("commander");
|
|
6
6
|
commander_1.program
|
|
7
|
-
.option('-c, --create
|
|
7
|
+
.option('-c, --create [dirname]', 'Create project.', (dirname = '') => {
|
|
8
8
|
return createTemp_1.createTemp(dirname);
|
|
9
9
|
})
|
|
10
10
|
.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
2
|
+
parser: '@typescript-eslint/parser',
|
|
3
|
+
parserOptions: {
|
|
4
|
+
project: 'tsconfig.json',
|
|
5
|
+
tsconfigRootDir: __dirname,
|
|
6
|
+
sourceType: 'module',
|
|
7
|
+
},
|
|
8
|
+
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
9
|
+
extends: [
|
|
10
|
+
'plugin:@typescript-eslint/recommended',
|
|
11
|
+
'plugin:prettier/recommended',
|
|
12
|
+
],
|
|
13
|
+
root: true,
|
|
14
|
+
env: {
|
|
15
|
+
node: true,
|
|
16
|
+
jest: true,
|
|
17
|
+
},
|
|
18
|
+
ignorePatterns: ['.eslintrc.js'],
|
|
19
|
+
rules: {
|
|
20
|
+
'@typescript-eslint/interface-name-prefix': 'off',
|
|
21
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
22
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
23
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
24
|
+
},
|
|
25
|
+
}
|
|
@@ -1,71 +1,74 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"@nestjs/common": "9.0.0",
|
|
25
|
-
"@nestjs/core": "9.0.0",
|
|
26
|
-
"@nestjs/platform-express": "9.0.0",
|
|
27
|
-
"reflect-metadata": "0.1.13",
|
|
28
|
-
"rimraf": "3.0.2",
|
|
29
|
-
"rxjs": "7.2.0"
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@nestjs/cli": "9.0.0",
|
|
33
|
-
"@nestjs/schematics": "9.0.0",
|
|
34
|
-
"@nestjs/testing": "9.0.0",
|
|
35
|
-
"@types/express": "4.17.13",
|
|
36
|
-
"@types/jest": "28.1.4",
|
|
37
|
-
"@types/node": "16.0.0",
|
|
38
|
-
"@types/supertest": "2.0.11",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "5.0.0",
|
|
40
|
-
"@typescript-eslint/parser": "5.0.0",
|
|
41
|
-
"eslint": "8.0.1",
|
|
42
|
-
"eslint-config-prettier": "8.3.0",
|
|
43
|
-
"eslint-plugin-prettier": "4.0.0",
|
|
44
|
-
"jest": "28.1.2",
|
|
45
|
-
"prettier": "2.3.2",
|
|
46
|
-
"source-map-support": "0.5.20",
|
|
47
|
-
"supertest": "6.1.3",
|
|
48
|
-
"ts-jest": "28.0.5",
|
|
49
|
-
"ts-loader": "9.2.3",
|
|
50
|
-
"ts-node": "10.0.0",
|
|
51
|
-
"tsconfig-paths": "4.0.0",
|
|
52
|
-
"typescript": "4.3.5"
|
|
53
|
-
},
|
|
54
|
-
"jest": {
|
|
55
|
-
"moduleFileExtensions": [
|
|
56
|
-
"js",
|
|
57
|
-
"json",
|
|
58
|
-
"ts"
|
|
59
|
-
],
|
|
60
|
-
"rootDir": "src",
|
|
61
|
-
"testRegex": ".*\\.spec\\.ts$",
|
|
62
|
-
"transform": {
|
|
63
|
-
"^.+\\.(t|j)s$": "ts-jest"
|
|
2
|
+
"name": "nest-temp",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"author": "",
|
|
6
|
+
"private": true,
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"prepare": "husky install",
|
|
10
|
+
"prebuild": "rimraf dist",
|
|
11
|
+
"build": "nest build",
|
|
12
|
+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
13
|
+
"start": "nest start",
|
|
14
|
+
"start:dev": "nest start --watch",
|
|
15
|
+
"start:debug": "nest start --debug --watch",
|
|
16
|
+
"start:prod": "node dist/main",
|
|
17
|
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
|
|
18
|
+
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
19
|
+
"test": "jest",
|
|
20
|
+
"test:watch": "jest --watch",
|
|
21
|
+
"test:cov": "jest --coverage",
|
|
22
|
+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
|
23
|
+
"test:e2e": "jest --config test/jest-e2e.json"
|
|
64
24
|
},
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@nestjs/common": "9.0.0",
|
|
27
|
+
"@nestjs/core": "9.0.0",
|
|
28
|
+
"@nestjs/platform-express": "9.0.0",
|
|
29
|
+
"reflect-metadata": "0.1.13",
|
|
30
|
+
"rimraf": "3.0.2",
|
|
31
|
+
"rxjs": "7.2.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@nestjs/cli": "9.0.0",
|
|
35
|
+
"@nestjs/schematics": "9.0.0",
|
|
36
|
+
"@nestjs/testing": "9.0.0",
|
|
37
|
+
"@types/express": "4.17.13",
|
|
38
|
+
"@types/jest": "28.1.4",
|
|
39
|
+
"@types/node": "16.0.0",
|
|
40
|
+
"@types/supertest": "2.0.11",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "5.0.0",
|
|
42
|
+
"@typescript-eslint/parser": "5.0.0",
|
|
43
|
+
"eslint": "8.0.1",
|
|
44
|
+
"eslint-config-prettier": "8.3.0",
|
|
45
|
+
"eslint-plugin-prettier": "4.0.0",
|
|
46
|
+
"husky": "8.0.1",
|
|
47
|
+
"jest": "28.1.2",
|
|
48
|
+
"prettier": "2.3.2",
|
|
49
|
+
"source-map-support": "0.5.20",
|
|
50
|
+
"supertest": "6.1.3",
|
|
51
|
+
"ts-jest": "28.0.5",
|
|
52
|
+
"ts-loader": "9.2.3",
|
|
53
|
+
"ts-node": "10.0.0",
|
|
54
|
+
"tsconfig-paths": "4.0.0",
|
|
55
|
+
"typescript": "4.3.5"
|
|
56
|
+
},
|
|
57
|
+
"jest": {
|
|
58
|
+
"moduleFileExtensions": [
|
|
59
|
+
"js",
|
|
60
|
+
"json",
|
|
61
|
+
"ts"
|
|
62
|
+
],
|
|
63
|
+
"rootDir": "src",
|
|
64
|
+
"testRegex": ".*\\.spec\\.ts$",
|
|
65
|
+
"transform": {
|
|
66
|
+
"^.+\\.(t|j)s$": "ts-jest"
|
|
67
|
+
},
|
|
68
|
+
"collectCoverageFrom": [
|
|
69
|
+
"**/*.(t|j)s"
|
|
70
|
+
],
|
|
71
|
+
"coverageDirectory": "../coverage",
|
|
72
|
+
"testEnvironment": "node"
|
|
73
|
+
}
|
|
71
74
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Test, TestingModule } from '@nestjs/testing'
|
|
2
|
-
import { AppController } from './app.controller'
|
|
3
|
-
import { AppService } from './app.service'
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing'
|
|
2
|
+
import { AppController } from './app.controller'
|
|
3
|
+
import { AppService } from './app.service'
|
|
4
4
|
|
|
5
5
|
describe('AppController', () => {
|
|
6
|
-
|
|
6
|
+
let appController: AppController
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
const app: TestingModule = await Test.createTestingModule({
|
|
10
|
+
controllers: [AppController],
|
|
11
|
+
providers: [AppService],
|
|
12
|
+
}).compile()
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
appController = app.get<AppController>(AppController)
|
|
15
|
+
})
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
17
|
+
describe('root', () => {
|
|
18
|
+
it('should return "Hello World!"', () => {
|
|
19
|
+
expect(appController.getHello()).toBe('Hello World!')
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Controller, Get } from '@nestjs/common'
|
|
2
|
-
import { AppService } from './app.service'
|
|
1
|
+
import { Controller, Get } from '@nestjs/common'
|
|
2
|
+
import { AppService } from './app.service'
|
|
3
3
|
|
|
4
4
|
@Controller()
|
|
5
5
|
export class AppController {
|
|
6
|
-
|
|
6
|
+
constructor(private readonly appService: AppService) {}
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
@Get()
|
|
9
|
+
getHello(): string {
|
|
10
|
+
return this.appService.getHello()
|
|
11
|
+
}
|
|
12
12
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common'
|
|
2
|
-
import { AppController } from './app.controller'
|
|
3
|
-
import { AppService } from './app.service'
|
|
1
|
+
import { Module } from '@nestjs/common'
|
|
2
|
+
import { AppController } from './app.controller'
|
|
3
|
+
import { AppService } from './app.service'
|
|
4
4
|
|
|
5
5
|
@Module({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
imports: [],
|
|
7
|
+
controllers: [AppController],
|
|
8
|
+
providers: [AppService],
|
|
9
9
|
})
|
|
10
10
|
export class AppModule {}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { NestFactory } from '@nestjs/core'
|
|
2
|
-
import { AppModule } from './app.module'
|
|
3
|
-
import { TransformInterceptor } from 'src/utils/transform.interceptor'
|
|
1
|
+
import { NestFactory } from '@nestjs/core'
|
|
2
|
+
import { AppModule } from './app.module'
|
|
3
|
+
import { TransformInterceptor } from 'src/utils/transform.interceptor'
|
|
4
4
|
|
|
5
5
|
async function bootstrap() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const app = await NestFactory.create(AppModule)
|
|
7
|
+
app.useGlobalInterceptors(new TransformInterceptor())
|
|
8
|
+
await app.listen(3000)
|
|
9
9
|
}
|
|
10
|
-
bootstrap()
|
|
10
|
+
bootstrap()
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Injectable,
|
|
3
|
+
NestInterceptor,
|
|
4
|
+
ExecutionContext,
|
|
5
|
+
CallHandler,
|
|
6
|
+
} from '@nestjs/common'
|
|
2
7
|
import { Observable } from 'rxjs'
|
|
3
8
|
import { map } from 'rxjs/operators'
|
|
4
9
|
|
|
@@ -7,8 +12,15 @@ export interface Response<T> {
|
|
|
7
12
|
}
|
|
8
13
|
|
|
9
14
|
@Injectable()
|
|
10
|
-
export class TransformInterceptor<T>
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
export class TransformInterceptor<T>
|
|
16
|
+
implements NestInterceptor<T, Response<T>>
|
|
17
|
+
{
|
|
18
|
+
intercept(
|
|
19
|
+
context: ExecutionContext,
|
|
20
|
+
next: CallHandler,
|
|
21
|
+
): Observable<Response<T>> {
|
|
22
|
+
return next
|
|
23
|
+
.handle()
|
|
24
|
+
.pipe(map((data) => ({ code: 200, message: '', data })))
|
|
13
25
|
}
|
|
14
26
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { Test, TestingModule } from '@nestjs/testing'
|
|
2
|
-
import { INestApplication } from '@nestjs/common'
|
|
3
|
-
import * as request from 'supertest'
|
|
4
|
-
import { AppModule } from '../src/app.module'
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing'
|
|
2
|
+
import { INestApplication } from '@nestjs/common'
|
|
3
|
+
import * as request from 'supertest'
|
|
4
|
+
import { AppModule } from '../src/app.module'
|
|
5
5
|
|
|
6
6
|
describe('AppController (e2e)', () => {
|
|
7
|
-
|
|
7
|
+
let app: INestApplication
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
const moduleFixture: TestingModule = await Test.createTestingModule({
|
|
11
|
+
imports: [AppModule],
|
|
12
|
+
}).compile()
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
app = moduleFixture.createNestApplication()
|
|
15
|
+
await app.init()
|
|
16
|
+
})
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
18
|
+
it('/ (GET)', () => {
|
|
19
|
+
return request(app.getHttpServer())
|
|
20
|
+
.get('/')
|
|
21
|
+
.expect(200)
|
|
22
|
+
.expect('Hello World!')
|
|
23
|
+
})
|
|
24
|
+
})
|
|
@@ -21,22 +21,15 @@
|
|
|
21
21
|
"web-vitals": "2.1.4"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
+
"prepare": "husky install",
|
|
24
25
|
"start": "craco start",
|
|
25
26
|
"build": "craco build",
|
|
26
27
|
"analyze": "craco build --analyze",
|
|
27
28
|
"test": "craco test",
|
|
28
29
|
"eject": "react-scripts eject",
|
|
29
|
-
"format": "prettier --write \"src/**/*.{ts,js,tsx,jsx,css,scss,less}\" \"./package.json\""
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"hooks": {
|
|
33
|
-
"pre-commit": "npm run format && lint-staged && git add ."
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"lint-staged": {
|
|
37
|
-
"./src/**/*.{css,scss,less}": [
|
|
38
|
-
"stylelint"
|
|
39
|
-
]
|
|
30
|
+
"format": "prettier --write \"src/**/*.{ts,js,tsx,jsx,css,scss,less}\" \"./package.json\"",
|
|
31
|
+
"lint": "eslint ./src/**/*.{tsx,ts,js,jsx,vue} && stylelint ./src/**/*.{css,scss,less}",
|
|
32
|
+
"lint:fix": "eslint ./src/**/*.{tsx,ts,js,jsx,vue} --fix && stylelint ./src/**/*.{css,scss,less} --fix"
|
|
40
33
|
},
|
|
41
34
|
"eslintConfig": {
|
|
42
35
|
"extends": [
|
|
@@ -60,7 +53,6 @@
|
|
|
60
53
|
"@testing-library/dom": "8.14.0",
|
|
61
54
|
"@types/recoil": "0.0.9",
|
|
62
55
|
"husky": "8.0.1",
|
|
63
|
-
"lint-staged": "13.0.3",
|
|
64
56
|
"prettier": "2.7.1",
|
|
65
57
|
"stylelint": "14.9.1",
|
|
66
58
|
"stylelint-config-standard": "26.0.0",
|