Skip to content

Commit

Permalink
Improve IDE quality of life using tsconfig paths (#574)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcready authored Jul 31, 2023
1 parent d33eac7 commit ee3ff2d
Show file tree
Hide file tree
Showing 41 changed files with 163 additions and 52 deletions.
35 changes: 34 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"name": "root",
"private": true,
"devDependencies": {
"lerna": "^3.22.1"
"@types/jasmine": "^3.5.10",
"lerna": "^3.22.1",
"typescript": ">=3.8.3 <4"
},
"license": "(Apache-2.0 AND BSD-3-Clause)"
}
4 changes: 2 additions & 2 deletions packages/grpc-backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ SPECS := $(shell find spec -name '*.spec.ts')
default: clean build test

build:
@./node_modules/.bin/tsc --project tsconfig.json --module es2015 --outDir build/es2015;
@./node_modules/.bin/tsc --project tsconfig.build.json --module es2015 --outDir build/es2015;
@echo "es6 done"
@./node_modules/.bin/tsc --project tsconfig.json --module commonjs --outDir build/commonjs \
@./node_modules/.bin/tsc --project tsconfig.build.json --module commonjs --outDir build/commonjs \
--declaration --declarationDir build/types;
@echo "cjs done"

Expand Down
6 changes: 6 additions & 0 deletions packages/grpc-backend/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {},
}
}
3 changes: 3 additions & 0 deletions packages/grpc-backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"skipLibCheck": false,
"paths": {
"@protobuf-ts/*": ["../*/src"]
},
"lib": [
"es2017",
"dom"
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-backend/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"compilerOptions": {
"module": "CommonJS",
"declaration": false,
"paths": {}
"sourceMap": true
}
}
4 changes: 2 additions & 2 deletions packages/grpc-transport/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ SPECS := $(shell find spec -name '*.spec.ts')
default: clean build test

build:
@./node_modules/.bin/tsc --project tsconfig.json --module es2015 --outDir build/es2015;
@./node_modules/.bin/tsc --project tsconfig.build.json --module es2015 --outDir build/es2015;
@echo "es6 done"
@./node_modules/.bin/tsc --project tsconfig.json --module commonjs --outDir build/commonjs \
@./node_modules/.bin/tsc --project tsconfig.build.json --module commonjs --outDir build/commonjs \
--declaration --declarationDir build/types;
@echo "cjs done"

Expand Down
6 changes: 6 additions & 0 deletions packages/grpc-transport/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {},
}
}
3 changes: 3 additions & 0 deletions packages/grpc-transport/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"skipLibCheck": false,
"paths": {
"@protobuf-ts/*": ["../*/src"]
},
"lib": [
"es2017",
"dom"
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-transport/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"compilerOptions": {
"module": "CommonJS",
"declaration": false,
"paths": {}
"sourceMap": true
}
}
4 changes: 2 additions & 2 deletions packages/grpcweb-transport/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ SPECS := $(shell find spec -name '*.spec.ts')
default: clean build test

build:
@./node_modules/.bin/tsc --project tsconfig.json --module es2015 --outDir build/es2015;
@./node_modules/.bin/tsc --project tsconfig.build.json --module es2015 --outDir build/es2015;
@echo "es6 done"
@./node_modules/.bin/tsc --project tsconfig.json --module commonjs --outDir build/commonjs \
@./node_modules/.bin/tsc --project tsconfig.build.json --module commonjs --outDir build/commonjs \
--declaration --declarationDir build/types;
@echo "cjs done"

Expand Down
5 changes: 5 additions & 0 deletions packages/grpcweb-transport/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ module.exports = function (config) {
browsers: ["ChromeHeadless"],
singleRun: true,
karmaTypescriptConfig: {
coverageOptions: {
exclude: [
/(^|\/)spec\//i,
]
},
tsconfig: './tsconfig.test.json'
},
client: {
Expand Down
6 changes: 6 additions & 0 deletions packages/grpcweb-transport/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {},
}
}
3 changes: 3 additions & 0 deletions packages/grpcweb-transport/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"skipLibCheck": false,
"paths": {
"@protobuf-ts/*": ["../*/src"]
},
"lib": [
"es2017",
"dom"
Expand Down
3 changes: 1 addition & 2 deletions packages/grpcweb-transport/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"compilerOptions": {
"sourceMap": true,
"module": "CommonJS",
"declaration": false,
"paths": {}
"declaration": false
}
}
4 changes: 2 additions & 2 deletions packages/plugin-framework/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ SPECS := $(shell find spec -name '*.spec.ts')
default: clean build test

build:
@./node_modules/.bin/tsc --project tsconfig.json --module es2015 --outDir build/es2015;
@./node_modules/.bin/tsc --project tsconfig.build.json --module es2015 --outDir build/es2015;
@echo "es6 done"
@./node_modules/.bin/tsc --project tsconfig.json --module commonjs --outDir build/commonjs \
@./node_modules/.bin/tsc --project tsconfig.build.json --module commonjs --outDir build/commonjs \
--declaration --declarationDir build/types;
@echo "cjs done"

