@justeattakeaway/pie-webc 0.5.43 → 0.5.45
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.json +14 -14
- package/src/componentService.js +24 -1
- package/test/componentService.spec.js +3 -0
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.5.
|
|
4
|
+
"version": "0.5.45",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"**/*.js",
|
|
@@ -247,28 +247,28 @@
|
|
|
247
247
|
"chalk": "5.3.0"
|
|
248
248
|
},
|
|
249
249
|
"dependencies": {
|
|
250
|
-
"@justeattakeaway/pie-assistive-text": "0.7.
|
|
250
|
+
"@justeattakeaway/pie-assistive-text": "0.7.4",
|
|
251
251
|
"@justeattakeaway/pie-button": "0.49.3",
|
|
252
252
|
"@justeattakeaway/pie-card": "0.21.2",
|
|
253
|
-
"@justeattakeaway/pie-checkbox": "0.13.
|
|
254
|
-
"@justeattakeaway/pie-checkbox-group": "0.7.
|
|
255
|
-
"@justeattakeaway/pie-chip": "0.8.
|
|
256
|
-
"@justeattakeaway/pie-cookie-banner": "0.
|
|
253
|
+
"@justeattakeaway/pie-checkbox": "0.13.3",
|
|
254
|
+
"@justeattakeaway/pie-checkbox-group": "0.7.3",
|
|
255
|
+
"@justeattakeaway/pie-chip": "0.8.6",
|
|
256
|
+
"@justeattakeaway/pie-cookie-banner": "1.0.0",
|
|
257
257
|
"@justeattakeaway/pie-divider": "0.14.2",
|
|
258
258
|
"@justeattakeaway/pie-form-label": "0.14.3",
|
|
259
|
-
"@justeattakeaway/pie-icon-button": "0.
|
|
259
|
+
"@justeattakeaway/pie-icon-button": "0.29.0",
|
|
260
260
|
"@justeattakeaway/pie-link": "0.18.2",
|
|
261
261
|
"@justeattakeaway/pie-lottie-player": "0.0.4",
|
|
262
|
-
"@justeattakeaway/pie-modal": "0.49.
|
|
263
|
-
"@justeattakeaway/pie-notification": "0.12.
|
|
262
|
+
"@justeattakeaway/pie-modal": "0.49.1",
|
|
263
|
+
"@justeattakeaway/pie-notification": "0.12.3",
|
|
264
264
|
"@justeattakeaway/pie-radio": "0.3.0",
|
|
265
265
|
"@justeattakeaway/pie-radio-group": "0.1.2",
|
|
266
266
|
"@justeattakeaway/pie-spinner": "0.7.2",
|
|
267
|
-
"@justeattakeaway/pie-switch": "0.30.
|
|
268
|
-
"@justeattakeaway/pie-tag": "0.
|
|
269
|
-
"@justeattakeaway/pie-text-input": "0.24.
|
|
270
|
-
"@justeattakeaway/pie-textarea": "0.
|
|
271
|
-
"@justeattakeaway/pie-toast": "0.4.
|
|
267
|
+
"@justeattakeaway/pie-switch": "0.30.4",
|
|
268
|
+
"@justeattakeaway/pie-tag": "0.11.0",
|
|
269
|
+
"@justeattakeaway/pie-text-input": "0.24.3",
|
|
270
|
+
"@justeattakeaway/pie-textarea": "0.11.0",
|
|
271
|
+
"@justeattakeaway/pie-toast": "0.4.1"
|
|
272
272
|
},
|
|
273
273
|
"volta": {
|
|
274
274
|
"extends": "../../../package.json"
|
package/src/componentService.js
CHANGED
|
@@ -171,10 +171,33 @@ export class ComponentService {
|
|
|
171
171
|
this.writeFilesForComponent(componentName, target);
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
const exportsObj = {
|
|
175
175
|
...newPackageJson.exports,
|
|
176
176
|
...this.createPackageJsonExports(componentName),
|
|
177
177
|
};
|
|
178
|
+
|
|
179
|
+
const sortedExports = Object.keys(exportsObj)
|
|
180
|
+
.sort((a, b) => {
|
|
181
|
+
// Extract path parts
|
|
182
|
+
const { dir: dirA, name: nameA } = this.path.parse(a);
|
|
183
|
+
const { dir: dirB, name: nameB } = this.path.parse(b);
|
|
184
|
+
|
|
185
|
+
// Compare by file names
|
|
186
|
+
const nameComparison = nameA.localeCompare(nameB);
|
|
187
|
+
|
|
188
|
+
// If the base names are the same, compare the paths
|
|
189
|
+
if (nameComparison === 0) return dirA.localeCompare(dirB);
|
|
190
|
+
|
|
191
|
+
// Otherwise, use the file name comparison
|
|
192
|
+
return nameComparison;
|
|
193
|
+
})
|
|
194
|
+
.reduce((acc, key) => {
|
|
195
|
+
// Use the sorted keys to build a new object
|
|
196
|
+
acc[key] = exportsObj[key];
|
|
197
|
+
return acc;
|
|
198
|
+
}, {});
|
|
199
|
+
|
|
200
|
+
newPackageJson.exports = sortedExports;
|
|
178
201
|
});
|
|
179
202
|
|
|
180
203
|
return newPackageJson;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from 'path';
|
|
1
2
|
import { ComponentService } from '../src/componentService';
|
|
2
3
|
|
|
3
4
|
describe('ComponentService', () => {
|
|
@@ -17,10 +18,12 @@ describe('ComponentService', () => {
|
|
|
17
18
|
pathMock = {
|
|
18
19
|
join: vi.fn(),
|
|
19
20
|
resolve: vi.fn(),
|
|
21
|
+
parse: vi.fn(),
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
pathMock.join.mockImplementation((...args) => args.join('/'));
|
|
23
25
|
pathMock.resolve.mockImplementation((...args) => args.join('/'));
|
|
26
|
+
pathMock.parse.mockImplementation(path.parse);
|
|
24
27
|
|
|
25
28
|
// Suppress console output
|
|
26
29
|
vi.spyOn(console, 'info').mockImplementation(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function
|