Skip to content

Commit

Permalink
Move ESM Patternfly generator to Spog UI
Browse files Browse the repository at this point in the history
Signed-off-by: carlosthe19916 <[email protected]>
  • Loading branch information
carlosthe19916 authored and ctron committed Oct 10, 2023
1 parent 74476f3 commit 0256051
Show file tree
Hide file tree
Showing 14 changed files with 18,924 additions and 0 deletions.
1 change: 1 addition & 0 deletions spog/ui/patternfly-charts/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GENERATE_SOURCEMAP=false
2 changes: 2 additions & 0 deletions spog/ui/patternfly-charts/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/**
build/**
25 changes: 25 additions & 0 deletions spog/ui/patternfly-charts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

.idea
7 changes: 7 additions & 0 deletions spog/ui/patternfly-charts/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"arrowParens": "always",
"printWidth": 100,
"singleQuote": true,
"jsxSingleQuote": false,
"trailingComma": "all"
}
20 changes: 20 additions & 0 deletions spog/ui/patternfly-charts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Patternfly charts

This folder contains the code for creating `spog/ui/crates/donut/js/main.js` which allows us to create Patternfly Charts

## Make changes

- Install dependencies:

```
npm ci
```

- Make the changes needed
- Generate the bundle ESM files:

```
npm run build
```

> The command `npm run build` should automatically overwrite the file `spog/ui/crates/donut/js/main.js` with the new value
47 changes: 47 additions & 0 deletions spog/ui/patternfly-charts/craco.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
module.exports = {
webpack: {
configure: (webpackConfig) => {
webpackConfig.output = {
...webpackConfig.output,
filename: 'static/js/main.js',

library: {
type: 'module',
},
libraryTarget: 'module',
};
webpackConfig.experiments = {
outputModule: true,
};
webpackConfig.optimization = {
...webpackConfig.optimization,
runtimeChunk: false, // For single main.js
splitChunks: {
cacheGroups: {
default: false,
vendors: false,
},
},
};

// inline all assets into the JS bundle
webpackConfig.module.rules[0].oneOf.unshift({
test: /\.(png|jpg|jpeg|woff|woff2|eot|ttf|svg)$/,
type: 'asset/inline',
});

return webpackConfig;
},
},
plugins: [
{
plugin: {
overrideWebpackConfig: ({ webpackConfig }) => {
webpackConfig.plugins[5].options.filename = 'static/css/[name].css';
return webpackConfig;
},
},
options: {},
},
],
};
Loading

0 comments on commit 0256051

Please sign in to comment.