Skip to content

Commit

Permalink
chore: switch to single distribution for es2017
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondfeng committed Sep 28, 2018
1 parent 729be0a commit 63a0cca
Show file tree
Hide file tree
Showing 60 changed files with 111 additions and 181 deletions.
5 changes: 1 addition & 4 deletions benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@
"performance",
"benchmark"
],
"types": "./dist10/index.d.ts",
"types": "./dist/index.d.ts",
"engines": {
"node": ">=8.9"
},
"scripts": {
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build": "lb-tsc",
"build:dist8": "lb-tsc es2017",
"build:dist10": "lb-tsc es2018",
"clean": "lb-clean dist*",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha \"DIST/__tests__\"",
Expand Down
4 changes: 2 additions & 2 deletions benchmark/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"compilerOptions": {
"rootDir": "src",
"composite": true,
"target": "es2018",
"outDir": "dist10"
"target": "es2017",
"outDir": "dist"
},
"references": [
{
Expand Down
5 changes: 1 addition & 4 deletions examples/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
"engines": {
"node": ">=8.9"
},
"types": "./dist10/index.d.ts",
"types": "./dist/index.d.ts",
"scripts": {
"acceptance": "lb-mocha \"DIST/__tests__/acceptance/**/*.js\"",
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc",
"build:dist8": "lb-tsc es2017",
"build:dist10": "lb-tsc es2018",
"build:watch": "lb-tsc --watch",
"clean": "lb-clean *example-hello-world*.tgz dist* package api-docs",
"verify": "npm pack && tar xf *example-hello-world*.tgz && tree package && npm run clean",
Expand Down
4 changes: 2 additions & 2 deletions examples/hello-world/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"compilerOptions": {
"rootDir": "src",
"composite": true,
"target": "es2018",
"outDir": "dist10"
"target": "es2017",
"outDir": "dist"
},
"references": [
{
Expand Down
5 changes: 1 addition & 4 deletions examples/log-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
"engines": {
"node": ">=8.9"
},
"types": "./dist10/index.d.ts",
"types": "./dist/index.d.ts",
"scripts": {
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc",
"build:dist8": "lb-tsc es2017",
"build:dist10": "lb-tsc es2018",
"build:watch": "lb-tsc --watch",
"clean": "lb-clean *example-log-extension-*.tgz dist* package api-docs",
"lint": "npm run prettier:check && npm run tslint",
Expand Down
4 changes: 2 additions & 2 deletions examples/log-extension/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"compilerOptions": {
"rootDir": "src",
"composite": true,
"target": "es2018",
"outDir": "dist10"
"target": "es2017",
"outDir": "dist"
},
"references": [
{
Expand Down
5 changes: 1 addition & 4 deletions examples/rpc-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@
"engines": {
"node": ">=8.9"
},
"types": "./dist10/index.d.ts",
"types": "./dist/index.d.ts",
"scripts": {
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc",
"build:dist8": "lb-tsc es2017",
"build:dist10": "lb-tsc es2018",
"build:watch": "lb-tsc --watch",
"clean": "lb-clean dist*",
"lint": "npm run prettier:check && npm run tslint",
Expand Down
5 changes: 1 addition & 4 deletions examples/soap-calculator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
"engines": {
"node": ">=8.9"
},
"types": "./dist10/index.d.ts",
"types": "./dist/index.d.ts",
"scripts": {
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc",
"build:dist8": "lb-tsc es2017",
"build:dist10": "lb-tsc es2018",
"build:watch": "lb-tsc --watch",
"clean": "lb-clean *example-soap*.tgz dist* package api-docs dist*",
"lint": "npm run prettier:check && npm run tslint",
Expand Down
4 changes: 2 additions & 2 deletions examples/soap-calculator/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"compilerOptions": {
"rootDir": "src",
"composite": true,
"target": "es2018",
"outDir": "dist10"
"target": "es2017",
"outDir": "dist"
},
"references": [
{
Expand Down
5 changes: 1 addition & 4 deletions examples/todo-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
"engines": {
"node": ">=8.9"
},
"types": "./dist10/index.d.ts",
"types": "./dist/index.d.ts",
"scripts": {
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc",
"build:dist8": "lb-tsc es2017",
"build:dist10": "lb-tsc es2018",
"build:watch": "lb-tsc --watch",
"clean": "lb-clean *example-todo-list*.tgz dist* package api-docs",
"lint": "npm run prettier:check && npm run tslint",
Expand Down
4 changes: 2 additions & 2 deletions examples/todo-list/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"compilerOptions": {
"rootDir": "src",
"composite": true,
"target": "es2018",
"outDir": "dist10"
"target": "es2017",
"outDir": "dist"
},
"references": [
{
Expand Down
5 changes: 1 addition & 4 deletions examples/todo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
"engines": {
"node": ">=8.9"
},
"types": "./dist10/index.d.ts",
"types": "./dist/index.d.ts",
"scripts": {
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc",
"build:dist8": "lb-tsc es2017",
"build:dist10": "lb-tsc es2018",
"build:watch": "lb-tsc --watch",
"clean": "lb-clean *example-todo*.tgz dist* package api-docs",
"lint": "npm run prettier:check && npm run tslint",
Expand Down
4 changes: 2 additions & 2 deletions examples/todo/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"compilerOptions": {
"rootDir": "src",
"composite": true,
"target": "es2018",
"outDir": "dist10"
"target": "es2017",
"outDir": "dist"
},
"references": [
{
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
"clean": "lerna run clean && node packages/build/bin/run-clean \"packages/*/dist*\" \"examples/*/dist*\"",
"clean:lerna": "lerna clean",
"build": "node bin/run-lerna run build",
"build:all-dist": "node bin/run-lerna run build:all-dist",
"build:full": "npm run clean:lerna && npm install && npm run build:all-dist",
"build:full": "npm run clean:lerna && npm install && npm run build",
"pretest": "npm run clean && npm run build",
"test": "node packages/build/bin/run-nyc npm run mocha --scripts-prepend-node-path",
"pretest:ci": "npm run build",
Expand Down
5 changes: 1 addition & 4 deletions packages/authentication/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
"engines": {
"node": ">=8.9"
},
"types": "./dist10/index.d.ts",
"types": "./dist/index.d.ts",
"scripts": {
"acceptance": "lb-mocha \"DIST/__tests__/acceptance/**/*.js\"",
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc",
"build:dist8": "lb-tsc es2017",
"build:dist10": "lb-tsc es2018",
"clean": "lb-clean loopback-authentication*.tgz dist* package api-docs",
"integration": "lb-mocha \"DIST/__tests__/integration/**/*.js\"",
"pretest": "npm run build",
Expand Down
4 changes: 2 additions & 2 deletions packages/authentication/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"compilerOptions": {
"rootDir": "src",
"composite": true,
"target": "es2018",
"outDir": "dist10"
"target": "es2017",
"outDir": "dist"
},
"references": [
{
Expand Down
5 changes: 1 addition & 4 deletions packages/boot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@
"engines": {
"node": ">=8.9"
},
"types": "./dist10/index.d.ts",
"types": "./dist/index.d.ts",
"publishConfig": {
"access": "public"
},
"scripts": {
"acceptance": "lb-mocha \"DIST/__tests__/acceptance/**/*.js\"",
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc",
"build:dist8": "lb-tsc es2017",
"build:dist10": "lb-tsc es2018",
"clean": "lb-clean loopback-boot*.tgz dist* package api-docs",
"pretest": "npm run build",
"integration": "lb-mocha \"DIST/__tests__/integration/**/*.js\"",
Expand Down
4 changes: 2 additions & 2 deletions packages/boot/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"compilerOptions": {
"rootDir": "src",
"composite": true,
"target": "es2018",
"outDir": "dist10"
"target": "es2017",
"outDir": "dist"
},
"references": [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Now you run the scripts, such as:
}
```

- Set options explicity for the script
- Set options explicitly for the script

```sh
lb-tsc -p tsconfig.json --target es2017 --outDir dist
Expand Down
13 changes: 6 additions & 7 deletions packages/build/bin/compile-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Usage:
node ./bin/compile-package <target>
Where <target> is one of es2015, es2017 or es2018.
Where <target> is one of es2015, es2017 or es2017.
========
*/
Expand Down Expand Up @@ -108,12 +108,11 @@ function run(argv, options) {
JSON.stringify(
{
extends: baseConfigFile,
exclude: [
'node_modules/**',
'packages/*/node_modules/**',
'examples/*/node_modules/**',
'**/*.d.ts',
],
compilerOptions: {
target: 'es2017',
outDir: 'dist',
},
exclude: ['**/*.d.ts'],
},
null,
' ',
Expand Down
3 changes: 1 addition & 2 deletions packages/build/bin/run-mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Usage:

function run(argv, options) {
const utils = require('./utils');
const path = require('path');

// Substitute the DIST variable with the dist folder
const dist = utils.getDistribution();
Expand All @@ -43,7 +42,7 @@ function run(argv, options) {
// Fail any tests that are printing to console.
mochaOpts.unshift(
'--require',
require.resolve('../src/fail-on-console-logs'),
require.resolve('../lib/fail-on-console-logs'),
);
} else {
// Allow tests to print to console, remove --allow-console-logs argument
Expand Down
4 changes: 2 additions & 2 deletions packages/build/bin/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const debug = require('debug')('loopback:build');
function getCompilationTarget() {
const nodeMajorVersion = +process.versions.node.split('.')[0];
return nodeMajorVersion >= 10
? 'es2018'
? 'es2017'
: nodeMajorVersion >= 7
? 'es2017'
: 'es2015';
Expand All @@ -37,7 +37,7 @@ function getDistribution(target) {
dist = 'dist10';
break;
case 'es2017':
dist = 'dist8';
dist = 'dist';
break;
case 'es2015':
dist = 'dist6';
Expand Down
7 changes: 2 additions & 5 deletions packages/build/config/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"extends": "./tsconfig.common.json",
"compilerOptions": {
"rootDir": "."
"rootDir": "src",
"outDir": "dist"
},
"include": [
"src",
"test"
],
"exclude": ["node_modules/**", "**/*.d.ts"]
}
7 changes: 4 additions & 3 deletions packages/build/config/tsconfig.common.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
"noImplicitAny": true,
"strictNullChecks": true,

"lib": ["es2018", "dom", "esnext.asynciterable"],
"lib": ["es2017", "dom", "esnext.asynciterable"],
"module": "commonjs",
"moduleResolution": "node",
"target": "es2017",
"sourceMap": true,
"declaration": true
"declaration": true,
"target": "es2017",
"composite": true
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/cli/generators/extension/templates/index.d.ts.ejs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './dist8';
export * from './dist';
3 changes: 0 additions & 3 deletions packages/cli/generators/project/templates/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
"node": ">=8.9"
},
"scripts": {
"build:all-dist": "npm run build:dist8 && npm run build:dist10",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc",
"build:dist8": "lb-tsc es2017",
"build:dist10": "lb-tsc es2018",
"build:watch": "lb-tsc --watch",
"clean": "lb-clean dist*",
<% if (project.prettier && project.tslint) { -%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
"node": ">=8.9"
},
"scripts": {
"build": "tsc --outDir dist --target es2017",
"build:all-dist": "npm run build",
"build:watch": "tsc --outDir dist --target es2017 --watch",
"build": "tsc",
"build:watch": "tsc --watch",
"clean": "rimraf dist",
<% if (project.prettier && project.tslint) { -%>
"lint": "npm run prettier:check && npm run tslint",
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/generators/project/templates/tsconfig.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"extends": "./node_modules/@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist10"
"outDir": "dist"
},
<% } else { -%>
"compilerOptions": {
Expand All @@ -13,14 +13,14 @@
"noImplicitAny": true,
"strictNullChecks": true,
"lib": ["es2018", "dom", "esnext.asynciterable"],
"lib": ["es2017", "dom", "esnext.asynciterable"],
"module": "commonjs",
"moduleResolution": "node",
"target": "es2017",
"sourceMap": true,
"declaration": true,
"rootDir": "src",
"outDir": "dist10"
"outDir": "dist"
},
<% } -%>
"exclude": [
Expand Down
Loading

0 comments on commit 63a0cca

Please sign in to comment.