@nuskin/nextgen-header 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package-dist/2630a3e3eab21c607e21.svg +14 -0
- package/package-dist/295183786cd8a1389865.woff +0 -0
- package/package-dist/a4e97f5a2a64f0ab1323.eot +0 -0
- package/package-dist/c94f7671dcc99dce43e2.ttf +0 -0
- package/package-dist/fb6f3c230cb846e25247.gif +0 -0
- package/package-dist/index.css +325 -0
- package/package-dist/index.css.map +1 -1
- package/package-dist/index.d.ts +65 -1
- package/package-dist/index.js +102351 -445
- package/package-dist/index.js.map +1 -1
- package/package-dist/index.mjs +102390 -0
- package/package-dist/index.mjs.map +1 -0
- package/package.json +20 -6
- package/readme.md +14 -3
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/nextgen-header",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Header micro-frontend and npm component library",
|
|
5
5
|
"main": "package-dist/index.js",
|
|
6
6
|
"module": "package-dist/index.mjs",
|
|
7
7
|
"types": "package-dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"start": "nodemon --watch src --ext js,jsx,css --delay 2 --exec \"yarn build && node server-launcher.js\"",
|
|
10
|
-
"build": "
|
|
11
|
-
"build
|
|
12
|
-
"build-
|
|
9
|
+
"start": "nodemon --watch src --ext js,jsx,css --delay 2 --exec \"yarn build:local && node server-launcher.js\"",
|
|
10
|
+
"build": "yarn build:local",
|
|
11
|
+
"build:local": "cross-env CMS_ENV=local yarn build:server:dev && cross-env CMS_ENV=local yarn build:client:dev && yarn build-storybook",
|
|
12
|
+
"build-dev": "cross-env CMS_ENV=dev yarn build:server:dev && cross-env CMS_ENV=dev yarn build:client:dev && yarn build-storybook",
|
|
13
|
+
"build-test": "cross-env CMS_ENV=test yarn build:server:dev && cross-env CMS_ENV=test yarn build:client:dev && yarn build-storybook",
|
|
13
14
|
"build-prod": "cross-env CMS_ENV=prod NODE_ENV=production yarn build:server:prod && cross-env CMS_ENV=prod NODE_ENV=production yarn build:client:prod",
|
|
14
15
|
"build:client:dev": "rimraf --glob dist/*.js dist/*.js.map dist/loadable-stats.json dist/index.html && yarn webpack --mode development --progress --config config/webpack.client.js",
|
|
15
16
|
"build:client:prod": "rimraf --glob dist/*.js dist/*.js.map dist/loadable-stats.json dist/index.html && yarn webpack --mode production --progress --config config/webpack.client.js",
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
"test": "jest",
|
|
19
20
|
"integration-test": "echo 'Integration test not yet implemented'",
|
|
20
21
|
"lint": "eslint src/ --ext .js,.jsx",
|
|
22
|
+
"build-storybook": "cross-env SB_DISABLE_TELEMETRY=1 CI=true storybook build -o dist/storybook",
|
|
21
23
|
"build:package": "rimraf package-dist && webpack --mode production --config config/webpack.library.js && shx cp src/library/index.d.ts package-dist/index.d.ts"
|
|
22
24
|
},
|
|
23
25
|
"keywords": [
|
|
@@ -56,7 +58,10 @@
|
|
|
56
58
|
"contentstack": "^3.26.0",
|
|
57
59
|
"prop-types": "^15.8.0",
|
|
58
60
|
"react": "^18.2.0",
|
|
59
|
-
"react-dom": "^18.2.0"
|
|
61
|
+
"react-dom": "^18.2.0",
|
|
62
|
+
"@mui/icons-material": "^5.0.0",
|
|
63
|
+
"@mui/material": "^5.0.0",
|
|
64
|
+
"@mui/system": "^5.0.0"
|
|
60
65
|
},
|
|
61
66
|
"engines": {
|
|
62
67
|
"node": ">=24.0.0"
|
|
@@ -70,6 +75,11 @@
|
|
|
70
75
|
"@loadable/babel-plugin": "^5.13.2",
|
|
71
76
|
"@loadable/component": "^5.16.4",
|
|
72
77
|
"@loadable/server": "^5.16.5",
|
|
78
|
+
"@mui/icons-material": "^5.15.0",
|
|
79
|
+
"@mui/material": "^5.15.0",
|
|
80
|
+
"@mui/system": "^5.15.0",
|
|
81
|
+
"@nuskin/foundation-theme": "1.8.0",
|
|
82
|
+
"@nuskin/foundation-ui-components": "^2.2.0",
|
|
73
83
|
"contentstack": "^3.26.2",
|
|
74
84
|
"core-js": "^3.39.0",
|
|
75
85
|
"cross-env": "7.0.3",
|
|
@@ -99,6 +109,9 @@
|
|
|
99
109
|
"@loadable/webpack-plugin": "5.15.2",
|
|
100
110
|
"@module-federation/enhanced": "0.15.0",
|
|
101
111
|
"@module-federation/node": "2.7.7",
|
|
112
|
+
"@storybook/addon-a11y": "^8.4.7",
|
|
113
|
+
"@storybook/addon-essentials": "^8.4.7",
|
|
114
|
+
"@storybook/react-webpack5": "^8.4.7",
|
|
102
115
|
"@testing-library/jest-dom": "^6.1.5",
|
|
103
116
|
"@testing-library/react": "^14.1.2",
|
|
104
117
|
"babel-jest": "^29.7.0",
|
|
@@ -116,6 +129,7 @@
|
|
|
116
129
|
"process": "^0.11.10",
|
|
117
130
|
"rimraf": "5.0.8",
|
|
118
131
|
"shx": "^0.4.0",
|
|
132
|
+
"storybook": "^8.4.7",
|
|
119
133
|
"style-loader": "^3.3.0",
|
|
120
134
|
"typescript": "^5.9.3",
|
|
121
135
|
"webpack": "^5.88.0",
|
package/readme.md
CHANGED
|
@@ -96,9 +96,11 @@ For the **webpack / MFE** build, dotenv files are loaded per build via `CMS_ENV`
|
|
|
96
96
|
|
|
97
97
|
| Command | Description |
|
|
98
98
|
|---------|-------------|
|
|
99
|
-
| `yarn start` |
|
|
100
|
-
| `yarn build` |
|
|
99
|
+
| `yarn start` | On each `src/` change: runs **`yarn build:local`** (MFE client + server webpack + **Storybook** static → `dist/storybook/`), then starts the Express server (`server-launcher.js`) |
|
|
100
|
+
| `yarn build` | Same as **`yarn build:local`** |
|
|
101
|
+
| `yarn build:local` | Client + server **webpack** in **development** mode with `CMS_ENV=local`, then **Storybook** static output to `dist/storybook/` (alongside MF assets under `dist/`). **`yarn start`** runs this on each rebuild. Use **`yarn build-prod`** for production mode + minification (**Storybook is not** included on `build-prod`). |
|
|
101
102
|
| `yarn build:package` | **Library** build to `package-dist/` via [`config/webpack.library.js`](config/webpack.library.js) (dual CJS/ESM + extracted CSS + copied `index.d.ts`); required before `npm publish` |
|
|
103
|
+
| `yarn build-storybook` | Storybook static build → **`dist/storybook/`** (included in **`yarn build:local`** / **`yarn start`**; use `CI=true` in automation to avoid interactive prompts) |
|
|
102
104
|
| `yarn test` | Jest + coverage |
|
|
103
105
|
| `yarn lint` | ESLint on `src/` |
|
|
104
106
|
|
|
@@ -120,7 +122,16 @@ The host must load `remoteEntry.js` and consume the `./App` expose.
|
|
|
120
122
|
- `src/utils/config.js` — `getStackConfig()` returns a fixed header content type (internal to that module) and locale from the URL
|
|
121
123
|
- `src/constants.js` — Contentstack credentials from env (used by the webpack/MFE build and internally by `contentstack.js`; not exported from the npm package)
|
|
122
124
|
|
|
123
|
-
The **npm library** currently exports only **`Header`** (the `Main` shell under that name); Contentstack helpers are not part of the published API yet.
|
|
125
|
+
The **npm library** currently exports only **`Header`** (the `Main` shell under that name); Contentstack helpers are not part of the published API yet. Header UI data is loaded from mock **`Header*Service`** modules until real `getContent` wiring; replace **`HEADER_CONTENT_ENTRY_UID`** in [`src/header/constants.js`](src/header/constants.js) when the slug/UID strategy is decided.
|
|
126
|
+
|
|
127
|
+
## Header scaffold (`src/header/`)
|
|
128
|
+
|
|
129
|
+
- **`HeaderView`** — header regions; receives each **`header*Service`** as its own prop. Each region calls async **`get*`** methods on its service (for example **`getLogoCopy`**, **`getNavigationTree`**) in **`useEffect`**, then renders; placeholders show until copy resolves. Click/search handlers still call the same service methods.
|
|
130
|
+
- **`HeaderContainer`** — resolves locale, builds default **`services`** (or uses injected **`services`**) with **`createHeader*Service`**, and passes each service into **`HeaderView`** as explicit props. Server **`renderAndExtractContext`** does not preload header data yet; SSR markup includes the header shell with per-region loading placeholders until real SSR hydration or client fetch completes.
|
|
131
|
+
- **`src/header/constants.js`** — `HEADER_CONTENT_ENTRY_UID` placeholder with **TODO** until the real Contentstack entry UID exists.
|
|
132
|
+
- **Storybook** — [`src/header/components/HeaderView.stories.jsx`](src/header/components/HeaderView.stories.jsx); config under [`.storybook/`](.storybook/). After **`yarn start`** or **`yarn build:local`**, open **`dist/storybook/index.html`** (or serve **`dist/storybook/`**). For a live dev server with HMR on port 6006: `cross-env SB_DISABLE_TELEMETRY=1 npx storybook dev -p 6006`.
|
|
133
|
+
|
|
134
|
+
**TODO:** Exclude **`dist/storybook/`** from production CDN / static deploy when tightening the pipeline (Storybook is for local dev and non-prod review).
|
|
124
135
|
|
|
125
136
|
## GitLab CI
|
|
126
137
|
|