Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ These GitHub repositories provide supplementary resources for Rush Stack:
| [/build-tests-samples/packlets-tutorial](./build-tests-samples/packlets-tutorial/) | (Copy of sample project) Building this project is a regression test for @rushstack/eslint-plugin-packlets |
| [/build-tests/api-documenter-scenarios](./build-tests/api-documenter-scenarios/) | Building this project is a regression test for api-documenter |
| [/build-tests/api-documenter-test](./build-tests/api-documenter-test/) | Building this project is a regression test for api-documenter |
| [/build-tests/api-extractor-d-cts-test](./build-tests/api-extractor-d-cts-test/) | Building this project is a regression test for api-extractor |
| [/build-tests/api-extractor-d-mts-test](./build-tests/api-extractor-d-mts-test/) | Building this project is a regression test for api-extractor |
| [/build-tests/api-extractor-lib1-test](./build-tests/api-extractor-lib1-test/) | Building this project is a regression test for api-extractor |
| [/build-tests/api-extractor-lib2-test](./build-tests/api-extractor-lib2-test/) | Building this project is a regression test for api-extractor |
| [/build-tests/api-extractor-lib3-test](./build-tests/api-extractor-lib3-test/) | Building this project is a regression test for api-extractor |
Expand Down
1 change: 1 addition & 0 deletions apps/api-extractor/src/api/ExtractorConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export class ExtractorConfig {
path.join(__dirname, '../schemas/api-extractor-defaults.json')
);

/** Match all three flavors for type declaration files (.d.ts, .d.mts, .d.cts) */
private static readonly _declarationFileExtensionRegExp: RegExp = /\.d\.(c|m)?ts$/i;

/** {@inheritDoc IConfigFile.projectFolder} */
Expand Down
4 changes: 4 additions & 0 deletions build-tests/api-extractor-d-cts-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This project's outputs are tracked to surface changes to API Extractor rollups during PRs
!dist
dist/*
!dist/*.d.ts
27 changes: 27 additions & 0 deletions build-tests/api-extractor-d-cts-test/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const fsx = require('fs-extra');
const child_process = require('child_process');
const path = require('path');
const process = require('process');

function executeCommand(command) {
console.log('---> ' + command);
child_process.execSync(command, { stdio: 'inherit' });
}

// Clean the old build outputs
console.log(`==> Starting build.js for ${path.basename(process.cwd())}`);
fsx.emptyDirSync('dist');
fsx.emptyDirSync('lib');
fsx.emptyDirSync('temp');

// Run the TypeScript compiler
executeCommand('node node_modules/typescript/lib/tsc');

// Run the API Extractor command-line
if (process.argv.indexOf('--production') >= 0) {
executeCommand('node node_modules/@microsoft/api-extractor/lib/start run');
} else {
executeCommand('node node_modules/@microsoft/api-extractor/lib/start run --local');
}

console.log(`==> Finished build.js for ${path.basename(process.cwd())}`);
22 changes: 22 additions & 0 deletions build-tests/api-extractor-d-cts-test/config/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",

"mainEntryPointFilePath": "<projectFolder>/lib/index.d.cts",

"apiReport": {
"enabled": true
},

"docModel": {
"enabled": true
},

"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.cts",
"alphaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-alpha.d.cts",
"publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.cts"
},

"testMode": true
}
10 changes: 10 additions & 0 deletions build-tests/api-extractor-d-cts-test/config/rush-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-project.schema.json",

"operationSettings": [
{
"operationName": "build",
"outputFolderNames": ["lib", "dist"]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## API Report File for "api-extractor-d-cts-test"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

// @public (undocumented)
class DefaultClass {
}
export default DefaultClass;

// @public (undocumented)
export class Lib5Class {
// (undocumented)
prop: number;
}

// @alpha (undocumented)
export interface Lib5Interface {
}

```
19 changes: 19 additions & 0 deletions build-tests/api-extractor-d-cts-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "api-extractor-d-cts-test",
"description": "Building this project is a regression test for api-extractor",
"version": "1.0.0",
"private": true,
"main": "lib/index.cjs",
"types": "dist/api-extractor-d-cts-test.d.cts",
"scripts": {
"build": "node build.js",
"_phase:build": "node build.js"
},
"devDependencies": {
"@microsoft/api-extractor": "workspace:*",
"@types/jest": "29.2.5",
"@types/node": "18.17.15",
"fs-extra": "~7.0.1",
"typescript": "~5.0.4"
}
}
22 changes: 22 additions & 0 deletions build-tests/api-extractor-d-cts-test/src/index.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

/**
* api-extractor-d-cts-test
*
* @remarks
* This library is consumed by api-extractor-scenarios.
*
* @packageDocumentation
*/

