@dune2/cli 0.5.4 → 0.6.0
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/chunk-PRJ3NOXB.js +28 -0
- package/dist/chunk-PRJ3NOXB.js.map +1 -0
- package/dist/cli.js +8 -8
- package/dist/cli.js.map +1 -1
- package/dist/{download-ZZKXRKW5.js → download-KXSMWNXH.js} +2 -2
- package/dist/{extract-DGQMSBR5.js → extract-ARNNWYYN.js} +2 -2
- package/dist/{generateApi-B7OSZKPS.js → generateApi-6O2YBWTL.js} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{initConfig-QRYGDQR7.js → initConfig-5VN3U4OF.js} +8 -10
- package/dist/initConfig-5VN3U4OF.js.map +1 -0
- package/dist/{namespace-4FUD4GZ2.js → namespace-SAPL3UY6.js} +2 -2
- package/dist/{upload-OUXQZAW4.js → upload-S43DON7A.js} +2 -2
- package/package.json +2 -2
- package/dist/chunk-2DSIJDNZ.js +0 -22
- package/dist/chunk-2DSIJDNZ.js.map +0 -1
- package/dist/initConfig-QRYGDQR7.js.map +0 -1
- /package/dist/{download-ZZKXRKW5.js.map → download-KXSMWNXH.js.map} +0 -0
- /package/dist/{extract-DGQMSBR5.js.map → extract-ARNNWYYN.js.map} +0 -0
- /package/dist/{generateApi-B7OSZKPS.js.map → generateApi-6O2YBWTL.js.map} +0 -0
- /package/dist/{namespace-4FUD4GZ2.js.map → namespace-SAPL3UY6.js.map} +0 -0
- /package/dist/{upload-OUXQZAW4.js.map → upload-S43DON7A.js.map} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeConfig
|
|
3
|
+
} from "./chunk-555YTWSW.js";
|
|
4
|
+
|
|
5
|
+
// src/shared/config/index.ts
|
|
6
|
+
import { createJiti } from "jiti";
|
|
7
|
+
function defineConfig(c) {
|
|
8
|
+
return c;
|
|
9
|
+
}
|
|
10
|
+
var configName = "dune.config.ts";
|
|
11
|
+
async function getConfig() {
|
|
12
|
+
const cwd = process.cwd();
|
|
13
|
+
const jiti = createJiti(cwd);
|
|
14
|
+
const res = await jiti.import(`./${configName}`, {
|
|
15
|
+
default: true
|
|
16
|
+
}).catch((err) => {
|
|
17
|
+
console.warn(`can not find config file: ${configName} in ${cwd}`);
|
|
18
|
+
return {};
|
|
19
|
+
});
|
|
20
|
+
return normalizeConfig(res);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
defineConfig,
|
|
25
|
+
configName,
|
|
26
|
+
getConfig
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=chunk-PRJ3NOXB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shared/config/index.ts"],"sourcesContent":["import { createJiti } from \"jiti\";\nimport { normalizeConfig } from \"./normalizeConfig\";\nimport { Config } from \"./types\";\n\nexport * from \"./types\";\n\nexport function defineConfig<T extends Config = Config>(c: T) {\n return c;\n}\n\nexport const configName = \"dune.config.ts\";\n\nexport async function getConfig(): Promise<Config> {\n const cwd = process.cwd();\n const jiti = createJiti(cwd);\n\n const res = await jiti\n .import<Config>(`./${configName}`, {\n default: true,\n })\n .catch((err) => {\n console.warn(`can not find config file: ${configName} in ${cwd}`);\n return {};\n });\n\n return normalizeConfig(res);\n}\n"],"mappings":";;;;;AAAA,SAAS,kBAAkB;AAMpB,SAAS,aAAwC,GAAM;AAC5D,SAAO;AACT;AAEO,IAAM,aAAa;AAE1B,eAAsB,YAA6B;AACjD,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,OAAO,WAAW,GAAG;AAE3B,QAAM,MAAM,MAAM,KACf,OAAe,KAAK,UAAU,IAAI;AAAA,IACjC,SAAS;AAAA,EACX,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,YAAQ,KAAK,6BAA6B,UAAU,OAAO,GAAG,EAAE;AAChE,WAAO,CAAC;AAAA,EACV,CAAC;AAEH,SAAO,gBAAgB,GAAG;AAC5B;","names":[]}
|
package/dist/cli.js
CHANGED
|
@@ -4,31 +4,31 @@ import {
|
|
|
4
4
|
} from "./chunk-UGSBKD2I.js";
|
|
5
5
|
|
|
6
6
|
// package.json
|
|
7
|
-
var version = "0.
|
|
7
|
+
var version = "0.6.0";
|
|
8
8
|
|
|
9
9
|
// src/cli.ts
|
|
10
10
|
cli.command("download", "\u751F\u6210\u7FFB\u8BD1\u6587\u4EF6").example("dune download").action(async () => {
|
|
11
|
-
const { download } = await import("./download-
|
|
11
|
+
const { download } = await import("./download-KXSMWNXH.js");
|
|
12
12
|
await download();
|
|
13
13
|
});
|
|
14
14
|
cli.command("extract", "\u63D0\u53D6\u4EE3\u7801\u4E2D\u7684\u6587\u6848").option("--deleteUnused", "\u5220\u9664\u672A\u4F7F\u7528\u7684\u6587\u6848").example("dune extract").action(async (args) => {
|
|
15
|
-
const { extract } = await import("./extract-
|
|
15
|
+
const { extract } = await import("./extract-ARNNWYYN.js");
|
|
16
16
|
await extract(args);
|
|
17
17
|
});
|
|
18
18
|
cli.command("namespaceSwc", "\u6DFB\u52A0 namespace \u524D\u7F00\uFF0C\u7531 swc \u9A71\u52A8").example("dune namespaceSwc").action(async () => {
|
|
19
|
-
const { namespace } = await import("./namespace-
|
|
19
|
+
const { namespace } = await import("./namespace-SAPL3UY6.js");
|
|
20
20
|
return namespace({ mode: "swc" });
|
|
21
21
|
});
|
|
22
22
|
cli.command("namespaceReg", "\u6DFB\u52A0 namespace \u524D\u7F00\uFF0C\u7531\u6B63\u5219\u9A71\u52A8").example("dune namespaceReg").action(async () => {
|
|
23
|
-
const { namespace } = await import("./namespace-
|
|
23
|
+
const { namespace } = await import("./namespace-SAPL3UY6.js");
|
|
24
24
|
return namespace({ mode: "reg" });
|
|
25
25
|
});
|
|
26
26
|
cli.command("upload", "\u4E0A\u4F20\u7FFB\u8BD1\u6587\u4EF6").example("dune upload").action(async (args) => {
|
|
27
|
-
const { upload } = await import("./upload-
|
|
27
|
+
const { upload } = await import("./upload-S43DON7A.js");
|
|
28
28
|
await upload();
|
|
29
29
|
});
|
|
30
30
|
cli.command("generateApi", "\u751F\u6210 api \u6587\u4EF6").example("dune generateApi").action(async () => {
|
|
31
|
-
const { generateApi } = await import("./generateApi-
|
|
31
|
+
const { generateApi } = await import("./generateApi-6O2YBWTL.js");
|
|
32
32
|
await generateApi();
|
|
33
33
|
});
|
|
34
34
|
cli.command("login", "\u767B\u5F55").action(async () => {
|
|
@@ -52,7 +52,7 @@ exp : ${new Date(googleAuth.tokens.expiry_date).toLocaleString()}
|
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
cli.command("init", "\u521D\u59CB\u5316\u914D\u7F6E\u6587\u4EF6").example("dune init").action(async () => {
|
|
55
|
-
const { initConfig } = await import("./initConfig-
|
|
55
|
+
const { initConfig } = await import("./initConfig-5VN3U4OF.js");
|
|
56
56
|
await initConfig();
|
|
57
57
|
});
|
|
58
58
|
cli.command("interactive", "\u4EA4\u4E92\u5F0F\u64CD\u4F5C").example("dune interactive").alias("i").action(async (args) => {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../src/cli.ts"],"sourcesContent":["{\n \"name\": \"@dune2/cli\",\n \"version\": \"0.
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/cli.ts"],"sourcesContent":["{\n \"name\": \"@dune2/cli\",\n \"version\": \"0.6.0\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/liaoyinglong/next-tools.git\",\n \"directory\": \"packages/cli\"\n },\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\"\n },\n \"./cli\": {\n \"import\": \"./dist/cli.js\"\n },\n \"./normalizeConfig\": {\n \"import\": \"./dist/normalizeConfig.js\"\n },\n \"./prettier\": {\n \"import\": \"./dist/prettier.js\",\n \"require\": \"./dist/prettier.cjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"types\": \"dist/index.d.ts\",\n \"bin\": {\n \"dune\": \"./dist/cli.js\"\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"shx rm -rf ./dist && tsup --splitting\",\n \"dev\": \"pnpm run build --watch\",\n \"lint\": \"tsc --diagnostics --noEmit\",\n \"test\": \"vitest run\",\n \"test:u\": \"vitest -u\"\n },\n \"dependencies\": {\n \"@apidevtools/swagger-parser\": \"^10.1.0\",\n \"@dune2/wasm\": \"workspace:*\",\n \"cac\": \"^6.7.14\",\n \"cli-table3\": \"^0.6.3\",\n \"connect\": \"^3.7.0\",\n \"debug\": \"^4.3.4\",\n \"enquirer\": \"^2.3.6\",\n \"fs-extra\": \"^11.2.0\",\n \"globby\": \"^14.0.1\",\n \"googleapis\": \"108.0.0\",\n \"jiti\": \"^2.4.2\",\n \"json-schema-to-typescript\": \"15.0.0\",\n \"lodash\": \"^4.17.21\",\n \"open\": \"^10.1.0\",\n \"p-map\": \"^7.0.2\",\n \"path-to-regexp\": \"7.1.0\",\n \"picocolors\": \"^1.0.0\"\n },\n \"devDependencies\": {\n \"@types/debug\": \"^4.1.7\",\n \"@types/lodash\": \"^4.14.186\",\n \"gaxios\": \"*\",\n \"google-auth-library\": \"*\",\n \"openapi-types\": \"^12.0.2\",\n \"prettier\": \"^3\",\n \"tsup\": \"8\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n","#!/usr/bin/env node\nimport { version } from \"../package.json\";\nimport { cli } from \"./shared\";\n//#region 翻译相关\n\ncli\n .command(\"download\", \"生成翻译文件\")\n .example(\"dune download\")\n .action(async () => {\n const { download } = await import(\"./commands/download\");\n await download();\n });\ncli\n .command(\"extract\", \"提取代码中的文案\")\n .option(\"--deleteUnused\", \"删除未使用的文案\")\n .example(\"dune extract\")\n .action(async (args) => {\n const { extract } = await import(\"./commands/extract\");\n await extract(args);\n });\n\ncli\n .command(\"namespaceSwc\", \"添加 namespace 前缀,由 swc 驱动\")\n .example(\"dune namespaceSwc\")\n .action(async () => {\n const { namespace } = await import(\"./commands/namespace\");\n return namespace({ mode: \"swc\" });\n });\n\ncli\n .command(\"namespaceReg\", \"添加 namespace 前缀,由正则驱动\")\n .example(\"dune namespaceReg\")\n .action(async () => {\n const { namespace } = await import(\"./commands/namespace\");\n return namespace({ mode: \"reg\" });\n });\n\ncli\n .command(\"upload\", \"上传翻译文件\")\n .example(\"dune upload\")\n .action(async (args) => {\n const { upload } = await import(\"./commands/upload\");\n await upload();\n });\n\n//#endregion\n\n//#region api 相关\ncli\n .command(\"generateApi\", \"生成 api 文件\")\n .example(\"dune generateApi\")\n .action(async () => {\n const { generateApi } = await import(\"./commands/generateApi\");\n await generateApi();\n });\n//#endregion\n\n//#region user 相关\ncli.command(\"login\", \"登录\").action(async () => {\n const { googleAuth } = await import(\"./shared/google/auth\");\n await googleAuth.initCredentials();\n});\ncli.command(\"logout\", \"退出\").action(async () => {\n const { googleAuth } = await import(\"./shared/google/auth\");\n await googleAuth.removeCredentials();\n});\ncli.command(\"userInfo\", \"用户信息\").action(async () => {\n const { googleAuth } = await import(\"./shared/google/auth\");\n if (googleAuth.tokens) {\n console.log(`\\\nemail: ${googleAuth.tokens.email}\naud : ${googleAuth.tokens.aud}\nexp : ${new Date(googleAuth.tokens.expiry_date).toLocaleString()}\n`);\n } else {\n console.log(\"未登录\");\n console.log(`运行 dune login 登录`);\n }\n});\n//#endregion\n\ncli\n .command(\"init\", \"初始化配置文件\")\n .example(\"dune init\")\n .action(async () => {\n const { initConfig } = await import(\"./commands/initConfig\");\n await initConfig();\n });\n\ncli\n .command(\"interactive\", \"交互式操作\")\n .example(\"dune interactive\")\n .alias(\"i\")\n .action(async (args) => {\n const { interactive } = await import(\"./commands/interactive\");\n await interactive(args);\n });\n\n// make default command run interactive\ncli.command(\"\").action(async (args) => {\n const { interactive } = await import(\"./commands/interactive\");\n await interactive(args);\n});\n\ncli.version(version);\ncli.help();\n\n(async () => {\n try {\n // Parse CLI args without running the command\n cli.parse(process.argv, { run: false });\n // Run the command yourself\n // You only need `await` when your command action returns a Promise\n await cli.runMatchedCommand();\n } catch (error) {\n // Handle error here..\n // e.g.\n // console.error(error.stack)\n // process.exit(1)\n }\n})();\n"],"mappings":";;;;;;AAEE,cAAW;;;ACGb,IACG,QAAQ,YAAY,sCAAQ,EAC5B,QAAQ,eAAe,EACvB,OAAO,YAAY;AAClB,QAAM,EAAE,SAAS,IAAI,MAAM,OAAO,wBAAqB;AACvD,QAAM,SAAS;AACjB,CAAC;AACH,IACG,QAAQ,WAAW,kDAAU,EAC7B,OAAO,kBAAkB,kDAAU,EACnC,QAAQ,cAAc,EACtB,OAAO,OAAO,SAAS;AACtB,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,uBAAoB;AACrD,QAAM,QAAQ,IAAI;AACpB,CAAC;AAEH,IACG,QAAQ,gBAAgB,kEAA0B,EAClD,QAAQ,mBAAmB,EAC3B,OAAO,YAAY;AAClB,QAAM,EAAE,UAAU,IAAI,MAAM,OAAO,yBAAsB;AACzD,SAAO,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,CAAC;AAEH,IACG,QAAQ,gBAAgB,yEAAuB,EAC/C,QAAQ,mBAAmB,EAC3B,OAAO,YAAY;AAClB,QAAM,EAAE,UAAU,IAAI,MAAM,OAAO,yBAAsB;AACzD,SAAO,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,CAAC;AAEH,IACG,QAAQ,UAAU,sCAAQ,EAC1B,QAAQ,aAAa,EACrB,OAAO,OAAO,SAAS;AACtB,QAAM,EAAE,OAAO,IAAI,MAAM,OAAO,sBAAmB;AACnD,QAAM,OAAO;AACf,CAAC;AAKH,IACG,QAAQ,eAAe,+BAAW,EAClC,QAAQ,kBAAkB,EAC1B,OAAO,YAAY;AAClB,QAAM,EAAE,YAAY,IAAI,MAAM,OAAO,2BAAwB;AAC7D,QAAM,YAAY;AACpB,CAAC;AAIH,IAAI,QAAQ,SAAS,cAAI,EAAE,OAAO,YAAY;AAC5C,QAAM,EAAE,WAAW,IAAI,MAAM,OAAO,oBAAsB;AAC1D,QAAM,WAAW,gBAAgB;AACnC,CAAC;AACD,IAAI,QAAQ,UAAU,cAAI,EAAE,OAAO,YAAY;AAC7C,QAAM,EAAE,WAAW,IAAI,MAAM,OAAO,oBAAsB;AAC1D,QAAM,WAAW,kBAAkB;AACrC,CAAC;AACD,IAAI,QAAQ,YAAY,0BAAM,EAAE,OAAO,YAAY;AACjD,QAAM,EAAE,WAAW,IAAI,MAAM,OAAO,oBAAsB;AAC1D,MAAI,WAAW,QAAQ;AACrB,YAAQ,IAAI,UACP,WAAW,OAAO,KAAK;AAAA,SACvB,WAAW,OAAO,GAAG;AAAA,SACrB,IAAI,KAAK,WAAW,OAAO,WAAW,EAAE,eAAe,CAAC;AAAA,CAChE;AAAA,EACC,OAAO;AACL,YAAQ,IAAI,oBAAK;AACjB,YAAQ,IAAI,sCAAkB;AAAA,EAChC;AACF,CAAC;AAGD,IACG,QAAQ,QAAQ,4CAAS,EACzB,QAAQ,WAAW,EACnB,OAAO,YAAY;AAClB,QAAM,EAAE,WAAW,IAAI,MAAM,OAAO,0BAAuB;AAC3D,QAAM,WAAW;AACnB,CAAC;AAEH,IACG,QAAQ,eAAe,gCAAO,EAC9B,QAAQ,kBAAkB,EAC1B,MAAM,GAAG,EACT,OAAO,OAAO,SAAS;AACtB,QAAM,EAAE,YAAY,IAAI,MAAM,OAAO,2BAAwB;AAC7D,QAAM,YAAY,IAAI;AACxB,CAAC;AAGH,IAAI,QAAQ,EAAE,EAAE,OAAO,OAAO,SAAS;AACrC,QAAM,EAAE,YAAY,IAAI,MAAM,OAAO,2BAAwB;AAC7D,QAAM,YAAY,IAAI;AACxB,CAAC;AAED,IAAI,QAAQ,OAAO;AACnB,IAAI,KAAK;AAAA,CAER,YAAY;AACX,MAAI;AAEF,QAAI,MAAM,QAAQ,MAAM,EAAE,KAAK,MAAM,CAAC;AAGtC,UAAM,IAAI,kBAAkB;AAAA,EAC9B,SAAS,OAAO;AAAA,EAKhB;AACF,GAAG;","names":[]}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-2SEEW5WZ.js";
|
|
12
12
|
import {
|
|
13
13
|
getConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PRJ3NOXB.js";
|
|
15
15
|
import "./chunk-555YTWSW.js";
|
|
16
16
|
import {
|
|
17
17
|
createLogger
|
|
@@ -46,4 +46,4 @@ async function download() {
|
|
|
46
46
|
export {
|
|
47
47
|
download
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=download-
|
|
49
|
+
//# sourceMappingURL=download-KXSMWNXH.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-2SEEW5WZ.js";
|
|
7
7
|
import {
|
|
8
8
|
getConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PRJ3NOXB.js";
|
|
10
10
|
import "./chunk-555YTWSW.js";
|
|
11
11
|
import {
|
|
12
12
|
createLogger
|
|
@@ -110,4 +110,4 @@ async function saveExtractedMetaData(config, extractedI18nDataMap) {
|
|
|
110
110
|
export {
|
|
111
111
|
extract
|
|
112
112
|
};
|
|
113
|
-
//# sourceMappingURL=extract-
|
|
113
|
+
//# sourceMappingURL=extract-ARNNWYYN.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-2SEEW5WZ.js";
|
|
7
7
|
import {
|
|
8
8
|
getConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PRJ3NOXB.js";
|
|
10
10
|
import "./chunk-555YTWSW.js";
|
|
11
11
|
import {
|
|
12
12
|
createLogger
|
|
@@ -276,4 +276,4 @@ export {
|
|
|
276
276
|
generateApiRequestCode,
|
|
277
277
|
markCircularToRef
|
|
278
278
|
};
|
|
279
|
-
//# sourceMappingURL=generateApi-
|
|
279
|
+
//# sourceMappingURL=generateApi-6O2YBWTL.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import '@apidevtools/swagger-parser';
|
|
|
6
6
|
import 'openapi-types';
|
|
7
7
|
|
|
8
8
|
declare function defineConfig<T extends Config = Config>(c: T): T;
|
|
9
|
-
declare const configName = "dune.config.
|
|
9
|
+
declare const configName = "dune.config.ts";
|
|
10
10
|
declare function getConfig(): Promise<Config>;
|
|
11
11
|
|
|
12
12
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
configName,
|
|
3
3
|
getConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PRJ3NOXB.js";
|
|
5
5
|
import "./chunk-555YTWSW.js";
|
|
6
6
|
import {
|
|
7
7
|
createLogger
|
|
@@ -11,14 +11,12 @@ import {
|
|
|
11
11
|
import fs from "fs-extra";
|
|
12
12
|
import path from "path";
|
|
13
13
|
var log = createLogger("initConfig");
|
|
14
|
-
var tpl =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
module.exports = defineConfig({ i18n: [], api:[] });
|
|
21
|
-
`;
|
|
14
|
+
var tpl = `import { defineConfig } from "@dune2/cli";
|
|
15
|
+
|
|
16
|
+
export default defineConfig({
|
|
17
|
+
i18n: [],
|
|
18
|
+
api: [],
|
|
19
|
+
});`;
|
|
22
20
|
var initConfig = async () => {
|
|
23
21
|
const config = await getConfig();
|
|
24
22
|
const configPath = path.join(config.cwd, configName);
|
|
@@ -33,4 +31,4 @@ var initConfig = async () => {
|
|
|
33
31
|
export {
|
|
34
32
|
initConfig
|
|
35
33
|
};
|
|
36
|
-
//# sourceMappingURL=initConfig-
|
|
34
|
+
//# sourceMappingURL=initConfig-5VN3U4OF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/initConfig.ts"],"sourcesContent":["import fs from \"fs-extra\";\nimport path from \"path\";\nimport { createLogger } from \"../shared\";\nimport { configName, getConfig } from \"../shared/config\";\n\nconst log = createLogger(\"initConfig\");\n\nconst tpl = `\\\nimport { defineConfig } from \"@dune2/cli\";\n\nexport default defineConfig({\n i18n: [],\n api: [],\n});`;\n\nexport const initConfig = async () => {\n const config = await getConfig();\n const configPath = path.join(config.cwd!, configName);\n log.info(`config file path: ${configPath}`);\n if (await fs.pathExists(configPath)) {\n log.info(`config file already exists, skip`);\n return;\n }\n await fs.writeFile(configPath, tpl);\n log.info(`config file created`);\n};\n"],"mappings":";;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAIjB,IAAM,MAAM,aAAa,YAAY;AAErC,IAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAQL,IAAM,aAAa,YAAY;AACpC,QAAM,SAAS,MAAM,UAAU;AAC/B,QAAM,aAAa,KAAK,KAAK,OAAO,KAAM,UAAU;AACpD,MAAI,KAAK,qBAAqB,UAAU,EAAE;AAC1C,MAAI,MAAM,GAAG,WAAW,UAAU,GAAG;AACnC,QAAI,KAAK,kCAAkC;AAC3C;AAAA,EACF;AACA,QAAM,GAAG,UAAU,YAAY,GAAG;AAClC,MAAI,KAAK,qBAAqB;AAChC;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-Q7UJ456X.js";
|
|
4
4
|
import {
|
|
5
5
|
getConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PRJ3NOXB.js";
|
|
7
7
|
import "./chunk-555YTWSW.js";
|
|
8
8
|
import {
|
|
9
9
|
createLogger
|
|
@@ -134,4 +134,4 @@ async function namespace(params) {
|
|
|
134
134
|
export {
|
|
135
135
|
namespace
|
|
136
136
|
};
|
|
137
|
-
//# sourceMappingURL=namespace-
|
|
137
|
+
//# sourceMappingURL=namespace-SAPL3UY6.js.map
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-2SEEW5WZ.js";
|
|
16
16
|
import {
|
|
17
17
|
getConfig
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PRJ3NOXB.js";
|
|
19
19
|
import "./chunk-555YTWSW.js";
|
|
20
20
|
import {
|
|
21
21
|
createLogger
|
|
@@ -89,4 +89,4 @@ async function upload() {
|
|
|
89
89
|
export {
|
|
90
90
|
upload
|
|
91
91
|
};
|
|
92
|
-
//# sourceMappingURL=upload-
|
|
92
|
+
//# sourceMappingURL=upload-S43DON7A.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dune2/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/liaoyinglong/next-tools.git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"fs-extra": "^11.2.0",
|
|
41
41
|
"globby": "^14.0.1",
|
|
42
42
|
"googleapis": "108.0.0",
|
|
43
|
-
"
|
|
43
|
+
"jiti": "^2.4.2",
|
|
44
44
|
"json-schema-to-typescript": "15.0.0",
|
|
45
45
|
"lodash": "^4.17.21",
|
|
46
46
|
"open": "^10.1.0",
|
package/dist/chunk-2DSIJDNZ.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
normalizeConfig
|
|
3
|
-
} from "./chunk-555YTWSW.js";
|
|
4
|
-
|
|
5
|
-
// src/shared/config/index.ts
|
|
6
|
-
import JoyCon from "joycon";
|
|
7
|
-
var joycon = new JoyCon();
|
|
8
|
-
function defineConfig(c) {
|
|
9
|
-
return c;
|
|
10
|
-
}
|
|
11
|
-
var configName = "dune.config.js";
|
|
12
|
-
async function getConfig() {
|
|
13
|
-
const res = await joycon.load([configName]);
|
|
14
|
-
return normalizeConfig(res.data ?? {});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
defineConfig,
|
|
19
|
-
configName,
|
|
20
|
-
getConfig
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=chunk-2DSIJDNZ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shared/config/index.ts"],"sourcesContent":["import JoyCon from \"joycon\";\nimport { Config } from \"./types\";\nimport { normalizeConfig } from \"./normalizeConfig\";\n\nexport * from \"./types\";\n\nconst joycon = new JoyCon();\n\nexport function defineConfig<T extends Config = Config>(c: T) {\n return c;\n}\n\nexport const configName = \"dune.config.js\";\n\nexport async function getConfig(): Promise<Config> {\n const res = await joycon.load([configName]);\n return normalizeConfig(res.data ?? {});\n}\n"],"mappings":";;;;;AAAA,OAAO,YAAY;AAMnB,IAAM,SAAS,IAAI,OAAO;AAEnB,SAAS,aAAwC,GAAM;AAC5D,SAAO;AACT;AAEO,IAAM,aAAa;AAE1B,eAAsB,YAA6B;AACjD,QAAM,MAAM,MAAM,OAAO,KAAK,CAAC,UAAU,CAAC;AAC1C,SAAO,gBAAgB,IAAI,QAAQ,CAAC,CAAC;AACvC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/initConfig.ts"],"sourcesContent":["import { createLogger } from \"../shared\";\nimport { getConfig, configName } from \"../shared/config\";\nimport fs from \"fs-extra\";\nimport path from \"path\";\n\nconst log = createLogger(\"initConfig\");\n\nconst tpl = `\\\n/**\n * @param {import('@dune2/cli').Config} config\n */\nfunction defineConfig(config) {\n return config;\n}\nmodule.exports = defineConfig({ i18n: [], api:[] });\n`;\n\nexport const initConfig = async () => {\n const config = await getConfig();\n const configPath = path.join(config.cwd!, configName);\n log.info(`config file path: ${configPath}`);\n if (await fs.pathExists(configPath)) {\n log.info(`config file already exists, skip`);\n return;\n }\n await fs.writeFile(configPath, tpl);\n log.info(`config file created`);\n};\n"],"mappings":";;;;;;;;;;AAEA,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,IAAM,MAAM,aAAa,YAAY;AAErC,IAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUL,IAAM,aAAa,YAAY;AACpC,QAAM,SAAS,MAAM,UAAU;AAC/B,QAAM,aAAa,KAAK,KAAK,OAAO,KAAM,UAAU;AACpD,MAAI,KAAK,qBAAqB,UAAU,EAAE;AAC1C,MAAI,MAAM,GAAG,WAAW,UAAU,GAAG;AACnC,QAAI,KAAK,kCAAkC;AAC3C;AAAA,EACF;AACA,QAAM,GAAG,UAAU,YAAY,GAAG;AAClC,MAAI,KAAK,qBAAqB;AAChC;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|