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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ These GitHub repositories provide supplementary resources for Rush Stack:
| [/build-tests/heft-parameter-plugin](./build-tests/heft-parameter-plugin/) | This project contains a Heft plugin that adds a custom parameter to built-in actions |
| [/build-tests/heft-parameter-plugin-test](./build-tests/heft-parameter-plugin-test/) | This project exercises a built-in Heft action with a custom parameter |
| [/build-tests/heft-sass-test](./build-tests/heft-sass-test/) | This project illustrates a minimal tutorial Heft project targeting the web browser runtime |
| [/build-tests/heft-swc-test](./build-tests/heft-swc-test/) | Building this project tests building with SWC |
| [/build-tests/heft-typescript-composite-test](./build-tests/heft-typescript-composite-test/) | Building this project tests behavior of Heft when the tsconfig.json file uses project references. |
| [/build-tests/heft-typescript-v2-test](./build-tests/heft-typescript-v2-test/) | Building this project tests building with TypeScript v2 |
| [/build-tests/heft-typescript-v3-test](./build-tests/heft-typescript-v3-test/) | Building this project tests building with TypeScript v3 |
Expand Down
9 changes: 9 additions & 0 deletions build-tests/heft-swc-test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('local-eslint-config/patch/modern-module-resolution');
// This is a workaround for https://github.com/microsoft/rushstack/issues/3021
require('local-eslint-config/patch/custom-config-package-names');

module.exports = {
extends: ['local-eslint-config/profile/web-app'],
parserOptions: { tsconfigRootDir: __dirname }
};
1 change: 1 addition & 0 deletions build-tests/heft-swc-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib-*
60 changes: 60 additions & 0 deletions build-tests/heft-swc-test/config/heft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft.schema.json",

// TODO: Add comments
"phasesByName": {
"build": {
"cleanFiles": [{ "includeGlobs": ["dist", "lib", "lib-esnext", "lib-es5", "lib-umd", "temp"] }],

"tasksByName": {
"typescript": {
"taskPlugin": {
"pluginPackage": "@rushstack/heft-typescript-plugin"
}
},
"lint": {
"taskDependencies": ["typescript"],
"taskPlugin": {
"pluginPackage": "@rushstack/heft-lint-plugin"
}
},
"transpile": {
"taskDependencies": [],
"taskPlugin": {
"pluginPackage": "@rushstack/heft-isolated-typescript-transpile-plugin",
"options": {
"emitKinds": [
{
"outDir": "lib-commonjs",
"formatOverride": "CommonJS",
"targetOverride": "ESNext"
},
{
"outDir": "lib-esm",
"formatOverride": "ESNext",
"targetOverride": "ESNext"
},
{
"outDir": "lib-es5",
"formatOverride": "ESNext",
"targetOverride": "ES5"
}
]
}
}
}
}
},

"test": {
"phaseDependencies": ["build"],
"tasksByName": {
"jest": {
"taskPlugin": {
"pluginPackage": "@rushstack/heft-jest-plugin"
}
}
}
}
}
}
8 changes: 8 additions & 0 deletions build-tests/heft-swc-test/config/jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@rushstack/heft-jest-plugin/includes/jest-web.config.json",

// Enable code coverage for Jest
"collectCoverage": true,
"coverageDirectory": "<rootDir>/coverage",
"coverageReporters": ["cobertura", "html"]
}
14 changes: 14 additions & 0 deletions build-tests/heft-swc-test/config/rush-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-project.schema.json",

"operationSettings": [
{
"operationName": "_phase:build",
"outputFolderNames": ["lib-commonjs", "lib-dts", "lib-esm", "temp/build"]
},
{
"operationName": "_phase:test",
"outputFolderNames": ["coverage"]
}
]
}
6 changes: 6 additions & 0 deletions build-tests/heft-swc-test/config/typescript.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* Configures the TypeScript plugin for Heft. This plugin also manages linting.
*/
{
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/typescript.schema.json"
}
25 changes: 25 additions & 0 deletions build-tests/heft-swc-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "heft-swc-test",
"description": "Building this project tests building with SWC",
"version": "1.0.0",
"private": true,
"main": "lib/index.js",
"license": "MIT",
"scripts": {
"build": "heft build --clean",
"_phase:build": "heft run --only build -- --clean",
"_phase:test": "heft run --only test -- --clean"
},
"devDependencies": {
"local-eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@rushstack/heft-isolated-typescript-transpile-plugin": "workspace:*",
"@rushstack/heft-jest-plugin": "workspace:*",
"@rushstack/heft-lint-plugin": "workspace:*",
"@rushstack/heft-typescript-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/webpack-env": "1.18.8",
"eslint": "~8.57.0",
"typescript": "~5.8.2"
}
}
7 changes: 7 additions & 0 deletions build-tests/heft-swc-test/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

/**
* @public
*/
export class TestClass {}
23 changes: 23 additions & 0 deletions build-tests/heft-swc-test/src/test/ExampleTest.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

interface IInterface {
element: string;
}

describe('Example Test', () => {
it('Correctly tests stuff', () => {
expect(true).toBeTruthy();
});

it('Correctly handles snapshots', () => {
expect({ a: 1, b: 2, c: 3 }).toMatchSnapshot();
});

it('Correctly handles TypeScript constructs', () => {
const interfaceInstance: IInterface = {
element: 'a'
};
expect(interfaceInstance).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Example Test Correctly handles snapshots 1`] = `
Object {
"a": 1,
"b": 2,
"c": 3,
}
`;
28 changes: 28 additions & 0 deletions build-tests/heft-swc-test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "http://json.schemastore.org/tsconfig",

"compilerOptions": {
"outDir": "lib-esm",
"rootDir": "src",

"forceConsistentCasingInFileNames": true,
"jsx": "react",
"declaration": true,
"sourceMap": true,
"declarationMap": true,
"declarationDir": "lib-dts",
"emitDeclarationOnly": true,
"inlineSources": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"strictNullChecks": true,
"noUnusedLocals": true,
"types": ["heft-jest", "webpack-env"],

"module": "esnext",
"target": "esnext",
"lib": ["esnext"]
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/heft-isolated-typescript-transpile-plugin",
"comment": "Fix source map comment in emitted files. Fix processing of \"outDir\" field to allow normal relative path formats (\"./lib\", or \"lib\" as opposed to \"/lib\").",
"type": "patch"
}
],
"packageName": "@rushstack/heft-isolated-typescript-transpile-plugin"
}
4 changes: 4 additions & 0 deletions common/config/rush/nonbrowser-approved-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@
"name": "@rushstack/heft-dev-cert-plugin",
"allowedCategories": [ "libraries", "tests" ]
},
{
"name": "@rushstack/heft-isolated-typescript-transpile-plugin",
"allowedCategories": [ "tests" ]
},
{
"name": "@rushstack/heft-jest-plugin",
"allowedCategories": [ "libraries", "tests" ]
Expand Down
Loading
Loading