Skip to content

Commit 0002b1c

Browse files
committed
Introduce test projects for TSv2, TSv3, and TSv4.
1 parent 81ef205 commit 0002b1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1314
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib-*
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
4+
"mainEntryPointFilePath": "<projectFolder>/lib/index.d.ts",
5+
"apiReport": {
6+
"enabled": true,
7+
"reportFolder": "<projectFolder>/etc"
8+
},
9+
"docModel": {
10+
"enabled": true
11+
},
12+
"dtsRollup": {
13+
"enabled": true,
14+
"alphaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-alpha.d.ts",
15+
"betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts"
16+
}
17+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* Defines configuration used by core Heft.
3+
*/
4+
{
5+
"$schema": "https://developer.microsoft.com/json-schemas/heft/heft.schema.json",
6+
7+
"eventActions": [
8+
{
9+
/**
10+
* The kind of built-in operation that should be performed.
11+
* The "deleteGlobs" action deletes files or folders that match the
12+
* specified glob patterns.
13+
*/
14+
"actionKind": "deleteGlobs",
15+
16+
/**
17+
* The stage of the Heft run during which this action should occur. Note that actions specified in heft.json
18+
* occur at the end of the stage of the Heft run.
19+
*/
20+
"heftEvent": "clean",
21+
22+
/**
23+
* A user-defined tag whose purpose is to allow configs to replace/delete handlers that were added by other
24+
* configs.
25+
*/
26+
"actionId": "defaultClean",
27+
28+
/**
29+
* Glob patterns to be deleted. The paths are resolved relative to the project folder.
30+
*/
31+
"globsToDelete": ["dist", "lib", "lib-esnext", "lib-umd", "temp"]
32+
}
33+
],
34+
35+
/**
36+
* The list of Heft plugins to be loaded.
37+
*/
38+
"heftPlugins": [
39+
// {
40+
// /**
41+
// * The path to the plugin package.
42+
// */
43+
// "plugin": "path/to/my-plugin",
44+
//
45+
// /**
46+
// * An optional object that provides additional settings that may be defined by the plugin.
47+
// */
48+
// // "options": { }
49+
// }
50+
51+
{
52+
/**
53+
* The path to the plugin package.
54+
*/
55+
"plugin": "@rushstack/heft-jest-plugin"
56+
}
57+
]
58+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@rushstack/heft-jest-plugin/includes/jest-shared.config.json"
3+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"operationSettings": [
3+
{
4+
"operationName": "build",
5+
"outputFolderNames": ["dist", "lib", "lib-esnext", "lib-umd"]
6+
}
7+
]
8+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Configures the TypeScript plugin for Heft. This plugin also manages linting.
3+
*/
4+
{
5+
"$schema": "https://developer.microsoft.com/json-schemas/heft/typescript.schema.json",
6+
7+
/**
8+
* If provided, emit these module kinds in addition to the modules specified in the tsconfig.
9+
* Note that this option only applies to the main tsconfig.json configuration.
10+
*/
11+
"additionalModuleKindsToEmit": [
12+
{
13+
"moduleKind": "esnext",
14+
"outFolderName": "lib-esnext"
15+
},
16+
{
17+
"moduleKind": "umd",
18+
"outFolderName": "lib-umd"
19+
}
20+
]
21+
22+
/**
23+
* If set to "true", the TSlint task will not be invoked.
24+
*/
25+
// "disableTslint": true,
26+
27+
/**
28+
* Set this to change the maximum number of file handles that will be opened concurrently for writing.
29+
* The default is 50.
30+
*/
31+
// "maxWriteParallelism": 50
32+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## API Report File for "heft-typescript-v2-test"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
// @public (undocumented)
8+
export class TestClass {
9+
}
10+
11+
// (No @packageDocumentation comment for this package)
12+
13+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "heft-typescript-v2-test",
3+
"description": "Building this project tests building with TypeScript v2",
4+
"version": "1.0.0",
5+
"private": true,
6+
"main": "lib/index.js",
7+
"license": "MIT",
8+
"scripts": {
9+
"build": "heft build --clean",
10+
"_phase:build": "heft build --clean",
11+
"_phase:test": "heft test --no-build"
12+
},
13+
"devDependencies": {
14+
"@microsoft/api-extractor": "workspace:*",
15+
"@rushstack/heft": "workspace:*",
16+
"@rushstack/heft-jest-plugin": "workspace:*",
17+
"@types/jest": "ts2.9",
18+
"@types/node": "ts2.9",
19+
"tslint": "~5.20.1",
20+
"tslint-microsoft-contrib": "~6.2.0",
21+
"typescript": "~2.9.2"
22+
}
23+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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+
* @public
6+
*/
7+
export class TestClass {} // tslint:disable-line:export-name
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
interface IInterface {
5+
element: string;
6+
}
7+
8+
describe('Example Test', () => {
9+
it('Correctly tests stuff', () => {
10+
expect(true).toBeTruthy();
11+
});
12+
13+
it('Correctly handles snapshots', () => {
14+
expect({ a: 1, b: 2, c: 3 }).toMatchSnapshot();
15+
});
16+
17+
it('Correctly handles TypeScript constructs', () => {
18+
const interfaceInstance: IInterface = {
19+
element: 'a'
20+
};
21+
expect(interfaceInstance).toBeTruthy();
22+
});
23+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Example Test Correctly handles snapshots 1`] = `
4+
Object {
5+
"a": 1,
6+
"b": 2,
7+
"c": 3,
8+
}
9+
`;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "http://json.schemastore.org/tsconfig",
3+
4+
"compilerOptions": {
5+
"outDir": "lib",
6+
"rootDir": "src",
7+
8+
"forceConsistentCasingInFileNames": true,
9+
"jsx": "react",
10+
"declaration": true,
11+
"sourceMap": true,
12+
"declarationMap": true,
13+
"inlineSources": true,
14+
"experimentalDecorators": true,
15+
"strictNullChecks": true,
16+
"noUnusedLocals": true,
17+
"types": ["jest", "node"],
18+
19+
"module": "commonjs",
20+
"target": "es2017",
21+
"lib": ["es2017"]
22+
},
23+
"include": ["src/**/*.ts", "src/**/*.tsx"],
24+
"exclude": ["node_modules", "lib"]
25+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
"$schema": "http://json.schemastore.org/tslint",
3+
4+
"rulesDirectory": ["tslint-microsoft-contrib"],
5+
"rules": {
6+
"class-name": true,
7+
"comment-format": [true, "check-space"],
8+
"curly": true,
9+
"eofline": false,
10+
"export-name": true,
11+
"forin": true,
12+
"indent": [true, "spaces", 2],
13+
"interface-name": true,
14+
"label-position": true,
15+
"max-line-length": [true, 120],
16+
"member-access": true,
17+
"member-ordering": [
18+
true,
19+
{
20+
"order": [
21+
"public-static-field",
22+
"protected-static-field",
23+
"private-static-field",
24+
"public-instance-field",
25+
"protected-instance-field",
26+
"private-instance-field",
27+
"public-static-method",
28+
"protected-static-method",
29+
"private-static-method",
30+
"public-constructor",
31+
"public-instance-method",
32+
"protected-constructor",
33+
"protected-instance-method",
34+
"private-constructor",
35+
"private-instance-method"
36+
]
37+
}
38+
],
39+
"missing-optional-annotation": true,
40+
"no-arg": true,
41+
"no-any": true,
42+
"no-bitwise": true,
43+
"no-consecutive-blank-lines": true,
44+
"no-console": [true, "debug", "info", "time", "timeEnd", "trace"],
45+
"no-constant-condition": true,
46+
"no-construct": true,
47+
"no-debugger": true,
48+
"no-duplicate-switch-case": true,
49+
"no-duplicate-parameter-names": true,
50+
"no-duplicate-variable": true,
51+
"no-empty": true,
52+
"no-eval": true,
53+
"no-floating-promises": true,
54+
"no-function-expression": true,
55+
"no-inferrable-types": false,
56+
"no-internal-module": true,
57+
"no-null-keyword": true,
58+
"no-shadowed-variable": true,
59+
"no-string-literal": true,
60+
"no-switch-case-fall-through": true,
61+
"no-trailing-whitespace": true,
62+
"no-unnecessary-semicolons": true,
63+
"no-unused-expression": true,
64+
"no-with-statement": true,
65+
"no-var-keyword": true,
66+
"object-literal-sort-keys": false,
67+
"one-line": [true, "check-open-brace", "check-catch", "check-else", "check-whitespace"],
68+
"quotemark": [true, "single", "avoid-escape"],
69+
"prefer-const": true,
70+
"radix": true,
71+
"semicolon": true,
72+
"trailing-comma": [
73+
true,
74+
{
75+
"multiline": "never",
76+
"singleline": "never"
77+
}
78+
],
79+
"triple-equals": [true, "allow-null-check"],
80+
"typedef": [
81+
true,
82+
"call-signature",
83+
"parameter",
84+
"property-declaration",
85+
"variable-declaration",
86+
"member-variable-declaration"
87+
],
88+
"typedef-whitespace": [
89+
true,
90+
{
91+
"call-signature": "nospace",
92+
"index-signature": "nospace",
93+
"parameter": "nospace",
94+
"property-declaration": "nospace",
95+
"variable-declaration": "nospace"
96+
}
97+
],
98+
"use-isnan": true,
99+
"use-named-parameter": true,
100+
"variable-name": [true, "check-format", "allow-leading-underscore", "ban-keywords"],
101+
"whitespace": [true, "check-branch", "check-decl", "check-operator", "check-separator", "check-type"]
102+
}
103+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib-*
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
4+
"mainEntryPointFilePath": "<projectFolder>/lib/index.d.ts",
5+
"apiReport": {
6+
"enabled": true,
7+
"reportFolder": "<projectFolder>/etc"
8+
},
9+
"docModel": {
10+
"enabled": true
11+
},
12+
"dtsRollup": {
13+
"enabled": true,
14+
"alphaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-alpha.d.ts",
15+
"betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts"
16+
}
17+
}

0 commit comments

Comments
 (0)