@tamagui/cli 2.0.0-rc.4 → 2.0.0-rc.40
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/add.cjs +96 -71
- package/dist/build.cjs +226 -133
- package/dist/cli.cjs +318 -268
- package/dist/generate-prompt.cjs +310 -261
- package/dist/generate.cjs +51 -38
- package/dist/update-template.cjs +43 -31
- package/dist/update.cjs +12 -10
- package/dist/upgrade.cjs +274 -162
- package/dist/utils.cjs +69 -44
- package/package.json +9 -8
- package/src/build.ts +190 -56
- package/src/cli.ts +20 -73
- package/src/generate-prompt.ts +1 -1
- package/src/utils.ts +13 -8
- package/types/build.d.ts +3 -0
- package/types/build.d.ts.map +1 -1
- package/types/generate-prompt.d.ts.map +1 -1
- package/types/utils.d.ts.map +1 -1
- package/dist/add.js +0 -91
- package/dist/add.js.map +0 -6
- package/dist/build.js +0 -188
- package/dist/build.js.map +0 -6
- package/dist/cli.js +0 -266
- package/dist/cli.js.map +0 -6
- package/dist/generate-prompt.js +0 -392
- package/dist/generate-prompt.js.map +0 -6
- package/dist/generate.js +0 -62
- package/dist/generate.js.map +0 -6
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -6
- package/dist/update-template.js +0 -57
- package/dist/update-template.js.map +0 -6
- package/dist/update.js +0 -22
- package/dist/update.js.map +0 -6
- package/dist/upgrade.js +0 -319
- package/dist/upgrade.js.map +0 -6
- package/dist/utils.js +0 -92
- package/dist/utils.js.map +0 -6
package/dist/cli.cjs
CHANGED
|
@@ -2,13 +2,15 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
+
get: () => from[key],
|
|
11
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
+
});
|
|
13
|
+
}
|
|
12
14
|
return to;
|
|
13
15
|
};
|
|
14
16
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
@@ -18,303 +20,351 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
18
20
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
19
21
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
22
|
value: mod,
|
|
21
|
-
enumerable:
|
|
23
|
+
enumerable: true
|
|
22
24
|
}) : target, mod));
|
|
23
|
-
var import_arg = __toESM(require("arg"))
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import_utils = require("./utils.cjs"),
|
|
27
|
-
import_static = require("@tamagui/static");
|
|
25
|
+
var import_arg = __toESM(require("arg"));
|
|
26
|
+
var import_chalk = __toESM(require("chalk"));
|
|
27
|
+
var import_utils = require("./utils.cjs");
|
|
28
28
|
["exit", "SIGINT"].forEach(_ => {
|
|
29
29
|
process.on(_, () => {
|
|
30
|
-
(0, import_utils.disposeAll)()
|
|
30
|
+
(0, import_utils.disposeAll)();
|
|
31
|
+
process.exit();
|
|
31
32
|
});
|
|
32
33
|
});
|
|
33
34
|
const COMMAND_MAP = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
async run() {
|
|
43
|
-
const {
|
|
44
|
-
_,
|
|
45
|
-
...flags2
|
|
46
|
-
} = (0, import_arg.default)(this.flags),
|
|
47
|
-
options = await (0, import_utils.getOptions)({
|
|
48
|
-
debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : !0 : !1,
|
|
49
|
-
loadTamaguiOptions: !0
|
|
50
|
-
});
|
|
51
|
-
await (0, import_static.checkDeps)(options.paths.root);
|
|
52
|
-
}
|
|
35
|
+
check: {
|
|
36
|
+
description: `Checks for inconsistent versions, duplicate installs, lockfile issues, and missing config.`,
|
|
37
|
+
shorthands: [],
|
|
38
|
+
flags: {
|
|
39
|
+
"--help": Boolean,
|
|
40
|
+
"--debug": Boolean,
|
|
41
|
+
"--verbose": Boolean
|
|
53
42
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"--verbose":
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const {
|
|
76
|
-
generatePrompt
|
|
77
|
-
} = require("./generate-prompt.cjs"),
|
|
78
|
-
{
|
|
79
|
-
join
|
|
80
|
-
} = require("node:path");
|
|
81
|
-
await generatePrompt({
|
|
82
|
-
...options,
|
|
83
|
-
output: join(options.paths.dotDir, "prompt.md")
|
|
84
|
-
});
|
|
85
|
-
}
|
|
43
|
+
async run() {
|
|
44
|
+
const {
|
|
45
|
+
_,
|
|
46
|
+
...flags2
|
|
47
|
+
} = (0, import_arg.default)(this.flags);
|
|
48
|
+
const options = await (0, import_utils.getOptions)({
|
|
49
|
+
debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : true : false
|
|
50
|
+
});
|
|
51
|
+
const {
|
|
52
|
+
checkDeps
|
|
53
|
+
} = require("@tamagui/static/checkDeps");
|
|
54
|
+
await checkDeps(options.paths.root);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
generate: {
|
|
58
|
+
description: `Builds your entire tamagui configuration and outputs any CSS.`,
|
|
59
|
+
shorthands: [],
|
|
60
|
+
flags: {
|
|
61
|
+
"--help": Boolean,
|
|
62
|
+
"--debug": Boolean,
|
|
63
|
+
"--verbose": Boolean
|
|
86
64
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"--verbose":
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
65
|
+
async run() {
|
|
66
|
+
const {
|
|
67
|
+
_,
|
|
68
|
+
...flags2
|
|
69
|
+
} = (0, import_arg.default)(this.flags);
|
|
70
|
+
const options = await (0, import_utils.getOptions)({
|
|
71
|
+
debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : true : false,
|
|
72
|
+
loadTamaguiOptions: true
|
|
73
|
+
});
|
|
74
|
+
const {
|
|
75
|
+
loadTamagui
|
|
76
|
+
} = require("@tamagui/static/loadTamagui");
|
|
77
|
+
process.env.TAMAGUI_KEEP_THEMES = "1";
|
|
78
|
+
await loadTamagui({
|
|
79
|
+
...options.tamaguiOptions,
|
|
80
|
+
platform: "web"
|
|
81
|
+
});
|
|
82
|
+
const {
|
|
83
|
+
generatePrompt
|
|
84
|
+
} = require("./generate-prompt.cjs");
|
|
85
|
+
const {
|
|
86
|
+
join
|
|
87
|
+
} = require("node:path");
|
|
88
|
+
await generatePrompt({
|
|
89
|
+
...options,
|
|
90
|
+
output: join(options.paths.dotDir, "prompt.md")
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"generate-css": {
|
|
95
|
+
shorthands: [],
|
|
96
|
+
description: `Generate the tamagui.generated.css file from your config`,
|
|
97
|
+
flags: {
|
|
98
|
+
"--help": Boolean,
|
|
99
|
+
"--debug": Boolean,
|
|
100
|
+
"--verbose": Boolean,
|
|
101
|
+
"--output": String
|
|
112
102
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"--verbose":
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
103
|
+
async run() {
|
|
104
|
+
const {
|
|
105
|
+
_,
|
|
106
|
+
...flags2
|
|
107
|
+
} = (0, import_arg.default)(this.flags);
|
|
108
|
+
const options = await (0, import_utils.getOptions)({
|
|
109
|
+
debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : true : false,
|
|
110
|
+
loadTamaguiOptions: true
|
|
111
|
+
});
|
|
112
|
+
const outputPath = flags2["--output"] || options.tamaguiOptions.outputCSS || "./tamagui.generated.css";
|
|
113
|
+
const {
|
|
114
|
+
loadTamagui
|
|
115
|
+
} = require("@tamagui/static/loadTamagui");
|
|
116
|
+
process.env.TAMAGUI_KEEP_THEMES = "1";
|
|
117
|
+
await loadTamagui({
|
|
118
|
+
...options.tamaguiOptions,
|
|
119
|
+
outputCSS: outputPath,
|
|
120
|
+
platform: "web"
|
|
121
|
+
});
|
|
122
|
+
console.info(`Generated CSS to ${outputPath}`);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"generate-themes": {
|
|
126
|
+
shorthands: [],
|
|
127
|
+
description: `Use to pre-build your themes`,
|
|
128
|
+
flags: {
|
|
129
|
+
"--help": Boolean,
|
|
130
|
+
"--debug": Boolean,
|
|
131
|
+
"--verbose": Boolean
|
|
143
132
|
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
"--verbose":
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
...flags2
|
|
156
|
-
} = (0, import_arg.default)(this.flags),
|
|
157
|
-
{
|
|
158
|
-
installGeneratedPackage
|
|
159
|
-
} = require("./add.cjs"),
|
|
160
|
-
[cmd, type, path] = _;
|
|
161
|
-
await installGeneratedPackage(type, path);
|
|
133
|
+
async run() {
|
|
134
|
+
const {
|
|
135
|
+
_,
|
|
136
|
+
...flags2
|
|
137
|
+
} = (0, import_arg.default)(this.flags);
|
|
138
|
+
const options = await (0, import_utils.getOptions)({
|
|
139
|
+
debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : true : false
|
|
140
|
+
});
|
|
141
|
+
const [_cmd, inPath, outPath] = _;
|
|
142
|
+
if (!inPath || !outPath) {
|
|
143
|
+
throw new Error(`Must supply both input and output paths, missing one (inPath: ${inPath}, outPath: ${outPath})`);
|
|
162
144
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
"--expect-optimizations": Number
|
|
175
|
-
},
|
|
176
|
-
async run() {
|
|
177
|
-
const argvSeparatorIdx = process.argv.indexOf("--");
|
|
178
|
-
let runCommand;
|
|
179
|
-
if (argvSeparatorIdx !== -1) {
|
|
180
|
-
runCommand = process.argv.slice(argvSeparatorIdx + 1);
|
|
181
|
-
const argsBeforeSeparator = process.argv.slice(0, argvSeparatorIdx);
|
|
182
|
-
process.argv = argsBeforeSeparator;
|
|
145
|
+
const {
|
|
146
|
+
generateThemes,
|
|
147
|
+
writeGeneratedThemes
|
|
148
|
+
} = require("@tamagui/generate-themes");
|
|
149
|
+
try {
|
|
150
|
+
const generated = await generateThemes(inPath);
|
|
151
|
+
if (generated) {
|
|
152
|
+
await writeGeneratedThemes(options.paths.dotDir, outPath, generated);
|
|
153
|
+
console.info(`Successfully generated themes to ${outPath}`);
|
|
154
|
+
} else {
|
|
155
|
+
process.exit(1);
|
|
183
156
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
} = (0, import_arg.default)(this.flags),
|
|
188
|
-
[_command, dir] = _,
|
|
189
|
-
{
|
|
190
|
-
build
|
|
191
|
-
} = require("./build.cjs"),
|
|
192
|
-
options = await (0, import_utils.getOptions)({
|
|
193
|
-
debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : !0 : !1
|
|
194
|
-
});
|
|
195
|
-
await build({
|
|
196
|
-
...options,
|
|
197
|
-
dir,
|
|
198
|
-
include: flags2["--include"],
|
|
199
|
-
target: flags2["--target"] || "both",
|
|
200
|
-
exclude: flags2["--exclude"],
|
|
201
|
-
expectOptimizations: flags2["--expect-optimizations"],
|
|
202
|
-
runCommand
|
|
203
|
-
});
|
|
157
|
+
} catch (err) {
|
|
158
|
+
console.error(`Error generating themes: ${err}`);
|
|
159
|
+
return;
|
|
204
160
|
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
add: {
|
|
164
|
+
shorthands: [],
|
|
165
|
+
description: `Use to add fonts and icons to your monorepo.`,
|
|
166
|
+
flags: {
|
|
167
|
+
"--help": Boolean,
|
|
168
|
+
"--debug": Boolean,
|
|
169
|
+
"--verbose": Boolean
|
|
205
170
|
},
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
171
|
+
async run() {
|
|
172
|
+
const {
|
|
173
|
+
_,
|
|
174
|
+
...flags2
|
|
175
|
+
} = (0, import_arg.default)(this.flags);
|
|
176
|
+
const {
|
|
177
|
+
installGeneratedPackage
|
|
178
|
+
} = require("./add.cjs");
|
|
179
|
+
const [cmd, type, path] = _;
|
|
180
|
+
await installGeneratedPackage(type, path);
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
build: {
|
|
184
|
+
shorthands: ["b"],
|
|
185
|
+
description: `Use to pre-build a Tamagui component directory. Use -- to run a command after optimization, then auto-restore files.`,
|
|
186
|
+
flags: {
|
|
187
|
+
"--help": Boolean,
|
|
188
|
+
"--debug": Boolean,
|
|
189
|
+
"--verbose": Boolean,
|
|
190
|
+
"--dry-run": Boolean,
|
|
191
|
+
"--target": String,
|
|
192
|
+
"--include": String,
|
|
193
|
+
"--exclude": String,
|
|
194
|
+
"--output": String,
|
|
195
|
+
"--output-around": Boolean,
|
|
196
|
+
"--expect-optimizations": Number
|
|
233
197
|
},
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
},
|
|
242
|
-
async run() {
|
|
243
|
-
const {
|
|
244
|
-
_,
|
|
245
|
-
...flags2
|
|
246
|
-
} = (0, import_arg.default)(this.flags),
|
|
247
|
-
{
|
|
248
|
-
updateTemplate
|
|
249
|
-
} = require("./update-template.cjs");
|
|
250
|
-
if (!flags2["--template-repo"]) throw new Error("--template-repo is required");
|
|
251
|
-
await updateTemplate(flags2["--template-repo"], flags2["--ignored-patterns"]?.split(" "));
|
|
198
|
+
async run() {
|
|
199
|
+
const argvSeparatorIdx = process.argv.indexOf("--");
|
|
200
|
+
let runCommand;
|
|
201
|
+
if (argvSeparatorIdx !== -1) {
|
|
202
|
+
runCommand = process.argv.slice(argvSeparatorIdx + 1);
|
|
203
|
+
const argsBeforeSeparator = process.argv.slice(0, argvSeparatorIdx);
|
|
204
|
+
process.argv = argsBeforeSeparator;
|
|
252
205
|
}
|
|
206
|
+
const {
|
|
207
|
+
_,
|
|
208
|
+
...flags2
|
|
209
|
+
} = (0, import_arg.default)(this.flags);
|
|
210
|
+
const [_command, dir] = _;
|
|
211
|
+
const dryRun = flags2["--dry-run"] || false;
|
|
212
|
+
const debug = flags2["--debug"] ? flags2["--verbose"] ? "verbose" : true : false;
|
|
213
|
+
const {
|
|
214
|
+
build
|
|
215
|
+
} = require("./build.cjs");
|
|
216
|
+
const options = await (0, import_utils.getOptions)({
|
|
217
|
+
debug
|
|
218
|
+
});
|
|
219
|
+
await build({
|
|
220
|
+
...options,
|
|
221
|
+
dir,
|
|
222
|
+
include: flags2["--include"],
|
|
223
|
+
target: flags2["--target"] || "both",
|
|
224
|
+
exclude: flags2["--exclude"],
|
|
225
|
+
output: flags2["--output"],
|
|
226
|
+
outputAround: flags2["--output-around"],
|
|
227
|
+
expectOptimizations: flags2["--expect-optimizations"],
|
|
228
|
+
runCommand,
|
|
229
|
+
dryRun
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
upgrade: {
|
|
234
|
+
shorthands: ["up"],
|
|
235
|
+
description: `Upgrade all tamagui packages in your workspace to the latest version`,
|
|
236
|
+
flags: {
|
|
237
|
+
"--help": Boolean,
|
|
238
|
+
"--debug": Boolean,
|
|
239
|
+
"--from": String,
|
|
240
|
+
"--to": String,
|
|
241
|
+
"--changelog-only": Boolean,
|
|
242
|
+
"--dry-run": Boolean
|
|
253
243
|
},
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
244
|
+
async run() {
|
|
245
|
+
const {
|
|
246
|
+
_,
|
|
247
|
+
...flags2
|
|
248
|
+
} = (0, import_arg.default)(this.flags);
|
|
249
|
+
const {
|
|
250
|
+
upgrade
|
|
251
|
+
} = require("./upgrade.cjs");
|
|
252
|
+
await upgrade({
|
|
253
|
+
from: flags2["--from"],
|
|
254
|
+
to: flags2["--to"],
|
|
255
|
+
changelogOnly: flags2["--changelog-only"],
|
|
256
|
+
dryRun: flags2["--dry-run"],
|
|
257
|
+
debug: flags2["--debug"]
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"update-template": {
|
|
262
|
+
shorthands: ["ut"],
|
|
263
|
+
description: `Used to update your git repo with the source template. (e.g. Takeout)`,
|
|
264
|
+
flags: {
|
|
265
|
+
"--help": Boolean,
|
|
266
|
+
"--template-repo": String,
|
|
267
|
+
"--ignored-patterns": String
|
|
268
|
+
},
|
|
269
|
+
async run() {
|
|
270
|
+
const {
|
|
271
|
+
_,
|
|
272
|
+
...flags2
|
|
273
|
+
} = (0, import_arg.default)(this.flags);
|
|
274
|
+
const {
|
|
275
|
+
updateTemplate
|
|
276
|
+
} = require("./update-template.cjs");
|
|
277
|
+
if (!flags2["--template-repo"]) {
|
|
278
|
+
throw new Error("--template-repo is required");
|
|
278
279
|
}
|
|
280
|
+
await updateTemplate(flags2["--template-repo"], flags2["--ignored-patterns"]?.split(" "));
|
|
279
281
|
}
|
|
280
282
|
},
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
283
|
+
"generate-prompt": {
|
|
284
|
+
shorthands: [],
|
|
285
|
+
description: `Generate an LLM-friendly markdown file from your Tamagui config`,
|
|
286
|
+
flags: {
|
|
287
|
+
"--help": Boolean,
|
|
288
|
+
"--debug": Boolean,
|
|
289
|
+
"--output": String
|
|
290
|
+
},
|
|
291
|
+
async run() {
|
|
292
|
+
const {
|
|
293
|
+
_,
|
|
294
|
+
...flags2
|
|
295
|
+
} = (0, import_arg.default)(this.flags);
|
|
296
|
+
const {
|
|
297
|
+
generatePrompt
|
|
298
|
+
} = require("./generate-prompt.cjs");
|
|
299
|
+
const options = await (0, import_utils.getOptions)({
|
|
300
|
+
debug: flags2["--debug"] ? true : false,
|
|
301
|
+
loadTamaguiOptions: true
|
|
302
|
+
});
|
|
303
|
+
await generatePrompt({
|
|
304
|
+
...options,
|
|
305
|
+
output: flags2["--output"]
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
const commandEntries = Object.keys(COMMAND_MAP).flatMap(command2 => {
|
|
311
|
+
const definition2 = COMMAND_MAP[command2];
|
|
312
|
+
const entries = [command2, ...definition2.shorthands].map(cmd => {
|
|
313
|
+
return [cmd, definition2];
|
|
294
314
|
});
|
|
295
|
-
|
|
296
|
-
|
|
315
|
+
return entries;
|
|
316
|
+
});
|
|
317
|
+
const commands = Object.fromEntries(commandEntries);
|
|
318
|
+
const {
|
|
319
|
+
_: [command],
|
|
320
|
+
...flags
|
|
321
|
+
} = (0, import_arg.default)({
|
|
322
|
+
"--help": Boolean,
|
|
323
|
+
"--version": Boolean
|
|
324
|
+
}, {
|
|
325
|
+
permissive: true
|
|
326
|
+
});
|
|
327
|
+
if (flags["--version"]) {
|
|
328
|
+
console.info(require("../package.json").version);
|
|
329
|
+
process.exit(0);
|
|
330
|
+
}
|
|
331
|
+
if (!command && flags["--help"]) {
|
|
332
|
+
console.info(`$ tamagui
|
|
297
333
|
|
|
298
334
|
commands:
|
|
299
335
|
|
|
300
|
-
${Object.keys(COMMAND_MAP).map(key =>
|
|
301
|
-
`
|
|
302
|
-
|
|
336
|
+
${Object.keys(COMMAND_MAP).map(key => {
|
|
337
|
+
return ` ${key}`;
|
|
338
|
+
}).join("\n")}`);
|
|
339
|
+
process.exit(0);
|
|
340
|
+
}
|
|
341
|
+
if (!(command in commands)) {
|
|
342
|
+
console.error();
|
|
343
|
+
console.warn(import_chalk.default.yellow(`Not a valid command: ${command}`));
|
|
344
|
+
process.exit(1);
|
|
345
|
+
}
|
|
303
346
|
const definition = commands[command];
|
|
304
347
|
main();
|
|
305
348
|
async function main() {
|
|
306
|
-
flags["--help"]
|
|
349
|
+
if (flags["--help"]) {
|
|
350
|
+
console.info(`
|
|
307
351
|
$ tamagui ${command}: ${definition.description}
|
|
308
|
-
`)
|
|
352
|
+
`);
|
|
353
|
+
console.info(`Flags: ${Object.entries(definition.flags).map(([k, v]) => `${k} (${v.name})`)}`);
|
|
354
|
+
process.exit(0);
|
|
355
|
+
}
|
|
309
356
|
const {
|
|
310
357
|
_,
|
|
311
358
|
...cmdFlags
|
|
312
359
|
} = (0, import_arg.default)(definition.flags);
|
|
313
|
-
cmdFlags["--help"]
|
|
360
|
+
if (cmdFlags["--help"]) {
|
|
361
|
+
console.info(`$ tamagui ${_}
|
|
314
362
|
|
|
315
363
|
Flags: ${JSON.stringify(cmdFlags, null, 2)}
|
|
316
364
|
|
|
317
|
-
`)
|
|
365
|
+
`);
|
|
366
|
+
process.exit(0);
|
|
367
|
+
}
|
|
318
368
|
try {
|
|
319
369
|
await definition.run();
|
|
320
370
|
} catch (err) {
|