@justeattakeaway/pie-webc 0.0.0-snapshot-release-20240501131344 → 0.0.0-snapshot-release-20240501160411

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 (58) hide show
  1. package/add-components.js +86 -0
  2. package/components/assistive-text.d.ts +1 -0
  3. package/components/assistive-text.js +1 -0
  4. package/components/card.d.ts +1 -0
  5. package/components/card.js +1 -0
  6. package/components/checkbox.d.ts +1 -0
  7. package/components/checkbox.js +1 -0
  8. package/components/chip.d.ts +1 -0
  9. package/components/chip.js +1 -0
  10. package/components/cookie-banner.d.ts +1 -0
  11. package/components/cookie-banner.js +1 -0
  12. package/components/divider.d.ts +1 -0
  13. package/components/divider.js +1 -0
  14. package/components/form-label.d.ts +1 -0
  15. package/components/form-label.js +1 -0
  16. package/components/icon-button.d.ts +1 -0
  17. package/components/icon-button.js +1 -0
  18. package/components/input.d.ts +1 -0
  19. package/components/input.js +1 -0
  20. package/components/link.d.ts +1 -0
  21. package/components/link.js +1 -0
  22. package/components/notification.d.ts +1 -0
  23. package/components/notification.js +1 -0
  24. package/components/spinner.d.ts +1 -0
  25. package/components/spinner.js +1 -0
  26. package/components/switch.d.ts +1 -0
  27. package/components/switch.js +1 -0
  28. package/components/tag.d.ts +1 -0
  29. package/components/tag.js +1 -0
  30. package/package.json +160 -3
  31. package/react/assistive-text.d.ts +1 -0
  32. package/react/assistive-text.js +1 -0
  33. package/react/card.d.ts +1 -0
  34. package/react/card.js +1 -0
  35. package/react/checkbox.d.ts +1 -0
  36. package/react/checkbox.js +1 -0
  37. package/react/chip.d.ts +1 -0
  38. package/react/chip.js +1 -0
  39. package/react/cookie-banner.d.ts +1 -0
  40. package/react/cookie-banner.js +1 -0
  41. package/react/divider.d.ts +1 -0
  42. package/react/divider.js +1 -0
  43. package/react/form-label.d.ts +1 -0
  44. package/react/form-label.js +1 -0
  45. package/react/icon-button.d.ts +1 -0
  46. package/react/icon-button.js +1 -0
  47. package/react/input.d.ts +1 -0
  48. package/react/input.js +1 -0
  49. package/react/link.d.ts +1 -0
  50. package/react/link.js +1 -0
  51. package/react/notification.d.ts +1 -0
  52. package/react/notification.js +1 -0
  53. package/react/spinner.d.ts +1 -0
  54. package/react/spinner.js +1 -0
  55. package/react/switch.d.ts +1 -0
  56. package/react/switch.js +1 -0
  57. package/react/tag.d.ts +1 -0
  58. package/react/tag.js +1 -0
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+
5
+ const workingDir = process.cwd();
6
+
7
+ // Function to check if the script is run from the expected directory
8
+ function verifyRootDirectory (expectedPackageName) {
9
+ const packageJsonPath = path.join(workingDir, 'package.json');
10
+ if (!fs.existsSync(packageJsonPath)) {
11
+ console.error('Error: Please run this script from the root of the monorepo.');
12
+ process.exit(1);
13
+ }
14
+
15
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
16
+ if (packageJson.name !== expectedPackageName) {
17
+ console.error('Error: Please run this script from the root of the monorepo.');
18
+ process.exit(1);
19
+ }
20
+ }
21
+
22
+ // Ensure the script is run from the root of the monorepo
23
+ verifyRootDirectory('pie-monorepo');
24
+
25
+ const componentsSourceDir = path.resolve('packages/components');
26
+ const pieWebcDir = path.join(componentsSourceDir, 'pie-webc');
27
+ const componentsTargetDir = path.join(pieWebcDir, 'components');
28
+ const reactTargetDir = path.join(pieWebcDir, 'react');
29
+ const pieWebcPackageJsonPath = path.join(pieWebcDir, 'package.json');
30
+ const excludedFolders = ['pie-webc', 'pie-webc-core', 'pie-webc-testing'];
31
+
32
+ // Read and parse the package.json of pie-webc
33
+ const pieWebcPackageJsonData = fs.readFileSync(pieWebcPackageJsonPath, 'utf-8');
34
+ const pieWebcPackageJson = JSON.parse(pieWebcPackageJsonData);
35
+ pieWebcPackageJson.exports = pieWebcPackageJson.exports || {};
36
+ pieWebcPackageJson.dependencies = pieWebcPackageJson.dependencies || {};
37
+
38
+ // Ensure target 'components' and 'react' directories exist
39
+ if (!fs.existsSync(componentsTargetDir)) {
40
+ fs.mkdirSync(componentsTargetDir, { recursive: true });
41
+ }
42
+
43
+ if (!fs.existsSync(reactTargetDir)) {
44
+ fs.mkdirSync(reactTargetDir, { recursive: true });
45
+ }
46
+
47
+ // Loop over all pie component packages and add them to pie-webc
48
+ fs.readdirSync(componentsSourceDir).forEach((folder) => {
49
+ if (folder.startsWith('pie-') && !excludedFolders.includes(folder)) {
50
+ const fullFolderPath = path.join(componentsSourceDir, folder);
51
+ const componentName = folder.replace('pie-', '');
52
+ const packageName = `@justeattakeaway/${folder}`;
53
+ const componentPackageJsonPath = path.join(fullFolderPath, 'package.json');
54
+ const componentPackageJsonData = fs.readFileSync(componentPackageJsonPath, 'utf-8');
55
+ const componentPackageJson = JSON.parse(componentPackageJsonData);
56
+
57
+ // Add the component package as a dependency to pie-webc
58
+ pieWebcPackageJson.dependencies[packageName] = componentPackageJson.version;
59
+
60
+ const targets = [
61
+ { dir: componentsTargetDir, type: 'components', exportPath: packageName },
62
+ { dir: reactTargetDir, type: 'react', exportPath: `${packageName}/dist/react.js` }
63
+ ];
64
+
65
+ // Create the js and d.ts files for the component in the target directories
66
+ targets.forEach((target) => {
67
+ const jsFilePath = path.join(target.dir, `${componentName}.js`);
68
+ const tsFilePath = path.join(target.dir, `${componentName}.d.ts`);
69
+
70
+ const fileContent = `export * from '${target.exportPath}';\n`;
71
+ fs.writeFileSync(jsFilePath, fileContent);
72
+ fs.writeFileSync(tsFilePath, fileContent);
73
+
74
+ // Update exports in the pie-webc package.json to include the component
75
+ pieWebcPackageJson.exports[`./${target.type}/${componentName}.js`] = {
76
+ import: `./${target.type}/${componentName}.js`,
77
+ require: `./${target.type}/${componentName}.js`,
78
+ types: `./${target.type}/${componentName}.d.ts`,
79
+ };
80
+ });
81
+ }
82
+ });
83
+
84
+ // Write updates back to the package.json
85
+ fs.writeFileSync(pieWebcPackageJsonPath, `${JSON.stringify(pieWebcPackageJson, null, 2)}\n`);
86
+ console.log('All components added to pie-webc');
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-assistive-text';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-assistive-text';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-card';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-card';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-checkbox';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-checkbox';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-chip';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-chip';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-cookie-banner';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-cookie-banner';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-divider';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-divider';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-form-label';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-form-label';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-icon-button';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-icon-button';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-input';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-input';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-link';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-link';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-notification';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-notification';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-spinner';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-spinner';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-switch';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-switch';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-tag';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-tag';
package/package.json CHANGED
@@ -1,13 +1,23 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-webc",
3
3
  "description": "Component bundle containing all PIE web components",
