@tamagui/cli 2.7.7 → 3.0.0-beta.1097.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 +76 -87
- package/dist/build.cjs +425 -278
- package/dist/cli.cjs +361 -340
- package/dist/generate-prompt.cjs +484 -362
- package/dist/generate.cjs +45 -54
- package/dist/index.cjs +1 -1
- package/dist/migrate.cjs +437 -0
- package/dist/setup-prompt.cjs +216 -0
- package/dist/to-tailwind-default-config.cjs +789 -0
- package/dist/to-tailwind.cjs +213 -0
- package/dist/update-template.cjs +43 -52
- package/dist/update.cjs +14 -18
- package/dist/upgrade.cjs +417 -401
- package/dist/utils.cjs +84 -101
- package/metro.cjs +1 -0
- package/metro.d.ts +1 -0
- package/metro.mjs +1 -0
- package/package.json +43 -13
- package/src/build.ts +594 -362
- package/src/cli.ts +113 -12
- package/src/generate-prompt.ts +428 -329
- package/src/migrate.ts +422 -0
- package/src/setup-prompt.ts +192 -0
- package/src/to-tailwind-default-config.ts +767 -0
- package/src/to-tailwind.ts +313 -0
- package/src/upgrade.ts +30 -33
- 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 +2 -1
- package/types/build.d.ts.map +1 -1
- package/types/generate-prompt.d.ts +6 -2
- package/types/generate-prompt.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 +5 -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/upgrade.d.ts.map +1 -1
- package/types/utils.d.ts.map +1 -1
- package/vite.cjs +1 -0
- package/vite.d.ts +1 -0
- package/vite.mjs +1 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { readFile, stat, writeFile } from 'node:fs/promises'
|
|
2
|
+
import { extname, relative, resolve, sep } from 'node:path'
|
|
3
|
+
import { bundledDefaultGrammarConfig } from './to-tailwind-default-config'
|
|
4
|
+
|
|
5
|
+
type GlobOptions = {
|
|
6
|
+
cwd: string
|
|
7
|
+
absolute: boolean
|
|
8
|
+
nodir: boolean
|
|
9
|
+
ignore: string[]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type ToTailwindOptions = {
|
|
13
|
+
patterns: string[]
|
|
14
|
+
write?: boolean
|
|
15
|
+
cwd?: string
|
|
16
|
+
// path to the app config; token/font/theme names, media, and shorthands drive claiming.
|
|
17
|
+
configPath?: string
|
|
18
|
+
// explicitly use the canonical bundled v5 token/font/theme/media/shorthand domains.
|
|
19
|
+
useDefaultConfig?: boolean
|
|
20
|
+
// opt in to DOM renaming (View→div …). default false: Tamagui components are PRESERVED so the
|
|
21
|
+
// cross-platform (native) app keeps working.
|
|
22
|
+
renameDom?: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type TransformConfig = {
|
|
26
|
+
tokens?: Record<string, Record<string, any>>
|
|
27
|
+
fonts?: Record<string, any>
|
|
28
|
+
themes?: Record<string, Record<string, any>>
|
|
29
|
+
media?: Record<string, any>
|
|
30
|
+
shorthands?: Record<string, string>
|
|
31
|
+
grammarConfig?: typeof bundledDefaultGrammarConfig
|
|
32
|
+
renameComponents?: boolean
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type ToTailwindResult = {
|
|
36
|
+
files: number
|
|
37
|
+
changed: number
|
|
38
|
+
written: number
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type Transform = (source: string, options?: TransformConfig) => string
|
|
42
|
+
|
|
43
|
+
const codeFileExtensions = new Set(['.js', '.jsx', '.ts', '.tsx'])
|
|
44
|
+
const defaultFileGlob = '**/*.{js,jsx,ts,tsx}'
|
|
45
|
+
const ignoredGlobs = ['**/node_modules/**', '**/.git/**']
|
|
46
|
+
|
|
47
|
+
const { glob } = require('glob') as {
|
|
48
|
+
glob(pattern: string, options: GlobOptions): Promise<string[]>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const { createTwoFilesPatch } = require('diff') as {
|
|
52
|
+
createTwoFilesPatch(
|
|
53
|
+
oldFileName: string,
|
|
54
|
+
newFileName: string,
|
|
55
|
+
oldStr: string,
|
|
56
|
+
newStr: string,
|
|
57
|
+
oldHeader?: string,
|
|
58
|
+
newHeader?: string,
|
|
59
|
+
options?: { context?: number }
|
|
60
|
+
): string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export async function toTailwind({
|
|
64
|
+
patterns,
|
|
65
|
+
write = false,
|
|
66
|
+
cwd = process.cwd(),
|
|
67
|
+
configPath,
|
|
68
|
+
useDefaultConfig = false,
|
|
69
|
+
renameDom = false,
|
|
70
|
+
}: ToTailwindOptions): Promise<ToTailwindResult> {
|
|
71
|
+
if (!patterns.length) {
|
|
72
|
+
throw new Error(
|
|
73
|
+
'Usage: tamagui to-tailwind <paths/glob> [--write] [--config <path> | --use-default-config] [--rename-dom]'
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// SAFETY: --write is destructive. Token domains, media, and shorthands differ per app, so
|
|
78
|
+
// require either an explicit app config or the explicit canonical bundled-config opt-in.
|
|
79
|
+
if (write && !configPath && !useDefaultConfig) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
'--write requires either --config <path> (app token/media grammar) or ' +
|
|
82
|
+
'--use-default-config (acknowledge the bundled defaults).'
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const { transformConfig, usedDefault } = await loadTransformConfig(
|
|
87
|
+
configPath,
|
|
88
|
+
useDefaultConfig,
|
|
89
|
+
cwd
|
|
90
|
+
)
|
|
91
|
+
if (usedDefault && !useDefaultConfig) {
|
|
92
|
+
// Dry-run fallback: bare token names pass through; other config data defaults.
|
|
93
|
+
console.warn(
|
|
94
|
+
'[to-tailwind] WARNING: no --config given — bare token names pass through ' +
|
|
95
|
+
'and bundled media/shorthands are used. pass --config <path> to enforce app domains.'
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
transformConfig.renameComponents = renameDom
|
|
99
|
+
|
|
100
|
+
const files = await collectFiles(patterns, cwd)
|
|
101
|
+
|
|
102
|
+
// TRANSACTIONAL parse check: abort BEFORE any transform/write if any file has parse errors,
|
|
103
|
+
// so malformed source is never normalized/partially rewritten.
|
|
104
|
+
const { findParseError } = require('@tamagui/to-tailwind') as {
|
|
105
|
+
findParseError?: (source: string) => string | null
|
|
106
|
+
}
|
|
107
|
+
if (typeof findParseError !== 'function') {
|
|
108
|
+
throw new Error(
|
|
109
|
+
'@tamagui/to-tailwind did not export findParseError — aborting because transactional parse safety is unavailable'
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
const sources = new Map<string, string>()
|
|
113
|
+
for (const file of files) {
|
|
114
|
+
const source = await readFile(file, 'utf8')
|
|
115
|
+
sources.set(file, source)
|
|
116
|
+
const err = findParseError(source)
|
|
117
|
+
if (err) {
|
|
118
|
+
throw new Error(
|
|
119
|
+
`parse error in ${relative(cwd, file) || file}: ${err} — aborted, no files written`
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const tamaguiToTailwind = loadTamaguiToTailwind()
|
|
125
|
+
let changed = 0
|
|
126
|
+
let written = 0
|
|
127
|
+
|
|
128
|
+
for (const file of files) {
|
|
129
|
+
const source = sources.get(file)!
|
|
130
|
+
const transformed = tamaguiToTailwind(source, transformConfig)
|
|
131
|
+
|
|
132
|
+
if (transformed === source) {
|
|
133
|
+
continue
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
changed++
|
|
137
|
+
|
|
138
|
+
if (write) {
|
|
139
|
+
await writeFile(file, transformed)
|
|
140
|
+
written++
|
|
141
|
+
continue
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
process.stdout.write(createDiff(file, source, transformed, cwd))
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (files.length === 0) {
|
|
148
|
+
console.info('No files matched.')
|
|
149
|
+
} else if (changed === 0) {
|
|
150
|
+
console.info(`No to-tailwind changes found in ${files.length} file(s).`)
|
|
151
|
+
} else if (write) {
|
|
152
|
+
console.info(`Converted ${changed} of ${files.length} file(s).`)
|
|
153
|
+
} else {
|
|
154
|
+
console.info(
|
|
155
|
+
`\n[dry-run] ${changed} of ${files.length} file(s) would change. Run with --write to apply.`
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
files: files.length,
|
|
161
|
+
changed,
|
|
162
|
+
written,
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function collectFiles(patterns: string[], cwd: string) {
|
|
167
|
+
const files = new Set<string>()
|
|
168
|
+
|
|
169
|
+
for (const pattern of patterns) {
|
|
170
|
+
const resolved = resolve(cwd, pattern)
|
|
171
|
+
const existing = await stat(resolved).catch(() => null)
|
|
172
|
+
|
|
173
|
+
if (existing?.isDirectory()) {
|
|
174
|
+
for (const file of await glob(defaultFileGlob, {
|
|
175
|
+
cwd: resolved,
|
|
176
|
+
absolute: true,
|
|
177
|
+
nodir: true,
|
|
178
|
+
ignore: ignoredGlobs,
|
|
179
|
+
})) {
|
|
180
|
+
files.add(resolve(file))
|
|
181
|
+
}
|
|
182
|
+
continue
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (existing?.isFile()) {
|
|
186
|
+
if (isCodeFile(resolved)) {
|
|
187
|
+
files.add(resolved)
|
|
188
|
+
}
|
|
189
|
+
continue
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
for (const file of await glob(pattern, {
|
|
193
|
+
cwd,
|
|
194
|
+
absolute: true,
|
|
195
|
+
nodir: true,
|
|
196
|
+
ignore: ignoredGlobs,
|
|
197
|
+
})) {
|
|
198
|
+
if (isCodeFile(file)) {
|
|
199
|
+
files.add(resolve(file))
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return [...files].sort()
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function createDiff(file: string, source: string, transformed: string, cwd: string) {
|
|
208
|
+
const displayPath = toPosixPath(relative(cwd, file) || file)
|
|
209
|
+
return createTwoFilesPatch(
|
|
210
|
+
displayPath,
|
|
211
|
+
displayPath,
|
|
212
|
+
source,
|
|
213
|
+
transformed,
|
|
214
|
+
'before',
|
|
215
|
+
'after',
|
|
216
|
+
{
|
|
217
|
+
context: 3,
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function isCodeFile(file: string) {
|
|
223
|
+
return codeFileExtensions.has(extname(file))
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function toPosixPath(path: string) {
|
|
227
|
+
return path.split(sep).join('/')
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Load the app's token/font/theme NAMES plus media/shorthands. Token values are never baked into
|
|
231
|
+
// output; names are used only to reject missing or ambiguous candidates. We take the explicit-path
|
|
232
|
+
// route (`--config <path>`) rather than auto-discovering + bundling `tamagui.config.ts`: a real
|
|
233
|
+
// tamagui config is TS with `~`/`@` aliases and needs the app's bundler to evaluate, which the
|
|
234
|
+
// CLI can't reliably do — an explicit path the user has already made requireable (or a small
|
|
235
|
+
// module re-exporting the relevant config view) is the honest, non-magical contract. An explicit
|
|
236
|
+
// config that fails to load or has an invalid relevant shape aborts. The bundled-config opt-in
|
|
237
|
+
// loads canonical v5 domains; config-less dry-run leaves token/font/theme domains unknown.
|
|
238
|
+
async function loadTransformConfig(
|
|
239
|
+
configPath: string | undefined,
|
|
240
|
+
useDefaultConfig: boolean,
|
|
241
|
+
cwd: string
|
|
242
|
+
): Promise<{ transformConfig: TransformConfig; usedDefault: boolean }> {
|
|
243
|
+
if (!configPath) {
|
|
244
|
+
if (useDefaultConfig) {
|
|
245
|
+
// --use-default-config is an authoritative opt-in. The local snapshot contains names only;
|
|
246
|
+
// a focused dev-only parity test checks every domain against the canonical v5 config.
|
|
247
|
+
return {
|
|
248
|
+
transformConfig: { grammarConfig: bundledDefaultGrammarConfig },
|
|
249
|
+
usedDefault: true,
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
// Config-less dry-run keeps domains unknown and uses converter media/shorthand defaults.
|
|
253
|
+
return { transformConfig: {}, usedDefault: true }
|
|
254
|
+
}
|
|
255
|
+
const resolved = resolve(cwd, configPath)
|
|
256
|
+
let mod: any
|
|
257
|
+
try {
|
|
258
|
+
mod = require(resolved)
|
|
259
|
+
} catch (requireErr) {
|
|
260
|
+
try {
|
|
261
|
+
mod = await import(resolved)
|
|
262
|
+
} catch {
|
|
263
|
+
throw new Error(
|
|
264
|
+
`--config ${configPath} could not be loaded (${(requireErr as Error).message}) — ` +
|
|
265
|
+
`aborted (not falling back to defaults).`
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const config = mod?.config ?? mod?.default ?? mod?.tamaguiConfig ?? mod
|
|
270
|
+
const tokens = config?.tokens
|
|
271
|
+
const fonts = config?.fonts
|
|
272
|
+
const themes = config?.themes
|
|
273
|
+
const media = config?.media
|
|
274
|
+
const shorthands = config?.shorthands
|
|
275
|
+
|
|
276
|
+
// Structure validation: malformed relevant config must abort rather than silently fall back.
|
|
277
|
+
const isObj = (v: any) => v != null && typeof v === 'object' && !Array.isArray(v)
|
|
278
|
+
const bad = (msg: string) => {
|
|
279
|
+
throw new Error(`--config ${configPath} has a malformed shape: ${msg} — aborted.`)
|
|
280
|
+
}
|
|
281
|
+
if (tokens !== undefined) {
|
|
282
|
+
if (!isObj(tokens)) bad('`tokens` must be an object')
|
|
283
|
+
for (const category of ['space', 'size', 'radius', 'zIndex', 'color']) {
|
|
284
|
+
if (tokens[category] !== undefined && !isObj(tokens[category])) {
|
|
285
|
+
bad(`\`tokens.${category}\` must be an object`)
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (fonts !== undefined && !isObj(fonts)) bad('`fonts` must be an object')
|
|
290
|
+
if (themes !== undefined && !isObj(themes)) bad('`themes` must be an object')
|
|
291
|
+
if (media !== undefined && !isObj(media)) bad('`media` must be an object')
|
|
292
|
+
if (shorthands !== undefined && !isObj(shorthands))
|
|
293
|
+
bad('`shorthands` must be an object')
|
|
294
|
+
if (!tokens && !fonts && !themes && !media && !shorthands) {
|
|
295
|
+
bad('exposes no { tokens, fonts, themes, media, shorthands }')
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
transformConfig: { tokens, fonts, themes, media, shorthands },
|
|
299
|
+
usedDefault: false,
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function loadTamaguiToTailwind(): Transform {
|
|
304
|
+
const { tamaguiToTailwind } = require('@tamagui/to-tailwind') as {
|
|
305
|
+
tamaguiToTailwind?: Transform
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (typeof tamaguiToTailwind !== 'function') {
|
|
309
|
+
throw new Error('@tamagui/to-tailwind did not export tamaguiToTailwind')
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return tamaguiToTailwind
|
|
313
|
+
}
|
package/src/upgrade.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
|
-
import {
|
|
2
|
+
import { execFileSync } from 'node:child_process'
|
|
3
|
+
import { globSync } from 'glob'
|
|
3
4
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
|
|
4
5
|
import { join } from 'node:path'
|
|
5
6
|
|
|
@@ -66,38 +67,16 @@ function parseVersionSpecifier(version: string): {
|
|
|
66
67
|
return { specifier: '', cleanVersion: version }
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
/**
|
|
70
|
-
* Find all package.json files in the workspace
|
|
71
|
-
*/
|
|
72
|
-
function findPackageJsonFiles(root: string): string[] {
|
|
73
|
-
const files: string[] = []
|
|
74
|
-
|
|
75
|
-
// Check root package.json
|
|
76
|
-
const rootPkgPath = join(root, 'package.json')
|
|
77
|
-
if (existsSync(rootPkgPath)) {
|
|
78
|
-
files.push(rootPkgPath)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Use find command to locate all package.json files
|
|
82
|
-
try {
|
|
83
|
-
const result = execSync(
|
|
84
|
-
`find "${root}" -name "package.json" -not -path "*/node_modules/*" -not -path "*/.git/*" 2>/dev/null`,
|
|
85
|
-
{ encoding: 'utf-8', maxBuffer: 10 * 1024 * 1024 }
|
|
86
|
-
)
|
|
87
|
-
const foundFiles = result.trim().split('\n').filter(Boolean)
|
|
88
|
-
files.push(...foundFiles.filter((f) => !files.includes(f)))
|
|
89
|
-
} catch {
|
|
90
|
-
// Fallback: just use root
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return files
|
|
94
|
-
}
|
|
95
|
-
|
|
96
70
|
/**
|
|
97
71
|
* Find all tamagui packages in the workspace
|
|
98
72
|
*/
|
|
99
73
|
function findTamaguiPackages(root: string): PackageInfo[] {
|
|
100
|
-
const packageJsonFiles =
|
|
74
|
+
const packageJsonFiles = globSync('**/package.json', {
|
|
75
|
+
cwd: root,
|
|
76
|
+
absolute: true,
|
|
77
|
+
nodir: true,
|
|
78
|
+
ignore: ['**/node_modules/**', '**/.git/**', '**/dist/**', '**/build/**'],
|
|
79
|
+
})
|
|
101
80
|
const packages: PackageInfo[] = []
|
|
102
81
|
|
|
103
82
|
for (const filePath of packageJsonFiles) {
|
|
@@ -141,7 +120,9 @@ function findTamaguiPackages(root: string): PackageInfo[] {
|
|
|
141
120
|
*/
|
|
142
121
|
async function getLatestVersion(): Promise<string> {
|
|
143
122
|
try {
|
|
144
|
-
const result =
|
|
123
|
+
const result = execFileSync('npm', ['view', 'tamagui', 'version'], {
|
|
124
|
+
encoding: 'utf-8',
|
|
125
|
+
})
|
|
145
126
|
return result.trim()
|
|
146
127
|
} catch (err) {
|
|
147
128
|
throw new Error('Failed to fetch latest tamagui version from npm')
|
|
@@ -222,7 +203,7 @@ function getChangelogFromGit(
|
|
|
222
203
|
try {
|
|
223
204
|
// Try to fetch tags first
|
|
224
205
|
try {
|
|
225
|
-
|
|
206
|
+
execFileSync('git', ['fetch', '--tags'], { encoding: 'utf-8', stdio: 'pipe' })
|
|
226
207
|
} catch {
|
|
227
208
|
// Ignore fetch errors
|
|
228
209
|
}
|
|
@@ -237,8 +218,15 @@ function getChangelogFromGit(
|
|
|
237
218
|
|
|
238
219
|
let result: string
|
|
239
220
|
try {
|
|
240
|
-
result =
|
|
241
|
-
|
|
221
|
+
result = execFileSync(
|
|
222
|
+
'git',
|
|
223
|
+
[
|
|
224
|
+
'log',
|
|
225
|
+
`${fromTag}..${toTag}`,
|
|
226
|
+
'--pretty=format:%H|%ad|%s',
|
|
227
|
+
'--date=short',
|
|
228
|
+
'--',
|
|
229
|
+
],
|
|
242
230
|
{ encoding: 'utf-8', maxBuffer: 10 * 1024 * 1024 }
|
|
243
231
|
)
|
|
244
232
|
} catch {
|
|
@@ -530,6 +518,15 @@ export async function upgrade(options: UpgradeOptions = {}): Promise<void> {
|
|
|
530
518
|
console.log(chalk.gray(` Target version: ${chalk.white(toVersion)}`))
|
|
531
519
|
console.log('')
|
|
532
520
|
|
|
521
|
+
if (fromVersion.startsWith('2.') && toVersion.startsWith('3.')) {
|
|
522
|
+
console.log(
|
|
523
|
+
chalk.yellow(
|
|
524
|
+
'Run `tamagui migrate --from v2` for the required API and configuration migration.'
|
|
525
|
+
)
|
|
526
|
+
)
|
|
527
|
+
console.log('')
|
|
528
|
+
}
|
|
529
|
+
|
|
533
530
|
// Show package summary (unless changelog only with no packages)
|
|
534
531
|
if (packages.length > 0 && !changelogOnly) {
|
|
535
532
|
displayPackageSummary(packages)
|
package/src/utils.ts
CHANGED
|
@@ -17,16 +17,11 @@ export async function getOptions({
|
|
|
17
17
|
let config = ''
|
|
18
18
|
try {
|
|
19
19
|
config = await getDefaultTamaguiConfigPath()
|
|
20
|
+
} catch {}
|
|
21
|
+
|
|
22
|
+
try {
|
|
20
23
|
pkgJson = await readJSON(join(root, 'package.json'))
|
|
21
|
-
} catch {
|
|
22
|
-
if (loadTamaguiOptions) {
|
|
23
|
-
console.warn(
|
|
24
|
-
chalk.yellow(
|
|
25
|
-
`Warning: no tamagui.config.ts found in ${root}. Commands that need a config may fail.`
|
|
26
|
-
)
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
24
|
+
} catch {}
|
|
30
25
|
|
|
31
26
|
const filledOptions = {
|
|
32
27
|
platform: 'native',
|
|
@@ -39,6 +34,13 @@ export async function getOptions({
|
|
|
39
34
|
if (loadTamaguiOptions) {
|
|
40
35
|
const { loadTamaguiBuildConfigSync } = require('@tamagui/static/loadTamagui')
|
|
41
36
|
finalOptions = loadTamaguiBuildConfigSync(filledOptions)
|
|
37
|
+
if (!finalOptions.config) {
|
|
38
|
+
console.warn(
|
|
39
|
+
chalk.yellow(
|
|
40
|
+
`Warning: no Tamagui config found in ${root}. Commands that need a config may fail.`
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
}
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
return {
|
package/types/add.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const generatedPackageTypes: readonly [
|
|
1
|
+
export declare const generatedPackageTypes: readonly ['font', 'icon'];
|
|
2
2
|
export declare const installGeneratedPackage: (type: string, packagesPath?: string) => Promise<void>;
|
|
3
3
|
//# sourceMappingURL=add.d.ts.map
|
package/types/add.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../src/add.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../src/add.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,qBAAqB,YAAI,MAAM,EAAE,MAAM,CAAU,CAAA;AAC9D,eAAO,MAAM,uBAAuB,SAAgB,MAAM,iBAAiB,MAAM,kBAqGhF,CAAA"}
|
package/types/build.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type BuildStats = {
|
|
|
5
5
|
flattened: number;
|
|
6
6
|
styled: number;
|
|
7
7
|
found: number;
|
|
8
|
+
bailed: number;
|
|
8
9
|
};
|
|
9
10
|
export type TrackedFile = {
|
|
10
11
|
path: string;
|
|
@@ -21,7 +22,7 @@ export type BuildResult = {
|
|
|
21
22
|
*/
|
|
22
23
|
export declare function insertCssImport(jsContent: string, cssImport: string): string;
|
|
23
24
|
export declare const build: (options: CLIResolvedOptions & {
|
|
24
|
-
target?:
|
|
25
|
+
target?: 'web' | 'native' | 'both';
|
|
25
26
|
dir?: string;
|
|
26
27
|
include?: string;
|
|
27
28
|
exclude?: string;
|
package/types/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,gBAAgB,CAAA;AAuBxE,MAAM,MAAM,UAAU,GAAG;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B,CAAA;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAW5E;AAED,eAAO,MAAM,KAAK,YACP,kBAAkB,GAAG;IAC5B,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;IAClC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,KACA,OAAO,CAAC,WAAW,CA2iBrB,CAAA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { CLIResolvedOptions } from '@tamagui/types';
|
|
2
|
-
interface GeneratePromptOptions extends CLIResolvedOptions {
|
|
2
|
+
export interface GeneratePromptOptions extends CLIResolvedOptions {
|
|
3
3
|
output?: string;
|
|
4
|
+
styleValueSyntax?: 'string' | 'object' | 'both';
|
|
4
5
|
}
|
|
5
6
|
export declare function generatePrompt(options: GeneratePromptOptions): Promise<void>;
|
|
6
|
-
export {
|
|
7
|
+
export interface GenerateMarkdownOptions {
|
|
8
|
+
styleValueSyntax?: 'string' | 'object' | 'both';
|
|
9
|
+
}
|
|
10
|
+
export declare function generateMarkdown(config: any, options?: GenerateMarkdownOptions): string;
|
|
7
11
|
//# sourceMappingURL=generate-prompt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-prompt.d.ts","sourceRoot":"","sources":["../src/generate-prompt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExD,
|
|
1
|
+
{"version":3,"file":"generate-prompt.d.ts","sourceRoot":"","sources":["../src/generate-prompt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExD,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gBAAgB,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAA;CAChD;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,qBAAqB,iBAoClE;AAED,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAA;CAChD;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,MAAM,CAmjBvF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../src/migrate.ts"],"names":[],"mappings":"AAEA,wBAAgB,oBAAoB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,QAE/D;AAED,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,UAkBlE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function resolveStyleValueSyntax(setting?: 'string' | 'object' | 'both'): Promise<'string' | 'object' | 'both'>;
|
|
2
|
+
export declare function setupPrompt(options?: any): Promise<any>;
|
|
3
|
+
export declare function printSetupPrompt(syntax?: 'string' | 'object' | 'both'): void;
|
|
4
|
+
export declare function getSetupPrompt(syntax?: 'string' | 'object' | 'both'): string;
|
|
5
|
+
//# sourceMappingURL=setup-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-prompt.d.ts","sourceRoot":"","sources":["../src/setup-prompt.ts"],"names":[],"mappings":"AASA,wBAAsB,uBAAuB,CAC3C,OAAO,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GACrC,OAAO,CAAC,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC,CAmBvC;AAED,wBAAsB,WAAW,CAAC,OAAO,CAAC,EAAE,GAAG,gBAG9C;AAED,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,QAYrE;AAED,wBAAgB,cAAc,CAAC,MAAM,GAAE,QAAQ,GAAG,QAAQ,GAAG,MAAe,UA4I3E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const bundledDefaultGrammarConfig: {
|
|
2
|
+
shorthands: {
|
|
3
|
+
text: string;
|
|
4
|
+
b: string;
|
|
5
|
+
bg: string;
|
|
6
|
+
content: string;
|
|
7
|
+
grow: string;
|
|
8
|
+
h: string;
|
|
9
|
+
items: string;
|
|
10
|
+
justify: string;
|
|
11
|
+
l: string;
|
|
12
|
+
m: string;
|
|
13
|
+
maxH: string;
|
|
14
|
+
maxW: string;
|
|
15
|
+
mb: string;
|
|
16
|
+
minH: string;
|
|
17
|
+
minW: string;
|
|
18
|
+
ml: string;
|
|
19
|
+
mr: string;
|
|
20
|
+
mt: string;
|
|
21
|
+
mx: string;
|
|
22
|
+
my: string;
|
|
23
|
+
p: string;
|
|
24
|
+
pb: string;
|
|
25
|
+
pl: string;
|
|
26
|
+
pr: string;
|
|
27
|
+
pt: string;
|
|
28
|
+
px: string;
|
|
29
|
+
py: string;
|
|
30
|
+
r: string;
|
|
31
|
+
rounded: string;
|
|
32
|
+
select: string;
|
|
33
|
+
self: string;
|
|
34
|
+
shrink: string;
|
|
35
|
+
t: string;
|
|
36
|
+
w: string;
|
|
37
|
+
z: string;
|
|
38
|
+
};
|
|
39
|
+
mediaNames: string[];
|
|
40
|
+
themeNames: string[];
|
|
41
|
+
tokenNames: {
|
|
42
|
+
space: string[];
|
|
43
|
+
size: string[];
|
|
44
|
+
radius: string[];
|
|
45
|
+
zIndex: never[];
|
|
46
|
+
color: string[];
|
|
47
|
+
fontFamily: string[];
|
|
48
|
+
fontSize: string[];
|
|
49
|
+
lineHeight: string[];
|
|
50
|
+
letterSpacing: string[];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=to-tailwind-default-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-tailwind-default-config.d.ts","sourceRoot":"","sources":["../src/to-tailwind-default-config.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,2BAA2B;IACtC,UAAU;QACR,IAAI;QACJ,CAAC;QACD,EAAE;QACF,OAAO;QACP,IAAI;QACJ,CAAC;QACD,KAAK;QACL,OAAO;QACP,CAAC;QACD,CAAC;QACD,IAAI;QACJ,IAAI;QACJ,EAAE;QACF,IAAI;QACJ,IAAI;QACJ,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,CAAC;QACD,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,EAAE;QACF,CAAC;QACD,OAAO;QACP,MAAM;QACN,IAAI;QACJ,MAAM;QACN,CAAC;QACD,CAAC;QACD,CAAC;;IAEH,UAAU;IAiCV,UAAU;IAkIV,UAAU;QACR,KAAK;QA+EL,IAAI;QAyCJ,MAAM;QAwBN,MAAM;QACN,KAAK;QAgVL,UAAU;QACV,QAAQ;QA+BR,UAAU;QA+BV,aAAa;;CAmBhB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type ToTailwindOptions = {
|
|
2
|
+
patterns: string[];
|
|
3
|
+
write?: boolean;
|
|
4
|
+
cwd?: string;
|
|
5
|
+
configPath?: string;
|
|
6
|
+
useDefaultConfig?: boolean;
|
|
7
|
+
renameDom?: boolean;
|
|
8
|
+
};
|
|
9
|
+
type ToTailwindResult = {
|
|
10
|
+
files: number;
|
|
11
|
+
changed: number;
|
|
12
|
+
written: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function toTailwind({ patterns, write, cwd, configPath, useDefaultConfig, renameDom, }: ToTailwindOptions): Promise<ToTailwindResult>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=to-tailwind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-tailwind.d.ts","sourceRoot":"","sources":["../src/to-tailwind.ts"],"names":[],"mappings":"AAWA,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAG1B,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAYD,KAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAwBD,wBAAsB,UAAU,CAAC,EAC/B,QAAQ,EACR,KAAa,EACb,GAAmB,EACnB,UAAU,EACV,gBAAwB,EACxB,SAAiB,GAClB,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA8F/C"}
|
package/types/upgrade.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAcA,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAocD;;GAEG;AACH,wBAAsB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6HzE"}
|
package/types/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAKxE,wBAAsB,UAAU,CAAC,EAC/B,IAAoB,EACpB,YAA8B,EAC9B,cAAc,EACd,IAAI,EACJ,KAAK,EACL,kBAAkB,GACnB,GAAE,OAAO,CAAC,cAAc,CAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAKxE,wBAAsB,UAAU,CAAC,EAC/B,IAAoB,EACpB,YAA8B,EAC9B,cAAc,EACd,IAAI,EACJ,KAAK,EACL,kBAAkB,GACnB,GAAE,OAAO,CAAC,cAAc,CAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA+C5D;AAED,wBAAgB,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAKzD;AAiBD,eAAO,MAAM,WAAW,SAChB,OAAO,CAAC,cAAc,CAAC,KAC5B,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAQnC,CAAA;AAID,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,IAAI,QAE7C;AAED,wBAAgB,UAAU,SAEzB"}
|
package/vite.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('@tamagui/vite-plugin')
|
package/vite.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tamagui/vite-plugin'
|
package/vite.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tamagui/vite-plugin'
|