@tamagui/cli 3.0.0-beta.1093.1 → 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/cli.cjs CHANGED
@@ -30,26 +30,45 @@ const COMMAND_MAP = {
30
30
  "--debug": Boolean,
31
31
  "--verbose": Boolean,
32
32
  "--styles-only": Boolean,
33
- "--deps-only": Boolean
33
+ "--deps-only": Boolean,
34
+ "--strict": Boolean
34
35
  },
35
36
  async run() {
36
37
  const { _, ...flags2 } = (0, import_arg.default)(this.flags);
37
- const options = await (0, import_utils.getOptions)({ debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : true : false });
38
+ const options = await (0, import_utils.getOptions)({
39
+ debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : true : false,
40
+ loadTamaguiOptions: flags2["--strict"] && !flags2["--deps-only"]
41
+ });
38
42
  if (!flags2["--styles-only"]) {
39
43
  const { checkDeps } = require("@tamagui/static/checkDeps");
40
44
  await checkDeps(options.paths.root);
41
45
  }
42
46
  if (flags2["--deps-only"]) return;
47
+ if (flags2["--strict"]) {
48
+ if (!options.tamaguiOptions.config) {
49
+ throw new Error("Strict style checking requires a Tamagui config.");
50
+ }
51
+ const { loadTamagui } = require("@tamagui/static/loadTamagui");
52
+ process.env.TAMAGUI_KEEP_THEMES = "1";
53
+ const loaded = await loadTamagui({
54
+ ...options.tamaguiOptions,
55
+ platform: "web"
56
+ }, true);
57
+ if (!loaded?.tamaguiConfig) {
58
+ throw new Error("Unable to load the Tamagui config for strict style checking.");
59
+ }
60
+ }
43
61
  const { checkStyleFiles, formatCheckResults, MissingConfigArtifactError } = require("@tamagui/language-service/check");
44
62
  try {
45
63
  const result = checkStyleFiles({
46
64
  root: options.paths.root,
47
- configPath: options.paths.conf
65
+ configPath: options.paths.conf,
66
+ strict: flags2["--strict"]
48
67
  });
49
68
  console.info(formatCheckResults(result));
50
69
  if (result.diagnosticCount > 0) process.exitCode = 1;
51
70
  } catch (error) {
52
- if (error instanceof MissingConfigArtifactError) {
71
+ if (error instanceof MissingConfigArtifactError && !flags2["--strict"]) {
53
72
  console.warn(import_chalk.default.yellow(`skipping flat value check: ${error.message}`));
54
73
  return;
55
74
  }