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