Skip to content
Permalink
Browse files

chore: Use typescript project references.

Project references allow typescript to efficiently build and watch dependencies
across TypeScript project boundaries.

There is a new tsconfig.json in packages that builds all the (non-ember)
typescript with a single compiler. This makes incremental builds work for all packages
based on what has changed.

Another great feature that TypeScript supports is also now enabled:
Type definition maps. This means that code navigation across packages will now
take you directly to the source instead of to the intermediate type
defintion from the compile. 🎉

The following new scripts are available:

* Top Level:
  * `yarn compile` - Build (or re-build) all typescript.
  * `yarn compile:clean` - Remove all compiled output and then compile.
  * `yarn compile:watch` - Start the typescript watcher for all
    typescript packages.
  * `yarn test:all` - Run all tests. This assumes the typescript has
    already been compiled.

* In each package:
  * `yarn compile` - Builds all typescript for the package and, if
    necessary, the local typescript projects that it depends on.
  * `yarn test` - Compile and run tests.
  * `yarn test:runner` - Run tests without compiling.
  • Loading branch information...
chriseppstein committed Dec 6, 2018
1 parent 4548d90 commit c622d4240818be68474e04b974bb76ca961ef300
@@ -4,7 +4,12 @@
"commitmsg": "commitlint --edit $GIT_PARAMS",
"ci": "lerna run test",
"docs": "typedoc",
"toc": "markdown-toc -i --maxdepth 2 README.md"
"toc": "markdown-toc -i --maxdepth 2 README.md",
"compile": "tsc -b packages",
"compile:watch": "tsc -b packages --watch",
"test:all": "lerna run test:runner",
"compile:clean": "rm -rf packages/@css-blocks/*/dist && yarn run compile",
"install:clean": "rm -rf node_modules packages/@css-blocks/*/node_modules && yarn"
},
"devDependencies": {
"@commitlint/cli": "^6.1.0",
@@ -13,11 +13,12 @@
"broccoli-plugin"
],
"scripts": {
"test": "mocha --opts test/mocha.opts dist/test",
"compile": "rm -rf dist && tsc -p tsconfig.json",
"test": "yarn run test:runner",
"test:runner": "mocha --opts test/mocha.opts dist/test",
"compile": "tsc --build",
"pretest": "yarn run compile",
"posttest": "yarn run lint",
"prepublish": "yarn run compile && yarn run lintall",
"prepublish": "rm -rf dist && yarn run compile && yarn run lintall",
"lint": "tslint -t msbuild --project . -c tslint.cli.json",
"lintall": "tslint -t msbuild --project . -c tslint.release.json",
"lintfix": "tslint -t msbuild --project . -c tslint.cli.json --fix",

This file was deleted.

@@ -1,9 +1,14 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"composite": true,
"outDir": "dist",
"baseUrl": "dist"
},
"references": [
{"path": "../glimmer"},
{"path": "../core"}
],
"include": [
"src",
"test"
@@ -15,6 +15,7 @@
"pretest": "yarn run compile",
"prepublish": "yarn run compile",
"test": "echo 'nothing to test'",
"test:runner": "echo 'nothing to test'",
"lint": "tslint -t msbuild -p . -c tslint.cli.json",
"lintfix": "tslint -t msbuild -p . --fix -c tslint.cli.json",
"lintall": "tslint -t msbuild -p . -c tslint.release.json"
@@ -4,11 +4,12 @@
"description": "Fast, maintainable, optimal, component-oriented CSS.",
"main": "dist/src/index.js",
"scripts": {
"compile": "tsc --version && rm -rf dist && tsc",
"compile": "tsc --version && tsc --build",
"pretest": "yarn run compile",
"test": "mocha dist/test --opts test/mocha.opts",
"test": "yarn run test:runner",
"test:runner": "mocha dist/test --opts test/mocha.opts",
"posttest": "yarn run lint",
"prepublish": "yarn run compile && yarn run lintall",
"prepublish": "rm -rf dist && yarn run compile && yarn run lintall",
"lint": "tslint -t msbuild --project . -c tslint.cli.json",
"lintall": "tslint -t msbuild --project . -c tslint.release.json",
"lintfix": "tslint -t msbuild --project . -c tslint.cli.json --fix",
@@ -1,6 +1,7 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"composite": true,
"outDir": "dist",
"baseUrl": "dist",
"paths": {
@@ -18,6 +18,7 @@
"lint:js": "eslint ./*.js addon addon-test-support app blueprints config lib server test-support tests",
"start": "ember serve",
"test": "ember test",
"test:runner": "ember test",
"test:all": "ember try:each"
},
"dependencies": {
@@ -10,11 +10,12 @@
"types-local"
],
"scripts": {
"test": "mocha --opts test/mocha.opts dist/cjs/test",
"compile": "rm -rf dist && tsc --version && tsc -p tsconfig.json && tsc -p tsconfig.amd.json -m AMD",
"test": "yarn run test:runner",
"test:runner": "mocha --opts test/mocha.opts dist/cjs/test",
"compile": "tsc --version && tsc --build && tsc --build tsconfig.amd.json",
"pretest": "yarn run compile",
"posttest": "yarn run lint",
"prepublish": "yarn run compile && yarn run lintall",
"prepublish": "rm -rf dist && yarn run compile && yarn run lintall",
"lint": "tslint -t msbuild --project . -c tslint.cli.json",
"lintall": "tslint -t msbuild --project . -c tslint.release.json",
"lintfix": "tslint -t msbuild --project . -c tslint.cli.json --fix",
@@ -3,9 +3,9 @@
"compilerOptions": {
"outDir": "dist/amd/src/helpers",
"baseUrl": "dist/amd/src/helpers",
"target": "es5"
"target": "es5",
"module": "amd"
},
"module": "AMD",
"include": [
"src/helpers"
],

This file was deleted.

@@ -1,9 +1,13 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"composite": true,
"outDir": "dist/cjs",
"baseUrl": "dist/cjs"
},
"references": [
{"path": "../core"}
],
"include": [
"src",
"test"
@@ -10,9 +10,10 @@
"scripts": {
"pretest": "yarn run compile",
"posttest": "yarn run lint",
"test": "mocha dist/test --recursive --opts test/mocha.opts && yarn run lint",
"compile": "rm -rf dist && tsc --jsx preserve -p tsconfig.json",
"prepublish": "yarn run compile && yarn run lintall",
"test": "yarn run test:runner",
"test:runner": "mocha dist/test --recursive --opts test/mocha.opts && yarn run lint",
"compile": "tsc --build",
"prepublish": "rm -rf dist && yarn run compile && yarn run lintall",
"watch": "watch 'yarn run test' './src' './test' --wait=3",
"lint": "tslint -t msbuild -c tslint.cli.json --project .",
"lintall": "tslint -t msbuild --project . -c tslint.release.json",
@@ -1,6 +1,7 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"composite": true,
"jsx": "preserve",
"jsxFactory": "h",

@@ -21,5 +22,10 @@
"dist",
"test/fixtures",
"node_modules"
],
"references": [
{"path": "../test-utils"},
{"path": "../core"},
{"path": "../runtime"},
]
}
@@ -9,7 +9,8 @@
"scripts": {
"build": "ember build -prod",
"start": "ember server",
"test": "ember test"
"test": "ember test",
"test:runner": "ember test"
},
"devDependencies": {
"@css-blocks/ember-cli": "^0.21.0",
@@ -10,10 +10,11 @@
"scripts": {
"pretest": "yarn run compile",
"posttest": "yarn run lint",
"test": "mocha dist/test --opts test/mocha.opts",
"test": "yarn run test:runner",
"watch": "watch 'yarn run test' './src' './test' --wait=1",
"compile": "rm -rf dist && tsc",
"prepublish": "yarn run compile && yarn run lintall",
"compile": "tsc --build",
"prepublish": "rm -rf dist && yarn run compile && yarn run lintall",
"test:runner": "mocha dist/test --opts test/mocha.opts",
"lint": "tslint -t msbuild -c tslint.cli.json --project .",
"lintall": "tslint -t msbuild --project . -c tslint.release.json",
"lintfix": "tslint -t msbuild -c tslint.cli.json --project . --fix"
@@ -2,6 +2,7 @@
// Runtime output is very different.
{
"compilerOptions": {
"composite": true,
// Compilation Configuration
"target": "es5",
"inlineSources": false,
@@ -7,7 +7,8 @@
"scripts": {
"compile": "tsc --version && rm -rf dist && tsc",
"pretest": "yarn run compile",
"test": "mocha dist/test --opts test/mocha.opts",
"test": "yarn run test:runner",
"test:runner": "mocha dist/test --opts test/mocha.opts",
"posttest": "yarn run lint",
"prepublish": "yarn run compile && yarn run lintall",
"lint": "tslint -t msbuild --project . -c tslint.cli.json",
@@ -1,6 +1,7 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"composite": true,
"outDir": "dist",
"baseUrl": "dist"
},
@@ -4,14 +4,15 @@
"description": "Webpack plugin for css-blocks.",
"main": "dist/src/index.js",
"scripts": {
"prepublish": "yarn run compile && yarn run lintall",
"compile": "rm -rf dist && tsc -p tsconfig.json",
"prepublish": "rm -rf dist && yarn run compile && yarn run lintall",
"compile": "tsc --build",
"pretest": "yarn run compile",
"posttest": "yarn run lint",
"lint": "tslint -t msbuild -c tslint.cli.json --project .",
"lintall": "tslint -t msbuild --project . -c tslint.release.json",
"lintfix": "tslint -t msbuild -c tslint.cli.json --project . --fix",
"test": "mocha dist/test --opts test/mocha.opts",
"test": "yarn run test:runner",
"test:runner": "mocha dist/test --opts test/mocha.opts",
"coverage": "istanbul cover -i dist/src/**/*.js --dir ./build/coverage node_modules/mocha/bin/_mocha -- dist/test --opts test/mocha.opts",
"remap": "remap-istanbul -i build/coverage/coverage.json -o coverage -t html",
"watch": "watch 'yarn run test' './src' './test' --wait=3"
@@ -1,6 +1,7 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"composite": true,
"outDir": "dist",
"baseUrl": "dist",
"paths": {
@@ -9,6 +10,9 @@
]
}
},
"references": [
{"path": "../core"}
],
"include": [
"src",
"test"
@@ -57,9 +57,10 @@
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"compile": "yarn run build",
"test": "echo 'nothing to test'",
"test": "yarn run test:runner",
"serve": "node server.js",
"snyk-protect": "snyk protect",
"test:runner": "echo 'nothing to test'",
"prepublish": "npm run snyk-protect"
},
"jest": {
@@ -0,0 +1,13 @@
{
"files": [],
"references": [
{"path": "@css-blocks/broccoli"},
{"path": "@css-blocks/core"},
{"path": "@css-blocks/glimmer"},
{"path": "@css-blocks/glimmer/tsconfig.amd.json"},
{"path": "@css-blocks/jsx"},
{"path": "@css-blocks/runtime"},
{"path": "@css-blocks/test-utils"},
{"path": "@css-blocks/webpack"},
]
}
@@ -30,6 +30,7 @@

// output options
"preserveConstEnums": false,
"declarationMap": true,
"newLine": "LF",
"traceResolution": false,
"module": "commonjs",

0 comments on commit c622d42

Please sign in to comment.
You can’t perform that action at this time.