@lovo/matter-cli 0.5.0 → 0.6.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @lovo/matter-cli
2
2
 
3
+ ## 0.6.0
4
+
3
5
  ## 0.5.0
4
6
 
5
7
  ### Minor Changes
@@ -12,22 +12,23 @@ function isRecord(value: unknown): value is Record<string, unknown> {
12
12
  return typeof value === 'object' && value !== null;
13
13
  }
14
14
 
15
- // Dynamic import returns `any`; assign to `unknown` first via explicit typing.
15
+ function isReactComponent(value: unknown): value is React.ComponentType<unknown> {
16
+ return typeof value === 'function';
17
+ }
18
+
16
19
  const rawModule: unknown = await import(/* @vite-ignore */ __MATTER_USER_MODULE_PATH);
17
20
  const userModule: Record<string, unknown> = isRecord(rawModule) ? rawModule : {};
18
21
 
19
22
  const rawExport: unknown = userModule[__MATTER_EXPORT_NAME];
20
23
 
21
- if (typeof rawExport !== 'function') {
24
+ if (!isReactComponent(rawExport)) {
22
25
  document.body.innerHTML = `<pre style="color:#fff;padding:1rem">matter poster: export "${__MATTER_EXPORT_NAME}" is not a React component (got ${typeof rawExport}). Available exports: ${Object.keys(
23
26
  userModule,
24
27
  ).join(', ')}</pre>`;
25
28
  throw new Error(`export "${__MATTER_EXPORT_NAME}" is not a component`);
26
29
  }
27
30
 
28
- // After the typeof guard above, rawExport is a function — safe to use as a React component.
29
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
30
- const Component = rawExport as React.ComponentType<unknown>;
31
+ const Component = rawExport;
31
32
 
32
33
  const rootEl = document.getElementById('root');
33
34
 
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ function fail(caughtError) {
9
9
  process.exit(1);
10
10
  }
11
11
  var program = new Command();
12
- program.name("matter-cli").description("CLI for Matter \u2014 copy-paste components from the registry into your project").version("0.5.0");
12
+ program.name("matter-cli").description("CLI for Matter \u2014 copy-paste components from the registry into your project").version("0.6.0");
13
13
  program.command("init").description("one-time project setup \u2014 writes matter.config.json").option("--force", "overwrite an existing matter.config.json").action(async (opts) => {
14
14
  try {
15
15
  const { runInit } = await import("./init-NB5EOU5H.js");
@@ -21,7 +21,7 @@ program.command("init").description("one-time project setup \u2014 writes matter
21
21
  program.command("list").description("show available components in the registry").option("--registry <url>", "override the registryUrl from matter.config.json").option("--reference <ref>", "tag, branch, or commit (defaults to the CLI version)").action(async (opts) => {
22
22
  try {
23
23
  const { runList } = await import("./list-L725RQM3.js");
24
- await runList({ registry: opts.registry, ref: opts.reference, cliVersion: "0.5.0" });
24
+ await runList({ registry: opts.registry, ref: opts.reference, cliVersion: "0.6.0" });
25
25
  } catch (caughtError) {
26
26
  fail(caughtError);
27
27
  }
@@ -34,7 +34,7 @@ program.command("add").description("copy one or more components from the registr
34
34
  registry: opts.registry,
35
35
  ref: opts.reference,
36
36
  force: opts.force,
37
- cliVersion: "0.5.0"
37
+ cliVersion: "0.6.0"
38
38
  });
39
39
  } catch (caughtError) {
40
40
  fail(caughtError);
@@ -49,7 +49,7 @@ program.command("update").description("re-fetch a previously-added component (or
49
49
  registry: opts.registry,
50
50
  ref: opts.reference,
51
51
  force: opts.force,
52
- cliVersion: "0.5.0"
52
+ cliVersion: "0.6.0"
53
53
  });
54
54
  } catch (caughtError) {
55
55
  fail(caughtError);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovo/matter-cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "CLI for Matter — copy-paste components from the registry into your project.",
5
5
  "keywords": [
6
6
  "cli",
@@ -48,7 +48,7 @@
48
48
  "typescript": "^5.6.0",
49
49
  "vite": "^8.0.14",
50
50
  "vitest": "^4.1.7",
51
- "@lovo/matter-react": "0.5.0",
51
+ "@lovo/matter-react": "0.6.0",
52
52
  "@matter/registry": "0.0.0",
53
53
  "@matter/tsconfig": "0.0.0"
54
54
  },