forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split the webpack 4 and webpack 5 tests out.
- Loading branch information
Showing
27 changed files
with
293 additions
and
94 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
51 changes: 51 additions & 0 deletions
51
build-tests/hashed-folder-copy-plugin-webpack4-test/config/heft.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,51 @@ | ||
/** | ||
* Defines configuration used by core Heft. | ||
*/ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/heft/heft.schema.json", | ||
|
||
"eventActions": [ | ||
{ | ||
/** | ||
* The kind of built-in operation that should be performed. | ||
* The "deleteGlobs" action deletes files or folders that match the | ||
* specified glob patterns. | ||
*/ | ||
"actionKind": "deleteGlobs", | ||
|
||
/** | ||
* The stage of the Heft run during which this action should occur. Note that actions specified in heft.json | ||
* occur at the end of the stage of the Heft run. | ||
*/ | ||
"heftEvent": "clean", | ||
|
||
/** | ||
* A user-defined tag whose purpose is to allow configs to replace/delete handlers that were added by other | ||
* configs. | ||
*/ | ||
"actionId": "defaultClean", | ||
|
||
/** | ||
* Glob patterns to be deleted. The paths are resolved relative to the project folder. | ||
*/ | ||
"globsToDelete": ["lib", "dist-dev", "dist-prod"] | ||
} | ||
], | ||
|
||
/** | ||
* The list of Heft plugins to be loaded. | ||
*/ | ||
"heftPlugins": [ | ||
{ | ||
/** | ||
* The path to the plugin package. | ||
*/ | ||
"plugin": "@rushstack/heft-webpack4-plugin" | ||
|
||
/** | ||
* An optional object that provides additional settings that may be defined by the plugin. | ||
*/ | ||
// "options": { } | ||
} | ||
] | ||
} |
File renamed without changes.
20 changes: 9 additions & 11 deletions
20
...shed-folder-copy-plugin-test/package.json → ...er-copy-plugin-webpack4-test/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 |
---|---|---|
@@ -1,25 +1,23 @@ | ||
{ | ||
"name": "hashed-folder-copy-plugin-test", | ||
"description": "Building this project exercises @rushstack/hashed-folder-copy-plugin.", | ||
"name": "hashed-folder-copy-plugin-webpack4-test", | ||
"description": "Building this project exercises @rushstack/hashed-folder-copy-plugin with Webpack 4.", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"build": "node build.js", | ||
"serve": "node serve.js", | ||
"_phase:build": "node build.js" | ||
"build": "heft build --clean", | ||
"serve": "heft start --clean", | ||
"_phase:build": "heft build --clean" | ||
}, | ||
"dependencies": { | ||
"devDependencies": { | ||
"@rushstack/hashed-folder-copy-plugin": "workspace:*", | ||
"@rushstack/heft-webpack4-plugin": "workspace:*", | ||
"@rushstack/heft": "workspace:*", | ||
"@rushstack/module-minifier-plugin": "workspace:*", | ||
"@rushstack/node-core-library": "workspace:*", | ||
"@rushstack/set-webpack-public-path-plugin": "workspace:*", | ||
"@types/webpack-env": "1.13.0", | ||
"html-webpack-plugin": "~4.5.2", | ||
"ts-loader": "6.0.0", | ||
"typescript": "~4.6.3", | ||
"webpack": "~4.44.2", | ||
"webpack-bundle-analyzer": "~4.5.0", | ||
"webpack-cli": "~3.3.2", | ||
"webpack-dev-server": "~3.11.0" | ||
"webpack": "~4.44.2" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist-* |
Binary file added
BIN
+341 Bytes
build-tests/hashed-folder-copy-plugin-webpack5-test/assets/blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+325 Bytes
build-tests/hashed-folder-copy-plugin-webpack5-test/assets/green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions
51
build-tests/hashed-folder-copy-plugin-webpack5-test/config/heft.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,51 @@ | ||
/** | ||
* Defines configuration used by core Heft. | ||
*/ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/heft/heft.schema.json", | ||
|
||
"eventActions": [ | ||
{ | ||
/** | ||
* The kind of built-in operation that should be performed. | ||
* The "deleteGlobs" action deletes files or folders that match the | ||
* specified glob patterns. | ||
*/ | ||
"actionKind": "deleteGlobs", | ||
|
||
/** | ||
* The stage of the Heft run during which this action should occur. Note that actions specified in heft.json | ||
* occur at the end of the stage of the Heft run. | ||
*/ | ||
"heftEvent": "clean", | ||
|
||
/** | ||
* A user-defined tag whose purpose is to allow configs to replace/delete handlers that were added by other | ||
* configs. | ||
*/ | ||
"actionId": "defaultClean", | ||
|
||
/** | ||
* Glob patterns to be deleted. The paths are resolved relative to the project folder. | ||
*/ | ||
"globsToDelete": ["lib", "dist-dev", "dist-prod"] | ||
} | ||
], | ||
|
||
/** | ||
* The list of Heft plugins to be loaded. | ||
*/ | ||
"heftPlugins": [ | ||
{ | ||
/** | ||
* The path to the plugin package. | ||
*/ | ||
"plugin": "@rushstack/heft-webpack5-plugin" | ||
|
||
/** | ||
* An optional object that provides additional settings that may be defined by the plugin. | ||
*/ | ||
// "options": { } | ||
} | ||
] | ||
} |
8 changes: 8 additions & 0 deletions
8
build-tests/hashed-folder-copy-plugin-webpack5-test/config/rush-project.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,8 @@ | ||
{ | ||
"operationSettings": [ | ||
{ | ||
"operationName": "build", | ||
"outputFolderNames": ["lib", "dist-dev", "dist-prod"] | ||
} | ||
] | ||
} |
21 changes: 21 additions & 0 deletions
21
build-tests/hashed-folder-copy-plugin-webpack5-test/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,21 @@ | ||
{ | ||
"name": "hashed-folder-copy-plugin-webpack5-test", | ||
"description": "Building this project exercises @rushstack/hashed-folder-copy-plugin with Webpack 5. NOTE - THIS TEST IS CURRENTLY EXPECTED TO BE BROKEN", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"build": "heft build --clean", | ||
"serve": "heft start --clean", | ||
"_phase:build": "heft build --clean" | ||
}, | ||
"devDependencies": { | ||
"@rushstack/hashed-folder-copy-plugin": "workspace:*", | ||
"@rushstack/heft-webpack5-plugin": "workspace:*", | ||
"@rushstack/heft": "workspace:*", | ||
"@types/webpack-env": "1.13.0", | ||
"html-webpack-plugin": "~4.5.2", | ||
"typescript": "~4.6.3", | ||
"webpack-bundle-analyzer": "~4.5.0", | ||
"webpack": "~5.68.0" | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
build-tests/hashed-folder-copy-plugin-webpack5-test/src/index.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,25 @@ | ||
import { ASSETS_BASE_URL2 } from './submodule'; | ||
|
||
const ASSETS_BASE_URL: string = requireFolder({ | ||
outputFolder: 'assets_[hash]', | ||
sources: [ | ||
{ | ||
globsBase: '../assets', | ||
globPatterns: ['**/*'] | ||
} | ||
] | ||
}); | ||
|
||
function appendImageToBody(url: string): void { | ||
const image: HTMLImageElement = document.createElement('img'); | ||
image.src = url; | ||
document.body.appendChild(image); | ||
} | ||
|
||
appendImageToBody(`${ASSETS_BASE_URL}/red.png`); | ||
appendImageToBody(`${ASSETS_BASE_URL}/green.png`); | ||
appendImageToBody(`${ASSETS_BASE_URL}/blue.png`); | ||
|
||
appendImageToBody(`${ASSETS_BASE_URL2}/red.png`); | ||
appendImageToBody(`${ASSETS_BASE_URL2}/green.png`); | ||
appendImageToBody(`${ASSETS_BASE_URL2}/blue.png`); |
9 changes: 9 additions & 0 deletions
9
build-tests/hashed-folder-copy-plugin-webpack5-test/src/submodule.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,9 @@ | ||
export const ASSETS_BASE_URL2: string = requireFolder({ | ||
outputFolder: 'assets2_[hash]', | ||
sources: [ | ||
{ | ||
globsBase: '../assets', | ||
globPatterns: ['**/*'] | ||
} | ||
] | ||
}); |
23 changes: 23 additions & 0 deletions
23
build-tests/hashed-folder-copy-plugin-webpack5-test/tsconfig.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,23 @@ | ||
{ | ||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationMap": true, | ||
"experimentalDecorators": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"inlineSources": true, | ||
"jsx": "react", | ||
"lib": ["es5", "scripthost", "es2015.collection", "es2015.promise", "es2015.iterable", "dom"], | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"noUnusedLocals": true, | ||
"sourceMap": true, | ||
"strictNullChecks": true, | ||
"target": "es5", | ||
"types": ["webpack-env", "@rushstack/hashed-folder-copy-plugin/ambientTypes"], | ||
|
||
"outDir": "lib", | ||
"rootDir": "src", | ||
"rootDirs": ["src", "temp/loc-json-ts"] | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.tsx"] | ||
} |
40 changes: 40 additions & 0 deletions
40
build-tests/hashed-folder-copy-plugin-webpack5-test/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,40 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
|
||
const { HashedFolderCopyPlugin } = require('@rushstack/hashed-folder-copy-plugin'); | ||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
|
||
function generateConfiguration(mode, outputFolderName) { | ||
return { | ||
mode: mode, | ||
entry: { | ||
test: path.join(__dirname, 'lib', 'index.js') | ||
}, | ||
output: { | ||
path: path.join(__dirname, outputFolderName), | ||
filename: '[name]_[contenthash].js', | ||
chunkFilename: '[id].[name]_[contenthash].js' | ||
}, | ||
plugins: [ | ||
new webpack.optimize.ModuleConcatenationPlugin(), | ||
new HashedFolderCopyPlugin(), | ||
new BundleAnalyzerPlugin({ | ||
openAnalyzer: false, | ||
analyzerMode: 'static', | ||
reportFilename: path.resolve(__dirname, 'temp', 'stats.html'), | ||
generateStatsFile: true, | ||
statsFilename: path.resolve(__dirname, 'temp', 'stats.json'), | ||
logLevel: 'error' | ||
}), | ||
new HtmlWebpackPlugin() | ||
] | ||
}; | ||
} | ||
|
||
module.exports = [ | ||
generateConfiguration('development', 'dist-dev'), | ||
generateConfiguration('production', 'dist-prod') | ||
]; |
Oops, something went wrong.