@dotcom-tool-kit/typescript 2.2.0 → 3.0.0-beta.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/.toolkitrc.yml +12 -6
- package/lib/tasks/typescript.d.ts +5 -17
- package/lib/tasks/typescript.d.ts.map +1 -1
- package/lib/tasks/typescript.js +15 -33
- package/package.json +7 -6
- package/readme.md +14 -11
- package/lib/index.d.ts +0 -3
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -5
package/.toolkitrc.yml
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
'
|
|
1
|
+
tasks:
|
|
2
|
+
TypeScript: './lib/tasks/typescript'
|
|
3
|
+
|
|
4
|
+
commands:
|
|
5
|
+
# TODO add options here once we support per-command-assignment options
|
|
6
|
+
'build:local': TypeScript
|
|
7
|
+
'build:ci': TypeScript
|
|
8
|
+
'build:remote': TypeScript
|
|
9
|
+
'run:local': TypeScript # watch
|
|
10
|
+
'test:local': TypeScript # noEmit
|
|
11
|
+
|
|
12
|
+
version: 2
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import { Task } from '@dotcom-tool-kit/
|
|
2
|
-
import type { TypeScriptSchema } from '@dotcom-tool-kit/
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Task } from '@dotcom-tool-kit/base';
|
|
2
|
+
import type { TypeScriptSchema } from '@dotcom-tool-kit/schemas/lib/tasks/typescript';
|
|
3
|
+
export default class TypeScript extends Task<{
|
|
4
|
+
task: typeof TypeScriptSchema;
|
|
5
|
+
}> {
|
|
5
6
|
run(): Promise<void>;
|
|
6
7
|
}
|
|
7
|
-
export declare class TypeScriptBuild extends TypeScriptTask {
|
|
8
|
-
static description: string;
|
|
9
|
-
taskArgs: never[];
|
|
10
|
-
}
|
|
11
|
-
export declare class TypeScriptWatch extends TypeScriptTask {
|
|
12
|
-
static description: string;
|
|
13
|
-
taskArgs: string[];
|
|
14
|
-
}
|
|
15
|
-
export declare class TypeScriptTest extends TypeScriptTask {
|
|
16
|
-
static description: string;
|
|
17
|
-
taskArgs: string[];
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
20
8
|
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/tasks/typescript.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/tasks/typescript.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAA;AAKrF,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,IAAI,CAAC;IAAE,IAAI,EAAE,OAAO,gBAAgB,CAAA;CAAE,CAAC;IACvE,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA+B3B"}
|
package/lib/tasks/typescript.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TypeScriptTest = exports.TypeScriptWatch = exports.TypeScriptBuild = void 0;
|
|
4
3
|
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
5
|
-
const
|
|
4
|
+
const base_1 = require("@dotcom-tool-kit/base");
|
|
6
5
|
const child_process_1 = require("child_process");
|
|
7
6
|
const tscPath = require.resolve('typescript/bin/tsc');
|
|
8
|
-
class
|
|
7
|
+
class TypeScript extends base_1.Task {
|
|
9
8
|
async run() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (this.options.
|
|
13
|
-
args.
|
|
9
|
+
const args = [];
|
|
10
|
+
// TODO:KB:20240408 refactor this
|
|
11
|
+
if (this.options.build) {
|
|
12
|
+
args.push('--build');
|
|
13
|
+
}
|
|
14
|
+
if (this.options.watch) {
|
|
15
|
+
args.push('--watch');
|
|
14
16
|
}
|
|
15
|
-
if (this.options.
|
|
16
|
-
args.push(
|
|
17
|
+
if (this.options.noEmit) {
|
|
18
|
+
args.push('--noEmit');
|
|
19
|
+
}
|
|
20
|
+
if (this.options.configPath) {
|
|
21
|
+
args.push('--project', this.options.configPath);
|
|
17
22
|
}
|
|
18
23
|
const child = (0, child_process_1.fork)(tscPath, args, { silent: true });
|
|
19
24
|
(0, logger_1.hookFork)(this.logger, 'typescript', child);
|
|
@@ -26,27 +31,4 @@ class TypeScriptTask extends types_1.Task {
|
|
|
26
31
|
this.logger.info('code compiled successfully');
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
|
-
|
|
30
|
-
constructor() {
|
|
31
|
-
super(...arguments);
|
|
32
|
-
this.taskArgs = [];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.TypeScriptBuild = TypeScriptBuild;
|
|
36
|
-
TypeScriptBuild.description = 'compile TypeScript to JavaScript';
|
|
37
|
-
class TypeScriptWatch extends TypeScriptTask {
|
|
38
|
-
constructor() {
|
|
39
|
-
super(...arguments);
|
|
40
|
-
this.taskArgs = ['--watch'];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.TypeScriptWatch = TypeScriptWatch;
|
|
44
|
-
TypeScriptWatch.description = 'rebuild TypeScript project every file change';
|
|
45
|
-
class TypeScriptTest extends TypeScriptTask {
|
|
46
|
-
constructor() {
|
|
47
|
-
super(...arguments);
|
|
48
|
-
this.taskArgs = ['--noEmit'];
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.TypeScriptTest = TypeScriptTest;
|
|
52
|
-
TypeScriptTest.description = 'type check TypeScript code';
|
|
34
|
+
exports.default = TypeScript;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcom-tool-kit/typescript",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib",
|
|
6
6
|
"scripts": {
|
|
@@ -21,20 +21,21 @@
|
|
|
21
21
|
".toolkitrc.yml"
|
|
22
22
|
],
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"dotcom-tool-kit": "
|
|
25
|
-
"typescript": "3.x || 4.x"
|
|
24
|
+
"dotcom-tool-kit": "4.0.0-beta.1",
|
|
25
|
+
"typescript": "3.x || 4.x || 5.x"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@dotcom-tool-kit/
|
|
29
|
-
"@dotcom-tool-kit/
|
|
28
|
+
"@dotcom-tool-kit/base": "4.0.0-beta.0",
|
|
29
|
+
"@dotcom-tool-kit/logger": "4.0.0-beta.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
+
"@dotcom-tool-kit/schemas": "2.0.0-beta.0",
|
|
32
33
|
"@jest/globals": "^29.3.1",
|
|
33
34
|
"typescript": "^4.9.4",
|
|
34
35
|
"winston": "^3.8.2"
|
|
35
36
|
},
|
|
36
37
|
"engines": {
|
|
37
|
-
"node": "
|
|
38
|
+
"node": "18.x || 20.x",
|
|
38
39
|
"npm": "7.x || 8.x || 9.x || 10.x"
|
|
39
40
|
}
|
|
40
41
|
}
|
package/readme.md
CHANGED
|
@@ -17,17 +17,20 @@ plugins:
|
|
|
17
17
|
- '@dotcom-tool-kit/typescript'
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
<!-- begin autogenerated docs -->
|
|
21
|
+
## Tasks
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|-|-|-|
|
|
24
|
-
| `configPath` | Path to the [TypeScript config file](https://www.typescriptlang.org/tsconfig) | use TypeScript's own [tsconfig.json resolution](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#using-tsconfigjson-or-jsconfigjson) |
|
|
25
|
-
| `extraArgs` | Extra [arguments](https://www.typescriptlang.org/docs/handbook/compiler-options.html) to pass to the tsc CLI that can't be set in `tsconfig.json` | `[]`
|
|
23
|
+
### `TypeScript`
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
Compile code with `tsc`.
|
|
26
|
+
#### Task options
|
|
27
|
+
|
|
28
|
+
| Property | Description | Type |
|
|
29
|
+
| :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
|
|
30
|
+
| `configPath` | to the [TypeScript config file](https://www.typescriptlang.org/tsconfig). Uses TypeScript's own [tsconfig.json resolution](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#using-tsconfigjson-or-jsconfigjson) by default | `string` |
|
|
31
|
+
| `build` | Run Typescript in [build mode](https://www.typescriptlang.org/docs/handbook/project-references.html#build-mode-for-typescript). | `true` |
|
|
32
|
+
| `watch` | Run Typescript in watch mode. | `true` |
|
|
33
|
+
| `noEmit` | Run Typescript with `--noEmit`, for checking your types without outputting compiled Javascript. | `true` |
|
|
28
34
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
| `TypeScriptBuild` | runs `tsc` to compile TypeScript to JavaScript | `build:local`, `build:ci`, `build:remote` |
|
|
32
|
-
| `TypeScriptWatch` | rebuild project on every project file change | `run:local` |
|
|
33
|
-
| `TypeScriptTest` | type check TypeScript code without emitting code | `test:local` |
|
|
35
|
+
_All properties are optional._
|
|
36
|
+
<!-- end autogenerated docs -->
|
package/lib/index.d.ts
DELETED
package/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,eAAe,EAAkB,MAAM,oBAAoB,CAAA;AAErF,eAAO,MAAM,KAAK,4BAAqD,CAAA"}
|
package/lib/index.js
DELETED