Skip to content

Commit

Permalink
docs: local debug frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
stringang committed Apr 30, 2024
1 parent 17ffe4d commit f5f854f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
31 changes: 31 additions & 0 deletions docs/local-dev-frontend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frontend dev

前端架构:
- react
- patternfly

## build
打包逻辑:
- yarn run build
- yarn clean
- yarn generate(编译 plugin sdk)
- yarn generate-graphql(`graphql-codegen --config graphql-codegen.yml`)
- yarn build-plugin-sdk(`yarn --cwd packages/console-dynamic-plugin-sdk build`)
- yarn clean && yarn validate && yarn compile && yarn generate
- yarn build-console-plugin-shared(`yarn --cwd packages/console-plugin-shared build`)
- yarn ts-node ./node_modules/.bin/webpack(编译主包)

优化:
- type check
- SWC

## entrypoint

## console extensions
console 插件:
- static plugin(`package.json.consolePlugin.entry`)
- dynamic plugin(`console-extensions.json`)


- 核心模块`@console/app`,项目工程[位于](../frontend/packages/console-app)

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"clean": "rm -rf ./public/dist",
"dev": "yarn clean && yarn generate && REACT_REFRESH=true NODE_OPTIONS=--max-old-space-size=4096 yarn ts-node ./node_modules/.bin/webpack serve --mode=development --progress",
"dev-once": "yarn clean && yarn generate && NODE_OPTIONS=--max-old-space-size=4096 yarn ts-node ./node_modules/.bin/webpack --mode=development",
"dev-debug": "NODE_OPTIONS=--max-old-space-size=4096 TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' TS_NODE_TRANSPILE_ONLY=true TS_NODE_DEBUG=true node --inspect-brk --require ts-node/register ./node_modules/.bin/webpack --mode=development",
"build": "yarn clean && yarn generate && NODE_ENV=production NODE_OPTIONS=--max-old-space-size=4096 yarn ts-node ./node_modules/.bin/webpack --mode=production",
"check-cycles": "CHECK_CYCLES=true yarn dev-once",
"coverage": "jest --coverage .",
Expand Down
3 changes: 2 additions & 1 deletion frontend/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ const config: Configuration = {
]),
extractCSS,
virtualModules,
// console plugin 打包
new ConsoleActivePluginsModule(resolvePluginPackages(), virtualModules),
...(REACT_REFRESH
? [
Expand All @@ -275,7 +276,7 @@ const config: Configuration = {
: []),
],
devtool: 'cheap-module-source-map',
stats: 'minimal',
stats: 'verbose',
};

if (CHECK_CYCLES === 'true') {
Expand Down

0 comments on commit f5f854f

Please sign in to comment.