Expand Down
6 changes: 6 additions & 0 deletions packages/plugin-framework/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {},
}
}
3 changes: 3 additions & 0 deletions packages/plugin-framework/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"skipLibCheck": false,
"paths": {
"@protobuf-ts/*": ["../*/src"]
},
"lib": [
"es2017",
"dom"
Expand Down
7 changes: 2 additions & 5 deletions packages/plugin-framework/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
"compilerOptions": {
"module": "CommonJS",
"declaration": false,
"paths": {
"@protobuf-ts/runtime": [
"../runtime"
]
}
"sourceMap": true,
"paths": {}
}
}
2 changes: 1 addition & 1 deletion packages/plugin/spec/protobufts-plugin-long.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {getCodeGeneratorRequest} from "./support/helpers";
import {ProtobuftsPlugin} from "../src/protobufts-plugin";
import {GeneratedFile} from "@protobuf-ts/plugin-framework/src";
import {GeneratedFile} from "@protobuf-ts/plugin-framework";

const stringSnippets = [
// Message
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"src/protobufts-plugin.ts",
"src/dump-plugin.ts"
],
"compilerOptions": {
"paths": {},
},
"include": [
"src/**/*.d.ts"
],
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": false,
"paths": {
"@protobuf-ts/*": ["../*/src"]
},
"lib": [
"es2017",
"dom"
Expand Down
8 changes: 4 additions & 4 deletions packages/plugin/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"spec/support/*.ts"
],
"compilerOptions": {
"skipLibCheck": true,
"sourceMap": true,
"outDir": "/tmp",
"paths": {
"@protobuf-ts/runtime": [
"../runtime"
]
}
"@protobuf-ts/*": ["../*/src"]
},
}
}
4 changes: 2 additions & 2 deletions packages/runtime-rpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ SPECS := $(shell find spec -name '*.spec.ts')
default: clean build test

build:
@./node_modules/.bin/tsc --project tsconfig.json --module es2015 --outDir build/es2015;
@./node_modules/.bin/tsc --project tsconfig.build.json --module es2015 --outDir build/es2015;
@echo "es6 done"
@./node_modules/.bin/tsc --project tsconfig.json --module commonjs --outDir build/commonjs \
@./node_modules/.bin/tsc --project tsconfig.build.json --module commonjs --outDir build/commonjs \
--declaration --declarationDir build/types;
@echo "cjs done"

Expand Down
5 changes: 5 additions & 0 deletions packages/runtime-rpc/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ module.exports = function (config) {
browsers: ["ChromeHeadless"],
singleRun: true,
karmaTypescriptConfig: {
coverageOptions: {
exclude: [
/(^|\/)spec\//i,
]
},
tsconfig: './tsconfig.test.json'
},
client: {
Expand Down
6 changes: 6 additions & 0 deletions packages/runtime-rpc/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {},
}
}
3 changes: 3 additions & 0 deletions packages/runtime-rpc/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
// svelte requires this option
"importsNotUsedAsValues": "error",

"paths": {
"@protobuf-ts/*": ["../*/src"]
},
"lib": [
"es2017",
"dom",
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-rpc/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"compilerOptions": {
"module": "CommonJS",
"declaration": false,
"paths": {}
"sourceMap": true
}
}
5 changes: 5 additions & 0 deletions packages/runtime/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ module.exports = function (config) {
browsers: ["ChromeHeadless"],
singleRun: true,
karmaTypescriptConfig: {
coverageOptions: {
exclude: [
/(^|\/)spec\//i,
]
},
tsconfig: './tsconfig.test.json'
},
client: {
Expand Down
6 changes: 2 additions & 4 deletions packages/runtime/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
],

"paths": {
"@protobuf-ts/runtime": [
"./src"
]
}
"@protobuf-ts/*": ["../*/src"]
},

}
}
1 change: 1 addition & 0 deletions packages/runtime/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
],
"include": [],
"compilerOptions": {
"paths": {},
}
}
1 change: 1 addition & 0 deletions packages/runtime/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"spec/**/*.ts"
],
"compilerOptions": {
"sourceMap": true,
"module": "CommonJS"
}
}
2 changes: 1 addition & 1 deletion packages/test-generated/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ clean:

test-spec:
@./node_modules/.bin/ts-node \
--project tsconfig.json \
--project tsconfig.test.json \
--require tsconfig-paths/register \
./node_modules/.bin/jasmine --helper="spec/support/reporter.ts" \
$(SPECS)
Expand Down
2 changes: 1 addition & 1 deletion packages/test-generated/tsconfig.bigint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./tsconfig.json",
"extends": "./tsconfig.test.json",
"compilerOptions": {

// compiler requires this target for bigint
Expand Down
Loading

0 comments on commit ee3ff2d

Please sign in to comment.