create-quadrokit 0.2.9 → 0.2.10

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
@@ -32,7 +32,7 @@ Interactive mode: run without `--template` / `--dir` / `--name` to be prompted.
32
32
  ## What it does
33
33
 
34
34
  1. Copies the chosen template from `create-quadrokit/templates/<name>` when installed from npm, or `packages/templates/<name>` when you run the CLI from the monorepo (skips `node_modules`, `dist`, `.quadrokit`, lockfiles).
35
- 2. Overlays **`template-common/`** (shared across all templates): `.env.example`, `vite.config.ts`, `tsconfig*.json`, `postcss.config.js`, `biome.json`, `src/vite-env.d.ts`, `.cursor/rules/commitlint-conventional.mdc`, etc. In the monorepo, `packages/templates/*` receives the same overlay via `bun run sync:template-common` (root **postinstall** and `bun run build`); those paths are gitignored under `packages/templates/` so only `template-common/` is the source of truth in git.
35
+ 2. Overlays **`template-common/`** (shared across all templates): `.env.example`, `vite.config.ts`, `tailwind.config.ts`, `tsconfig*.json`, `postcss.config.js`, `biome.json`, `src/vite-env.d.ts`, `.cursor/rules/commitlint-conventional.mdc`, etc. In the monorepo, `packages/templates/*` receives the same overlay via `bun run sync:template-common` (root **postinstall** and `bun run build`); those paths are gitignored under `packages/templates/` so only `template-common/` is the source of truth in git.
36
36
  3. Rewrites `src/lib/quadro-client.ts` to import from `@quadrokit/generated/client.gen.js` (alias in `vite.config.ts` / `tsconfig.app.json`).
37
37
  4. Removes `@quadrokit/sample-client` and rewrites `workspace:*` on `@quadrokit/*` deps to `^<version>` matching **create-quadrokit**’s own `package.json` `version` (run `bun run version:set` at repo root to bump public packages) unless `--keep-workspace`.
38
38
  5. Writes `QUADROKIT.md` with proxy and `quadrokit:generate` instructions. Does **not** copy `.quadrokit/generated` — run `bun run quadrokit:generate` after install.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-quadrokit",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Scaffold a QuadroKit Vite + React app from a template",
5
5
  "type": "module",
6
6
  "bin": "./dist/index.mjs",
@@ -0,0 +1,24 @@
1
+ import { createRequire } from 'node:module'
2
+ import path from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
4
+ import preset from '@quadrokit/ui/tailwind-preset'
5
+ import type { Config } from 'tailwindcss'
6
+
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
8
+ const require = createRequire(import.meta.url)
9
+
10
+ function quadroUiDistGlob(): string {
11
+ try {
12
+ const pkgJson = require.resolve('@quadrokit/ui/package.json')
13
+ return path.join(path.dirname(pkgJson), 'dist', '**', '*.{mjs,js}').replace(/\\/g, '/')
14
+ } catch {
15
+ return path
16
+ .join(__dirname, 'node_modules', '@quadrokit', 'ui', 'dist', '**', '*.{mjs,js}')
17
+ .replace(/\\/g, '/')
18
+ }
19
+ }
20
+
21
+ export default {
22
+ presets: [preset],
23
+ content: ['./index.html', './src/**/*.{ts,tsx}', quadroUiDistGlob()],
24
+ } satisfies Config
@@ -11,7 +11,7 @@ Vite + React 19 + React Router 7 + **Tailwind 3.4** + **i18next** + **react-hook
11
11
 
12
12
  ## Monorepo
13
13
 
14
- Shared config (Vite, TypeScript, Biome, PostCSS, `.env.example`, etc.) lives in **`../../create-quadrokit/template-common/`** and is copied into each template by **`bun run sync:template-common`** (runs on root **postinstall** and before template builds). Do not edit those files inside `packages/templates/<name>/`—change **`template-common`** and re-sync.
14
+ Shared config (Vite, TypeScript, Tailwind, Biome, PostCSS, `.env.example`, etc.) lives in **`../../create-quadrokit/template-common/`** and is copied into each template by **`bun run sync:template-common`** (runs on root **postinstall** and before template builds). Do not edit those files inside `packages/templates/<name>/`—change **`template-common`** and re-sync.
15
15
 