4
- "version": "0.0.0-snapshot-release-20240501131344",
4
+ "version": "0.0.0-snapshot-release-20240501160411",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "**/*.js",
8
8
  "**/*.d.ts"
9
9
  ],
10
10
  "exports": {
11
+ "./components/assistive-text.js": {
12
+ "import": "./components/assistive-text.js",
13
+ "require": "./components/assistive-text.js",
14
+ "types": "./components/assistive-text.d.ts"
15
+ },
16
+ "./react/assistive-text.js": {
17
+ "import": "./react/assistive-text.js",
18
+ "require": "./react/assistive-text.js",
19
+ "types": "./react/assistive-text.d.ts"
20
+ },
11
21
  "./components/button.js": {
12
22
  "import": "./components/button.js",
13
23
  "require": "./components/button.js",
@@ -18,6 +28,96 @@
18
28
  "require": "./react/button.js",
19
29
  "types": "./react/button.d.ts"
20
30
  },
31
+ "./components/card.js": {
32
+ "import": "./components/card.js",
33
+ "require": "./components/card.js",
34
+ "types": "./components/card.d.ts"
35
+ },
36
+ "./react/card.js": {
37
+ "import": "./react/card.js",
38
+ "require": "./react/card.js",
39
+ "types": "./react/card.d.ts"
40
+ },
41
+ "./components/checkbox.js": {
42
+ "import": "./components/checkbox.js",
43
+ "require": "./components/checkbox.js",
44
+ "types": "./components/checkbox.d.ts"
45
+ },
46
+ "./react/checkbox.js": {
47
+ "import": "./react/checkbox.js",
48
+ "require": "./react/checkbox.js",
49
+ "types": "./react/checkbox.d.ts"
50
+ },
51
+ "./components/chip.js": {
52
+ "import": "./components/chip.js",
53
+ "require": "./components/chip.js",
54
+ "types": "./components/chip.d.ts"
55
+ },
56
+ "./react/chip.js": {
57
+ "import": "./react/chip.js",
58
+ "require": "./react/chip.js",
59
+ "types": "./react/chip.d.ts"
60
+ },
61
+ "./components/cookie-banner.js": {
62
+ "import": "./components/cookie-banner.js",
63
+ "require": "./components/cookie-banner.js",
64
+ "types": "./components/cookie-banner.d.ts"
65
+ },
66
+ "./react/cookie-banner.js": {
67
+ "import": "./react/cookie-banner.js",
68
+ "require": "./react/cookie-banner.js",
69
+ "types": "./react/cookie-banner.d.ts"
70
+ },
71
+ "./components/divider.js": {
72
+ "import": "./components/divider.js",
73
+ "require": "./components/divider.js",
74
+ "types": "./components/divider.d.ts"
75
+ },
76
+ "./react/divider.js": {
77
+ "import": "./react/divider.js",
78
+ "require": "./react/divider.js",
79
+ "types": "./react/divider.d.ts"
80
+ },
81
+ "./components/form-label.js": {
82
+ "import": "./components/form-label.js",
83
+ "require": "./components/form-label.js",
84
+ "types": "./components/form-label.d.ts"
85
+ },
86
+ "./react/form-label.js": {
87
+ "import": "./react/form-label.js",
88
+ "require": "./react/form-label.js",
89
+ "types": "./react/form-label.d.ts"
90
+ },
91
+ "./components/icon-button.js": {
92
+ "import": "./components/icon-button.js",
93
+ "require": "./components/icon-button.js",
94
+ "types": "./components/icon-button.d.ts"
95
+ },
96
+ "./react/icon-button.js": {
97
+ "import": "./react/icon-button.js",
98
+ "require": "./react/icon-button.js",
99
+ "types": "./react/icon-button.d.ts"
100
+ },
101
+ "./components/input.js": {
102
+ "import": "./components/input.js",
103
+ "require": "./components/input.js",
104
+ "types": "./components/input.d.ts"
105
+ },
106
+ "./react/input.js": {
107
+ "import": "./react/input.js",
108
+ "require": "./react/input.js",
109
+ "types": "./react/input.d.ts"
110
+ },
111
+ "./components/link.js": {
112
+ "import": "./components/link.js",
113
+ "require": "./components/link.js",
114
+ "types": "./components/link.d.ts"
115
+ },
116
+ "./react/link.js": {
117
+ "import": "./react/link.js",
118
+ "require": "./react/link.js",
119
+ "types": "./react/link.d.ts"
120
+ },
21
121
  "./components/modal.js": {
22
122
  "import": "./components/modal.js",
23
123
  "require": "./components/modal.js",
@@ -27,8 +127,51 @@
27
127
  "import": "./react/modal.js",
28
128
  "require": "./react/modal.js",
29
129
  "types": "./react/modal.d.ts"
130
+ },
131
+ "./components/notification.js": {
132
+ "import": "./components/notification.js",
133
+ "require": "./components/notification.js",
134
+ "types": "./components/notification.d.ts"
135
+ },
136
+ "./react/notification.js": {
137
+ "import": "./react/notification.js",
138
+ "require": "./react/notification.js",
139
+ "types": "./react/notification.d.ts"
140
+ },
141
+ "./components/spinner.js": {
142
+ "import": "./components/spinner.js",
143
+ "require": "./components/spinner.js",
144
+ "types": "./components/spinner.d.ts"
145
+ },
146
+ "./react/spinner.js": {
147
+ "import": "./react/spinner.js",
148
+ "require": "./react/spinner.js",
149
+ "types": "./react/spinner.d.ts"
150
+ },
151
+ "./components/switch.js": {
152
+ "import": "./components/switch.js",
153
+ "require": "./components/switch.js",
154
+ "types": "./components/switch.d.ts"
155
+ },
156
+ "./react/switch.js": {
157
+ "import": "./react/switch.js",
158
+ "require": "./react/switch.js",
159
+ "types": "./react/switch.d.ts"
160
+ },
161
+ "./components/tag.js": {
162
+ "import": "./components/tag.js",
163
+ "require": "./components/tag.js",
164
+ "types": "./components/tag.d.ts"
165
+ },
166
+ "./react/tag.js": {
167
+ "import": "./react/tag.js",
168
+ "require": "./react/tag.js",
169
+ "types": "./react/tag.d.ts"
30
170
  }
31
171
  },
