Skip to content

Commit 5b544f1

Browse files
committed
build(): unnest dist scripts from src folder via multi tsconfig setup
1 parent c66b32d commit 5b544f1

File tree

5 files changed

+65
-53
lines changed

5 files changed

+65
-53
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ coverage
1010
output*/
1111
ref*/
1212
dist/
13+
tsconfig.tsbuildinfo

package.json

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"version": "5.0.0-beta.3",
44
"description": "Angular REST API client generator from Swagger YAML or JSON file with camel case settings",
55
"homepage": "https://github.com/flowup/api-client-generator/blob/master/README.md",
6-
"main": "./dist/src/main.js",
6+
"main": "./dist/main.js",
77
"author": {
88
"name": "FlowUp",
99
"email": "[email protected]",
1010
"url": "https://flowup.cz"
1111
},
1212
"bin": {
13-
"api-client-generator": "./dist/src/main.js"
13+
"api-client-generator": "./dist/main.js"
1414
},
1515
"bugs": {
1616
"url": "https://github.com/flowup/api-client-generator/issues"
@@ -51,23 +51,24 @@
5151
"license": "MIT",
5252
"scripts": {
5353
"generate": "node ./dist/main.js",
54-
"build": "npm run lint && rimraf dist && tsc",
55-
"lint": "tslint -p tsconfig.json -c tslint.json src/**/*.ts",
54+
"build": "npm run lint && rimraf dist && tsc --build src",
55+
"lint": "tslint -p src/tsconfig.json -c tslint.json src/**/*.ts",
5656
"gen": "ts-node --files ./src/main.ts",
5757
"gen:all": "npm run gen-custom && npm run gen-custom-without-guards && npm run gen-esquare && npm run gen-gcloud-firestore && npm run gen-github && npm run gen-filtered-api && npm run gen-pet-store && npm run gen-with-all-tags",
5858
"gen:all:parallel": "concurrently --kill-others-on-fail \"npm:gen-*\"",
59-
"gen-custom": "rimraf ./tests/custom/api && ts-node --files ./src/main.ts -s ./tests/custom/swagger.yaml -o ./tests/custom/api",
60-
"gen-custom-without-guards": "rimraf ./tests/custom-without-guards/api && ts-node --files ./src/main.ts -s ./tests/custom/swagger.yaml -o ./tests/custom-without-guards/api -g",
61-
"gen-esquare": "rimraf ./tests/esquare/api && ts-node --files ./src/main.ts -s ./tests/esquare/swagger.yaml -o ./tests/esquare/api",
62-
"gen-gcloud-firestore": "rimraf ./tests/gcloud-firestore/api && ts-node --files ./src/main.ts -s ./tests/gcloud-firestore/swagger.yaml -o ./tests/gcloud-firestore/api",
63-
"gen-github": "rimraf ./tests/github/api && ts-node --files ./src/main.ts -s ./tests/github/swagger.yaml -o ./tests/github/api -t all",
64-
"gen-filtered-api": "rimraf ./tests/filtered-api/api && ts-node --files ./src/main.ts -s ./tests/filtered-api/swagger.json -o ./tests/filtered-api/api -t DummySelector,Project,NonExistingTag -m",
65-
"gen-pet-store": "rimraf ./tests/pet-store/api && ts-node --files ./src/main.ts --verbose -s ./tests/pet-store/swagger.yaml -o ./tests/pet-store/api",
66-
"gen-with-all-tags": "rimraf ./tests/with-all-tags/api && ts-node --files ./src/main.ts -s ./tests/with-all-tags/swagger.json -o ./tests/with-all-tags/api -t all",
59+
"gen-custom": "rimraf ./tests/custom/api && npm run gen -- -s ./tests/custom/swagger.yaml -o ./tests/custom/api",
60+
"gen-custom-without-guards": "rimraf ./tests/custom-without-guards/api && npm run gen -- -s ./tests/custom/swagger.yaml -o ./tests/custom-without-guards/api -g",
61+
"gen-esquare": "rimraf ./tests/esquare/api && npm run gen -- -s ./tests/esquare/swagger.yaml -o ./tests/esquare/api",
62+
"gen-gcloud-firestore": "rimraf ./tests/gcloud-firestore/api && npm run gen -- -s ./tests/gcloud-firestore/swagger.yaml -o ./tests/gcloud-firestore/api",
63+
"gen-github": "rimraf ./tests/github/api && npm run gen -- -s ./tests/github/swagger.yaml -o ./tests/github/api -t all",
64+
"gen-filtered-api": "rimraf ./tests/filtered-api/api && npm run gen -- -s ./tests/filtered-api/swagger.json -o ./tests/filtered-api/api -t DummySelector,Project,NonExistingTag -m",
65+
"gen-pet-store": "rimraf ./tests/pet-store/api && npm run gen -- --verbose -s ./tests/pet-store/swagger.yaml -o ./tests/pet-store/api",
66+
"gen-with-all-tags": "rimraf ./tests/with-all-tags/api && npm run gen -- -s ./tests/with-all-tags/swagger.json -o ./tests/with-all-tags/api -t all",
6767
"release": "npm run tests && npm run build && standard-version --tag-prefix=''",
6868
"test": "jest",
69-
"intg-tests:gen-all-tags": "rimraf tests/test-angular-project/src/api-all-tags && npm run gen -- src/main.ts -s tests/test-angular-project/swagger.yaml -o tests/test-angular-project/src/api-all-tags -t all",
70-
"intg-tests:gen-no-tag": "rimraf tests/test-angular-project/src/api-no-tags && npm run gen -- src/main.ts -s tests/test-angular-project/swagger.yaml -o tests/test-angular-project/src/api-no-tags",
69+
"test--showConfig ": "jest --showConfig ",
70+
"intg-tests:gen-all-tags": "rimraf tests/test-angular-project/src/api-all-tags && npm run gen -- -s tests/test-angular-project/swagger.yaml -o tests/test-angular-project/src/api-all-tags -t all",
71+
"intg-tests:gen-no-tag": "rimraf tests/test-angular-project/src/api-no-tags && npm run gen -- -s tests/test-angular-project/swagger.yaml -o tests/test-angular-project/src/api-no-tags",
7172
"intg-tests:clear-gen": "rimraf tests/test-angular-project/src/api-no-tags && rimraf tests/test-angular-project/src/api-all-tags",
7273
"intg-tests:run-tests": "cd tests/test-angular-project && npm run test",
7374
"intg-tests:run-build": "cd tests/test-angular-project && npm run build",
@@ -119,7 +120,8 @@
119120
"jest": {
120121
"preset": "jest-preset-typescript",
121122
"setupFilesAfterEnv": [
122-
"<rootDir>/setupJest.ts"
123+
"<rootDir>/setupJest.ts",
124+
"<rootDir>/src/typings.d.ts"
123125
],
124126
"testRegex": "^\\/src\\/.*|\\.tests?\\.ts$",
125127
"modulePaths": [

src/tsconfig.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"compilerOptions": {
3+
"moduleResolution": "node",
4+
"target": "es2020",
5+
"module": "commonjs",
6+
"lib": [
7+
"es2015",
8+
"es2016",
9+
"es2017",
10+
"es2018",
11+
"es2019",
12+
"es2020",
13+
"ESNext",
14+
"dom"
15+
],
16+
"noLib": false,
17+
"removeComments": true,
18+
"strict": true,
19+
"sourceMap": true,
20+
"allowSyntheticDefaultImports": true,
21+
"experimentalDecorators": true,
22+
"noImplicitAny": true,
23+
"emitDecoratorMetadata": true,
24+
"noUnusedLocals": true,
25+
"noUnusedParameters": true,
26+
"noImplicitReturns": true,
27+
"noFallthroughCasesInSwitch": true,
28+
"typeRoots": ["../node_modules/@types", "typings.d.ts"],
29+
30+
"rootDir": ".",
31+
"outDir": "../dist/",
32+
"resolveJsonModule": true
33+
},
34+
"references": [
35+
{ "path": "../" } // this is how we declare a dependency from this project to the one at the root dir`
36+
],
37+
"exclude": ["**/*.tests.ts"]
38+
}

tsconfig.json

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,14 @@
11
{
2+
"extends": "./src/tsconfig.json",
23
"compilerOptions": {
3-
"moduleResolution": "node",
4+
"typeRoots": ["node_modules/@types", "./src/typings.d.ts"],
5+
"rootDir": ".",
6+
"outDir": ".", // if out path for a file is same as its src path, nothing will be emitted
47
"resolveJsonModule": true,
5-
"target": "es2020",
6-
"module": "commonjs",
7-
"lib": [
8-
"es2015",
9-
"es2016",
10-
"es2017",
11-
"es2018",
12-
"es2019",
13-
"es2020",
14-
"ESNext",
15-
"dom"
16-
],
17-
"noLib": false,
18-
"removeComments": true,
19-
"strict": true,
20-
"sourceMap": true,
21-
"declaration": false,
22-
"allowSyntheticDefaultImports": true,
23-
"experimentalDecorators": true,
24-
"noImplicitAny": true,
25-
"emitDecoratorMetadata": true,
26-
"noUnusedLocals": true,
27-
"noUnusedParameters": true,
28-
"noImplicitReturns": true,
29-
"noFallthroughCasesInSwitch": true,
30-
"outDir": "dist",
31-
"typeRoots": ["node_modules/@types", "src/typings.d.ts"]
8+
"composite": true // required on the dependency project for references to work
329
},
33-
"include": ["src/**/*"],
34-
"exclude": ["src/**/*.tests.ts"]
10+
"include": ["./src/typings.d.ts"],
11+
"files": [
12+
"package.json" // by whitelisting the files to include, TS won't automatically include all source below root, which is the default.
13+
]
3514
}

tsconfig.tests.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)