@tuya-sat/sdf-main-sdk 0.0.11 → 0.0.13
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/dist/{131.863128ba.chunk.js → 131.eeac513e.chunk.js} +1 -1
- package/dist/{131.863128ba.chunk.js.map → 131.eeac513e.chunk.js.map} +1 -1
- package/dist/components/PSetting/index.d.ts +1 -1
- package/dist/main.bundle.js +1 -1
- package/dist/main.bundle.js.map +1 -1
- package/dist/pages/home/setting/index.d.ts +8 -1
- package/package.json +1 -1
- package/scripts/gen-localize-file.mjs +56 -0
- package/tsconfig.json +28 -0
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface SettingProps {
|
|
3
|
+
extra?: {
|
|
4
|
+
beforeSolt?: FC;
|
|
5
|
+
afterSolt?: FC;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
1
8
|
/**
|
|
2
9
|
* 公版用户设置页面
|
|
3
10
|
*/
|
|
4
|
-
declare const Setting:
|
|
11
|
+
declare const Setting: FC<SettingProps>;
|
|
5
12
|
export default Setting;
|
package/package.json
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
function normalizeLang(langKey, content) {
|
|
5
|
+
let obj = {};
|
|
6
|
+
|
|
7
|
+
function attachTo(prev, next) {
|
|
8
|
+
return `${prev === '' ? '' : prev + '.'}${next}`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function toSingleKey(lang, prevKey = '') {
|
|
12
|
+
Object.keys(lang).forEach((key) => {
|
|
13
|
+
let oneLevelKey = attachTo(prevKey, key);
|
|
14
|
+
if (typeof lang[key] !== 'object') {
|
|
15
|
+
obj[oneLevelKey] = lang[key];
|
|
16
|
+
} else {
|
|
17
|
+
toSingleKey(lang[key], oneLevelKey);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
toSingleKey(content);
|
|
23
|
+
|
|
24
|
+
obj = {
|
|
25
|
+
[langKey]: obj,
|
|
26
|
+
};
|
|
27
|
+
return obj;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
(function run() {
|
|
31
|
+
const dir = './src/lang/';
|
|
32
|
+
|
|
33
|
+
const nowTime = new Date().valueOf();
|
|
34
|
+
|
|
35
|
+
const files = fs
|
|
36
|
+
.readdirSync(dir)
|
|
37
|
+
.filter((filename) => !filename.endsWith('.ts'));
|
|
38
|
+
|
|
39
|
+
let outputLang = {};
|
|
40
|
+
|
|
41
|
+
files.forEach(async (file) => {
|
|
42
|
+
const abosultePath = path.resolve(dir, file);
|
|
43
|
+
const basename = path.basename(file, '.json');
|
|
44
|
+
console.log(abosultePath, basename);
|
|
45
|
+
const content = JSON.parse(fs.readFileSync(abosultePath, 'utf-8'));
|
|
46
|
+
const lang = normalizeLang(basename, content);
|
|
47
|
+
outputLang = {
|
|
48
|
+
...outputLang,
|
|
49
|
+
...lang,
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
fs.writeFileSync(
|
|
53
|
+
`lang_${nowTime}.json`,
|
|
54
|
+
JSON.stringify(outputLang, undefined, 2),
|
|
55
|
+
);
|
|
56
|
+
})();
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": "./",
|
|
4
|
+
"paths": {
|
|
5
|
+
"@/*": ["./src/*"]
|
|
6
|
+
},
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"lib": ["ES2021", "DOM"],
|
|
9
|
+
"module": "ESNext",
|
|
10
|
+
"target": "es6",
|
|
11
|
+
"composite": false,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationMap": false,
|
|
14
|
+
"declarationDir": "dist",
|
|
15
|
+
"esModuleInterop": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
17
|
+
"inlineSources": false,
|
|
18
|
+
"isolatedModules": false,
|
|
19
|
+
"moduleResolution": "node",
|
|
20
|
+
"noUnusedLocals": false,
|
|
21
|
+
"noUnusedParameters": false,
|
|
22
|
+
"preserveWatchOutput": true,
|
|
23
|
+
"skipLibCheck": true,
|
|
24
|
+
"strict": false,
|
|
25
|
+
"resolveJsonModule": true
|
|
26
|
+
},
|
|
27
|
+
"include": ["./src", "./typings.d.ts"]
|
|
28
|
+
}
|