td-web-cli 0.1.3 → 0.1.5

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.
@@ -1,8 +1,12 @@
1
1
  import { input } from '@inquirer/prompts';
2
2
  import XLSX from 'xlsx';
3
3
  import fs from 'fs';
4
+ import { fileURLToPath } from 'url';
4
5
  import path from 'path';
5
6
  import { getTimestamp, logger, loggerError, normalizeError, languageToolCheck, getLanguageTool, } from '../../../utils/index.js';
7
+ // 获取当前文件目录
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
6
10
  /**
7
11
  * 读取并解析配置文件
8
12
  * @param configPath 配置文件路径
@@ -100,7 +104,7 @@ async function batchCheckTexts(texts, language) {
100
104
  export async function excel2json(program) {
101
105
  var _a;
102
106
  // 配置文件默认路径
103
- const configPath = path.join(__dirname, '../setting.json');
107
+ const configPath = path.join(__dirname, '../../../../setting.json');
104
108
  let i18nConfig;
105
109
  // 加载配置文件
106
110
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "td-web-cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "A CLI tool for efficiency",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -2,6 +2,7 @@ import { Command } from 'commander';
2
2
  import { input } from '@inquirer/prompts';
3
3
  import XLSX from 'xlsx';
4
4
  import fs from 'fs';
5
+ import { fileURLToPath } from 'url';
5
6
  import path from 'path';
6
7
  import {
7
8
  getTimestamp,
@@ -13,6 +14,10 @@ import {
13
14
  getLanguageTool,
14
15
  } from '../../../utils/index.js';
15
16
 
17
+ // 获取当前文件目录
18
+ const __filename = fileURLToPath(import.meta.url);
19
+ const __dirname = path.dirname(__filename);
20
+
16
21
  type Row = (string | number | null | undefined)[];
17
22
 
18
23
  /**
@@ -138,7 +143,7 @@ async function batchCheckTexts(
138
143
  */
139
144
  export async function excel2json(program: Command) {
140
145
  // 配置文件默认路径
141
- const configPath = path.join(__dirname, '../setting.json');
146
+ const configPath = path.join(__dirname, '../../../../setting.json');
142
147
  let i18nConfig: I18nConfig;
143
148
 
144
149
  // 加载配置文件