@momo-kits/foundation 0.81.48 → 0.81.50
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/Text/types.ts +19 -1
- package/migrate_typo.js +56 -0
- package/package.json +1 -1
- package/verify.js +37 -4
package/Text/types.ts
CHANGED
|
@@ -14,13 +14,31 @@ export type TypographyWeight = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export type Typography =
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
**/
|
|
20
|
+
| 'headline_default'
|
|
21
|
+
| 'headline_l'
|
|
22
|
+
| 'headline_xl'
|
|
23
|
+
| 'title_default'
|
|
24
|
+
| 'title_xs'
|
|
25
|
+
| 'title_s'
|
|
26
|
+
| 'header_default'
|
|
27
|
+
| 'paragraph_default'
|
|
28
|
+
| 'paragraph_bold'
|
|
29
|
+
| 'paragraph_italic'
|
|
30
|
+
| 'label_xxs'
|
|
31
|
+
| 'action_s'
|
|
32
|
+
/**
|
|
33
|
+
* end
|
|
34
|
+
**/
|
|
17
35
|
| 'headline_default_bold'
|
|
18
36
|
| 'header_m_bold'
|
|
19
37
|
| 'header_default_bold'
|
|
20
38
|
| 'header_s_semibold'
|
|
21
39
|
| 'header_xs_semibold'
|
|
22
40
|
| 'body_default_regular'
|
|
23
|
-
| '
|
|
41
|
+
| 'body_default_regularstrikethrought'
|
|
24
42
|
| 'description_default_regular'
|
|
25
43
|
| 'description_default_regularstrikethrought'
|
|
26
44
|
| 'description_xs_regular'
|
package/migrate_typo.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const {readFileSync, writeFileSync, readdirSync, statSync} = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
let rootPath = process.argv[2];
|
|
4
|
+
|
|
5
|
+
const migrateText = [
|
|
6
|
+
{typo1: 'headline_s', typo2: 'headline_default_bold'},
|
|
7
|
+
{typo1: 'header_s', typo2: 'header_s_semibold'},
|
|
8
|
+
{typo1: 'header_xs', typo2: 'header_xs_semibold'},
|
|
9
|
+
{typo1: 'description_default', typo2: 'body_default_regular'},
|
|
10
|
+
{typo1: 'description_s', typo2: 'description_default_regular'},
|
|
11
|
+
{typo1: 'description_xs', typo2: 'description_xs_regular'},
|
|
12
|
+
{typo1: 'label_default', typo2: 'label_default_medium'},
|
|
13
|
+
{typo1: 'label_s', typo2: 'label_s_medium'},
|
|
14
|
+
{typo1: 'label_xs', typo2: 'label_xs_medium'},
|
|
15
|
+
{typo1: 'action_default', typo2: 'action_default_bold'},
|
|
16
|
+
{typo1: 'action_xs', typo2: 'action_xs_bold'},
|
|
17
|
+
{typo1: 'action_xxs', typo2: 'action_xxs_bold'},
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
function replaceTextInFile(oldText, newText, filePath) {
|
|
21
|
+
try {
|
|
22
|
+
let content = readFileSync(filePath, {encoding: 'utf-8'});
|
|
23
|
+
const regex = new RegExp(`\\b${oldText}\\b`, 'g');
|
|
24
|
+
content = content.replace(regex, newText);
|
|
25
|
+
writeFileSync(filePath, content, 'utf8');
|
|
26
|
+
console.log(`Replaced text in: ${filePath}`);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error(`Error processing file ${filePath}:`, error);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function scanDirectory(directory, oldText, newText) {
|
|
33
|
+
const files = readdirSync(directory);
|
|
34
|
+
|
|
35
|
+
files.forEach(file => {
|
|
36
|
+
const filePath = path.join(directory, file);
|
|
37
|
+
const stat = statSync(filePath);
|
|
38
|
+
|
|
39
|
+
if (stat.isDirectory()) {
|
|
40
|
+
scanDirectory(filePath, oldText, newText);
|
|
41
|
+
} else if (
|
|
42
|
+
stat.isFile() &&
|
|
43
|
+
(filePath.endsWith('.tsx') || filePath.endsWith('.ts'))
|
|
44
|
+
) {
|
|
45
|
+
replaceTextInFile(oldText, newText, filePath);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function main() {
|
|
51
|
+
migrateText.forEach(({typo1, typo2}) => {
|
|
52
|
+
scanDirectory(rootPath, typo1, typo2);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
main();
|
package/package.json
CHANGED
package/verify.js
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const packageInfo = JSON.parse(
|
|
5
|
+
fs.readFileSync(path.join(`${__dirname}`, 'package.json'), 'utf8')
|
|
6
|
+
);
|
|
7
|
+
const packageVersion = parseInt(packageInfo?.version.split('.')?.[1]);
|
|
8
|
+
|
|
9
|
+
const app = path.join(`${__dirname}/../../../`, 'app.json');
|
|
10
|
+
const miniJson = path.join(`${__dirname}/../../../`, 'package.json');
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(app) || !fs.existsSync(miniJson)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const appInfo = JSON.parse(fs.readFileSync(app, 'utf8'));
|
|
17
|
+
const miniInfo = JSON.parse(fs.readFileSync(miniJson, 'utf8'));
|
|
18
|
+
|
|
19
|
+
const iOSAppTarget = appInfo?.client?.ios.deploymentTarget;
|
|
20
|
+
const androidAppTarget = appInfo?.client?.android.deploymentTarget;
|
|
21
|
+
|
|
22
|
+
if (
|
|
23
|
+
miniInfo?.dependencies?.['@momo-platform/momo-core']?.includes('optimize')
|
|
24
|
+
) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
`\x1b[41m Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (
|
|
35
|
+
miniInfo?.dependencies?.['@momo-platform/momo-core'] &&
|
|
36
|
+
miniInfo?.dependencies?.['@momo-platform/momo-core'] !== packageInfo?.version
|
|
37
|
+
) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
`\x1b[41m Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`
|
|
40
|
+
);
|
|
8
41
|
}
|