forked from cockpit-project/cockpit-podman
-
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.
TODO: [ ] cockpit-po-plugin [ ] fail on warnings eslint (Open eslint issue eslint/eslint#16804) [ ] string replace loader does not work [ ] css from Patternfly is not being extracted
- Loading branch information
Showing
7 changed files
with
83 additions
and
207 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
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,55 @@ | ||
const copy = require('esbuild-plugin-copy'); | ||
const esbuild = require("esbuild"); | ||
const eslint = require('esbuild-plugin-linter'); | ||
const path = require("path"); | ||
const replacePlugin = require('esbuild-plugin-replace-regex'); | ||
const {sassPlugin } = require('esbuild-sass-plugin') | ||
|
||
const production = process.env.NODE_ENV === 'production'; | ||
/* development options for faster iteration */ | ||
const useEslint = process.env.ESLINT !== '0'; | ||
const watchMode = process.env.ESBUILD_WATCH === "true" || false; | ||
if(watchMode) { | ||
console.log("Running in watch mode"); | ||
} | ||
|
||
nodePaths=[path.resolve(__dirname, 'pkg/lib')] | ||
|
||
esbuild.build({ | ||
// Cockpit's http server is not able to load multiple JS files | ||
bundle: true, | ||
entryPoints: ["./src/index.js"], | ||
// Allow external font files which live in ../../static/fonts | ||
external: ['*.woff', '*.woff2', '*.jpg', '*.svg', '../../assets*'], | ||
// Move all legal comments to a .LEGAL.txt file | ||
legalComments: 'external', | ||
loader: { ".js": "jsx" }, | ||
minify: production, | ||
// List of directories to use when resolving import statements | ||
nodePaths, | ||
outdir: "./dist", | ||
... !production ? { sourcemap: "external" } : {}, | ||
target: ['es2020'], | ||
watch: watchMode, | ||
logLevel: "debug", | ||
plugins: [ | ||
// Esbuild will only copy assets that are explicitly imported and used | ||
// in the code. This is a problem for index.html and manifest.json which are not imported | ||
copy.copy({ | ||
assets: [ | ||
{ from: ['./src/manifest.json'], to: [ './manifest.json' ] }, | ||
{ from: ['./src/index.html'], to: ['./index.html'] }, | ||
] | ||
}), | ||
sassPlugin({ | ||
loadPaths: [...nodePaths, 'node_modules'], quietDeps: true | ||
}), | ||
replacePlugin({ | ||
patterns: [ | ||
[/@font-face[^}]*patternfly-fonts-fake-path[^}]*}/g, ''], | ||
[/src:url\("patternfly-icons-fake-path\/pficon[^}]*/g, 'src:url("../base1/fonts/patternfly.woff") format("woff");'], | ||
] | ||
}), | ||
... useEslint ? [eslint({ filter: /src\/*/ })] : [], | ||
] | ||
}).catch(() => process.exit(1)); |
Submodule node_modules
updated
8081 files
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 was deleted.
Oops, something went wrong.