@cieloazul310/digital-go-pandacss-cli 0.1.2 → 0.1.3
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/bin/index.cjs +46 -33
- package/bin/index.js +46 -39
- package/package.json +4 -4
package/bin/index.cjs
CHANGED
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
5
5
|
var import_commander = require("commander");
|
|
6
|
-
var import_fs5 = require("fs");
|
|
7
6
|
var import_path5 = require("path");
|
|
8
7
|
|
|
9
8
|
// src/load-catalogue.ts
|
|
10
|
-
var
|
|
9
|
+
var import_promises = require("fs/promises");
|
|
11
10
|
var import_path = require("path");
|
|
12
|
-
function loadCatalogue() {
|
|
11
|
+
async function loadCatalogue() {
|
|
13
12
|
const cataloguePath = (0, import_path.resolve)(__dirname, "..", "public", "catalogue.json");
|
|
14
13
|
let file;
|
|
15
14
|
try {
|
|
16
|
-
file = (0,
|
|
15
|
+
file = await (0, import_promises.readFile)(cataloguePath, "utf8");
|
|
17
16
|
} catch (err) {
|
|
18
17
|
throw new Error(`Could not read ${cataloguePath}: ${getErrorMessage(err)}`);
|
|
19
18
|
}
|
|
@@ -40,23 +39,37 @@ function getErrorMessage(err) {
|
|
|
40
39
|
// src/install-snippets.ts
|
|
41
40
|
var import_simple_git = require("simple-git");
|
|
42
41
|
var import_os = require("os");
|
|
43
|
-
var
|
|
42
|
+
var import_promises5 = require("fs/promises");
|
|
44
43
|
var import_path4 = require("path");
|
|
45
44
|
|
|
46
45
|
// src/read-config.ts
|
|
47
|
-
var
|
|
46
|
+
var import_promises3 = require("fs/promises");
|
|
48
47
|
var import_path2 = require("path");
|
|
49
|
-
|
|
48
|
+
|
|
49
|
+
// src/fs-exists.ts
|
|
50
|
+
var import_promises2 = require("fs/promises");
|
|
51
|
+
var import_fs = require("fs");
|
|
52
|
+
async function exists(path) {
|
|
53
|
+
try {
|
|
54
|
+
await (0, import_promises2.access)(path, import_fs.constants.F_OK);
|
|
55
|
+
return true;
|
|
56
|
+
} catch {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/read-config.ts
|
|
62
|
+
async function readConfig(cwd = process.cwd()) {
|
|
50
63
|
const defaultConfig = {
|
|
51
64
|
outDir: "src/components/ui",
|
|
52
65
|
override: true
|
|
53
66
|
};
|
|
54
67
|
const configPath = (0, import_path2.join)(cwd, "components.json");
|
|
55
|
-
if (!
|
|
68
|
+
if (!await exists(configPath)) {
|
|
56
69
|
return defaultConfig;
|
|
57
70
|
}
|
|
58
71
|
const config = JSON.parse(
|
|
59
|
-
(0,
|
|
72
|
+
await (0, import_promises3.readFile)(configPath, "utf-8")
|
|
60
73
|
);
|
|
61
74
|
return {
|
|
62
75
|
...defaultConfig,
|
|
@@ -65,9 +78,9 @@ function readConfig(cwd = process.cwd()) {
|
|
|
65
78
|
}
|
|
66
79
|
|
|
67
80
|
// src/copy-components.ts
|
|
68
|
-
var
|
|
81
|
+
var import_promises4 = require("fs/promises");
|
|
69
82
|
var import_path3 = require("path");
|
|
70
|
-
function copyComponents({
|
|
83
|
+
async function copyComponents({
|
|
71
84
|
templateDir,
|
|
72
85
|
outputDir,
|
|
73
86
|
versionComment,
|
|
@@ -75,55 +88,55 @@ function copyComponents({
|
|
|
75
88
|
ids
|
|
76
89
|
}) {
|
|
77
90
|
if (!ids) {
|
|
78
|
-
if (
|
|
91
|
+
if (await exists(outputDir) && !override) {
|
|
79
92
|
throw new Error(
|
|
80
93
|
`\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059: ${outputDir}. --override\u3092\u4F7F\u7528\u3057\u3066\u4E0A\u66F8\u304D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
81
94
|
);
|
|
82
95
|
}
|
|
83
|
-
(0,
|
|
84
|
-
const dirs = (0,
|
|
96
|
+
await (0, import_promises4.cp)(templateDir, outputDir, { recursive: true });
|
|
97
|
+
const dirs = await (0, import_promises4.readdir)(outputDir, { withFileTypes: true });
|
|
85
98
|
for (const dir of dirs) {
|
|
86
99
|
if (dir.isDirectory()) {
|
|
87
100
|
const destDir = (0, import_path3.join)(outputDir, dir.name);
|
|
88
|
-
const files = (0,
|
|
101
|
+
const files = await (0, import_promises4.readdir)(destDir, { withFileTypes: true });
|
|
89
102
|
for (const file of files) {
|
|
90
103
|
if (file.isFile() && file.name.endsWith(".tsx")) {
|
|
91
104
|
const destPath = (0, import_path3.join)(destDir, file.name);
|
|
92
|
-
const content = (0,
|
|
105
|
+
const content = await (0, import_promises4.readFile)(destPath, "utf8");
|
|
93
106
|
if (versionComment && content.startsWith(versionComment)) continue;
|
|
94
|
-
(0,
|
|
107
|
+
await (0, import_promises4.writeFile)(destPath, (versionComment || "") + content, "utf8");
|
|
95
108
|
}
|
|
96
109
|
}
|
|
97
110
|
}
|
|
98
111
|
}
|
|
99
112
|
return;
|
|
100
113
|
}
|
|
101
|
-
if (
|
|
114
|
+
if (await exists(outputDir) && !override) {
|
|
102
115
|
throw new Error(
|
|
103
116
|
`\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059: ${outputDir}. --override\u3092\u4F7F\u7528\u3057\u3066\u4E0A\u66F8\u304D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
104
117
|
);
|
|
105
118
|
}
|
|
106
119
|
for (const id of ids) {
|
|
107
120
|
const src = (0, import_path3.join)(templateDir, id);
|
|
108
|
-
if (!
|
|
121
|
+
if (!await exists(src)) {
|
|
109
122
|
throw new Error(
|
|
110
123
|
`\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${id} (expected at ${src})`
|
|
111
124
|
);
|
|
112
125
|
}
|
|
113
126
|
const dest = (0, import_path3.join)(outputDir, id);
|
|
114
|
-
if (
|
|
127
|
+
if (await exists(dest) && !override) {
|
|
115
128
|
throw new Error(
|
|
116
129
|
`\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059: ${dest}. --override\u3092\u4F7F\u7528\u3057\u3066\u4E0A\u66F8\u304D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
117
130
|
);
|
|
118
131
|
}
|
|
119
|
-
(0,
|
|
120
|
-
const destFiles = (0,
|
|
132
|
+
await (0, import_promises4.cp)(src, dest, { recursive: true });
|
|
133
|
+
const destFiles = await (0, import_promises4.readdir)(dest, { withFileTypes: true });
|
|
121
134
|
for (const file of destFiles) {
|
|
122
135
|
if (file.isFile() && file.name.endsWith(".tsx")) {
|
|
123
136
|
const destPath = (0, import_path3.join)(dest, file.name);
|
|
124
|
-
const content = (0,
|
|
137
|
+
const content = await (0, import_promises4.readFile)(destPath, "utf8");
|
|
125
138
|
if (versionComment && content.startsWith(versionComment)) continue;
|
|
126
|
-
(0,
|
|
139
|
+
await (0, import_promises4.writeFile)(destPath, (versionComment || "") + content, "utf8");
|
|
127
140
|
}
|
|
128
141
|
}
|
|
129
142
|
}
|
|
@@ -144,12 +157,12 @@ function createVersionComment({
|
|
|
144
157
|
// src/install-snippets.ts
|
|
145
158
|
async function main(args) {
|
|
146
159
|
const cwd = process.cwd();
|
|
147
|
-
const { outDir, sourceDir, override } = readConfig(cwd);
|
|
160
|
+
const { outDir, sourceDir, override } = await readConfig(cwd);
|
|
148
161
|
const tmpPath = (0, import_path4.join)((0, import_os.tmpdir)(), `digital-go-pandacss-${Date.now()}`);
|
|
149
162
|
let templateDir = void 0;
|
|
150
163
|
let versionComment = void 0;
|
|
151
164
|
if (sourceDir) {
|
|
152
|
-
(0,
|
|
165
|
+
await (0, import_promises5.cp)((0, import_path4.join)(cwd, sourceDir), tmpPath, { recursive: true });
|
|
153
166
|
templateDir = tmpPath;
|
|
154
167
|
versionComment = createVersionComment();
|
|
155
168
|
} else {
|
|
@@ -163,12 +176,12 @@ async function main(args) {
|
|
|
163
176
|
templateDir = (0, import_path4.join)(tmpPath, templateSubdir);
|
|
164
177
|
versionComment = createVersionComment({ tag, commit });
|
|
165
178
|
}
|
|
166
|
-
if (!
|
|
179
|
+
if (!await exists(templateDir)) {
|
|
167
180
|
throw new Error(`\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${templateDir}`);
|
|
168
181
|
}
|
|
169
182
|
const outputDir = (0, import_path4.join)(cwd, outDir);
|
|
170
183
|
const idsToCopy = args && args.length > 0 ? args : void 0;
|
|
171
|
-
copyComponents({
|
|
184
|
+
await copyComponents({
|
|
172
185
|
templateDir,
|
|
173
186
|
outputDir,
|
|
174
187
|
override,
|
|
@@ -196,7 +209,7 @@ program.command("install [ids...]").description("\u30A4\u30F3\u30B9\u30C8\u30FC\
|
|
|
196
209
|
console.error("\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8ID\u3092\u6307\u5B9A\u3059\u308B\u304B\u3001--all\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
197
210
|
process.exit(2);
|
|
198
211
|
}
|
|
199
|
-
const catalogue = loadCatalogue() ?? { components: {} };
|
|
212
|
+
const catalogue = await loadCatalogue() ?? { components: {} };
|
|
200
213
|
const availableIds = Object.values(catalogue.components || {}).map(
|
|
201
214
|
({ id }) => id
|
|
202
215
|
);
|
|
@@ -207,11 +220,11 @@ program.command("install [ids...]").description("\u30A4\u30F3\u30B9\u30C8\u30FC\
|
|
|
207
220
|
process.exit(2);
|
|
208
221
|
}
|
|
209
222
|
try {
|
|
210
|
-
const { outDir: cfgOutDir, override: cfgOverride } = readConfig(
|
|
223
|
+
const { outDir: cfgOutDir, override: cfgOverride } = await readConfig(
|
|
211
224
|
process.cwd()
|
|
212
225
|
);
|
|
213
226
|
const outputPath = (0, import_path5.join)(process.cwd(), cfgOutDir);
|
|
214
|
-
if (
|
|
227
|
+
if (await exists(outputPath) && !cfgOverride) {
|
|
215
228
|
console.error(
|
|
216
229
|
`\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059: ${outputPath}. --override\u3092\u4F7F\u7528\u3057\u3066\u4E0A\u66F8\u304D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
217
230
|
);
|
|
@@ -223,8 +236,8 @@ program.command("install [ids...]").description("\u30A4\u30F3\u30B9\u30C8\u30FC\
|
|
|
223
236
|
process.exit(1);
|
|
224
237
|
}
|
|
225
238
|
});
|
|
226
|
-
program.command("list").description("\u5229\u7528\u53EF\u80FD\u306A\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8ID\u306E\u4E00\u89A7\u3092\u8868\u793A\u3057\u307E\u3059").option("--json", "JSON\u5F62\u5F0F\u3067\u51FA\u529B\u3057\u307E\u3059").action((options) => {
|
|
227
|
-
const catalogue = loadCatalogue();
|
|
239
|
+
program.command("list").description("\u5229\u7528\u53EF\u80FD\u306A\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8ID\u306E\u4E00\u89A7\u3092\u8868\u793A\u3057\u307E\u3059").option("--json", "JSON\u5F62\u5F0F\u3067\u51FA\u529B\u3057\u307E\u3059").action(async (options) => {
|
|
240
|
+
const catalogue = await loadCatalogue();
|
|
228
241
|
if (!catalogue || !catalogue.components) {
|
|
229
242
|
console.error("\u30AB\u30BF\u30ED\u30B0\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093");
|
|
230
243
|
process.exit(1);
|
package/bin/index.js
CHANGED
|
@@ -9,17 +9,16 @@ var __dirname = /* @__PURE__ */ getDirname();
|
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
11
|
import { Command } from "commander";
|
|
12
|
-
import { existsSync as existsSync4 } from "fs";
|
|
13
12
|
import { join as join4 } from "path";
|
|
14
13
|
|
|
15
14
|
// src/load-catalogue.ts
|
|
16
|
-
import {
|
|
15
|
+
import { readFile } from "fs/promises";
|
|
17
16
|
import { resolve } from "path";
|
|
18
|
-
function loadCatalogue() {
|
|
17
|
+
async function loadCatalogue() {
|
|
19
18
|
const cataloguePath = resolve(__dirname, "..", "public", "catalogue.json");
|
|
20
19
|
let file;
|
|
21
20
|
try {
|
|
22
|
-
file =
|
|
21
|
+
file = await readFile(cataloguePath, "utf8");
|
|
23
22
|
} catch (err) {
|
|
24
23
|
throw new Error(`Could not read ${cataloguePath}: ${getErrorMessage(err)}`);
|
|
25
24
|
}
|
|
@@ -46,23 +45,37 @@ function getErrorMessage(err) {
|
|
|
46
45
|
// src/install-snippets.ts
|
|
47
46
|
import { simpleGit } from "simple-git";
|
|
48
47
|
import { tmpdir } from "os";
|
|
49
|
-
import {
|
|
48
|
+
import { cp as cp2 } from "fs/promises";
|
|
50
49
|
import { join as join3 } from "path";
|
|
51
50
|
|
|
52
51
|
// src/read-config.ts
|
|
53
|
-
import {
|
|
52
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
54
53
|
import { join } from "path";
|
|
55
|
-
|
|
54
|
+
|
|
55
|
+
// src/fs-exists.ts
|
|
56
|
+
import { access } from "fs/promises";
|
|
57
|
+
import { constants } from "fs";
|
|
58
|
+
async function exists(path2) {
|
|
59
|
+
try {
|
|
60
|
+
await access(path2, constants.F_OK);
|
|
61
|
+
return true;
|
|
62
|
+
} catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/read-config.ts
|
|
68
|
+
async function readConfig(cwd = process.cwd()) {
|
|
56
69
|
const defaultConfig = {
|
|
57
70
|
outDir: "src/components/ui",
|
|
58
71
|
override: true
|
|
59
72
|
};
|
|
60
73
|
const configPath = join(cwd, "components.json");
|
|
61
|
-
if (!
|
|
74
|
+
if (!await exists(configPath)) {
|
|
62
75
|
return defaultConfig;
|
|
63
76
|
}
|
|
64
77
|
const config = JSON.parse(
|
|
65
|
-
|
|
78
|
+
await readFile2(configPath, "utf-8")
|
|
66
79
|
);
|
|
67
80
|
return {
|
|
68
81
|
...defaultConfig,
|
|
@@ -71,15 +84,9 @@ function readConfig(cwd = process.cwd()) {
|
|
|
71
84
|
}
|
|
72
85
|
|
|
73
86
|
// src/copy-components.ts
|
|
74
|
-
import {
|
|
75
|
-
readdirSync,
|
|
76
|
-
readFileSync as readFileSync3,
|
|
77
|
-
writeFileSync,
|
|
78
|
-
existsSync as existsSync2,
|
|
79
|
-
cpSync
|
|
80
|
-
} from "fs";
|
|
87
|
+
import { readdir, readFile as readFile3, writeFile, cp } from "fs/promises";
|
|
81
88
|
import { join as join2 } from "path";
|
|
82
|
-
function copyComponents({
|
|
89
|
+
async function copyComponents({
|
|
83
90
|
templateDir,
|
|
84
91
|
outputDir,
|
|
85
92
|
versionComment,
|
|
@@ -87,55 +94,55 @@ function copyComponents({
|
|
|
87
94
|
ids
|
|
88
95
|
}) {
|
|
89
96
|
if (!ids) {
|
|
90
|
-
if (
|
|
97
|
+
if (await exists(outputDir) && !override) {
|
|
91
98
|
throw new Error(
|
|
92
99
|
`\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059: ${outputDir}. --override\u3092\u4F7F\u7528\u3057\u3066\u4E0A\u66F8\u304D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
93
100
|
);
|
|
94
101
|
}
|
|
95
|
-
|
|
96
|
-
const dirs =
|
|
102
|
+
await cp(templateDir, outputDir, { recursive: true });
|
|
103
|
+
const dirs = await readdir(outputDir, { withFileTypes: true });
|
|
97
104
|
for (const dir of dirs) {
|
|
98
105
|
if (dir.isDirectory()) {
|
|
99
106
|
const destDir = join2(outputDir, dir.name);
|
|
100
|
-
const files =
|
|
107
|
+
const files = await readdir(destDir, { withFileTypes: true });
|
|
101
108
|
for (const file of files) {
|
|
102
109
|
if (file.isFile() && file.name.endsWith(".tsx")) {
|
|
103
110
|
const destPath = join2(destDir, file.name);
|
|
104
|
-
const content =
|
|
111
|
+
const content = await readFile3(destPath, "utf8");
|
|
105
112
|
if (versionComment && content.startsWith(versionComment)) continue;
|
|
106
|
-
|
|
113
|
+
await writeFile(destPath, (versionComment || "") + content, "utf8");
|
|
107
114
|
}
|
|
108
115
|
}
|
|
109
116
|
}
|
|
110
117
|
}
|
|
111
118
|
return;
|
|
112
119
|
}
|
|
113
|
-
if (
|
|
120
|
+
if (await exists(outputDir) && !override) {
|
|
114
121
|
throw new Error(
|
|
115
122
|
`\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059: ${outputDir}. --override\u3092\u4F7F\u7528\u3057\u3066\u4E0A\u66F8\u304D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
116
123
|
);
|
|
117
124
|
}
|
|
118
125
|
for (const id of ids) {
|
|
119
126
|
const src = join2(templateDir, id);
|
|
120
|
-
if (!
|
|
127
|
+
if (!await exists(src)) {
|
|
121
128
|
throw new Error(
|
|
122
129
|
`\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${id} (expected at ${src})`
|
|
123
130
|
);
|
|
124
131
|
}
|
|
125
132
|
const dest = join2(outputDir, id);
|
|
126
|
-
if (
|
|
133
|
+
if (await exists(dest) && !override) {
|
|
127
134
|
throw new Error(
|
|
128
135
|
`\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059: ${dest}. --override\u3092\u4F7F\u7528\u3057\u3066\u4E0A\u66F8\u304D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
129
136
|
);
|
|
130
137
|
}
|
|
131
|
-
|
|
132
|
-
const destFiles =
|
|
138
|
+
await cp(src, dest, { recursive: true });
|
|
139
|
+
const destFiles = await readdir(dest, { withFileTypes: true });
|
|
133
140
|
for (const file of destFiles) {
|
|
134
141
|
if (file.isFile() && file.name.endsWith(".tsx")) {
|
|
135
142
|
const destPath = join2(dest, file.name);
|
|
136
|
-
const content =
|
|
143
|
+
const content = await readFile3(destPath, "utf8");
|
|
137
144
|
if (versionComment && content.startsWith(versionComment)) continue;
|
|
138
|
-
|
|
145
|
+
await writeFile(destPath, (versionComment || "") + content, "utf8");
|
|
139
146
|
}
|
|
140
147
|
}
|
|
141
148
|
}
|
|
@@ -156,12 +163,12 @@ function createVersionComment({
|
|
|
156
163
|
// src/install-snippets.ts
|
|
157
164
|
async function main(args) {
|
|
158
165
|
const cwd = process.cwd();
|
|
159
|
-
const { outDir, sourceDir, override } = readConfig(cwd);
|
|
166
|
+
const { outDir, sourceDir, override } = await readConfig(cwd);
|
|
160
167
|
const tmpPath = join3(tmpdir(), `digital-go-pandacss-${Date.now()}`);
|
|
161
168
|
let templateDir = void 0;
|
|
162
169
|
let versionComment = void 0;
|
|
163
170
|
if (sourceDir) {
|
|
164
|
-
|
|
171
|
+
await cp2(join3(cwd, sourceDir), tmpPath, { recursive: true });
|
|
165
172
|
templateDir = tmpPath;
|
|
166
173
|
versionComment = createVersionComment();
|
|
167
174
|
} else {
|
|
@@ -175,12 +182,12 @@ async function main(args) {
|
|
|
175
182
|
templateDir = join3(tmpPath, templateSubdir);
|
|
176
183
|
versionComment = createVersionComment({ tag, commit });
|
|
177
184
|
}
|
|
178
|
-
if (!
|
|
185
|
+
if (!await exists(templateDir)) {
|
|
179
186
|
throw new Error(`\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${templateDir}`);
|
|
180
187
|
}
|
|
181
188
|
const outputDir = join3(cwd, outDir);
|
|
182
189
|
const idsToCopy = args && args.length > 0 ? args : void 0;
|
|
183
|
-
copyComponents({
|
|
190
|
+
await copyComponents({
|
|
184
191
|
templateDir,
|
|
185
192
|
outputDir,
|
|
186
193
|
override,
|
|
@@ -208,7 +215,7 @@ program.command("install [ids...]").description("\u30A4\u30F3\u30B9\u30C8\u30FC\
|
|
|
208
215
|
console.error("\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8ID\u3092\u6307\u5B9A\u3059\u308B\u304B\u3001--all\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
209
216
|
process.exit(2);
|
|
210
217
|
}
|
|
211
|
-
const catalogue = loadCatalogue() ?? { components: {} };
|
|
218
|
+
const catalogue = await loadCatalogue() ?? { components: {} };
|
|
212
219
|
const availableIds = Object.values(catalogue.components || {}).map(
|
|
213
220
|
({ id }) => id
|
|
214
221
|
);
|
|
@@ -219,11 +226,11 @@ program.command("install [ids...]").description("\u30A4\u30F3\u30B9\u30C8\u30FC\
|
|
|
219
226
|
process.exit(2);
|
|
220
227
|
}
|
|
221
228
|
try {
|
|
222
|
-
const { outDir: cfgOutDir, override: cfgOverride } = readConfig(
|
|
229
|
+
const { outDir: cfgOutDir, override: cfgOverride } = await readConfig(
|
|
223
230
|
process.cwd()
|
|
224
231
|
);
|
|
225
232
|
const outputPath = join4(process.cwd(), cfgOutDir);
|
|
226
|
-
if (
|
|
233
|
+
if (await exists(outputPath) && !cfgOverride) {
|
|
227
234
|
console.error(
|
|
228
235
|
`\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059: ${outputPath}. --override\u3092\u4F7F\u7528\u3057\u3066\u4E0A\u66F8\u304D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
229
236
|
);
|
|
@@ -235,8 +242,8 @@ program.command("install [ids...]").description("\u30A4\u30F3\u30B9\u30C8\u30FC\
|
|
|
235
242
|
process.exit(1);
|
|
236
243
|
}
|
|
237
244
|
});
|
|
238
|
-
program.command("list").description("\u5229\u7528\u53EF\u80FD\u306A\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8ID\u306E\u4E00\u89A7\u3092\u8868\u793A\u3057\u307E\u3059").option("--json", "JSON\u5F62\u5F0F\u3067\u51FA\u529B\u3057\u307E\u3059").action((options) => {
|
|
239
|
-
const catalogue = loadCatalogue();
|
|
245
|
+
program.command("list").description("\u5229\u7528\u53EF\u80FD\u306A\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8ID\u306E\u4E00\u89A7\u3092\u8868\u793A\u3057\u307E\u3059").option("--json", "JSON\u5F62\u5F0F\u3067\u51FA\u529B\u3057\u307E\u3059").action(async (options) => {
|
|
246
|
+
const catalogue = await loadCatalogue();
|
|
240
247
|
if (!catalogue || !catalogue.components) {
|
|
241
248
|
console.error("\u30AB\u30BF\u30ED\u30B0\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093");
|
|
242
249
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cieloazul310/digital-go-pandacss-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/cieloazul310/digital-go-design-system-with-panda",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"simple-git": "^3.28.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@repo/eslint-config": "^0.1.
|
|
40
|
-
"@repo/typescript-config": "^0.1.
|
|
39
|
+
"@repo/eslint-config": "^0.1.3",
|
|
40
|
+
"@repo/typescript-config": "^0.1.3",
|
|
41
41
|
"eslint": "^9.37.0",
|
|
42
42
|
"execa": "^9.6.0",
|
|
43
43
|
"tsup": "8.5.0",
|
|
@@ -50,4 +50,4 @@
|
|
|
50
50
|
"prettier --parser typescript --write"
|
|
51
51
|
]
|
|
52
52
|
}
|
|
53
|
-
}
|
|
53
|
+
}
|