@justeattakeaway/generator-pie-component 0.29.2 → 0.30.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.
Files changed (2) hide show
  1. package/README.md +32 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -18,9 +18,8 @@
18
18
 
19
19
  1. [Installation](#installation)
20
20
  2. [Generate the component](#generating-a-new-component)
21
- 3. [Add the component to storybook](#setting-up-storybook)
22
- 4. [Set up Percy visual regression testing](#setting-up-visual-regression-testing)
23
- 5. [Set up the project label for GitHub](#setting-up-the-project-label-for-github)
21
+ 3. [Set up Percy visual regression testing](#setting-up-visual-regression-testing)
22
+ 4. [Export sub components](#exporting-sub-components)
24
23
 
25
24
  ### Installation
26
25
 
@@ -48,6 +47,36 @@ Once you have completed all the prompts, your scaffolded component will be gener
48
47
  - From the "Project settings" page, copy the project token value.
49
48
  - You need to add the new token value as a repository secret in GitHub. It must be named `PERCY_TOKEN_PIE_COMPONENT_NAME`. Visual tests will not work/run if this is not set up correctly.
50
49
 
50
+ ### Exporting Sub-Components
51
+
52
+ The generator *does not* currently support automatic generation of sub-components. To add a sub-component, follow these steps:
53
+
54
+ - Create a folder inside the component's src directory with the sub-component’s name (e.g., pie-breadcrumb-item).
55
+ - Add the following files to the new folder:
56
+ - [index.ts](https://gist.github.com/raoufswe/8ed0f8aa148755520729c1cf732f2d70#indexts) – contains the component logic.
57
+ - [defs.ts](https://gist.github.com/raoufswe/8ed0f8aa148755520729c1cf732f2d70#defsts) – provides the component types.
58
+ - [defs-react.ts](https://gist.github.com/raoufswe/8ed0f8aa148755520729c1cf732f2d70#defs-reactts) – provides the React wrapper type.
59
+ - Modify the component's `vite.config.ts` to match the following:
60
+
61
+ ```
62
+ export default viteConfig({
63
+ build: {
64
+ lib: {
65
+ entry: {
66
+ 'pie-sub-component/index': 'src/pie-sub-component/index.ts',
67
+ 'pie-sub-component/react': 'src/pie-sub-component/react.ts',
68
+ },
69
+ },
70
+ },
71
+ dtsConfig: {
72
+ entryRoot: 'src',
73
+ rollupTypes: false,
74
+ },
75
+ });
76
+ ```
77
+
78
+ - Run `npx add-components` from the monorepo root to update the `webc` package exports.
79
+
51
80
  ## Local development
52
81
 
53
82
  Install the dependencies. Note that this, and the following commands below, should be run from the **root of the monorepo**:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justeattakeaway/generator-pie-component",
3
- "version": "0.29.2",
3
+ "version": "0.30.0",
4
4
  "description": "A generator for PIE Web Components",
5
5
  "repository": {
6
6
  "type": "git",