16
16
  ```bash
17
17
  cd packages/templates/dashboard # or website / ecommerce / admin-shell
@@ -1,29 +1,37 @@
1
1
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@quadrokit/ui'
2
- import { useEffect, useState } from 'react'
2
+ import { useEffect, useRef, useState } from 'react'
3
3
  import { quadro } from '@/lib/quadro-client'
4
4
 
5
+ const PAGE_SIZE = 20
6
+
5
7
  export function AgenciesPage() {
6
8
  const [names, setNames] = useState<string[]>([])
7
9
  const [error, setError] = useState<string | null>(null)
10
+ const loadSeq = useRef(0)
8
11
 
9
12
  useEffect(() => {
13
+ const seq = ++loadSeq.current
10
14
  let cancelled = false
11
15
  ;(async () => {
12
16
  try {
13
17
  const list = quadro.Agency.all({
14
18
  page: 1,
15
- pageSize: 20,
19
+ pageSize: PAGE_SIZE,
16
20
  select: ['name'],
21
+ maxItems: PAGE_SIZE,
17
22
  })
18
23
  const acc: string[] = []
19
24
  for await (const a of list) {
25
+ if (cancelled || seq !== loadSeq.current) {
26
+ break
27
+ }
20
28
  acc.push(a.name ?? '')
21
29
  }
22
- if (!cancelled) {
30
+ if (!cancelled && seq === loadSeq.current) {
23
31
  setNames(acc)
24
32
  }
25
33
  } catch (e) {
26
- if (!cancelled) {
34
+ if (!cancelled && seq === loadSeq.current) {
27
35
  setError(e instanceof Error ? e.message : String(e))
28
36
  }
29
37
  }
@@ -1,29 +1,37 @@
1
1
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@quadrokit/ui'
2
- import { useEffect, useState } from 'react'
2
+ import { useEffect, useRef, useState } from 'react'
3
3
  import { quadro } from '@/lib/quadro-client'
4
4
 
5
+ const PAGE_SIZE = 20
6
+
5
7
  export function AgenciesPage() {
6
8
  const [names, setNames] = useState<string[]>([])
7
9
  const [error, setError] = useState<string | null>(null)
10
+ const loadSeq = useRef(0)
8
11
 
9
12
  useEffect(() => {
13
+ const seq = ++loadSeq.current
10
14
  let cancelled = false
11
15
  ;(async () => {
12
16
  try {
13
17
  const list = quadro.Agency.all({
14
18
  page: 1,
15
- pageSize: 20,
19
+ pageSize: PAGE_SIZE,
16
20
  select: ['name'],
21
+ maxItems: PAGE_SIZE,
17
22
  })
18
23
  const acc: string[] = []
19
24
  for await (const a of list) {
25
+ if (cancelled || seq !== loadSeq.current) {
26
+ break
27
+ }
20
28
  acc.push(a.name ?? '')
21
29
  }
22
- if (!cancelled) {
30
+ if (!cancelled && seq === loadSeq.current) {
23
31
  setNames(acc)
24
32
  }
25
33
  } catch (e) {
26
- if (!cancelled) {
34
+ if (!cancelled && seq === loadSeq.current) {
27
35
  setError(e instanceof Error ? e.message : String(e))
28
36
  }
29
37
  }
@@ -1,29 +1,37 @@
1
1
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@quadrokit/ui'
2
- import { useEffect, useState } from 'react'
2
+ import { useEffect, useRef, useState } from 'react'
3
3
  import { quadro } from '@/lib/quadro-client'
4
4
 
5
+ const PAGE_SIZE = 20
6
+
5
7
  export function AgenciesPage() {
6
8
  const [names, setNames] = useState<string[]>([])
7
9
  const [error, setError] = useState<string | null>(null)
10
+ const loadSeq = useRef(0)
8
11
 
9
12
  useEffect(() => {
13
+ const seq = ++loadSeq.current
10
14
  let cancelled = false
11
15
  ;(async () => {
12
16
  try {
13
17
  const list = quadro.Agency.all({
14
18
  page: 1,
15
- pageSize: 20,
19
+ pageSize: PAGE_SIZE,
16
20
  select: ['name'],
21
+ maxItems: PAGE_SIZE,
17
22
  })
18
23
  const acc: string[] = []
19
24
  for await (const a of list) {
25
+ if (cancelled || seq !== loadSeq.current) {
26
+ break
27
+ }
20
28
  acc.push(a.name ?? '')
21
29
  }
22
- if (!cancelled) {
30
+ if (!cancelled && seq === loadSeq.current) {
23
31
  setNames(acc)
24
32
  }
25
33
  } catch (e) {
26
- if (!cancelled) {
34
+ if (!cancelled && seq === loadSeq.current) {
27
35
  setError(e instanceof Error ? e.message : String(e))
28
36
  }
29
37
  }
@@ -1,29 +1,37 @@
1
1
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@quadrokit/ui'
2
- import { useEffect, useState } from 'react'
2
+ import { useEffect, useRef, useState } from 'react'
3
3
  import { quadro } from '@/lib/quadro-client'
4
4
 
5
+ const PAGE_SIZE = 20
6
+
5
7
  export function AgenciesPage() {
6
8
  const [names, setNames] = useState<string[]>([])
7
9
  const [error, setError] = useState<string | null>(null)
10
+ const loadSeq = useRef(0)
8
11
 
9
12
  useEffect(() => {
13
+ const seq = ++loadSeq.current
10
14
  let cancelled = false
11
15
  ;(async () => {
12
16
  try {
13
17
  const list = quadro.Agency.all({
14
18
  page: 1,
15
- pageSize: 20,
19
+ pageSize: PAGE_SIZE,
16
20
  select: ['name'],
21
+ maxItems: PAGE_SIZE,
17
22
  })
18
23
  const acc: string[] = []
19
24
  for await (const a of list) {
25
+ if (cancelled || seq !== loadSeq.current) {
26
+ break
27
+ }
20
28
  acc.push(a.name ?? '')
21
29
  }
22
- if (!cancelled) {
30
+ if (!cancelled && seq === loadSeq.current) {
23
31
  setNames(acc)
24
32
  }
25
33
  } catch (e) {
26
- if (!cancelled) {
34
+ if (!cancelled && seq === loadSeq.current) {
27
35
  setError(e instanceof Error ? e.message : String(e))
28
36
  }
29
37
  }
@@ -1,7 +0,0 @@
1
- import preset from '@quadrokit/ui/tailwind-preset'
2
- import type { Config } from 'tailwindcss'
3
-
4
- export default {
5
- presets: [preset],
6
- content: ['./index.html', './src/**/*.{ts,tsx}', '../../ui/src/**/*.{ts,tsx}'],
7
- } satisfies Config
@@ -1,7 +0,0 @@
1
- import preset from '@quadrokit/ui/tailwind-preset'
2
- import type { Config } from 'tailwindcss'
3
-
4
- export default {
5
- presets: [preset],
6
- content: ['./index.html', './src/**/*.{ts,tsx}', '../../ui/src/**/*.{ts,tsx}'],
7
- } satisfies Config
@@ -1,7 +0,0 @@
1
- import preset from '@quadrokit/ui/tailwind-preset'
2
- import type { Config } from 'tailwindcss'
3
-
4
- export default {
5
- presets: [preset],
6
- content: ['./index.html', './src/**/*.{ts,tsx}', '../../ui/src/**/*.{ts,tsx}'],
7
- } satisfies Config
@@ -1,7 +0,0 @@
1
- import preset from '@quadrokit/ui/tailwind-preset'
2
- import type { Config } from 'tailwindcss'
3
-
4
- export default {
5
- presets: [preset],
6
- content: ['./index.html', './src/**/*.{ts,tsx}', '../../ui/src/**/*.{ts,tsx}'],
7
- } satisfies Config