Skip to content

Commit 12dd995

Browse files
committed
Set up api-extractor-lib2-test project
1 parent 6aad54a commit 12dd995

File tree

10 files changed

+126
-4
lines changed

10 files changed

+126
-4
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// @public (undocumented)
2-
declare class ExternalClass {
2+
declare class Lib1Class {
33
}
44

55
// @public (undocumented)
6-
interface ExternalInterface {
6+
interface Lib2Interface {
77
}
88

build-tests/api-extractor-lib1-test/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
*/
1212

1313
/** @public */
14-
export class ExternalClass {
14+
export class Lib1Class {
1515
}
1616

1717
/** @public */
18-
export interface ExternalInterface {
18+
export interface Lib2Interface {
1919
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/api-extractor.schema.json",
3+
"compiler" : {
4+
"configType": "tsconfig",
5+
"rootFolder": "."
6+
},
7+
8+
"dtsRollup": {
9+
"enabled": true
10+
},
11+
12+
"project": {
13+
"entryPointSourceFile": "lib/index.d.ts"
14+
}
15+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const fsx = require('fs-extra');
2+
const child_process = require('child_process');
3+
const path = require('path');
4+
const process = require('process');
5+
6+
function executeCommand(command) {
7+
console.log('---> ' + command);
8+
child_process.execSync(command, { stdio: 'inherit' });
9+
}
10+
11+
// Clean the old build outputs
12+
console.log(`==> Starting build.js for ${path.basename(process.cwd())}`);
13+
fsx.emptyDirSync('dist');
14+
fsx.emptyDirSync('lib');
15+
fsx.emptyDirSync('temp');
16+
17+
// Run the TypeScript compiler
18+
executeCommand('node node_modules/typescript/lib/tsc');
19+
20+
// Run the API Extractor command-line
21+
if (process.argv.indexOf('--production') >= 0) {
22+
executeCommand('node node_modules/@microsoft/api-extractor/lib/start run');
23+
} else {
24+
executeCommand('node node_modules/@microsoft/api-extractor/lib/start run --local');
25+
}
26+
27+
console.log(`==> Finished build.js for ${path.basename(process.cwd())}`);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// @public (undocumented)
2+
declare class Lib2Class {
3+
}
4+
5+
// @public (undocumented)
6+
interface Lib2Interface {
7+
}
8+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "api-extractor-lib2-test",
3+
"description": "Building this project is a regression test for api-extractor",
4+
"version": "1.0.0",
5+
"private": true,
6+
"main": "lib/index.js",
7+
"typings": "dist/internal/api-extractor-lib2-test.d.ts",
8+
"scripts": {
9+
"build": "node build.js"
10+
},
11+
"dependencies": {
12+
"@microsoft/api-extractor": "7.0.9",
13+
"@types/jest": "23.3.11",
14+
"@types/node": "8.5.8",
15+
"fs-extra": "~7.0.1",
16+
"typescript": "~3.1.6"
17+
}
18+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
/**
5+
* api-extractor-lib2-test
6+
*
7+
* @remarks
8+
* This library is consumed by api-extractor-scenarios.
9+
*
10+
* @packagedocumentation
11+
*/
12+
13+
/** @public */
14+
export class Lib2Class {
15+
}
16+
17+
/** @public */
18+
export interface Lib2Interface {
19+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es6",
4+
"forceConsistentCasingInFileNames": true,
5+
"module": "commonjs",
6+
"declaration": true,
7+
"sourceMap": true,
8+
"experimentalDecorators": true,
9+
"strictNullChecks": true,
10+
"types": [
11+
"node",
12+
"jest"
13+
],
14+
"lib": [
15+
"es5",
16+
"scripthost",
17+
"es2015.collection",
18+
"es2015.promise",
19+
"es2015.iterable",
20+
"dom"
21+
],
22+
"outDir": "lib"
23+
},
24+
"include": [
25+
"src/**/*.ts",
26+
"typings/tsd.d.ts"
27+
]
28+
}

build-tests/api-extractor-scenarios/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"@types/jest": "23.3.11",
1515
"@types/node": "8.5.8",
1616
"api-extractor-lib1-test": "1.0.0",
17+
"api-extractor-lib2-test": "1.0.0",
1718
"fs-extra": "~7.0.1",
1819
"typescript": "~3.1.6"
1920
}

rush.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,12 @@
313313
"reviewCategory": "tests",
314314
"shouldPublish": false
315315
},
316+
{
317+
"packageName": "api-extractor-lib2-test",
318+
"projectFolder": "build-tests/api-extractor-lib2-test",
319+
"reviewCategory": "tests",
320+
"shouldPublish": false
321+
},
316322
{
317323
"packageName": "api-extractor-scenarios",
318324
"projectFolder": "build-tests/api-extractor-scenarios",

0 commit comments

Comments
 (0)