fix(compiler): return emitted files from compilation results and align tests with emitted output handling
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
pages/
|
||||||
|
test/assets/output/
|
||||||
|
|
||||||
# installs
|
# installs
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|||||||
+1
-1
@@ -29,6 +29,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@git.zone/tsdoc": {
|
"@git.zone/tsdoc": {
|
||||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [license](./license) file.\n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.\n\nUse of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District Court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vendored
+5
-5
@@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"json.schemas": [
|
"json.schemas": [
|
||||||
{
|
{
|
||||||
"fileMatch": ["/npmextra.json"],
|
"fileMatch": ["/.smartconfig.json"],
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"npmci": {
|
"@ship.zone/szci": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"description": "settings for npmci"
|
"description": "settings for szci"
|
||||||
},
|
},
|
||||||
"gitzone": {
|
"@git.zone/cli": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"description": "settings for gitzone",
|
"description": "settings for @git.zone/cli",
|
||||||
"properties": {
|
"properties": {
|
||||||
"projectType": {
|
"projectType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-05-09 - 4.4.1 - fix(compiler)
|
||||||
|
return emitted files from compilation results and align tests with emitted output handling
|
||||||
|
|
||||||
|
- enable TypeScript's emitted file listing during compilation so compile results include emittedFiles
|
||||||
|
- update tests to assert emitted output from compileFilesOrThrow and compileGlob
|
||||||
|
- simplify test glob inputs and ignore generated test output directories
|
||||||
|
- refresh dependency versions and CLI examples in documentation
|
||||||
|
|
||||||
## 2026-03-24 - 4.4.0 - feat(config)
|
## 2026-03-24 - 4.4.0 - feat(config)
|
||||||
add smartconfig metadata and update TypeScript build configuration docs
|
add smartconfig metadata and update TypeScript build configuration docs
|
||||||
|
|
||||||
|
|||||||
+11
-11
@@ -36,21 +36,21 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://code.foss.global/git.zone/tsbuild#README",
|
"homepage": "https://code.foss.global/git.zone/tsbuild#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@git.zone/tspublish": "^1.11.3",
|
"@git.zone/tspublish": "^1.11.6",
|
||||||
"@push.rocks/early": "^4.0.4",
|
"@push.rocks/early": "^4.0.4",
|
||||||
"@push.rocks/smartcli": "^4.0.20",
|
"@push.rocks/smartcli": "^4.0.21",
|
||||||
"@push.rocks/smartdelay": "^3.0.5",
|
"@push.rocks/smartdelay": "^3.1.0",
|
||||||
"@push.rocks/smartfile": "^13.1.2",
|
"@push.rocks/smartfile": "^13.1.3",
|
||||||
"@push.rocks/smartfs": "^1.5.0",
|
"@push.rocks/smartfs": "^1.5.1",
|
||||||
"@push.rocks/smartlog": "^3.2.1",
|
"@push.rocks/smartlog": "^3.2.2",
|
||||||
"@push.rocks/smartpath": "^6.0.0",
|
"@push.rocks/smartpath": "^6.0.0",
|
||||||
"@push.rocks/smartpromise": "^4.2.3",
|
"@push.rocks/smartpromise": "^4.2.4",
|
||||||
"typescript": "^6.0.2"
|
"typescript": "^6.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@git.zone/tsrun": "^2.0.1",
|
"@git.zone/tsrun": "^2.0.3",
|
||||||
"@git.zone/tstest": "^3.5.1",
|
"@git.zone/tstest": "^3.6.5",
|
||||||
"@types/node": "^25.5.0"
|
"@types/node": "^25.6.2"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
|||||||
Generated
+2117
-3240
File diff suppressed because it is too large
Load Diff
@@ -9,11 +9,7 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
|
|||||||
## Install
|
## Install
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Using pnpm (recommended)
|
pnpm add --save-dev @git.zone/tsbuild
|
||||||
pnpm install @git.zone/tsbuild --save-dev
|
|
||||||
|
|
||||||
# Using npm
|
|
||||||
npm install @git.zone/tsbuild --save-dev
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Why tsbuild?
|
## Why tsbuild?
|
||||||
@@ -38,13 +34,13 @@ npm install @git.zone/tsbuild --save-dev
|
|||||||
|
|
||||||
**Compile your TypeScript project:**
|
**Compile your TypeScript project:**
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild
|
pnpm exec tsbuild
|
||||||
```
|
```
|
||||||
Compiles `./ts/**/*.ts` to `./dist_ts/`
|
Compiles `./ts/**/*.ts` to `./dist_ts/`
|
||||||
|
|
||||||
**Custom directories:**
|
**Custom directories:**
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild custom src utils
|
pnpm exec tsbuild custom src utils
|
||||||
```
|
```
|
||||||
Compiles:
|
Compiles:
|
||||||
- `./src/**/*.ts` -> `./dist_src/`
|
- `./src/**/*.ts` -> `./dist_src/`
|
||||||
@@ -52,7 +48,7 @@ Compiles:
|
|||||||
|
|
||||||
**Auto-discover and compile in dependency order:**
|
**Auto-discover and compile in dependency order:**
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild tsfolders
|
pnpm exec tsbuild tsfolders
|
||||||
```
|
```
|
||||||
Finds all `ts_*` folders and compiles them respecting dependencies.
|
Finds all `ts_*` folders and compiles them respecting dependencies.
|
||||||
|
|
||||||
@@ -103,7 +99,7 @@ await compiler.compileGlob({
|
|||||||
### 1. Default Build
|
### 1. Default Build
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild [options]
|
pnpm exec tsbuild [options]
|
||||||
```
|
```
|
||||||
|
|
||||||
Compiles all TypeScript files from `./ts/` to `./dist_ts/`
|
Compiles all TypeScript files from `./ts/` to `./dist_ts/`
|
||||||
@@ -121,39 +117,39 @@ Compiles all TypeScript files from `./ts/` to `./dist_ts/`
|
|||||||
**Examples:**
|
**Examples:**
|
||||||
```bash
|
```bash
|
||||||
# Standard build
|
# Standard build
|
||||||
npx tsbuild
|
pnpm exec tsbuild
|
||||||
|
|
||||||
# Build with JSON output for CI
|
# Build with JSON output for CI
|
||||||
npx tsbuild --json --quiet
|
pnpm exec tsbuild --json --quiet
|
||||||
|
|
||||||
# CommonJS build
|
# CommonJS build
|
||||||
npx tsbuild --commonjs
|
pnpm exec tsbuild --commonjs
|
||||||
|
|
||||||
# Strict mode
|
# Strict mode
|
||||||
npx tsbuild --disallowimplicitany
|
pnpm exec tsbuild --disallowimplicitany
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Custom Directories
|
### 2. Custom Directories
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild custom <dir1> <dir2> ... [options]
|
pnpm exec tsbuild custom <dir1> <dir2> ... [options]
|
||||||
```
|
```
|
||||||
|
|
||||||
Compile specific directories to their corresponding `dist_` folders.
|
Compile specific directories to their corresponding `dist_` folders.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Compile src and utils
|
# Compile src and utils
|
||||||
npx tsbuild custom src utils
|
pnpm exec tsbuild custom src utils
|
||||||
# Creates: ./dist_src/ and ./dist_utils/
|
# Creates: ./dist_src/ and ./dist_utils/
|
||||||
|
|
||||||
# Multiple directories with options
|
# Multiple directories with options
|
||||||
npx tsbuild custom api models services --commonjs
|
pnpm exec tsbuild custom api models services --commonjs
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. TSFolders (Dependency-Aware)
|
### 3. TSFolders (Dependency-Aware)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild tsfolders [options]
|
pnpm exec tsbuild tsfolders [options]
|
||||||
```
|
```
|
||||||
|
|
||||||
Automatically discovers and compiles all `ts_*` folders in dependency order:
|
Automatically discovers and compiles all `ts_*` folders in dependency order:
|
||||||
@@ -176,17 +172,17 @@ TypeScript Folder Compilation Plan (5 folders)
|
|||||||
### 4. Emit Check
|
### 4. Emit Check
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild emitcheck <file_or_pattern> [more...] [options]
|
pnpm exec tsbuild emitcheck <file_or_pattern> [more...] [options]
|
||||||
```
|
```
|
||||||
|
|
||||||
Validates TypeScript files can be compiled without actually emitting them.
|
Validates TypeScript files can be compiled without actually emitting them.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Check specific files
|
# Check specific files
|
||||||
npx tsbuild emitcheck src/main.ts src/utils.ts
|
pnpm exec tsbuild emitcheck src/main.ts src/utils.ts
|
||||||
|
|
||||||
# Check with glob patterns
|
# Check with glob patterns
|
||||||
npx tsbuild emitcheck "src/**/*.ts" "test/**/*.ts"
|
pnpm exec tsbuild emitcheck "src/**/*.ts" "test/**/*.ts"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Exit codes:**
|
**Exit codes:**
|
||||||
@@ -196,15 +192,15 @@ npx tsbuild emitcheck "src/**/*.ts" "test/**/*.ts"
|
|||||||
### 5. Type Check
|
### 5. Type Check
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild check [pattern] [more...] [options]
|
pnpm exec tsbuild check [pattern] [more...] [options]
|
||||||
```
|
```
|
||||||
|
|
||||||
Performs type checking without emitting files.
|
Performs type checking without emitting files.
|
||||||
|
|
||||||
**With arguments:** Check specified files/patterns
|
**With arguments:** Check specified files/patterns
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild check "ts/**/*.ts"
|
pnpm exec tsbuild check "ts/**/*.ts"
|
||||||
npx tsbuild check "src/**/*.ts" "test/**/*.ts"
|
pnpm exec tsbuild check "src/**/*.ts" "test/**/*.ts"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Without arguments:** Two-phase default check
|
**Without arguments:** Two-phase default check
|
||||||
@@ -212,7 +208,7 @@ npx tsbuild check "src/**/*.ts" "test/**/*.ts"
|
|||||||
2. Phase 2: Type check `test/**/*` (relaxed, skipLibCheck: true)
|
2. Phase 2: Type check `test/**/*` (relaxed, skipLibCheck: true)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild check
|
pnpm exec tsbuild check
|
||||||
# Running default type checking sequence...
|
# Running default type checking sequence...
|
||||||
# Checking ts/**/* files...
|
# Checking ts/**/* files...
|
||||||
# Checking test/**/* files with --skiplibcheck...
|
# Checking test/**/* files with --skiplibcheck...
|
||||||
@@ -549,14 +545,16 @@ Each `ts_*` folder can contain its own `tspublish.json` to configure compilation
|
|||||||
|
|
||||||
#### tspublish.json Configuration
|
#### tspublish.json Configuration
|
||||||
|
|
||||||
Create a `tspublish.json` in each `ts_*` folder:
|
Create a `tspublish.json` in each publishable `ts_*` folder. `@git.zone/tspublish` expects publishing fields, while tsbuild additionally reads `order` and `unpack` for build ordering and output flattening:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"name": "@myorg/core",
|
"name": "@myorg/core",
|
||||||
"order": 3,
|
"order": 3,
|
||||||
"unpack": true,
|
"unpack": true,
|
||||||
"dependencies": ["ts_interfaces", "ts_shared"]
|
"dependencies": ["@myorg/interfaces", "@myorg/shared"],
|
||||||
|
"registries": ["useBase"],
|
||||||
|
"bin": []
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -565,14 +563,16 @@ Create a `tspublish.json` in each `ts_*` folder:
|
|||||||
| `name` | string | -- | Package name for publishing |
|
| `name` | string | -- | Package name for publishing |
|
||||||
| `order` | number | `Infinity` | Build sequence (lower builds first) |
|
| `order` | number | `Infinity` | Build sequence (lower builds first) |
|
||||||
| `unpack` | boolean | `true` | Flatten nested output directories |
|
| `unpack` | boolean | `true` | Flatten nested output directories |
|
||||||
| `dependencies` | string[] | -- | Monorepo dependencies to bundle |
|
| `dependencies` | string[] | `[]` | Published package dependencies resolved from the monorepo `package.json` |
|
||||||
|
| `registries` | string[] | -- | Publish registries, for example `useBase` to read `.smartconfig.json` |
|
||||||
|
| `bin` | string[] | `[]` | CLI binary names generated by `@git.zone/tspublish` |
|
||||||
|
|
||||||
#### Build Order
|
#### Build Order
|
||||||
|
|
||||||
The `tsfolders` command respects the `order` property:
|
The `tsfolders` command respects the `order` property:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild tsfolders
|
pnpm exec tsbuild tsfolders
|
||||||
```
|
```
|
||||||
|
|
||||||
**Default ordering (without tspublish.json):**
|
**Default ordering (without tspublish.json):**
|
||||||
@@ -680,14 +680,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '22'
|
||||||
|
|
||||||
- run: npm install
|
- run: pnpm install
|
||||||
- run: npx tsbuild
|
- run: pnpm exec tsbuild
|
||||||
```
|
```
|
||||||
|
|
||||||
### JSON Output
|
### JSON Output
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild --json --quiet
|
pnpm exec tsbuild --json --quiet
|
||||||
```
|
```
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@@ -739,14 +739,14 @@ Ensure your tsconfig.json has:
|
|||||||
|
|
||||||
Use `--skiplibcheck` to skip declaration file checking:
|
Use `--skiplibcheck` to skip declaration file checking:
|
||||||
```bash
|
```bash
|
||||||
npx tsbuild --skiplibcheck
|
pnpm exec tsbuild --skiplibcheck
|
||||||
```
|
```
|
||||||
|
|
||||||
Only use this if you trust your dependencies' type definitions.
|
Only use this if you trust your dependencies' type definitions.
|
||||||
|
|
||||||
## License and Legal Information
|
## License and Legal Information
|
||||||
|
|
||||||
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./license) file.
|
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [license](./license) file.
|
||||||
|
|
||||||
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -5,17 +5,19 @@ import { TsCompiler } from '../ts/index.js';
|
|||||||
const assetfiles: string[] = ['./test/assets/tocompile.ts', './test/assets/tocompile2.ts'];
|
const assetfiles: string[] = ['./test/assets/tocompile.ts', './test/assets/tocompile2.ts'];
|
||||||
|
|
||||||
const assetfiles2 = {
|
const assetfiles2 = {
|
||||||
'./test/assets/**/!(*.d.ts|*.js|output)': './test/assets/output',
|
'./test/assets/tocompile*.ts': './test/assets/output',
|
||||||
};
|
};
|
||||||
|
|
||||||
tap.test('should compile files from an array', async () => {
|
tap.test('should compile files from an array', async () => {
|
||||||
const compiler = new TsCompiler();
|
const compiler = new TsCompiler();
|
||||||
await compiler.compileFilesOrThrow(assetfiles, { outDir: './test/assets/output' });
|
const emittedFiles = await compiler.compileFilesOrThrow(assetfiles, { outDir: './test/assets/output' });
|
||||||
|
expect(emittedFiles.length).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should compile files from glob pattern object', async () => {
|
tap.test('should compile files from glob pattern object', async () => {
|
||||||
const compiler = new TsCompiler();
|
const compiler = new TsCompiler();
|
||||||
await compiler.compileGlob(assetfiles2);
|
const result = await compiler.compileGlob(assetfiles2);
|
||||||
|
expect(result.emittedFiles.length).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
export default tap.start();
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/tsbuild',
|
name: '@git.zone/tsbuild',
|
||||||
version: '4.4.0',
|
version: '4.4.1',
|
||||||
description: 'A tool for compiling TypeScript files using the latest nightly features, offering flexible APIs and a CLI for streamlined development.'
|
description: 'A tool for compiling TypeScript files using the latest nightly features, offering flexible APIs and a CLI for streamlined development.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,7 +197,10 @@ export class TsCompiler {
|
|||||||
customOptions: CompilerOptions = {},
|
customOptions: CompilerOptions = {},
|
||||||
taskInfo?: ITaskInfo
|
taskInfo?: ITaskInfo
|
||||||
): Promise<ICompileResult> {
|
): Promise<ICompileResult> {
|
||||||
const options = this.createOptions(customOptions);
|
const options = {
|
||||||
|
...this.createOptions(customOptions),
|
||||||
|
listEmittedFiles: true,
|
||||||
|
};
|
||||||
|
|
||||||
if (options.skipLibCheck) {
|
if (options.skipLibCheck) {
|
||||||
await this.handleSkipLibCheckWarning();
|
await this.handleSkipLibCheckWarning();
|
||||||
|
|||||||
Reference in New Issue
Block a user