172
+ "bin": {
173
+ "add-components": "./add-components.js"
174
+ },
32
175
  "scripts": {
33
176
  "lint:scripts": "run -T eslint .",
34
177
  "lint:scripts:fix": "yarn lint:scripts --fix",
@@ -43,8 +186,22 @@
43
186
  "@justeattakeaway/pie-components-config": "0.16.0"
44
187
  },
45
188
  "dependencies": {
46
- "@justeattakeaway/pie-button": "0.0.0-snapshot-release-20240501131344",
47
- "@justeattakeaway/pie-modal": "0.0.0-snapshot-release-20240501131344"
189
+ "@justeattakeaway/pie-assistive-text": "0.3.5",
190
+ "@justeattakeaway/pie-button": "0.47.3",
191
+ "@justeattakeaway/pie-card": "0.19.3",
192
+ "@justeattakeaway/pie-checkbox": "0.0.0",
193
+ "@justeattakeaway/pie-chip": "0.6.1",
194
+ "@justeattakeaway/pie-cookie-banner": "0.19.5",
195
+ "@justeattakeaway/pie-divider": "0.13.3",
196
+ "@justeattakeaway/pie-form-label": "0.13.3",
197
+ "@justeattakeaway/pie-icon-button": "0.28.4",
198
+ "@justeattakeaway/pie-input": "0.18.1",
199
+ "@justeattakeaway/pie-link": "0.17.3",
200
+ "@justeattakeaway/pie-modal": "0.42.4",
201
+ "@justeattakeaway/pie-notification": "0.5.4",
202
+ "@justeattakeaway/pie-spinner": "0.6.3",
203
+ "@justeattakeaway/pie-switch": "0.29.3",
204
+ "@justeattakeaway/pie-tag": "0.9.4"
48
205
  },
49
206
  "volta": {
50
207
  "extends": "../../../package.json"
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-assistive-text/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-assistive-text/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-card/dist/react.js';
package/react/card.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-card/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-checkbox/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-checkbox/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-chip/dist/react.js';
package/react/chip.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-chip/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-cookie-banner/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-cookie-banner/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-divider/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-divider/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-form-label/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-form-label/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-icon-button/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-icon-button/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-input/dist/react.js';
package/react/input.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-input/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-link/dist/react.js';
package/react/link.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-link/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-notification/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-notification/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-spinner/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-spinner/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-switch/dist/react.js';
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-switch/dist/react.js';
package/react/tag.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-tag/dist/react.js';
package/react/tag.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@justeattakeaway/pie-tag/dist/react.js';