@cieloazul310/digital-go-pandacss-cli 0.1.1 → 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/public/catalogue.json +41 -20
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
|
+
}
|
package/public/catalogue.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "アコーディオン",
|
|
6
6
|
"className": "accordion",
|
|
7
7
|
"description": "アコーディオンは、ユーザーがコンテンツのセクションを展開または折りたたむことができるユーザーインタフェースです。",
|
|
8
|
-
"digitalgo": "https://design.digital.go.jp/components/accordion/",
|
|
8
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/accordion/",
|
|
9
9
|
"ark": "https://ark-ui.com/docs/components/accordion",
|
|
10
10
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%82%A2%E3%82%B3%E3%83%BC%E3%83%87%E3%82%A3%E3%82%AA%E3%83%B3--docs"
|
|
11
11
|
},
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"className": "breadcrumb",
|
|
16
16
|
"description": "パンくずリストは、ウェブサイトの階層内でユーザーの現在の位置を表示します。",
|
|
17
17
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%83%91%E3%83%B3%E3%81%8F%E3%81%9A%E3%83%AA%E3%82%B9%E3%83%88--docs",
|
|
18
|
-
"digitalgo": "https://design.digital.go.jp/components/breadcrumb/"
|
|
18
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/breadcrumb/"
|
|
19
19
|
},
|
|
20
20
|
"Button": {
|
|
21
21
|
"id": "button",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"className": "button",
|
|
24
24
|
"description": "ボタンは、主にアクション実行またはページ遷移のためのトリガーとして使用します。",
|
|
25
25
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%83%9C%E3%82%BF%E3%83%B3--docs",
|
|
26
|
-
"digitalgo": "https://design.digital.go.jp/components/button/"
|
|
26
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/button/"
|
|
27
27
|
},
|
|
28
28
|
"Card": {
|
|
29
29
|
"id": "card",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"className": "card",
|
|
32
32
|
"description": "カードは、単一の主題に関するコンテンツをまとめて表示するコンテナとなるコンポーネントです。",
|
|
33
33
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%82%AB%E3%83%BC%E3%83%89--docs",
|
|
34
|
-
"digitalgo": "https://design.digital.go.jp/components/card/"
|
|
34
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/card/"
|
|
35
35
|
},
|
|
36
36
|
"Checkbox": {
|
|
37
37
|
"id": "checkbox",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"className": "checkbox",
|
|
40
40
|
"description": "チェックボックスは、複数の項目の中から複数の選択肢を選ぶことを可能にします。",
|
|
41
41
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%83%81%E3%82%A7%E3%83%83%E3%82%AF%E3%83%9C%E3%83%83%E3%82%AF%E3%82%B9-%E3%82%B0%E3%83%AB%E3%83%BC%E3%83%97--docs",
|
|
42
|
-
"digitalgo": "https://design.digital.go.jp/components/checkbox/",
|
|
42
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/checkbox/",
|
|
43
43
|
"ark": "https://ark-ui.com/docs/components/checkbox"
|
|
44
44
|
},
|
|
45
45
|
"ChipTag": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"className": "chip-tag",
|
|
49
49
|
"description": "アイテム化した任意の情報を、表示・削除しやすくするための要素です。属性やユーザー情報をアイテムにして並べたり削除したりするような場合に有効です。",
|
|
50
50
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-チップタグ--docs",
|
|
51
|
-
"digitalgo": "https://design.digital.go.jp/components/chip-tag/"
|
|
51
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/chip-tag/"
|
|
52
52
|
},
|
|
53
53
|
"ChipLabel": {
|
|
54
54
|
"id": "chip-label",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"className": "chip-label",
|
|
57
57
|
"description": "状態や状況を示すキーワードを表示して、情報の分類・整理の効率を向上させるグラフィック要素です。情報リストやテーブルの各行などのステータスを分かりやすく表示したい場合に有効です。",
|
|
58
58
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%83%81%E3%83%83%E3%83%97%E3%83%A9%E3%83%99%E3%83%AB--docs",
|
|
59
|
-
"digitalgo": "https://design.digital.go.jp/components/chip-label/"
|
|
59
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/chip-label/"
|
|
60
60
|
},
|
|
61
61
|
"DatePicker": {
|
|
62
62
|
"id": "date-picker",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"className": "date-picker",
|
|
65
65
|
"description": "日付ピッカーは、日付を選択するためのフォームコントロールを提供します。カレンダーは、日付の選択を補助するコンポーネントです。",
|
|
66
66
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E6%97%A5%E4%BB%98%E3%83%94%E3%83%83%E3%82%AB%E3%83%BC%EF%BC%8F%E3%82%AB%E3%83%AC%E3%83%B3%E3%83%80%E3%83%BC--docs",
|
|
67
|
-
"digitalgo": "https://design.digital.go.jp/components/date-picker/",
|
|
67
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/date-picker/",
|
|
68
68
|
"ark": "https://ark-ui.com/docs/components/date-picker"
|
|
69
69
|
},
|
|
70
70
|
"Disclosure": {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"className": "disclosure",
|
|
74
74
|
"description": "ディスクロージャーは、コンテンツのセクション内の任意の範囲を折りたたむことができるユーザーインターフェースです。",
|
|
75
75
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%83%87%E3%82%A3%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%82%B8%E3%83%A3%E3%83%BC--docs",
|
|
76
|
-
"digitalgo": "https://design.digital.go.jp/components/disclosure/",
|
|
76
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/disclosure/",
|
|
77
77
|
"ark": "https://ark-ui.com/docs/components/collapsible"
|
|
78
78
|
},
|
|
79
79
|
"Divider": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"className": "divider",
|
|
83
83
|
"description": "ディバイダーは、異なるセクション、コンポーネント、またはコンテンツのグループ間に設けられる視覚的な区切りです。",
|
|
84
84
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%83%87%E3%82%A3%E3%83%90%E3%82%A4%E3%83%80%E3%83%BC--docs",
|
|
85
|
-
"digitalgo": "https://design.digital.go.jp/components/divider/"
|
|
85
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/divider/"
|
|
86
86
|
},
|
|
87
87
|
"Drawer": {
|
|
88
88
|
"id": "drawer",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"className": "drawer",
|
|
91
91
|
"description": "ブラウザ画面の四辺(上下左右端)から展開し、モバイルメニューなどのコンポーネントを格納可能なコンテナです。",
|
|
92
92
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/story/components-%E3%83%89%E3%83%AD%E3%83%AF%E3%83%BC--basic",
|
|
93
|
-
"digitalgo": "https://design.digital.go.jp/components/drawer/",
|
|
93
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/drawer/",
|
|
94
94
|
"ark": "https://ark-ui.com/docs/components/dialog"
|
|
95
95
|
},
|
|
96
96
|
"EmergencyBanner": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"className": "emergency-banner",
|
|
100
100
|
"description": "緊急時バナーは、当該ウェブサイトで本来成すべきコミュニケーションを中断してでもファーストビューを占有して注意を促すためのコンポーネントです。",
|
|
101
101
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E7%B7%8A%E6%80%A5%E6%99%82%E3%83%90%E3%83%8A%E3%83%BC--docs",
|
|
102
|
-
"digitalgo": "https://design.digital.go.jp/components/emergency-banner/"
|
|
102
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/emergency-banner/"
|
|
103
103
|
},
|
|
104
104
|
"Field": {
|
|
105
105
|
"id": "field",
|
|
@@ -107,16 +107,29 @@
|
|
|
107
107
|
"className": "field",
|
|
108
108
|
"description": "インプットテキストコンポーネントは、名前や電話番号など、1行以内のテキストを入力する場合に使用します。",
|
|
109
109
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%82%A4%E3%83%B3%E3%83%97%E3%83%83%E3%83%88%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88--docs",
|
|
110
|
-
"digitalgo": "https://design.digital.go.jp/components/input-text/",
|
|
110
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/input-text/",
|
|
111
111
|
"ark": "https://ark-ui.com/docs/components/field"
|
|
112
112
|
},
|
|
113
|
+
"Fieldset": {
|
|
114
|
+
"id": "fieldset",
|
|
115
|
+
"name": "フィールドセット",
|
|
116
|
+
"className": "fieldset",
|
|
117
|
+
"storybook": "http://localhost:6006/?path=/story/components-%E3%83%95%E3%82%A3%E3%83%BC%E3%83%AB%E3%83%89%E3%82%BB%E3%83%83%E3%83%88--basic",
|
|
118
|
+
"ark": "https://ark-ui.com/docs/components/fieldset"
|
|
119
|
+
},
|
|
120
|
+
"Form": {
|
|
121
|
+
"id": "form",
|
|
122
|
+
"name": "フォームコントロール",
|
|
123
|
+
"className": "form",
|
|
124
|
+
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%83%95%E3%82%A9%E3%83%BC%E3%83%A0--docs"
|
|
125
|
+
},
|
|
113
126
|
"HamburgerMenuButton": {
|
|
114
127
|
"id": "hamburger-menu-button",
|
|
115
128
|
"name": "ハンバーガーメニューボタン",
|
|
116
129
|
"className": "hamburger-menu-button",
|
|
117
130
|
"description": "ハンバーガーメニューボタンは画面スペース資源に制限のある、主にモバイルデバイスで使用されるモバイルメニューを表示するためのトリガーとなるボタンです。",
|
|
118
131
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/component-dads-v2-hamburgermenubutton--docs",
|
|
119
|
-
"digitalgo": "https://design.digital.go.jp/components/hamburger-menu-button/"
|
|
132
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/hamburger-menu-button/"
|
|
120
133
|
},
|
|
121
134
|
"Link": {
|
|
122
135
|
"id": "link",
|
|
@@ -124,7 +137,15 @@
|
|
|
124
137
|
"className": "link",
|
|
125
138
|
"description": "「リンクテキスト」は通常、色や下線などの視覚的な表現で通常のテキストと区別され、リンクを持つテキスト要素です。",
|
|
126
139
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%83%AA%E3%83%B3%E3%82%AF--docs",
|
|
127
|
-
"digitalgo": "https://design.digital.go.jp/foundations/link-text/"
|
|
140
|
+
"digitalgo": "https://design.digital.go.jp/dads/foundations/link-text/"
|
|
141
|
+
},
|
|
142
|
+
"List": {
|
|
143
|
+
"id": "list",
|
|
144
|
+
"name": "リスト",
|
|
145
|
+
"className": "list",
|
|
146
|
+
"description": "一般的なリスト要素。HTMLのul要素、ol要素に相当します。",
|
|
147
|
+
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/story/components-%E3%83%AA%E3%82%B9%E3%83%88-ol--basic",
|
|
148
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/list/"
|
|
128
149
|
},
|
|
129
150
|
"NotificationBanner": {
|
|
130
151
|
"id": "notification-banner",
|
|
@@ -132,7 +153,7 @@
|
|
|
132
153
|
"className": "notification-banner",
|
|
133
154
|
"description": "ウェブサイト全体に関わる、またはページや要素単位における重要度の高い情報を、ユーザーの操作に関わらず、ウェブサイト側からユーザーへ提示する場合に用いる通知バナーです。",
|
|
134
155
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%83%8E%E3%83%86%E3%82%A3%E3%83%95%E3%82%A3%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%83%90%E3%83%8A%E3%83%BC--docs",
|
|
135
|
-
"digitalgo": "https://design.digital.go.jp/components/notification-banner/"
|
|
156
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/notification-banner/"
|
|
136
157
|
},
|
|
137
158
|
"Progress": {
|
|
138
159
|
"id": "progress",
|
|
@@ -140,7 +161,7 @@
|
|
|
140
161
|
"className": "progress",
|
|
141
162
|
"description": "プログレスインジケーターは、ユーザーのアクションに対して処理進行中であることを通知します。",
|
|
142
163
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/story/components-%E3%83%97%E3%83%AD%E3%82%B0%E3%83%AC%E3%82%B9%E3%82%A4%E3%83%B3%E3%82%B8%E3%82%B1%E3%83%BC%E3%82%BF%E3%83%BC--docs",
|
|
143
|
-
"digitalgo": "https://design.digital.go.jp/components/progress-indicator/"
|
|
164
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/progress-indicator/"
|
|
144
165
|
},
|
|
145
166
|
"ResourceList": {
|
|
146
167
|
"id": "resource-list",
|
|
@@ -148,7 +169,7 @@
|
|
|
148
169
|
"className": "resource-list",
|
|
149
170
|
"description": "リソースリストは、共通した複数の任意情報で構成されたオブジェクトのリストを表示します。",
|
|
150
171
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%83%AA%E3%82%BD%E3%83%BC%E3%82%B9%E3%83%AA%E3%82%B9%E3%83%88--docs",
|
|
151
|
-
"digitalgo": "https://design.digital.go.jp/components/resource-list/"
|
|
172
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/resource-list/"
|
|
152
173
|
},
|
|
153
174
|
"Select": {
|
|
154
175
|
"id": "select",
|
|
@@ -156,7 +177,7 @@
|
|
|
156
177
|
"className": "select",
|
|
157
178
|
"description": "セレクトボックスは、複数の選択肢を提供するフォームコントロールです。",
|
|
158
179
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%82%BB%E3%83%AC%E3%82%AF%E3%83%88%E3%83%9C%E3%83%83%E3%82%AF%E3%82%B9--docs",
|
|
159
|
-
"digitalgo": "https://design.digital.go.jp/components/select/",
|
|
180
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/select/",
|
|
160
181
|
"ark": "https://ark-ui.com/docs/components/select"
|
|
161
182
|
},
|
|
162
183
|
"Table": {
|
|
@@ -165,7 +186,7 @@
|
|
|
165
186
|
"className": "table",
|
|
166
187
|
"description": "テーブルは、データや情報を行と列の組み合わせで構造化された表組です。",
|
|
167
188
|
"storybook": "https://cieloazul310.github.io/digital-go-design-system-with-panda/?path=/docs/components-%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB--docs",
|
|
168
|
-
"digitalgo": "https://design.digital.go.jp/components/table/"
|
|
189
|
+
"digitalgo": "https://design.digital.go.jp/dads/components/table/"
|
|
169
190
|
},
|
|
170
191
|
"Tabs": {
|
|
171
192
|
"id": "tabs",
|