@fairmint/ui 0.1.1 → 0.1.2

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/README.md CHANGED
@@ -53,7 +53,13 @@ export default defineConfig({
53
53
  });
54
54
  ```
55
55
 
56
- This auto-detects the sibling `design/ui/` repo and resolves imports to local source. Opt out with `LOCAL_UI=0 bun run dev`. In CI the design repo isn't present, so it falls back to the npm package automatically.
56
+ By default this does nothing — it uses the npm-published package. To enable local source resolution:
57
+
58
+ ```bash
59
+ LOCAL_UI=1 bun run dev
60
+ ```
61
+
62
+ The plugin checks for `../ui/src/index.ts` relative to your app. If found, imports resolve to local source with instant HMR. If not found, it warns and falls back to npm.
57
63
 
58
64
  ## Fonts
59
65
 
package/dist/vite.cjs CHANGED
@@ -3,10 +3,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const node_fs = require("node:fs");
4
4
  const node_path = require("node:path");
5
5
  function fairmintUiLocal(options) {
6
- const disabled = process.env.LOCAL_UI === "0";
7
- const localSource = options?.source ?? node_path.resolve(process.cwd(), "../design/ui/src/index.ts");
6
+ const enabled = process.env.LOCAL_UI === "1";
7
+ const localSource = options?.source ?? node_path.resolve(process.cwd(), "../ui/src/index.ts");
8
8
  const localStyles = node_path.resolve(localSource, "../styles.css");
9
- const found = !disabled && node_fs.existsSync(localSource);
9
+ const found = enabled && node_fs.existsSync(localSource);
10
+ if (enabled && !node_fs.existsSync(localSource)) {
11
+ console.warn("[@fairmint/ui] LOCAL_UI=1 but source not found at:", localSource);
12
+ }
10
13
  if (found) {
11
14
  console.log("[@fairmint/ui] Using local source:", localSource);
12
15
  }
package/dist/vite.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.cjs","sources":["../src/vite.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport type { Plugin } from \"vite\";\n\ninterface FairmintUiLocalOptions {\n /** Path to the design repo's ui/src/index.ts. Auto-detected from ../design/ui/src/index.ts if not set. */\n source?: string;\n}\n\n/**\n * Vite plugin for local @fairmint/ui development.\n *\n * Auto-detects the sibling design repo and resolves @fairmint/ui to local source.\n * Opt out with LOCAL_UI=0 env var.\n *\n * Usage in consumer vite.config.ts:\n * import { fairmintUiLocal } from '@fairmint/ui/vite';\n * plugins: [fairmintUiLocal(), react()]\n */\nexport function fairmintUiLocal(options?: FairmintUiLocalOptions): Plugin {\n const disabled = process.env.LOCAL_UI === \"0\";\n\n const localSource = options?.source ?? resolve(process.cwd(), \"../design/ui/src/index.ts\");\n const localStyles = resolve(localSource, \"../styles.css\");\n const found = !disabled && existsSync(localSource);\n\n if (found) {\n console.log(\"[@fairmint/ui] Using local source:\", localSource);\n }\n\n return {\n name: \"fairmint-ui-local\",\n config() {\n if (!found) return {};\n\n return {\n resolve: {\n alias: {\n \"@fairmint/ui/styles.css\": localStyles,\n \"@fairmint/ui\": localSource,\n },\n dedupe: [\"@mantine/core\", \"@mantine/hooks\", \"react\", \"react-dom\"],\n },\n };\n },\n };\n}\n"],"names":["resolve","existsSync"],"mappings":";;;;AAmBO,SAAS,gBAAgB,SAA0C;AACxE,QAAM,WAAW,QAAQ,IAAI,aAAa;AAE1C,QAAM,cAAc,SAAS,UAAUA,UAAAA,QAAQ,QAAQ,IAAA,GAAO,2BAA2B;AACzF,QAAM,cAAcA,UAAAA,QAAQ,aAAa,eAAe;AACxD,QAAM,QAAQ,CAAC,YAAYC,QAAAA,WAAW,WAAW;AAEjD,MAAI,OAAO;AACT,YAAQ,IAAI,sCAAsC,WAAW;AAAA,EAC/D;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AACP,UAAI,CAAC,MAAO,QAAO,CAAA;AAEnB,aAAO;AAAA,QACL,SAAS;AAAA,UACP,OAAO;AAAA,YACL,2BAA2B;AAAA,YAC3B,gBAAgB;AAAA,UAAA;AAAA,UAElB,QAAQ,CAAC,iBAAiB,kBAAkB,SAAS,WAAW;AAAA,QAAA;AAAA,MAClE;AAAA,IAEJ;AAAA,EAAA;AAEJ;;"}
1
+ {"version":3,"file":"vite.cjs","sources":["../src/vite.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport type { Plugin } from \"vite\";\n\ninterface FairmintUiLocalOptions {\n /** Path to the ui repo's src/index.ts. Auto-detected from ../ui/src/index.ts if not set. */\n source?: string;\n}\n\n/**\n * Vite plugin for local @fairmint/ui development.\n *\n * Resolves @fairmint/ui to local source for instant HMR without building.\n * Disabled by default — enable with LOCAL_UI=1 env var.\n *\n * Usage in consumer vite.config.ts:\n * import { fairmintUiLocal } from '@fairmint/ui/vite';\n * plugins: [fairmintUiLocal(), react()]\n *\n * Then run: LOCAL_UI=1 bun run dev\n */\nexport function fairmintUiLocal(options?: FairmintUiLocalOptions): Plugin {\n const enabled = process.env.LOCAL_UI === \"1\";\n\n const localSource = options?.source ?? resolve(process.cwd(), \"../ui/src/index.ts\");\n const localStyles = resolve(localSource, \"../styles.css\");\n const found = enabled && existsSync(localSource);\n\n if (enabled && !existsSync(localSource)) {\n console.warn(\"[@fairmint/ui] LOCAL_UI=1 but source not found at:\", localSource);\n }\n\n if (found) {\n console.log(\"[@fairmint/ui] Using local source:\", localSource);\n }\n\n return {\n name: \"fairmint-ui-local\",\n config() {\n if (!found) return {};\n\n return {\n resolve: {\n alias: {\n \"@fairmint/ui/styles.css\": localStyles,\n \"@fairmint/ui\": localSource,\n },\n dedupe: [\"@mantine/core\", \"@mantine/hooks\", \"react\", \"react-dom\"],\n },\n };\n },\n };\n}\n"],"names":["resolve","existsSync"],"mappings":";;;;AAqBO,SAAS,gBAAgB,SAA0C;AACxE,QAAM,UAAU,QAAQ,IAAI,aAAa;AAEzC,QAAM,cAAc,SAAS,UAAUA,UAAAA,QAAQ,QAAQ,IAAA,GAAO,oBAAoB;AAClF,QAAM,cAAcA,UAAAA,QAAQ,aAAa,eAAe;AACxD,QAAM,QAAQ,WAAWC,QAAAA,WAAW,WAAW;AAE/C,MAAI,WAAW,CAACA,mBAAW,WAAW,GAAG;AACvC,YAAQ,KAAK,sDAAsD,WAAW;AAAA,EAChF;AAEA,MAAI,OAAO;AACT,YAAQ,IAAI,sCAAsC,WAAW;AAAA,EAC/D;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AACP,UAAI,CAAC,MAAO,QAAO,CAAA;AAEnB,aAAO;AAAA,QACL,SAAS;AAAA,UACP,OAAO;AAAA,YACL,2BAA2B;AAAA,YAC3B,gBAAgB;AAAA,UAAA;AAAA,UAElB,QAAQ,CAAC,iBAAiB,kBAAkB,SAAS,WAAW;AAAA,QAAA;AAAA,MAClE;AAAA,IAEJ;AAAA,EAAA;AAEJ;;"}
package/dist/vite.d.ts CHANGED
@@ -1,17 +1,19 @@
1
1
  import { Plugin } from 'vite';
2
2
  interface FairmintUiLocalOptions {
3
- /** Path to the design repo's ui/src/index.ts. Auto-detected from ../design/ui/src/index.ts if not set. */
3
+ /** Path to the ui repo's src/index.ts. Auto-detected from ../ui/src/index.ts if not set. */
4
4
  source?: string;
5
5
  }
6
6
  /**
7
7
  * Vite plugin for local @fairmint/ui development.
8
8
  *
9
- * Auto-detects the sibling design repo and resolves @fairmint/ui to local source.
10
- * Opt out with LOCAL_UI=0 env var.
9
+ * Resolves @fairmint/ui to local source for instant HMR without building.
10
+ * Disabled by default — enable with LOCAL_UI=1 env var.
11
11
  *
12
12
  * Usage in consumer vite.config.ts:
13
13
  * import { fairmintUiLocal } from '@fairmint/ui/vite';
14
14
  * plugins: [fairmintUiLocal(), react()]
15
+ *
16
+ * Then run: LOCAL_UI=1 bun run dev
15
17
  */
16
18
  export declare function fairmintUiLocal(options?: FairmintUiLocalOptions): Plugin;
17
19
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,UAAU,sBAAsB;IAC9B,0GAA0G;IAC1G,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CA2BxE"}
1
+ {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,UAAU,sBAAsB;IAC9B,4FAA4F;IAC5F,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CA+BxE"}
package/dist/vite.js CHANGED
@@ -1,10 +1,13 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { resolve } from "node:path";
3
3
  function fairmintUiLocal(options) {
4
- const disabled = process.env.LOCAL_UI === "0";
5
- const localSource = options?.source ?? resolve(process.cwd(), "../design/ui/src/index.ts");
4
+ const enabled = process.env.LOCAL_UI === "1";
5
+ const localSource = options?.source ?? resolve(process.cwd(), "../ui/src/index.ts");
6
6
  const localStyles = resolve(localSource, "../styles.css");
7
- const found = !disabled && existsSync(localSource);
7
+ const found = enabled && existsSync(localSource);
8
+ if (enabled && !existsSync(localSource)) {
9
+ console.warn("[@fairmint/ui] LOCAL_UI=1 but source not found at:", localSource);
10
+ }
8
11
  if (found) {
9
12
  console.log("[@fairmint/ui] Using local source:", localSource);
10
13
  }
package/dist/vite.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.js","sources":["../src/vite.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport type { Plugin } from \"vite\";\n\ninterface FairmintUiLocalOptions {\n /** Path to the design repo's ui/src/index.ts. Auto-detected from ../design/ui/src/index.ts if not set. */\n source?: string;\n}\n\n/**\n * Vite plugin for local @fairmint/ui development.\n *\n * Auto-detects the sibling design repo and resolves @fairmint/ui to local source.\n * Opt out with LOCAL_UI=0 env var.\n *\n * Usage in consumer vite.config.ts:\n * import { fairmintUiLocal } from '@fairmint/ui/vite';\n * plugins: [fairmintUiLocal(), react()]\n */\nexport function fairmintUiLocal(options?: FairmintUiLocalOptions): Plugin {\n const disabled = process.env.LOCAL_UI === \"0\";\n\n const localSource = options?.source ?? resolve(process.cwd(), \"../design/ui/src/index.ts\");\n const localStyles = resolve(localSource, \"../styles.css\");\n const found = !disabled && existsSync(localSource);\n\n if (found) {\n console.log(\"[@fairmint/ui] Using local source:\", localSource);\n }\n\n return {\n name: \"fairmint-ui-local\",\n config() {\n if (!found) return {};\n\n return {\n resolve: {\n alias: {\n \"@fairmint/ui/styles.css\": localStyles,\n \"@fairmint/ui\": localSource,\n },\n dedupe: [\"@mantine/core\", \"@mantine/hooks\", \"react\", \"react-dom\"],\n },\n };\n },\n };\n}\n"],"names":[],"mappings":";;AAmBO,SAAS,gBAAgB,SAA0C;AACxE,QAAM,WAAW,QAAQ,IAAI,aAAa;AAE1C,QAAM,cAAc,SAAS,UAAU,QAAQ,QAAQ,IAAA,GAAO,2BAA2B;AACzF,QAAM,cAAc,QAAQ,aAAa,eAAe;AACxD,QAAM,QAAQ,CAAC,YAAY,WAAW,WAAW;AAEjD,MAAI,OAAO;AACT,YAAQ,IAAI,sCAAsC,WAAW;AAAA,EAC/D;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AACP,UAAI,CAAC,MAAO,QAAO,CAAA;AAEnB,aAAO;AAAA,QACL,SAAS;AAAA,UACP,OAAO;AAAA,YACL,2BAA2B;AAAA,YAC3B,gBAAgB;AAAA,UAAA;AAAA,UAElB,QAAQ,CAAC,iBAAiB,kBAAkB,SAAS,WAAW;AAAA,QAAA;AAAA,MAClE;AAAA,IAEJ;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"vite.js","sources":["../src/vite.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport type { Plugin } from \"vite\";\n\ninterface FairmintUiLocalOptions {\n /** Path to the ui repo's src/index.ts. Auto-detected from ../ui/src/index.ts if not set. */\n source?: string;\n}\n\n/**\n * Vite plugin for local @fairmint/ui development.\n *\n * Resolves @fairmint/ui to local source for instant HMR without building.\n * Disabled by default — enable with LOCAL_UI=1 env var.\n *\n * Usage in consumer vite.config.ts:\n * import { fairmintUiLocal } from '@fairmint/ui/vite';\n * plugins: [fairmintUiLocal(), react()]\n *\n * Then run: LOCAL_UI=1 bun run dev\n */\nexport function fairmintUiLocal(options?: FairmintUiLocalOptions): Plugin {\n const enabled = process.env.LOCAL_UI === \"1\";\n\n const localSource = options?.source ?? resolve(process.cwd(), \"../ui/src/index.ts\");\n const localStyles = resolve(localSource, \"../styles.css\");\n const found = enabled && existsSync(localSource);\n\n if (enabled && !existsSync(localSource)) {\n console.warn(\"[@fairmint/ui] LOCAL_UI=1 but source not found at:\", localSource);\n }\n\n if (found) {\n console.log(\"[@fairmint/ui] Using local source:\", localSource);\n }\n\n return {\n name: \"fairmint-ui-local\",\n config() {\n if (!found) return {};\n\n return {\n resolve: {\n alias: {\n \"@fairmint/ui/styles.css\": localStyles,\n \"@fairmint/ui\": localSource,\n },\n dedupe: [\"@mantine/core\", \"@mantine/hooks\", \"react\", \"react-dom\"],\n },\n };\n },\n };\n}\n"],"names":[],"mappings":";;AAqBO,SAAS,gBAAgB,SAA0C;AACxE,QAAM,UAAU,QAAQ,IAAI,aAAa;AAEzC,QAAM,cAAc,SAAS,UAAU,QAAQ,QAAQ,IAAA,GAAO,oBAAoB;AAClF,QAAM,cAAc,QAAQ,aAAa,eAAe;AACxD,QAAM,QAAQ,WAAW,WAAW,WAAW;AAE/C,MAAI,WAAW,CAAC,WAAW,WAAW,GAAG;AACvC,YAAQ,KAAK,sDAAsD,WAAW;AAAA,EAChF;AAEA,MAAI,OAAO;AACT,YAAQ,IAAI,sCAAsC,WAAW;AAAA,EAC/D;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AACP,UAAI,CAAC,MAAO,QAAO,CAAA;AAEnB,aAAO;AAAA,QACL,SAAS;AAAA,UACP,OAAO;AAAA,YACL,2BAA2B;AAAA,YAC3B,gBAAgB;AAAA,UAAA;AAAA,UAElB,QAAQ,CAAC,iBAAiB,kBAAkB,SAAS,WAAW;AAAA,QAAA;AAAA,MAClE;AAAA,IAEJ;AAAA,EAAA;AAEJ;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fairmint/ui",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Fairmint design system and UI component library",
6
6
  "license": "UNLICENSED",
@@ -51,6 +51,7 @@
51
51
  "test": "vitest run",
52
52
  "test:watch": "vitest",
53
53
  "test:coverage": "vitest run --coverage",
54
+ "prepare": "husky",
54
55
  "prepublishOnly": "bun run build"
55
56
  },
56
57
  "peerDependencies": {
@@ -61,8 +62,6 @@
61
62
  },
62
63
  "devDependencies": {
63
64
  "@biomejs/biome": "2.4.5",
64
- "@mantine/core": "8.3.15",
65
- "@mantine/hooks": "8.3.15",
66
65
  "@storybook/addon-a11y": "10.2.13",
67
66
  "@storybook/react": "10.2.13",
68
67
  "@storybook/react-vite": "10.2.13",