-
Notifications
You must be signed in to change notification settings - Fork 627
[heft-web-rig] Add an "app" profile, upgrade to Webpack 5, implement new CSS rules #3204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
ba04506
Bring over prototype of updated heft-web-rig
octogonz 05a01b4
Sync some changes to heft-node-rig
octogonz 2e691b6
Relink workspaces dependencies
octogonz 44827a2
Sync dependencies
octogonz bd7212a
rush update --full
octogonz fd483cc
Fix a Jest test that failed on Windows OS
octogonz 74ec89a
Reenable strictPeerDependencies=true, upgrade PNPM, and solve all the…
octogonz f0a227e
rush update --full
octogonz 99777c9
Fix up projects so everything builds successfully
octogonz 9b98c7e
Merge remote-tracking branch 'remotes/origin/master' into octogonz/he…
octogonz 4b3547e
rush change
octogonz c458420
rush change
octogonz 4728061
Merge remote-tracking branch 'remotes/origin/master' into octogonz/he…
octogonz b00dbe3
PR feedback -- we're not ready to release 1.0.0 yet
octogonz 2824e3c
PR feedback rush-project.json "outputFolderNames" should match heft.j…
octogonz 02e3346
Update rigs/heft-web-rig/profiles/library/config/typescript.json
octogonz 28b938b
Update rigs/heft-web-rig/profiles/app/config/typescript.json
octogonz 6295160
Update rigs/heft-web-rig/shared/webpack-base.config.js
octogonz 7baea3b
Merge branch 'octogonz/heft-web-rig-revamp' of https://github.com/mic…
octogonz 9fa72da
Convert "webpack" to be a peer dependency of "heft-webpack?-plugin". …
octogonz d6eca76
rush update --full
octogonz 2f44260
rush change
octogonz 7c0aa06
rush rebuild
octogonz deee2f2
Enable (optional) bundling of library projects
octogonz 57a632d
Add test projects
octogonz b70867b
rush update
octogonz e8f1ae8
Fix some issues with the Webpack config
octogonz a1bab5f
Example app now builds an runs
octogonz 198b595
PR feedback - cosmetic issues
octogonz 5436f15
Regenerate README.md
octogonz 770ff15
PR feedback -- remove @types/webpack-dev-server
octogonz 4d05712
Show how to configure heft-web-rig-app-tutorial to consume the librar…
octogonz 4fed4d3
PR feedback: Replace "file-loader" with asset modules, and update the…
octogonz 9aeadf2
rush update
octogonz 1c3388d
Move src/templates -> src/schemas/templates to make this folder more …
octogonz f04d5f7
Bring back the template for sass.json, which got inadvertently delete…
octogonz 72ad161
Replace sass-loader with heft-sass-plugin (work in progress, NOT WORK…
octogonz bccec15
Temporarily revert the sass.json features from 9aeadf28d49c6a9dc19811…
octogonz 5ccbe25
Fix an issue where source maps weren't loaded for library projects
octogonz da1d200
rush change
octogonz bb0edf2
Merge remote-tracking branch 'remotes/origin/master' into octogonz/he…
octogonz 06f121a
rush update --full
octogonz 55ef407
Update README.md
octogonz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.