@justeattakeaway/pie-webc 0.0.0-snapshot-release-20250313112810 → 0.0.0-snapshot-release-20250314132605
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@justeattakeaway/pie-select/dist/pie-select-option';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@justeattakeaway/pie-select/dist/pie-select-option';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
4
|
+
"version": "0.0.0-snapshot-release-20250314132605",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/justeattakeaway/pie",
|
|
@@ -184,6 +184,16 @@
|
|
|
184
184
|
"require": "./react/select.js",
|
|
185
185
|
"types": "./react/select.d.ts"
|
|
186
186
|
},
|
|
187
|
+
"./components/select-option.js": {
|
|
188
|
+
"import": "./components/select/select-option.js",
|
|
189
|
+
"require": "./components/select/select-option.js",
|
|
190
|
+
"types": "./components/select/select-option.d.ts"
|
|
191
|
+
},
|
|
192
|
+
"./react/select-option.js": {
|
|
193
|
+
"import": "./react/select/select-option.js",
|
|
194
|
+
"require": "./react/select/select-option.js",
|
|
195
|
+
"types": "./react/select/select-option.d.ts"
|
|
196
|
+
},
|
|
187
197
|
"./components/spinner.js": {
|
|
188
198
|
"import": "./components/spinner.js",
|
|
189
199
|
"require": "./components/spinner.js",
|
|
@@ -287,7 +297,7 @@
|
|
|
287
297
|
"@justeattakeaway/pie-checkbox": "0.14.3",
|
|
288
298
|
"@justeattakeaway/pie-checkbox-group": "0.7.12",
|
|
289
299
|
"@justeattakeaway/pie-chip": "0.10.2",
|
|
290
|
-
"@justeattakeaway/pie-cookie-banner": "1.4.
|
|
300
|
+
"@justeattakeaway/pie-cookie-banner": "1.4.1",
|
|
291
301
|
"@justeattakeaway/pie-divider": "1.2.1",
|
|
292
302
|
"@justeattakeaway/pie-form-label": "0.14.5",
|
|
293
303
|
"@justeattakeaway/pie-icon-button": "1.3.2",
|
|
@@ -297,7 +307,7 @@
|
|
|
297
307
|
"@justeattakeaway/pie-notification": "0.12.15",
|
|
298
308
|
"@justeattakeaway/pie-radio": "0.9.1",
|
|
299
309
|
"@justeattakeaway/pie-radio-group": "0.7.3",
|
|
300
|
-
"@justeattakeaway/pie-select": "0.0.0-snapshot-release-
|
|
310
|
+
"@justeattakeaway/pie-select": "0.0.0-snapshot-release-20250314132605",
|
|
301
311
|
"@justeattakeaway/pie-spinner": "1.0.1",
|
|
302
312
|
"@justeattakeaway/pie-switch": "1.2.2",
|
|
303
313
|
"@justeattakeaway/pie-tag": "0.15.0",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@justeattakeaway/pie-select/dist/pie-select-option/react.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@justeattakeaway/pie-select/dist/pie-select-option/react.js';
|
package/src/componentService.js
CHANGED
|
@@ -74,20 +74,19 @@ export class ComponentService {
|
|
|
74
74
|
/**
|
|
75
75
|
* Creates the exports for a component to be added to the pie-webc package.json.
|
|
76
76
|
* @param {string} componentName - The name of the component to create exports for, omitting the `'pie-'` prefix.
|
|
77
|
+
* @param {string} [parentComponentName] - The name of the parent component, omitting the `'pie-'` prefix.
|
|
77
78
|
* @returns {Object} - An object containing the exports for the component.
|
|
78
79
|
*/
|
|
79
|
-
createPackageJsonExports (componentName) {
|
|
80
|
+
createPackageJsonExports (componentName, parentComponentName) {
|
|
81
|
+
const createExportPath = (pathPrefix) => ({
|
|
82
|
+
import: `${pathPrefix}/${componentName}.js`,
|
|
83
|
+
require: `${pathPrefix}/${componentName}.js`,
|
|
84
|
+
types: `${pathPrefix}/${componentName}.d.ts`,
|
|
85
|
+
});
|
|
86
|
+
|
|
80
87
|
const exports = {
|
|
81
|
-
[`./components/${componentName}.js`]: {
|
|
82
|
-
|
|
83
|
-
require: `./components/${componentName}.js`,
|
|
84
|
-
types: `./components/${componentName}.d.ts`,
|
|
85
|
-
},
|
|
86
|
-
[`./react/${componentName}.js`]: {
|
|
87
|
-
import: `./react/${componentName}.js`,
|
|
88
|
-
require: `./react/${componentName}.js`,
|
|
89
|
-
types: `./react/${componentName}.d.ts`,
|
|
90
|
-
},
|
|
88
|
+
[`./components/${componentName}.js`]: createExportPath(`./components${parentComponentName ? `/${parentComponentName}` : ''}`),
|
|
89
|
+
[`./react/${componentName}.js`]: createExportPath(`./react${parentComponentName ? `/${parentComponentName}` : ''}`),
|
|
91
90
|
};
|
|
92
91
|
|
|
93
92
|
return exports;
|
|
@@ -121,6 +120,25 @@ export class ComponentService {
|
|
|
121
120
|
this.fs.writeFileSync(path, `${JSON.stringify(content, null, 2)}\n`);
|
|
122
121
|
}
|
|
123
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Finds sub components in a component directory.
|
|
125
|
+
* @param {string} componentPath - The path to the component directory.
|
|
126
|
+
* @returns {Array} - An array of sub component names found in the component's src directory.
|
|
127
|
+
*/
|
|
128
|
+
findSubComponents (componentPath) {
|
|
129
|
+
const srcPath = this.path.join(componentPath, 'src');
|
|
130
|
+
|
|
131
|
+
if (!this.fs.existsSync(srcPath)) {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return this.fs.readdirSync(srcPath)
|
|
136
|
+
.filter((item) => {
|
|
137
|
+
const itemPath = this.path.join(srcPath, item);
|
|
138
|
+
return this.fs.statSync(itemPath).isDirectory() && item.startsWith('pie-');
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
124
142
|
/**
|
|
125
143
|
* Processes all components in the components directory, adding them to the pie-webc package.
|
|
126
144
|
* @param {*} workingDir - The working directory from which the script is run.
|
|
@@ -171,6 +189,37 @@ export class ComponentService {
|
|
|
171
189
|
this.writeFilesForComponent(componentName, target);
|
|
172
190
|
});
|
|
173
191
|
|
|
192
|
+
const subComponents = this.findSubComponents(fullFolderPath);
|
|
193
|
+
|
|
194
|
+
if (subComponents.length > 0) {
|
|
195
|
+
subComponents.forEach((subComponent) => {
|
|
196
|
+
const subComponentName = subComponent.replace('pie-', '');
|
|
197
|
+
|
|
198
|
+
console.info(chalk.gray(`Adding sub-component: ${chalk.white(subComponent)}`));
|
|
199
|
+
|
|
200
|
+
const subComponentTargets = [
|
|
201
|
+
{
|
|
202
|
+
dir: componentsTargetDir,
|
|
203
|
+
exportPath: `${packageName}/dist/${subComponent}`,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
dir: reactTargetDir,
|
|
207
|
+
exportPath: `${packageName}/dist/${subComponent}/react.js`,
|
|
208
|
+
}
|
|
209
|
+
];
|
|
210
|
+
|
|
211
|
+
subComponentTargets.forEach((target) => {
|
|
212
|
+
this.writeFilesForComponent(subComponentName, target);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
const subComponentExports = this.createPackageJsonExports(subComponentName, componentName);
|
|
216
|
+
newPackageJson.exports = {
|
|
217
|
+
...newPackageJson.exports,
|
|
218
|
+
...subComponentExports,
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
174
223
|
const exportsObj = {
|
|
175
224
|
...newPackageJson.exports,
|
|
176
225
|
...this.createPackageJsonExports(componentName),
|