@tamagui/cli 2.0.0-rc.27 → 2.0.0-rc.29

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/cli.cjs CHANGED
@@ -22,9 +22,7 @@ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
22
  }) : target, mod));
23
23
  var import_arg = __toESM(require("arg")),
24
24
  import_chalk = __toESM(require("chalk")),
25
- import_add = require("./add.cjs"),
26
- import_utils = require("./utils.cjs"),
27
- import_static = require("@tamagui/static");
25
+ import_utils = require("./utils.cjs");
28
26
  ["exit", "SIGINT"].forEach(_ => {
29
27
  process.on(_, () => {
30
28
  (0, import_utils.disposeAll)(), process.exit();
@@ -45,10 +43,12 @@ const COMMAND_MAP = {
45
43
  ...flags2
46
44
  } = (0, import_arg.default)(this.flags),
47
45
  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);
46
+ debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : !0 : !1
47
+ }),
48
+ {
49
+ checkDeps
50
+ } = require("@tamagui/static/checkDeps");
51
+ await checkDeps(options.paths.root);
52
52
  }
53
53
  },
54
54
  generate: {
@@ -67,8 +67,11 @@ const COMMAND_MAP = {
67
67
  options = await (0, import_utils.getOptions)({
68
68
  debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : !0 : !1,
69
69
  loadTamaguiOptions: !0
70
- });
71
- process.env.TAMAGUI_KEEP_THEMES = "1", await (0, import_static.loadTamagui)({
70
+ }),
71
+ {
72
+ loadTamagui
73
+ } = require("@tamagui/static/loadTamagui");
74
+ process.env.TAMAGUI_KEEP_THEMES = "1", await loadTamagui({
72
75
  ...options.tamaguiOptions,
73
76
  platform: "web"
74
77
  });
@@ -102,8 +105,11 @@ const COMMAND_MAP = {
102
105
  debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : !0 : !1,
103
106
  loadTamaguiOptions: !0
104
107
  }),
105
- outputPath = flags2["--output"] || options.tamaguiOptions.outputCSS || "./tamagui.generated.css";
106
- process.env.TAMAGUI_KEEP_THEMES = "1", await (0, import_static.loadTamagui)({
108
+ outputPath = flags2["--output"] || options.tamaguiOptions.outputCSS || "./tamagui.generated.css",
109
+ {
110
+ loadTamagui
111
+ } = require("@tamagui/static/loadTamagui");
112
+ process.env.TAMAGUI_KEEP_THEMES = "1", await loadTamagui({
107
113
  ...options.tamaguiOptions,
108
114
  outputCSS: outputPath,
109
115
  platform: "web"
@@ -143,7 +149,7 @@ const COMMAND_MAP = {
143
149
  },
144
150
  add: {
145
151
  shorthands: [],
146
- description: `Use to add fonts and icons to your monorepo. Supported types: ${import_add.generatedPackageTypes.join(", ")}`,
152
+ description: "Use to add fonts and icons to your monorepo.",
147
153
  flags: {
148
154
  "--help": Boolean,
149
155
  "--debug": Boolean,
@@ -35,14 +35,16 @@ __export(generate_prompt_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(generate_prompt_exports);
37
37
  var import_node_path = require("node:path"),
38
- FS = __toESM(require("fs-extra")),
39
- import_static = require("@tamagui/static");
38
+ FS = __toESM(require("fs-extra"));
40
39
  async function generatePrompt(options) {
41
40
  const {
42
- paths,
43
- output
44
- } = options;
45
- process.env.TAMAGUI_KEEP_THEMES = "1", await (0, import_static.loadTamagui)({
41
+ paths,
42
+ output
43
+ } = options,
44
+ {
45
+ loadTamagui
46
+ } = require("@tamagui/static/loadTamagui");
47
+ process.env.TAMAGUI_KEEP_THEMES = "1", await loadTamagui({
46
48
  ...options.tamaguiOptions,
47
49
  platform: "web"
48
50
  });
package/dist/utils.cjs CHANGED
@@ -38,8 +38,7 @@ __export(utils_exports, {
38
38
  registerDispose: () => registerDispose
39
39
  });
40
40
  module.exports = __toCommonJS(utils_exports);
41
- var import_static = require("@tamagui/static"),
42
- import_chalk = __toESM(require("chalk")),
41
+ var import_chalk = __toESM(require("chalk")),
43
42
  import_fs_extra = require("fs-extra"),
44
43
  import_node_path = require("node:path");
45
44
  async function getOptions({
@@ -55,14 +54,22 @@ async function getOptions({
55
54
  config = "";
56
55
  try {
57
56
  config = await getDefaultTamaguiConfigPath(), pkgJson = await (0, import_fs_extra.readJSON)((0, import_node_path.join)(root, "package.json"));
58
- } catch {}
57
+ } catch {
58
+ loadTamaguiOptions && console.warn(import_chalk.default.yellow(`Warning: no tamagui.config.ts found in ${root}. Commands that need a config may fail.`));
59
+ }
59
60
  const filledOptions = {
60
- platform: "native",
61
- components: ["tamagui"],
62
- config,
63
- ...tamaguiOptions
64
- },
65
- finalOptions = loadTamaguiOptions ? (0, import_static.loadTamaguiBuildConfigSync)(filledOptions) : filledOptions;
61
+ platform: "native",
62
+ components: ["tamagui"],
63
+ config,
64
+ ...tamaguiOptions
65
+ };
66
+ let finalOptions = filledOptions;
67
+ if (loadTamaguiOptions) {
68
+ const {
69
+ loadTamaguiBuildConfigSync
70
+ } = require("@tamagui/static/loadTamagui");
71
+ finalOptions = loadTamaguiBuildConfigSync(filledOptions);
72
+ }
66
73
  return {
67
74
  mode: process.env.NODE_ENV === "production" ? "production" : "development",
68
75
  root,
@@ -91,11 +98,16 @@ async function getDefaultTamaguiConfigPath() {
91
98
  if (!found) throw new Error("No found tamagui.config.ts");
92
99
  return cachedPath = found, found;
93
100
  }
94
- const loadTamagui = async opts => await (0, import_static.loadTamagui)({
95
- components: ["tamagui"],
96
- ...opts,
97
- config: opts.config ?? (await getDefaultTamaguiConfigPath())
98
- }),
101
+ const loadTamagui = async opts => {
102
+ const {
103
+ loadTamagui: loadTamaguiStatic
104
+ } = require("@tamagui/static/loadTamagui");
105
+ return await loadTamaguiStatic({
106
+ components: ["tamagui"],
107
+ ...opts,
108
+ config: opts.config ?? (await getDefaultTamaguiConfigPath())
109
+ });
110
+ },
99
111
  disposers = /* @__PURE__ */new Set();
100
112
  function registerDispose(cb) {
101
113
  disposers.add(cb);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/cli",
3
- "version": "2.0.0-rc.27",
3
+ "version": "2.0.0-rc.29",
4
4
  "bin": {
5
5
  "tama": "./dist/index.cjs",
6
6
  "tamagui": "./dist/index.cjs"
@@ -26,11 +26,11 @@
26
26
  "test:web": "bun run test"
27
27
  },
28
28
  "dependencies": {
29
- "@tamagui/create-theme": "2.0.0-rc.27",
30
- "@tamagui/generate-themes": "2.0.0-rc.27",
31
- "@tamagui/static": "2.0.0-rc.27",
32
- "@tamagui/types": "2.0.0-rc.27",
33
- "@tamagui/vite-plugin": "2.0.0-rc.27",
29
+ "@tamagui/create-theme": "2.0.0-rc.29",
30
+ "@tamagui/generate-themes": "2.0.0-rc.29",
31
+ "@tamagui/static": "2.0.0-rc.29",
32
+ "@tamagui/types": "2.0.0-rc.29",
33
+ "@tamagui/vite-plugin": "2.0.0-rc.29",
34
34
  "arg": "^5.0.2",
35
35
  "chalk": "^4.1.2",
36
36
  "change-case": "^4.1.2",
@@ -49,7 +49,7 @@
49
49
  "url": "^0.11.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@tamagui/build": "2.0.0-rc.27",
52
+ "@tamagui/build": "2.0.0-rc.29",
53
53
  "@types/chokidar": "^2.1.3",
54
54
  "@types/marked": "^5.0.0",
55
55
  "vitest": "4.0.4"
package/src/cli.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import arg from 'arg'
2
2
  import chalk from 'chalk'
3
3
 
4
- import { generatedPackageTypes } from './add'
5
4
  import { disposeAll, getOptions } from './utils'
6
- import { loadTamagui, checkDeps } from '@tamagui/static'
7
5
 
8
6
  // exit handlers
9
7
  ;['exit', 'SIGINT'].forEach((_) => {
@@ -26,9 +24,8 @@ const COMMAND_MAP = {
26
24
  const { _, ...flags } = arg(this.flags)
27
25
  const options = await getOptions({
28
26
  debug: flags['--debug'] ? (flags['--verbose'] ? 'verbose' : true) : false,
29
- loadTamaguiOptions: true,
30
27
  })
31
-
28
+ const { checkDeps } = require('@tamagui/static/checkDeps')
32
29
  await checkDeps(options.paths.root)
33
30
  },
34
31
  },
@@ -47,13 +44,14 @@ const COMMAND_MAP = {
47
44
  debug: flags['--debug'] ? (flags['--verbose'] ? 'verbose' : true) : false,
48
45
  loadTamaguiOptions: true,
49
46
  })
47
+ const { loadTamagui } = require('@tamagui/static/loadTamagui')
50
48
  process.env.TAMAGUI_KEEP_THEMES = '1'
51
49
  await loadTamagui({
52
50
  ...options.tamaguiOptions,
53
51
  platform: 'web',
54
52
  })
55
53
 
56
- // Also generate prompt to .tamagui/prompt.md
54
+ // also generate prompt to .tamagui/prompt.md
57
55
  const { generatePrompt } = require('./generate-prompt')
58
56
  const { join } = require('node:path')
59
57
  await generatePrompt({
@@ -82,6 +80,7 @@ const COMMAND_MAP = {
82
80
  const outputPath =
83
81
  flags['--output'] || options.tamaguiOptions.outputCSS || './tamagui.generated.css'
84
82
 
83
+ const { loadTamagui } = require('@tamagui/static/loadTamagui')
85
84
  process.env.TAMAGUI_KEEP_THEMES = '1'
86
85
  await loadTamagui({
87
86
  ...options.tamaguiOptions,
@@ -133,9 +132,7 @@ const COMMAND_MAP = {
133
132
 
134
133
  add: {
135
134
  shorthands: [],
136
- description: `Use to add fonts and icons to your monorepo. Supported types: ${generatedPackageTypes.join(
137
- ', '
138
- )}`,
135
+ description: `Use to add fonts and icons to your monorepo.`,
139
136
  flags: {
140
137
  '--help': Boolean,
141
138
  '--debug': Boolean,
@@ -145,9 +142,6 @@ const COMMAND_MAP = {
145
142
  const { _, ...flags } = arg(this.flags)
146
143
  const { installGeneratedPackage } = require('./add')
147
144
  const [cmd, type, path] = _
148
- // const options = await getOptions({
149
- // debug: flags['--debug'] ? (flags['--verbose'] ? 'verbose' : true) : false,
150
- // })
151
145
  await installGeneratedPackage(type, path)
152
146
  },
153
147
  },
@@ -364,63 +358,3 @@ async function main() {
364
358
 
365
359
  process.exit(0)
366
360
  }
367
-
368
- function showHelp(definition: CommandDefinition, flags: { '--help'?: boolean }) {
369
- if (flags['--help']) {
370
- console.info(`$ ${definition}`)
371
- }
372
- }
373
-
374
- // async function main() {
375
- // const options = await getOptions({
376
- // host: flags['--host'],
377
- // })
378
-
379
- // switch (command) {
380
- // // build
381
- // case 'b':
382
- // case 'build': {
383
- // const { build } = await import('./build')
384
- // break
385
- // }
386
-
387
- // // generate
388
- // case 'generate':
389
- // case 'gen': {
390
- // const { generateTamaguiConfig: generateTamgauiConfig } = await import(
391
- // './tamaguiConfigUtils.js'
392
- // )
393
- // const { generateTypes } = await import('./generate')
394
-
395
- // if (props[0] === 'types') {
396
- // await generateTypes(options)
397
- // return
398
- // }
399
- // if (props[0] === 'config') {
400
- // await generateTamgauiConfig(options)
401
- // return
402
- // }
403
-
404
- // await Promise.all([
405
- // // all
406
- // generateTypes(options),
407
- // generateTamgauiConfig(options),
408
- // ])
409
- // break
410
- // }
411
-
412
- // // for now, dev === serve, eventually serve can be just prod mode
413
- // case 'dev': {
414
- // const { dev } = await import('./dev')
415
- // await dev(options)
416
- // break
417
- // }
418
-
419
- // default: {
420
- // if (!command || flags['--help']) {
421
- // }
422
- // console.warn(chalk.yellow(`No command found ${command}`))
423
- // process.exit(1)
424
- // }
425
- // }
426
- // }
@@ -1,6 +1,5 @@
1
1
  import { join } from 'node:path'
2
2
  import * as FS from 'fs-extra'
3
- import { loadTamagui } from '@tamagui/static'
4
3
  import type { CLIResolvedOptions } from '@tamagui/types'
5
4
 
6
5
  interface GeneratePromptOptions extends CLIResolvedOptions {
@@ -11,6 +10,7 @@ export async function generatePrompt(options: GeneratePromptOptions) {
11
10
  const { paths, output } = options
12
11
 
13
12
  // Regenerate the config first
13
+ const { loadTamagui } = require('@tamagui/static/loadTamagui')
14
14
  process.env.TAMAGUI_KEEP_THEMES = '1'
15
15
  await loadTamagui({
16
16
  ...options.tamaguiOptions,
package/src/utils.ts CHANGED
@@ -1,8 +1,4 @@
1
1
  import type { TamaguiOptions, TamaguiProjectInfo } from '@tamagui/static'
2
- import {
3
- loadTamaguiBuildConfigSync,
4
- loadTamagui as loadTamaguiStatic,
5
- } from '@tamagui/static'
6
2
  import type { CLIResolvedOptions, CLIUserOptions } from '@tamagui/types'
7
3
  import chalk from 'chalk'
8
4
  import fs, { pathExists, readJSON } from 'fs-extra'
@@ -23,7 +19,13 @@ export async function getOptions({
23
19
  config = await getDefaultTamaguiConfigPath()
24
20
  pkgJson = await readJSON(join(root, 'package.json'))
25
21
  } catch {
26
- // ok
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
+ }
27
29
  }
28
30
 
29
31
  const filledOptions = {
@@ -33,9 +35,11 @@ export async function getOptions({
33
35
  ...tamaguiOptions,
34
36
  } satisfies TamaguiOptions
35
37
 
36
- const finalOptions = loadTamaguiOptions
37
- ? loadTamaguiBuildConfigSync(filledOptions)
38
- : filledOptions
38
+ let finalOptions: TamaguiOptions = filledOptions
39
+ if (loadTamaguiOptions) {
40
+ const { loadTamaguiBuildConfigSync } = require('@tamagui/static/loadTamagui')
41
+ finalOptions = loadTamaguiBuildConfigSync(filledOptions)
42
+ }
39
43
 
40
44
  return {
41
45
  mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
@@ -79,6 +83,7 @@ async function getDefaultTamaguiConfigPath() {
79
83
  export const loadTamagui = async (
80
84
  opts: Partial<TamaguiOptions>
81
85
  ): Promise<TamaguiProjectInfo | null> => {
86
+ const { loadTamagui: loadTamaguiStatic } = require('@tamagui/static/loadTamagui')
82
87
  const loaded = await loadTamaguiStatic({
83
88
  components: ['tamagui'],
84
89
  ...opts,
@@ -1 +1 @@
1
- {"version":3,"file":"generate-prompt.d.ts","sourceRoot":"","sources":["../src/generate-prompt.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExD,UAAU,qBAAsB,SAAQ,kBAAkB;IACxD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,qBAAqB,iBA6BlE"}
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,UAAU,qBAAsB,SAAQ,kBAAkB;IACxD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,qBAAqB,iBA8BlE"}
@@ -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;AAKzE,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,CAqC5D;AAED,wBAAgB,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAKzD;AAiBD,eAAO,MAAM,WAAW,GACtB,MAAM,OAAO,CAAC,cAAc,CAAC,KAC5B,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAOnC,CAAA;AAID,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,IAAI,QAE7C;AAED,wBAAgB,UAAU,SAEzB"}
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,CA6C5D;AAED,wBAAgB,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAKzD;AAiBD,eAAO,MAAM,WAAW,GACtB,MAAM,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"}