Skip to content

Commit a5a3f0d

Browse files
authored
chore(repo): QoL for subpaths script (#4180)
1 parent 26ab88c commit a5a3f0d

File tree

5 files changed

+31
-83
lines changed

5 files changed

+31
-83
lines changed

.changeset/moody-fans-kneel.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/localizations/subpaths.mjs

+9-41
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,13 @@
1-
// This file is a helper for the "subpath-workaround.mjs" script
2-
// We have to polyfill our "exports" subpaths :cry:
1+
import packageJson from './package.json' with { type: 'json' };
32

4-
export const subpathNames = [
5-
'ar-SA',
6-
'cs-CZ',
7-
'da-DK',
8-
'de-DE',
9-
'el-GR',
10-
'en-US',
11-
'es-ES',
12-
'fr-FR',
13-
'fi-FI',
14-
'he-IL',
15-
'is-IS',
16-
'it-IT',
17-
'ja-JP',
18-
'ko-KR',
19-
'mn-MN',
20-
'nb-NO',
21-
'nl-NL',
22-
'nl-BE',
23-
'pl-PL',
24-
'pt-BR',
25-
'pt-PT',
26-
'ro-RO',
27-
'ru-RU',
28-
'sk-SK',
29-
'sv-SE',
30-
'tr-TR',
31-
'uk-UA',
32-
'vi-VN',
33-
'zh-CN',
34-
'zh-TW',
35-
'es-MX',
36-
'bg-BG',
37-
'th-TH',
38-
'ca-ES',
39-
'hu-HU',
40-
'sr-RS',
41-
'hr-HR',
42-
];
3+
/**
4+
* This file is a helper for the "subpath-workaround.mjs" script.
5+
* Add your new subpath to package.json#files.
6+
*
7+
* When you add an entry to the package.json "files" field, a subfolder will be automatically created with a package.json pointing to that file
8+
*/
9+
10+
export const subpathNames = packageJson.files.filter(k => k !== 'dist');
4311

4412
export const subpathFoldersBarrel = [];
4513

packages/react/subpaths.mjs

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import packageJson from './package.json' assert { type: 'json' };
2-
// This file is a helper for the "subpath-workaround.mjs" script
3-
// We have to polyfill our "exports" subpaths :cry:
1+
import packageJson from './package.json' with { type: 'json' };
42

5-
export const subpathNames = Object.keys(packageJson.exports)
6-
.filter(k => k.startsWith('./') && k !== './' && k !== './package.json')
7-
.map(k => k.replace('./', ''));
3+
/**
4+
* This file is a helper for the "subpath-workaround.mjs" script.
5+
* Add your new subpath to package.json#files.
6+
*
7+
* When you add an entry to the package.json "files" field, a subfolder will be automatically created with a package.json pointing to that file
8+
*/
9+
10+
export const subpathNames = packageJson.files.filter(k => k !== 'dist');
811

912
export const subpathFoldersBarrel = [];
1013

packages/shared/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@
4444
},
4545
"main": "./dist/index.js",
4646
"files": [
47-
"authorization",
4847
"dist",
48+
"scripts",
49+
"authorization",
4950
"browser",
5051
"callWithRetry",
5152
"color",
@@ -71,7 +72,6 @@
7172
"react",
7273
"constants",
7374
"apiUrlFromPublishableKey",
74-
"scripts",
7575
"telemetry",
7676
"logger",
7777
"webauthn",

packages/shared/subpaths.mjs

+9-34
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,13 @@
1-
// This file is a helper for the "subpath-workaround.mjs" script
2-
// When adding an entry to "subpathNames" also add it to "files" in package.json
1+
import packageJson from './package.json' with { type: 'json' };
32

4-
export const subpathNames = [
5-
'authorization',
6-
'browser',
7-
'callWithRetry',
8-
'color',
9-
'cookie',
10-
'date',
11-
'deprecated',
12-
'deriveState',
13-
'error',
14-
'file',
15-
'globs',
16-
'handleValueOrFn',
17-
'isomorphicAtob',
18-
'isomorphicBtoa',
19-
'keys',
20-
'loadClerkJsScript',
21-
'loadScript',
22-
'localStorageBroadcastChannel',
23-
'poller',
24-
'proxy',
25-
'underscore',
26-
'url',
27-
'versionSelector',
28-
'constants',
29-
'apiUrlFromPublishableKey',
30-
'telemetry',
31-
'logger',
32-
'webauthn',
33-
'router',
34-
'pathToRegexp',
35-
];
3+
/**
4+
* This file is a helper for the "subpath-workaround.mjs" script.
5+
* Add your new subpath to package.json#files.
6+
*
7+
* When you add an entry to the package.json "files" field, a subfolder will be automatically created with a package.json pointing to that file
8+
*/
9+
10+
export const subpathNames = packageJson.files.filter(k => !['dist', 'scripts', 'react'].includes(k));
3611

3712
export const subpathFoldersBarrel = ['react'];
3813

0 commit comments

Comments
 (0)