/** @public */
export class Lib5Class {
prop: number;
}

/** @alpha */
export interface Lib5Interface {}

/** @public */
export default class DefaultClass {}
16 changes: 16 additions & 0 deletions build-tests/api-extractor-d-cts-test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "es6",
"forceConsistentCasingInFileNames": true,
"module": "commonjs",
"declaration": true,
"sourceMap": true,
"declarationMap": true,
"experimentalDecorators": true,
"strictNullChecks": true,
"types": ["node", "jest"],
"lib": ["es5", "scripthost", "es2015.collection", "es2015.promise", "es2015.iterable", "dom"],
"outDir": "lib"
},
"include": ["src/**/*.cts", "typings/tsd.d.ts"]
}
4 changes: 4 additions & 0 deletions build-tests/api-extractor-d-mts-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This project's outputs are tracked to surface changes to API Extractor rollups during PRs
!dist
dist/*
!dist/*.d.ts
27 changes: 27 additions & 0 deletions build-tests/api-extractor-d-mts-test/build.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const fsx = require('fs-extra');
const child_process = require('child_process');
const path = require('path');
const process = require('process');

function executeCommand(command) {
console.log('---> ' + command);
child_process.execSync(command, { stdio: 'inherit' });
}

// Clean the old build outputs
console.log(`==> Starting build.js for ${path.basename(process.cwd())}`);
fsx.emptyDirSync('dist');
fsx.emptyDirSync('lib');
fsx.emptyDirSync('temp');

// Run the TypeScript compiler
executeCommand('node node_modules/typescript/lib/tsc');

// Run the API Extractor command-line
if (process.argv.indexOf('--production') >= 0) {
executeCommand('node node_modules/@microsoft/api-extractor/lib/start run');
} else {
executeCommand('node node_modules/@microsoft/api-extractor/lib/start run --local');
}

console.log(`==> Finished build.js for ${path.basename(process.cwd())}`);
22 changes: 22 additions & 0 deletions build-tests/api-extractor-d-mts-test/config/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",

"mainEntryPointFilePath": "<projectFolder>/lib/index.d.mts",

"apiReport": {
"enabled": true
},

"docModel": {
"enabled": true
},

"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.mts",
"alphaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-alpha.d.mts",
"publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.mts"
},

"testMode": true
}
10 changes: 10 additions & 0 deletions build-tests/api-extractor-d-mts-test/config/rush-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-project.schema.json",

"operationSettings": [
{
"operationName": "build",
"outputFolderNames": ["lib", "dist"]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## API Report File for "api-extractor-d-mts-test"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

// @public (undocumented)
class DefaultClass {
}
export default DefaultClass;

// @public (undocumented)
export class Lib4Class {
// (undocumented)
prop: number;
}

// @alpha (undocumented)
export interface Lib4Interface {
}

```
20 changes: 20 additions & 0 deletions build-tests/api-extractor-d-mts-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "api-extractor-d-mts-test",
"description": "Building this project is a regression test for api-extractor",
"version": "1.0.0",
"private": true,
"module": "lib/index.mjs",
"type": "module",
"types": "dist/api-extractor-d-mts-test.d.mts",
"scripts": {
"build": "node build.cjs",
"_phase:build": "node build.cjs"
},
"devDependencies": {
"@microsoft/api-extractor": "workspace:*",
"@types/jest": "29.2.5",
"@types/node": "18.17.15",
"fs-extra": "~7.0.1",
"typescript": "~5.0.4"
}
}
22 changes: 22 additions & 0 deletions build-tests/api-extractor-d-mts-test/src/index.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

/**
* api-extractor-d-mts-test
*
* @remarks
* This library is consumed by api-extractor-scenarios.
*
* @packageDocumentation
*/

/** @public */
export class Lib4Class {
prop: number;
}

/** @alpha */
export interface Lib4Interface {}

/** @public */
export default class DefaultClass {}
16 changes: 16 additions & 0 deletions build-tests/api-extractor-d-mts-test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "es6",
"forceConsistentCasingInFileNames": true,
"module": "commonjs",
"declaration": true,
"sourceMap": true,
"declarationMap": true,
"experimentalDecorators": true,
"strictNullChecks": true,
"types": ["node", "jest"],
"lib": ["es5", "scripthost", "es2015.collection", "es2015.promise", "es2015.iterable", "dom"],
"outDir": "lib"
},
"include": ["src/**/*.mts", "typings/tsd.d.ts"]
}
Loading