-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3204 from microsoft/octogonz/heft-web-rig-revamp
[heft-web-rig] Add an "app" profile, upgrade to Webpack 5, implement new CSS rules
- Loading branch information
Showing
105 changed files
with
6,037 additions
and
4,063 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## Important | ||
|
||
If you change the Heft schemas, be sure to update the example files under **src/templates**. | ||
If you change the Heft schemas, be sure to update the example files under **schemas/templates**. | ||
The templates are used as a reference when updating the website documentation. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This is a workaround for https://github.com/eslint/eslint/issues/3458 | ||
require('@rushstack/eslint-config/patch/modern-module-resolution'); | ||
|
||
module.exports = { | ||
extends: ['@rushstack/eslint-config/profile/web-app', '@rushstack/eslint-config/mixins/react'], | ||
parserOptions: { tsconfigRootDir: __dirname } | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# heft-web-rig-app-tutorial | ||
|
||
This is a copy of the | ||
[heft-web-rig-app-tutorial](https://github.com/microsoft/rushstack-samples/tree/main/heft/heft-web-rig-app-tutorial) | ||
tutorial project from the [rushstack-samples](https://github.com/microsoft/rushstack-samples) repo. | ||
|
||
The copy here serves as a regression test, by using `"workspace:*"` references to the local projects in this repo. | ||
Please update the copy from time to time to keep it in sync with the official tutorial. |
12 changes: 12 additions & 0 deletions
12
build-tests-samples/heft-web-rig-app-tutorial/assets/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>Example Application</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
3 changes: 3 additions & 0 deletions
3
build-tests-samples/heft-web-rig-app-tutorial/config/jest.config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@rushstack/heft-web-rig/profiles/library/config/jest.config.json" | ||
} |
6 changes: 6 additions & 0 deletions
6
build-tests-samples/heft-web-rig-app-tutorial/config/rig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", | ||
|
||
"rigPackageName": "@rushstack/heft-web-rig", | ||
"rigProfile": "library" | ||
} |
28 changes: 28 additions & 0 deletions
28
build-tests-samples/heft-web-rig-app-tutorial/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "heft-web-rig-app-tutorial", | ||
"description": "(Copy of sample project) Building this project is a regression test for Heft", | ||
"version": "1.0.0", | ||
"private": true, | ||
"scripts": { | ||
"build": "heft test --clean", | ||
"start": "heft start", | ||
"_phase:build": "heft build --clean", | ||
"_phase:test": "heft test --no-build" | ||
}, | ||
"dependencies": { | ||
"heft-web-rig-library-tutorial": "workspace:*", | ||
"react": "~16.13.1", | ||
"react-dom": "~16.13.1", | ||
"tslib": "~2.3.1" | ||
}, | ||
"devDependencies": { | ||
"@rushstack/eslint-config": "workspace:*", | ||
"@rushstack/heft-web-rig": "workspace:*", | ||
"@rushstack/heft": "workspace:*", | ||
"@types/heft-jest": "1.0.1", | ||
"@types/react-dom": "16.9.14", | ||
"@types/react": "16.14.23", | ||
"@types/webpack-env": "1.13.0", | ||
"typescript": "~4.5.2" | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
build-tests-samples/heft-web-rig-app-tutorial/src/ExampleApp.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import * as React from 'react'; | ||
import { ToggleSwitch, IToggleEventArgs } from 'heft-web-rig-library-tutorial'; | ||
|
||
/** | ||
* This React component renders the application page. | ||
*/ | ||
export class ExampleApp extends React.Component { | ||
public render(): React.ReactNode { | ||
const appStyle: React.CSSProperties = { | ||
backgroundColor: '#ffffff', | ||
padding: '20px', | ||
margin: '20px', | ||
borderRadius: '5px', | ||
width: '400px' | ||
}; | ||
|
||
return ( | ||
<div style={appStyle}> | ||
<h2>Hello, world!</h2> | ||
<p>Here is an example control:</p> | ||
<ToggleSwitch leftColor={'#800000'} rightColor={'#008000'} onToggle={this._onToggle} /> | ||
|
||
<p>Here is an example image:</p> | ||
<img src={require('./example-image.png')} /> | ||
</div> | ||
); | ||
} | ||
|
||
// React event handlers should be represented as fields instead of methods to ensure the "this" pointer | ||
// is bound correctly. This form does not work with virtual/override inheritance, so use regular methods | ||
// everywhere else. | ||
private _onToggle = (sender: ToggleSwitch, args: IToggleEventArgs): void => { | ||
console.log('Toggle switch changed: ' + args.sliderPosition); | ||
}; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions
11
build-tests-samples/heft-web-rig-app-tutorial/src/start.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* This file gets copied to the "lib" folder because its extension is registered in copy-static-assets.json | ||
* Then Webpack uses css-loader to embed it in the application bundle, and then style-loader applies to the DOM. | ||
*/ | ||
html, | ||
body { | ||
margin: 0; | ||
height: 100%; | ||
background-color: #c0c0c0; | ||
font-family: Tahoma, sans-serif; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
import * as React from 'react'; | ||
import * as ReactDOM from 'react-dom'; | ||
import { ExampleApp } from './ExampleApp'; | ||
|
||
import './start.css'; | ||
|
||
const rootDiv: HTMLElement = document.getElementById('root') as HTMLElement; | ||
ReactDOM.render(<ExampleApp />, rootDiv); |
12 changes: 12 additions & 0 deletions
12
build-tests-samples/heft-web-rig-app-tutorial/src/test/ToggleSwitch.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
|
||
// Note that Jest tests import the CommonJS files (from lib-commonjs/*.js) | ||
// whereas Webpack will import the ESM files (from lib/*.js) | ||
import { ToggleSwitch } from 'heft-web-rig-library-tutorial'; | ||
|
||
describe('ToggleSwitch', () => { | ||
it('can be tested', () => { | ||
expect(ToggleSwitch).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "./node_modules/@rushstack/heft-web-rig/profiles/app/tsconfig-base.json", | ||
"compilerOptions": { | ||
"types": ["heft-jest", "webpack-env"] | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
build-tests-samples/heft-web-rig-app-tutorial/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
const createWebpackConfig = require('@rushstack/heft-web-rig/profiles/app/webpack-base.config'); | ||
|
||
module.exports = function createConfig(env, argv) { | ||
return createWebpackConfig({ | ||
env: env, | ||
argv: argv, | ||
projectRoot: __dirname, | ||
// Documentation: https://webpack.js.org/configuration/ | ||
configOverride: { | ||
resolve: { | ||
alias: { | ||
// Use the bundled library | ||
'heft-web-rig-library-tutorial': | ||
'heft-web-rig-library-tutorial/dist/heft-web-rig-library-tutorial.js' | ||
} | ||
}, | ||
performance: { | ||
hints: env.production ? 'error' : false | ||
// This specifies the bundle size limit that will trigger Webpack's warning saying: | ||
// "The following entrypoint(s) combined asset size exceeds the recommended limit." | ||
// maxEntrypointSize: 500000, | ||
// maxAssetSize: 500000 | ||
} | ||
} | ||
}); | ||
}; |
7 changes: 7 additions & 0 deletions
7
build-tests-samples/heft-web-rig-library-tutorial/.eslintrc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This is a workaround for https://github.com/eslint/eslint/issues/3458 | ||
require('@rushstack/eslint-config/patch/modern-module-resolution'); | ||
|
||
module.exports = { | ||
extends: ['@rushstack/eslint-config/profile/web-app', '@rushstack/eslint-config/mixins/react'], | ||
parserOptions: { tsconfigRootDir: __dirname } | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# heft-web-rig-library-tutorial | ||
|
||
This is a copy of the | ||
[heft-web-rig-library-tutorial](https://github.com/microsoft/rushstack-samples/tree/main/heft/heft-web-rig-library-tutorial) | ||
tutorial project from the [rushstack-samples](https://github.com/microsoft/rushstack-samples) repo. | ||
|
||
The copy here serves as a regression test, by using `"workspace:*"` references to the local projects in this repo. | ||
Please update the copy from time to time to keep it in sync with the official tutorial. |
Oops, something went wrong.