td-octopus 0.1.15 → 0.1.16
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 +1 -1
- package/src/check/index.js +5 -5
- package/src/utils/index.js +3 -4
package/package.json
CHANGED
package/src/check/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @Author: 郑泳健
|
|
4
4
|
* @Date: 2024-12-12 15:00:24
|
|
5
5
|
* @LastEditors: 郑泳健
|
|
6
|
-
* @LastEditTime: 2025-09-
|
|
6
|
+
* @LastEditTime: 2025-09-11 09:56:54
|
|
7
7
|
*/
|
|
8
8
|
const path = require('path')
|
|
9
9
|
const fs = require('fs')
|
|
@@ -102,11 +102,11 @@ function main() {
|
|
|
102
102
|
|
|
103
103
|
rewriteFiles(getFileKeyValueList(zhCNResult), 'zh-CN');
|
|
104
104
|
rewriteFiles(getFileKeyValueList(enCNResult), 'en-US');
|
|
105
|
-
const cnJSON = fs.readFileSync(path.resolve(process.cwd(), '
|
|
106
|
-
const enJSON = fs.readFileSync(path.resolve(process.cwd(), '
|
|
105
|
+
const cnJSON = fs.readFileSync(path.resolve(process.cwd(), '.octopus/zh-CN/index.js'), 'utf-8');
|
|
106
|
+
const enJSON = fs.readFileSync(path.resolve(process.cwd(), '.octopus/en-US/index.js'), 'utf-8');
|
|
107
107
|
|
|
108
|
-
autoImportJSFiles(path.resolve(process.cwd(), '
|
|
109
|
-
autoImportJSFiles(path.resolve(process.cwd(), '
|
|
108
|
+
autoImportJSFiles(path.resolve(process.cwd(), '.octopus/zh-CN'), cnJSON)
|
|
109
|
+
autoImportJSFiles(path.resolve(process.cwd(), '.octopus/en-US'), enJSON)
|
|
110
110
|
spinner.succeed(`同步完成`);
|
|
111
111
|
})()
|
|
112
112
|
}
|
package/src/utils/index.js
CHANGED
|
@@ -296,7 +296,7 @@ function prettierFile(fileContent, proType) {
|
|
|
296
296
|
let newImports = '';
|
|
297
297
|
let newExports = '';
|
|
298
298
|
|
|
299
|
-
missing.forEach(file => {
|
|
299
|
+
missing.forEach((file) => {
|
|
300
300
|
newImports += `import ${file} from './${file}';\n`;
|
|
301
301
|
newExports += ` ${file},\n`;
|
|
302
302
|
});
|
|
@@ -308,15 +308,14 @@ function prettierFile(fileContent, proType) {
|
|
|
308
308
|
|
|
309
309
|
const updatedContent =
|
|
310
310
|
indexContent.slice(0, lastImportIndex) +
|
|
311
|
-
indexContent.slice(lastImportIndex, firstExportIndex) +
|
|
312
|
-
'\n' + newImports + '\n' +
|
|
311
|
+
indexContent.slice(lastImportIndex, firstExportIndex) + newImports + '\n' +
|
|
313
312
|
indexContent.slice(firstExportIndex).replace(
|
|
314
313
|
/(export default Object\.assign\(\{\},\s*\{[\s\S]*?)(\}\);)/,
|
|
315
314
|
`$1\n${newExports}$2`
|
|
316
315
|
);
|
|
317
316
|
|
|
318
317
|
// 6. 写回 index.js
|
|
319
|
-
fs.writeFileSync(
|
|
318
|
+
fs.writeFileSync(path.resolve(__dirname, 'index.js'), updatedContent, 'utf-8');
|
|
320
319
|
|
|
321
320
|
}
|
|
322
321
|
|