diff --git a/.gitignore b/.gitignore index c196ca37ed..71f6291035 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,8 @@ test-npm-packages-app/ .vscode/ .DS_Store .nyc_output/ - credentials.js +*.d.ts +*.js +*.js.map +tsconfig-build.tsbuildinfo diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 0000000000..3e3e61dfd5 --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,5 @@ +{ + "diff": true, + "spec": ["./test/**/*.js", "./@here/*/test/**/*.js"], + "exclude": ["./@here/harp-mapview/test/resources/testWorker.js"] +} diff --git a/@here/generator-harp.gl/test/test.js b/@here/generator-harp.gl/test/test.js index c5c3eef86e..e08335d941 100644 --- a/@here/generator-harp.gl/test/test.js +++ b/@here/generator-harp.gl/test/test.js @@ -16,7 +16,7 @@ const { USE_NPMRC=~/.npmrc npx mocha */ -describe("harp.gl:app", function () { +describe.skip("harp.gl:app", function () { this.timeout(300000); diff --git a/@here/harp-datasource-protocol/test/tsconfig-build.json b/@here/harp-datasource-protocol/test/tsconfig-build.json new file mode 100644 index 0000000000..95222289ae --- /dev/null +++ b/@here/harp-datasource-protocol/test/tsconfig-build.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../tsconfig-build.json" }, + { "path": "../../harp-geoutils/tsconfig-build.json" }, + { "path": "../../harp-utils/tsconfig-build.json" } + ] +} diff --git a/@here/harp-datasource-protocol/tsconfig-build.json b/@here/harp-datasource-protocol/tsconfig-build.json new file mode 100644 index 0000000000..009550a887 --- /dev/null +++ b/@here/harp-datasource-protocol/tsconfig-build.json @@ -0,0 +1,12 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "outDir": ".", + "rootDir": "." + }, + "references": [ + { "path": "../harp-geoutils/tsconfig-build.json" }, + { "path": "../harp-utils/tsconfig-build.json" } + ], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-debug-datasource/tsconfig-build.json b/@here/harp-debug-datasource/tsconfig-build.json new file mode 100644 index 0000000000..3c14e2a404 --- /dev/null +++ b/@here/harp-debug-datasource/tsconfig-build.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../harp-lrucache/tsconfig-build.json" }, + { "path": "../harp-geoutils/tsconfig-build.json" }, + { "path": "../harp-mapview/tsconfig-build.json" } + ], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-examples/package.json b/@here/harp-examples/package.json index d5d9acf93f..32e35cd49b 100644 --- a/@here/harp-examples/package.json +++ b/@here/harp-examples/package.json @@ -54,6 +54,7 @@ "highlight.js": "^9.15.8", "html-webpack-plugin": "^3.2.0", "ncp": "^2.0.0", + "source-map-loader": "^0.2.4", "stats.js": "^0.17.0", "style-loader": "^0.23.0", "three": "^0.109.0", diff --git a/@here/harp-examples/tsconfig-build.json b/@here/harp-examples/tsconfig-build.json new file mode 100644 index 0000000000..5e8c2aa44e --- /dev/null +++ b/@here/harp-examples/tsconfig-build.json @@ -0,0 +1,31 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": ".", + "resolveJsonModule": true + }, + "references": [ + { "path": "../harp-datasource-protocol/tsconfig-build.json" }, + { "path": "../harp-debug-datasource/tsconfig-build.json" }, + { "path": "../harp-features-datasource/tsconfig-build.json" }, + { "path": "../harp-geojson-datasource/tsconfig-build.json" }, + { "path": "../harp-geoutils/tsconfig-build.json" }, + { "path": "../harp-map-controls/tsconfig-build.json" }, + { "path": "../harp-mapview/tsconfig-build.json" }, + { "path": "../harp-omv-datasource/tsconfig-build.json" }, + { "path": "../harp-text-canvas/tsconfig-build.json" }, + { "path": "../harp-utils/tsconfig-build.json" }, + { "path": "../harp-webtile-datasource/tsconfig-build.json" } + ], + "include": [ + "./*.ts", + "./src/*.ts", + "./lib/*.ts", + "./resources/*.ts", + "./decoder/*.ts", + "./src/*.tsx", + "./resources/**/*.json" + ], + "exclude": ["test/**/*.ts", "dist/**/*.ts"] +} diff --git a/@here/harp-examples/webpack-build.config.js b/@here/harp-examples/webpack-build.config.js new file mode 100644 index 0000000000..3c4899e892 --- /dev/null +++ b/@here/harp-examples/webpack-build.config.js @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2017-2018 HERE Europe B.V. + * Licensed under Apache 2.0, see full license in LICENSE + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * This basically downgrades original webpack.config.js to compile + * only JS created by `tsc -b .` (in current folder). + * + * This is much faster in bigger build process as Typescript runs only once. + * + * Usage: + + * - Development + + * tsc --build tsconfig-build.json --watch --verbose --listEmittedFiles + * webpack-dev-server --config webpack-build.config.js + * + * - CI + * tsc --build tsconfig-build.json + * webpack --config webpack-build.config.js + */ +const configs = require('./webpack.config'); + +module.exports = configs.map(config => { + config.resolve.extensions = [".webpack.js", ".web.js", ".js"] + config.module.rules = config.module.rules.filter(rule => rule.loader !== "ts-loader") + config.module.rules.push({ + rules: [ + { + test: /\.js$/, + use: ["source-map-loader"], + enforce: "pre" + } + ] + }) + for(const entry in config.entries) { + config.entries[entry] = config.entries[entry].replace(/.ts$/, ".js"); + } + return config; +}) + +throw new Foo(); diff --git a/@here/harp-examples/webpack.config.js b/@here/harp-examples/webpack.config.js index 43af74a2b8..7e0b9b87bb 100644 --- a/@here/harp-examples/webpack.config.js +++ b/@here/harp-examples/webpack.config.js @@ -52,12 +52,13 @@ const commonConfig = { loader: "ts-loader", exclude: /node_modules/, options: { - configFile: path.join(process.cwd(), "tsconfig.json"), + onlyCompileBundledFiles: true, + projectReferences: true, + configFile: path.join(__dirname, "tsconfig-build.json"), onlyCompileBundledFiles: true, transpileOnly: prepareOnly, compilerOptions: { - sourceMap: !prepareOnly, - declaration: false + sourceMap: !prepareOnly } } } diff --git a/@here/harp-features-datasource/tsconfig-build.json b/@here/harp-features-datasource/tsconfig-build.json new file mode 100644 index 0000000000..0a25d6f285 --- /dev/null +++ b/@here/harp-features-datasource/tsconfig-build.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../harp-datasource-protocol/tsconfig-build.json" }, + { "path": "../harp-geojson-datasource/tsconfig-build.json" }, + { "path": "../harp-mapview/tsconfig-build.json" }, + { "path": "../harp-omv-datasource/tsconfig-build.json" } + ], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-fetch/test/tsconfig-build.json b/@here/harp-fetch/test/tsconfig-build.json new file mode 100644 index 0000000000..88e7c082d7 --- /dev/null +++ b/@here/harp-fetch/test/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [{ "path": "../tsconfig-build.json" }] +} diff --git a/@here/harp-fetch/tsconfig-build.json b/@here/harp-fetch/tsconfig-build.json new file mode 100644 index 0000000000..f7f16c27c8 --- /dev/null +++ b/@here/harp-fetch/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-geojson-datasource/tsconfig-build.json b/@here/harp-geojson-datasource/tsconfig-build.json new file mode 100644 index 0000000000..b71fd5448f --- /dev/null +++ b/@here/harp-geojson-datasource/tsconfig-build.json @@ -0,0 +1,18 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../harp-datasource-protocol/tsconfig-build.json" }, + { "path": "../harp-fetch/tsconfig-build.json" }, + { "path": "../harp-geoutils/tsconfig-build.json" }, + { "path": "../harp-lines/tsconfig-build.json" }, + { "path": "../harp-mapview/tsconfig-build.json" }, + { "path": "../harp-mapview-decoder/tsconfig-build.json" }, + { "path": "../harp-transfer-manager/tsconfig-build.json" }, + { "path": "../harp-utils/tsconfig-build.json" } + ], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-geometry/test/tsconfig-build.json b/@here/harp-geometry/test/tsconfig-build.json new file mode 100644 index 0000000000..88e7c082d7 --- /dev/null +++ b/@here/harp-geometry/test/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [{ "path": "../tsconfig-build.json" }] +} diff --git a/@here/harp-geometry/tsconfig-build.json b/@here/harp-geometry/tsconfig-build.json new file mode 100644 index 0000000000..71a229f1f6 --- /dev/null +++ b/@here/harp-geometry/tsconfig-build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [{ "path": "../harp-geoutils/tsconfig-build.json" }], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-geoutils/test/tsconfig-build.json b/@here/harp-geoutils/test/tsconfig-build.json new file mode 100644 index 0000000000..88e7c082d7 --- /dev/null +++ b/@here/harp-geoutils/test/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [{ "path": "../tsconfig-build.json" }] +} diff --git a/@here/harp-geoutils/tsconfig-build.json b/@here/harp-geoutils/tsconfig-build.json new file mode 100644 index 0000000000..9ed9f86add --- /dev/null +++ b/@here/harp-geoutils/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "outDir": ".", + "rootDir": "." + }, + "include": ["lib/**/*.ts", "index.ts"] +} diff --git a/@here/harp-lines/test/tsconfig-build.json b/@here/harp-lines/test/tsconfig-build.json new file mode 100644 index 0000000000..88e7c082d7 --- /dev/null +++ b/@here/harp-lines/test/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [{ "path": "../tsconfig-build.json" }] +} diff --git a/@here/harp-lines/tsconfig-build.json b/@here/harp-lines/tsconfig-build.json new file mode 100644 index 0000000000..d46906ed52 --- /dev/null +++ b/@here/harp-lines/tsconfig-build.json @@ -0,0 +1,12 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "outDir": ".", + "rootDir": "." + }, + "references": [ + { "path": "../harp-utils/tsconfig-build.json" }, + { "path": "../harp-materials/tsconfig-build.json" } + ], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-lrucache/test/tsconfig-build.json b/@here/harp-lrucache/test/tsconfig-build.json new file mode 100644 index 0000000000..6d69f03e94 --- /dev/null +++ b/@here/harp-lrucache/test/tsconfig-build.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../tsconfig-build.json" }, + { "path": "../../harp-utils/tsconfig-build.json" } + ] +} diff --git a/@here/harp-lrucache/tsconfig-build.json b/@here/harp-lrucache/tsconfig-build.json new file mode 100644 index 0000000000..537e77a94e --- /dev/null +++ b/@here/harp-lrucache/tsconfig-build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "outDir": ".", + "rootDir": "." + }, + "references": [{ "path": "../harp-utils/tsconfig-build.json" }], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-map-controls/test/MapControlsTest.ts b/@here/harp-map-controls/test/MapControlsTest.ts index 9107182456..621f166ce6 100644 --- a/@here/harp-map-controls/test/MapControlsTest.ts +++ b/@here/harp-map-controls/test/MapControlsTest.ts @@ -18,7 +18,7 @@ declare const global: any; const inNodeContext = typeof window === "undefined"; -describe("MapControls", function() { +describe.only("MapControls", function() { let sandbox: sinon.SinonSandbox; beforeEach(function() { diff --git a/@here/harp-map-controls/test/tsconfig-build.json b/@here/harp-map-controls/test/tsconfig-build.json new file mode 100644 index 0000000000..a29db8b81b --- /dev/null +++ b/@here/harp-map-controls/test/tsconfig-build.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../tsconfig-build.json" }, + { "path": "../../harp-geoutils/tsconfig-build.json" } + ] +} diff --git a/@here/harp-map-controls/tsconfig-build.json b/@here/harp-map-controls/tsconfig-build.json new file mode 100644 index 0000000000..b32c066b97 --- /dev/null +++ b/@here/harp-map-controls/tsconfig-build.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../harp-geoutils/tsconfig-build.json" }, + { "path": "../harp-mapview/tsconfig-build.json" }, + { "path": "../harp-utils/tsconfig-build.json" } + ], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-mapview-decoder/test/tsconfig-build.json b/@here/harp-mapview-decoder/test/tsconfig-build.json new file mode 100644 index 0000000000..f9716329dd --- /dev/null +++ b/@here/harp-mapview-decoder/test/tsconfig-build.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../tsconfig-build.json" }, + { "path": "../../harp-test-utils/tsconfig-build.json" } + ] +} diff --git a/@here/harp-mapview-decoder/tsconfig-build.json b/@here/harp-mapview-decoder/tsconfig-build.json new file mode 100644 index 0000000000..8729c0af1d --- /dev/null +++ b/@here/harp-mapview-decoder/tsconfig-build.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../harp-datasource-protocol/tsconfig-build.json" }, + { "path": "../harp-fetch/tsconfig-build.json" }, + { "path": "../harp-geoutils/tsconfig-build.json" }, + { "path": "../harp-mapview/tsconfig-build.json" }, + { "path": "../harp-utils/tsconfig-build.json" }, + { "path": "../harp-test-utils/tsconfig-build.json" } + ], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-mapview/test/tsconfig-build.json b/@here/harp-mapview/test/tsconfig-build.json new file mode 100644 index 0000000000..f9716329dd --- /dev/null +++ b/@here/harp-mapview/test/tsconfig-build.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../tsconfig-build.json" }, + { "path": "../../harp-test-utils/tsconfig-build.json" } + ] +} diff --git a/@here/harp-mapview/tsconfig-build.json b/@here/harp-mapview/tsconfig-build.json new file mode 100644 index 0000000000..bbd4121ecc --- /dev/null +++ b/@here/harp-mapview/tsconfig-build.json @@ -0,0 +1,18 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../harp-datasource-protocol/tsconfig-build.json" }, + { "path": "../harp-fetch/tsconfig-build.json" }, + { "path": "../harp-geoutils/tsconfig-build.json" }, + { "path": "../harp-lines/tsconfig-build.json" }, + { "path": "../harp-lrucache/tsconfig-build.json" }, + { "path": "../harp-materials/tsconfig-build.json" }, + { "path": "../harp-text-canvas/tsconfig-build.json" }, + { "path": "../harp-utils/tsconfig-build.json" } + ], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-materials/lib/MapMeshMaterials.ts b/@here/harp-materials/lib/MapMeshMaterials.ts index 364f535997..3ec303c7f9 100644 --- a/@here/harp-materials/lib/MapMeshMaterials.ts +++ b/@here/harp-materials/lib/MapMeshMaterials.ts @@ -689,7 +689,8 @@ export namespace ExtrusionFeature { * * @see [[Tile#addRenderHelper]] */ -export class ExtrusionFeatureMixin implements ExtrusionFeature { + +class ExtrusionFeatureMixin implements ExtrusionFeature { needsUpdate?: boolean; uniformsNeedUpdate?: boolean; private m_extrusion: number = ExtrusionFeature.DEFAULT_RATIO_MAX; diff --git a/@here/harp-materials/tsconfig-build.json b/@here/harp-materials/tsconfig-build.json new file mode 100644 index 0000000000..537e77a94e --- /dev/null +++ b/@here/harp-materials/tsconfig-build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "outDir": ".", + "rootDir": "." + }, + "references": [{ "path": "../harp-utils/tsconfig-build.json" }], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-omv-datasource/test/tsconfig-build.json b/@here/harp-omv-datasource/test/tsconfig-build.json new file mode 100644 index 0000000000..469bfcb270 --- /dev/null +++ b/@here/harp-omv-datasource/test/tsconfig-build.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../tsconfig-build.json" }, + { "path": "../../harp-geoutils/tsconfig-build.json" }, + { "path": "../../harp-mapview-decoder/tsconfig-build.json" } + ] +} diff --git a/@here/harp-omv-datasource/tsconfig-build.json b/@here/harp-omv-datasource/tsconfig-build.json new file mode 100644 index 0000000000..f5a8122657 --- /dev/null +++ b/@here/harp-omv-datasource/tsconfig-build.json @@ -0,0 +1,20 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../harp-datasource-protocol/tsconfig-build.json" }, + { "path": "../harp-fetch/tsconfig-build.json" }, + { "path": "../harp-geoutils/tsconfig-build.json" }, + { "path": "../harp-lines/tsconfig-build.json" }, + { "path": "../harp-lrucache/tsconfig-build.json" }, + { "path": "../harp-mapview/tsconfig-build.json" }, + { "path": "../harp-mapview-decoder/tsconfig-build.json" }, + { "path": "../harp-transfer-manager/tsconfig-build.json" }, + { "path": "../harp-utils/tsconfig-build.json" }, + { "path": "../harp-geometry/tsconfig-build.json" } + ], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-test-utils/test/tsconfig-build.json b/@here/harp-test-utils/test/tsconfig-build.json new file mode 100644 index 0000000000..88e7c082d7 --- /dev/null +++ b/@here/harp-test-utils/test/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [{ "path": "../tsconfig-build.json" }] +} diff --git a/@here/harp-test-utils/tsconfig-build.json b/@here/harp-test-utils/tsconfig-build.json new file mode 100644 index 0000000000..537e77a94e --- /dev/null +++ b/@here/harp-test-utils/tsconfig-build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "outDir": ".", + "rootDir": "." + }, + "references": [{ "path": "../harp-utils/tsconfig-build.json" }], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-text-canvas/test/tsconfig-build.json b/@here/harp-text-canvas/test/tsconfig-build.json new file mode 100644 index 0000000000..f9716329dd --- /dev/null +++ b/@here/harp-text-canvas/test/tsconfig-build.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [ + { "path": "../tsconfig-build.json" }, + { "path": "../../harp-test-utils/tsconfig-build.json" } + ] +} diff --git a/@here/harp-text-canvas/tsconfig-build.json b/@here/harp-text-canvas/tsconfig-build.json new file mode 100644 index 0000000000..654e2010c5 --- /dev/null +++ b/@here/harp-text-canvas/tsconfig-build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [{ "path": "../harp-lrucache/tsconfig-build.json" }], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-transfer-manager/test/tsconfig-build.json b/@here/harp-transfer-manager/test/tsconfig-build.json new file mode 100644 index 0000000000..88e7c082d7 --- /dev/null +++ b/@here/harp-transfer-manager/test/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [{ "path": "../tsconfig-build.json" }] +} diff --git a/@here/harp-transfer-manager/tsconfig-build.json b/@here/harp-transfer-manager/tsconfig-build.json new file mode 100644 index 0000000000..f5bbc9217d --- /dev/null +++ b/@here/harp-transfer-manager/tsconfig-build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [{ "path": "../harp-fetch/tsconfig-build.json" }], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-utils/test/tsconfig-build.json b/@here/harp-utils/test/tsconfig-build.json new file mode 100644 index 0000000000..88e7c082d7 --- /dev/null +++ b/@here/harp-utils/test/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [{ "path": "../tsconfig-build.json" }] +} diff --git a/@here/harp-utils/tsconfig-build.json b/@here/harp-utils/tsconfig-build.json new file mode 100644 index 0000000000..204802c5ce --- /dev/null +++ b/@here/harp-utils/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "outDir": ".", + "rootDir": "." + }, + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp-webtile-datasource/test/tsconfig-build.json b/@here/harp-webtile-datasource/test/tsconfig-build.json new file mode 100644 index 0000000000..88e7c082d7 --- /dev/null +++ b/@here/harp-webtile-datasource/test/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [{ "path": "../tsconfig-build.json" }] +} diff --git a/@here/harp-webtile-datasource/tsconfig-build.json b/@here/harp-webtile-datasource/tsconfig-build.json new file mode 100644 index 0000000000..bd81ffd998 --- /dev/null +++ b/@here/harp-webtile-datasource/tsconfig-build.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "outDir": ".", + "rootDir": "." + }, + "references": [ + { "path": "../harp-geoutils/tsconfig-build.json" }, + { "path": "../harp-mapview/tsconfig-build.json" }, + { "path": "../harp-utils/tsconfig-build.json" } + ], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp.gl/tsconfig-build.json b/@here/harp.gl/tsconfig-build.json new file mode 100644 index 0000000000..2c607dd1bb --- /dev/null +++ b/@here/harp.gl/tsconfig-build.json @@ -0,0 +1,20 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "outDir": ".", + "rootDir": "." + }, + "references": [ + { "path": "../harp-datasource-protocol/tsconfig-build.json" }, + { "path": "../harp-features-datasource/tsconfig-build.json" }, + { "path": "../harp-geojson-datasource/tsconfig-build.json" }, + { "path": "../harp-geoutils/tsconfig-build.json" }, + { "path": "../harp-map-controls/tsconfig-build.json" }, + { "path": "../harp-mapview/tsconfig-build.json" }, + { "path": "../harp-mapview-decoder/tsconfig-build.json" }, + { "path": "../harp-omv-datasource/tsconfig-build.json" }, + { "path": "../harp-utils/tsconfig-build.json" }, + { "path": "../harp-webtile-datasource/tsconfig-build.json" } + ], + "exclude": ["test/**/*.ts"] +} diff --git a/@here/harp.gl/webpack.config.js b/@here/harp.gl/webpack.config.js index b446f03467..86e3cde04c 100644 --- a/@here/harp.gl/webpack.config.js +++ b/@here/harp.gl/webpack.config.js @@ -24,14 +24,10 @@ const commonConfig = { exclude: /node_modules/, options: { onlyCompileBundledFiles: true, + projectReferences: true, // use the main tsconfig.json for all compilation // configFile: path.join(process.cwd(), "tsconfig.json"), - configFile: fs.existsSync("../../tsconfig.json") - ? path.resolve(__dirname, "../../tsconfig.json") - : path.resolve(__dirname, "./tsconfig.json"), - compilerOptions: { - declaration: false - } + configFile: path.resolve(__dirname, "./tsconfig-build.json") } } ] diff --git a/package.json b/package.json index 26697ef83f..6fd44fd272 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "cov-test": "nyc mocha -r ts-node/register ./@here/*/test/*.ts", "cov-report-html": "nyc report --reporter=html", "start": "ts-node ./scripts/credentials.ts -- . && webpack-dev-server -d --config @here/harp-examples/webpack.config.js", - "build": "npm run build-bundle && npm run build-examples", + "build": "yarn build-bundle && yarn build-examples", "build-examples": "ts-node ./scripts/credentials.ts -- dist/examples && webpack -d --config @here/harp-examples/webpack.config.js", "build-bundle": "cd @here/harp.gl && webpack", "start-tests": "webpack-dev-server -d --config webpack.tests.config.js", @@ -52,7 +52,11 @@ "tslint:fix": "tslint --fix --project tsconfig.json", "prettier": "prettier -l \"**/*.ts\" \"**/*.tsx\" \"**/*.json\"", "prettier:fix": "prettier --write \"**/*.ts\" \"**/*.tsx\" \"**/*.json\"", - "postinstall": "ts-node ./scripts/postinstall.ts" + "postinstall": "ts-node ./scripts/postinstall.ts", + "tsc": "tsc -b ./tsconfig-build.json", + "tsc-examples": "tsc -b ./@here/harp-examples/tsconfig-build.json", + "tsc-sdk": "tsc -b ./tsconfig-build-sdk.json", + "tsc-tests": "tsc -b ./tsconfig-build-tests.json" }, "engines": { "node": ">=10.5.0", diff --git a/test/tsconfig-build.json b/test/tsconfig-build.json new file mode 100644 index 0000000000..8305bc3807 --- /dev/null +++ b/test/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.settings.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "." + }, + "references": [{ "path": "../@here/harp-examples/tsconfig-build.json" }] +} diff --git a/tsconfig-build-sdk.json b/tsconfig-build-sdk.json new file mode 100644 index 0000000000..225b0ffed5 --- /dev/null +++ b/tsconfig-build-sdk.json @@ -0,0 +1,28 @@ +{ + "files": [], + "compilerOptions": { + "composite": true + }, + "references": [ + { "path": "@here/harp.gl/tsconfig-build.json" }, + { "path": "@here/harp-datasource-protocol/tsconfig-build.json" }, + { "path": "@here/harp-fetch/tsconfig-build.json" }, + { "path": "@here/harp-debug-datasource/tsconfig-build.json" }, + { "path": "@here/harp-features-datasource/tsconfig-build.json" }, + { "path": "@here/harp-geojson-datasource/tsconfig-build.json" }, + { "path": "@here/harp-geometry/tsconfig-build.json" }, + { "path": "@here/harp-geoutils/tsconfig-build.json" }, + { "path": "@here/harp-lines/tsconfig-build.json" }, + { "path": "@here/harp-lrucache/tsconfig-build.json" }, + { "path": "@here/harp-map-controls/tsconfig-build.json" }, + { "path": "@here/harp-mapview/tsconfig-build.json" }, + { "path": "@here/harp-mapview-decoder/tsconfig-build.json" }, + { "path": "@here/harp-materials/tsconfig-build.json" }, + { "path": "@here/harp-omv-datasource/tsconfig-build.json" }, + { "path": "@here/harp-utils/tsconfig-build.json" }, + { "path": "@here/harp-test-utils/tsconfig-build.json" }, + { "path": "@here/harp-text-canvas/tsconfig-build.json" }, + { "path": "@here/harp-transfer-manager" }, + { "path": "@here/harp-webtile-datasource/tsconfig-build.json" } + ] +} diff --git a/tsconfig-build-tests.json b/tsconfig-build-tests.json new file mode 100644 index 0000000000..43a6063ee7 --- /dev/null +++ b/tsconfig-build-tests.json @@ -0,0 +1,24 @@ +{ + "files": [], + "compilerOptions": { + "composite": true + }, + "references": [ + { "path": "test/tsconfig-build.json" }, + { "path": "@here/harp-datasource-protocol/test/tsconfig-build.json" }, + { "path": "@here/harp-fetch/test/tsconfig-build.json" }, + { "path": "@here/harp-geoutils/test/tsconfig-build.json" }, + { "path": "@here/harp-geometry/test/tsconfig-build.json" }, + { "path": "@here/harp-lines/test/tsconfig-build.json" }, + { "path": "@here/harp-lrucache/test/tsconfig-build.json" }, + { "path": "@here/harp-map-controls/test/tsconfig-build.json" }, + { "path": "@here/harp-mapview/test/tsconfig-build.json" }, + { "path": "@here/harp-mapview-decoder/test/tsconfig-build.json" }, + { "path": "@here/harp-omv-datasource/test/tsconfig-build.json" }, + { "path": "@here/harp-utils/test/tsconfig-build.json" }, + { "path": "@here/harp-test-utils/test/tsconfig-build.json" }, + { "path": "@here/harp-text-canvas/test/tsconfig-build.json" }, + { "path": "@here/harp-transfer-manager/test/tsconfig-build.json" }, + { "path": "@here/harp-webtile-datasource/test/tsconfig-build.json" } + ] +} diff --git a/tsconfig-build.json b/tsconfig-build.json new file mode 100644 index 0000000000..0c3b932cbc --- /dev/null +++ b/tsconfig-build.json @@ -0,0 +1,8 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig-build-sdk.json" }, + { "path": "./@here/harp-examples/tsconfig-build.json" }, + { "path": "./tsconfig-build-tests.json" } + ] +} diff --git a/tsconfig.settings.json b/tsconfig.settings.json new file mode 100644 index 0000000000..6ea21753d4 --- /dev/null +++ b/tsconfig.settings.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "es6", + "lib": ["es2017", "dom"], + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "declaration": true, + "strictNullChecks": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "downlevelIteration": true, + "composite": true + }, + "exclude": ["*.d.ts"] +} diff --git a/webpack.tests.config.js b/webpack.tests.config.js index 8b53844be9..a22232cd18 100644 --- a/webpack.tests.config.js +++ b/webpack.tests.config.js @@ -21,26 +21,12 @@ const harpFontResourcesPath = path.dirname(require.resolve("@here/harp-fontcatal const browserTestsConfig = { devtool: "source-map", resolve: { - extensions: [".webpack.js", ".web.ts", ".ts", ".tsx", ".web.js", ".js"], + extensions: [".web.js", ".js"], modules: [".", "node_modules"] }, - module: { - rules: [ - { - test: /\.tsx?$/, - loader: "ts-loader", - exclude: /node_modules/, - options: { - onlyCompileBundledFiles: true, - // use the main tsconfig.json for all compilation - configFile: path.resolve(__dirname, "tsconfig.json") - } - } - ] - }, entry: { - test: glob.sync("@here/*/test/**/*.ts"), - "performance-test": glob.sync("test/performance/**/*.ts") + test: glob.sync("@here/*/test/**/*.js").filter(path => !path.includes("generator-harp.gl")), + "performance-test": glob.sync("test/performance/**/*.js") }, output: { path: path.join(__dirname, "dist/test"), @@ -94,6 +80,10 @@ const browserTestsConfig = { entrypoints: true, warnings: true }, + watchOptions: { + aggregateTimeout: 300, + poll: 1000 + }, mode: process.env.NODE_ENV || "development" }; diff --git a/yarn.lock b/yarn.lock index 525f203e82..6829ba526f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1061,7 +1061,7 @@ async@^1.5.2: resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= -async@^2.6.0, async@^2.6.2: +async@^2.5.0, async@^2.6.0, async@^2.6.2: version "2.6.3" resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg== @@ -7239,6 +7239,14 @@ source-list-map@^2.0.0: resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== +source-map-loader@^0.2.4: + version "0.2.4" + resolved "https://registry.yarnpkg.com/source-map-loader/-/source-map-loader-0.2.4.tgz#c18b0dc6e23bf66f6792437557c569a11e072271" + integrity sha512-OU6UJUty+i2JDpTItnizPrlpOIBLmQbWMuBg9q5bVtnHACqw1tn9nNwqJLbv0/00JjnJb/Ee5g5WS5vrRv7zIQ== + dependencies: + async "^2.5.0" + loader-utils "^1.1.0" + source-map-resolve@^0.5.0: version "0.5.2" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" @@ -7906,10 +7914,21 @@ ts-json-schema-generator@^0.47.0: json-stable-stringify "^1.0.1" typescript "~3.5.2" -ts-loader@^6.0.3: - version "6.1.0" - resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.1.0.tgz#999cb0a7644f9c7c6c0901802dce50ceb0a76e5b" - integrity sha512-7JedeOu2rsYHQDEr2fwmMozABwbQTZXEaEMZPSIWG7gpzRefOLJCqwdazcegHtyaxp04PeEgs/b0m08WMpnIzQ== +ts-loader@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.2.0.tgz#52d3993ecbc5474c1513242388e1049da0fce880" + integrity sha512-Da8h3fD+HiZ9GvZJydqzk3mTC9nuOKYlJcpuk+Zv6Y1DPaMvBL+56GRzZFypx2cWrZFMsQr869+Ua2slGoLxvQ== + dependencies: + chalk "^2.3.0" + enhanced-resolve "^4.0.0" + loader-utils "^1.0.2" + micromatch "^4.0.0" + semver "^6.0.0" + +ts-loader@^6.2.1: + version "6.2.1" + resolved "https://artifactory.in.here.com/artifactory/api/npm/here-node/ts-loader/-/ts-loader-6.2.1.tgz#67939d5772e8a8c6bdaf6277ca023a4812da02ef" + integrity sha1-Z5OdV3LoqMa9r2J3ygI6SBLaAu8= dependencies: chalk "^2.3.0" enhanced-resolve "^4.0.0" @@ -8081,10 +8100,10 @@ typescript@3.5.x, typescript@~3.5.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== -typescript@^3.6.3: +typescript@^3.6.4: version "3.6.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d" - integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg== + resolved "https://artifactory.in.here.com/artifactory/api/npm/here-node/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d" + integrity sha1-sYdSuzeSvBoCgTNff26/G7/FuR0= typestring@^2.9.2: version "2.9.2"