@loopback/build 7.0.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/README.md +9 -0
- package/bin/compile-package.js +31 -4
- package/config/tsconfig.common.json +3 -0
- package/package.json +13 -12
- package/test/integration/scripts.integration.js +25 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,51 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.0.1](https://github.com/loopbackio/loopback-next/compare/@loopback/build@8.0.0...@loopback/build@8.0.1) (2022-01-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @loopback/build
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [8.0.0](https://github.com/loopbackio/loopback-next/compare/@loopback/build@7.0.2...@loopback/build@8.0.0) (2021-11-18)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* drop support for Node.js v10 ([9bcbbb3](https://github.com/loopbackio/loopback-next/commit/9bcbbb358ec3eabc3033d4e7e1c22b524a7069b3))
|
|
20
|
+
* support Node.js v17 ([8d86c03](https://github.com/loopbackio/loopback-next/commit/8d86c03cb7047e2b1f18d05870628ef5783e71b2))
|
|
21
|
+
* upgrade to TypeScript 4.5.2 ([72ece91](https://github.com/loopbackio/loopback-next/commit/72ece91289ecfdfd8747bb9888ad75db73e8ff4b))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### BREAKING CHANGES
|
|
25
|
+
|
|
26
|
+
* drop support for Node.js v10
|
|
27
|
+
|
|
28
|
+
Co-authored-by: Francisco Buceta <frbuceta@gmail.com>
|
|
29
|
+
Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## [7.0.2](https://github.com/loopbackio/loopback-next/compare/@loopback/build@7.0.1...@loopback/build@7.0.2) (2021-10-18)
|
|
36
|
+
|
|
37
|
+
**Note:** Version bump only for package @loopback/build
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## [7.0.1](https://github.com/loopbackio/loopback-next/compare/@loopback/build@7.0.0...@loopback/build@7.0.1) (2021-09-16)
|
|
44
|
+
|
|
45
|
+
**Note:** Version bump only for package @loopback/build
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
6
51
|
# [7.0.0](https://github.com/loopbackio/loopback-next/compare/@loopback/build@6.4.1...@loopback/build@7.0.0) (2021-07-15)
|
|
7
52
|
|
|
8
53
|
|
package/README.md
CHANGED
|
@@ -94,6 +94,15 @@ Now you run the scripts, such as:
|
|
|
94
94
|
| ------------------ | ------------------------------------------------------------------------------------------------- |
|
|
95
95
|
| `--copy-resources` | Copy all non-typescript files from `src` and `test` to `outDir`, preserving their relative paths. |
|
|
96
96
|
|
|
97
|
+
- Using [`ttypescript`](https://github.com/cevek/ttypescript)
|
|
98
|
+
|
|
99
|
+
### Stability: ⚠️Experimental⚠️
|
|
100
|
+
|
|
101
|
+
If you would like to use `ttypescript` and its availalbe plugins, you can
|
|
102
|
+
substitute `lb-tsc` with `lb-ttsc`, or pass the option
|
|
103
|
+
`lb-tsc --use-ttypescript`. If `ttypescript` is not installed, the default
|
|
104
|
+
TypeScript compiler `tsc` will be used instead.
|
|
105
|
+
|
|
97
106
|
4. Run builds
|
|
98
107
|
|
|
99
108
|
```sh
|
package/bin/compile-package.js
CHANGED
|
@@ -34,8 +34,12 @@ function run(argv, options) {
|
|
|
34
34
|
|
|
35
35
|
const packageDir = utils.getPackageDir();
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const runnerName = argv[1];
|
|
38
38
|
|
|
39
|
+
const compilerOpts = argv.slice(2);
|
|
40
|
+
const runnerIsLbttsc = runnerName.includes('lb-ttsc');
|
|
41
|
+
const isUseTtscSet = utils.isOptionSet(compilerOpts, '--use-ttypescript');
|
|
42
|
+
const useTtsc = runnerIsLbttsc || isUseTtscSet;
|
|
39
43
|
const isTargetSet = utils.isOptionSet(compilerOpts, '--target');
|
|
40
44
|
const isOutDirSet = utils.isOptionSet(compilerOpts, '--outDir');
|
|
41
45
|
const isProjectSet = utils.isOptionSet(compilerOpts, '-p', '--project');
|
|
@@ -44,12 +48,35 @@ function run(argv, options) {
|
|
|
44
48
|
'--copy-resources',
|
|
45
49
|
);
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
let TSC_CLI = 'typescript/lib/tsc';
|
|
52
|
+
if (useTtsc) {
|
|
53
|
+
try {
|
|
54
|
+
require.resolve('ttypescript');
|
|
55
|
+
TSC_CLI = 'ttypescript/lib/tsc';
|
|
56
|
+
} catch (e) {
|
|
57
|
+
if (isUseTtscSet) {
|
|
58
|
+
console.error(
|
|
59
|
+
'Error using the --use-ttypescript option - ttypescript is not installed',
|
|
60
|
+
);
|
|
61
|
+
} else {
|
|
62
|
+
console.error('Error using lb-ttsc - ttypescript is not installed');
|
|
63
|
+
}
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
debug(`Using ${TSC_CLI} to compile package`);
|
|
68
|
+
|
|
69
|
+
// --copy-resources and --use-ttypescript are not a TS Compiler options,
|
|
70
|
+
// so we remove them from the list of compiler options to avoid compiler
|
|
71
|
+
// errors.
|
|
49
72
|
if (isCopyResourcesSet) {
|
|
50
73
|
compilerOpts.splice(compilerOpts.indexOf('--copy-resources'), 1);
|
|
51
74
|
}
|
|
52
75
|
|
|
76
|
+
if (isUseTtscSet) {
|
|
77
|
+
compilerOpts.splice(compilerOpts.indexOf('--use-ttypescript'), 1);
|
|
78
|
+
}
|
|
79
|
+
|
|
53
80
|
let target;
|
|
54
81
|
if (isTargetSet) {
|
|
55
82
|
const targetIx = compilerOpts.indexOf('--target');
|
|
@@ -138,7 +165,7 @@ function run(argv, options) {
|
|
|
138
165
|
|
|
139
166
|
const validArgs = validArgsForBuild(args);
|
|
140
167
|
|
|
141
|
-
return utils.runCLI(
|
|
168
|
+
return utils.runCLI(TSC_CLI, validArgs, {cwd, ...options});
|
|
142
169
|
}
|
|
143
170
|
|
|
144
171
|
/**
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
// FIXME(bajtos) LB4 is not compatible with this setting yet
|
|
11
11
|
"strictPropertyInitialization": false,
|
|
12
12
|
|
|
13
|
+
// https://devblogs.microsoft.com/typescript/announcing-typescript-4-4/#use-unknown-catch-variables
|
|
14
|
+
"useUnknownInCatchVariables": false,
|
|
15
|
+
|
|
13
16
|
"incremental": true,
|
|
14
17
|
|
|
15
18
|
"lib": ["es2020"],
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loopback/build",
|
|
3
3
|
"description": "A set of common scripts and default configurations to build LoopBack 4 or other TypeScript modules",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "8.0.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
7
7
|
"lb-tsc": "./bin/compile-package.js",
|
|
8
|
+
"lb-ttsc": "./bin/compile-package.js",
|
|
8
9
|
"lb-eslint": "./bin/run-eslint.js",
|
|
9
10
|
"lb-prettier": "./bin/run-prettier.js",
|
|
10
11
|
"lb-mocha": "./bin/run-mocha.js",
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
"directory": "packages/build"
|
|
21
22
|
},
|
|
22
23
|
"engines": {
|
|
23
|
-
"node": "
|
|
24
|
+
"node": "12 || 14 || 16 || 17"
|
|
24
25
|
},
|
|
25
26
|
"scripts": {
|
|
26
27
|
"test": "npm run mocha",
|
|
@@ -30,21 +31,21 @@
|
|
|
30
31
|
"access": "public"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@loopback/eslint-config": "^
|
|
34
|
-
"@types/mocha": "^
|
|
34
|
+
"@loopback/eslint-config": "^12.0.1",
|
|
35
|
+
"@types/mocha": "^9.0.0",
|
|
35
36
|
"@types/node": "^10.17.60",
|
|
36
37
|
"cross-spawn": "^7.0.3",
|
|
37
|
-
"debug": "^4.3.
|
|
38
|
-
"eslint": "^
|
|
38
|
+
"debug": "^4.3.3",
|
|
39
|
+
"eslint": "^8.6.0",
|
|
39
40
|
"fs-extra": "^10.0.0",
|
|
40
|
-
"glob": "^7.
|
|
41
|
+
"glob": "^7.2.0",
|
|
41
42
|
"lodash": "^4.17.21",
|
|
42
|
-
"mocha": "^9.
|
|
43
|
+
"mocha": "^9.1.3",
|
|
43
44
|
"nyc": "^15.1.0",
|
|
44
|
-
"prettier": "^2.
|
|
45
|
+
"prettier": "^2.5.1",
|
|
45
46
|
"rimraf": "^3.0.2",
|
|
46
|
-
"source-map-support": "^0.5.
|
|
47
|
-
"typescript": "~4.
|
|
47
|
+
"source-map-support": "^0.5.21",
|
|
48
|
+
"typescript": "~4.5.4"
|
|
48
49
|
},
|
|
49
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "4a8886403cd9cb3ae529cb69712f077623cba2c2"
|
|
50
51
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const assert = require('assert');
|
|
9
9
|
const path = require('path');
|
|
10
|
+
const spawn = require('cross-spawn');
|
|
10
11
|
const fs = require('fs-extra');
|
|
11
12
|
const utils = require('../../bin/utils');
|
|
12
13
|
|
|
@@ -56,6 +57,30 @@ describe('build', /** @this {Mocha.Suite} */ function () {
|
|
|
56
57
|
});
|
|
57
58
|
});
|
|
58
59
|
|
|
60
|
+
describe('with --use-ttypescript', () => {
|
|
61
|
+
it('Returns an error if ttypescript is not installed', done => {
|
|
62
|
+
const childProcess = spawn(
|
|
63
|
+
process.execPath, // Typically '/usr/local/bin/node'
|
|
64
|
+
['../../../bin/compile-package', '--use-ttypescript'],
|
|
65
|
+
{
|
|
66
|
+
env: Object.create(process.env),
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
let processOutput;
|
|
70
|
+
childProcess.stderr.on('data', m => {
|
|
71
|
+
processOutput = m.toString('ascii');
|
|
72
|
+
});
|
|
73
|
+
childProcess.on('close', code => {
|
|
74
|
+
assert.equal(code, 1);
|
|
75
|
+
assert.equal(
|
|
76
|
+
processOutput,
|
|
77
|
+
'Error using the --use-ttypescript option - ttypescript is not installed\n',
|
|
78
|
+
);
|
|
79
|
+
done();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
59
84
|
it('honors tsconfig.build.json over tsconfig.json', () => {
|
|
60
85
|
fs.writeJSONSync('tsconfig.build.json', {
|
|
61
86
|
extends: '../../../config/tsconfig.common.json',
|