create-saasicat-admin 0.3.0 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-saasicat-admin",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Scaffolding CLI for SuperAdmin frontend projects (Vue 3 + Quasar + Vite). Generates a minimal working admin app built on @saasicat/ui-vue. Usage: `pnpm create saasicat-admin <dir>`.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -3,15 +3,17 @@
3
3
  import 'quasar/src/css/index.sass';
4
4
  import '@quasar/extras/material-icons/material-icons.css';
5
5
 
6
- import { createSuperAdminApp } from '@saasicat/ui-vue';
6
+ import { createSuperAdminApp } from '@saasicat/ui-vue/quasar';
7
7
  import App from './App.vue';
8
8
  import { appRoutes } from './router/routes';
9
9
  import { adminLogin, isAuthenticated } from './services/http';
10
+ import { ADMIN_ENDPOINTS } from './services/platform-loaders';
11
+ import { useManifestStore } from './stores/manifest';
10
12
 
11
13
  const handle = createSuperAdminApp({
12
14
  rootComponent: App,
13
15
  brand: { logoText: '__LOGO_TEXT__', name: '__BRAND_NAME__' },
14
- endpoints: { apiBase: '__API_BASE__' },
16
+ endpoints: ADMIN_ENDPOINTS,
15
17
  appRoutes,
16
18
  loginAdapter: { login: adminLogin },
17
19
  authGuard: {
@@ -19,6 +21,10 @@ const handle = createSuperAdminApp({
19
21
  onUnauthenticated: () => '/login',
20
22
  },
21
23
  manifestGuard: {
24
+ // Lazy store access: the Pinia instance exists once
25
+ // createSuperAdminApp() has run; the guard only fires afterwards.
26
+ ensureLoaded: () => useManifestStore().ensureLoaded(),
27
+ getManifest: () => useManifestStore().manifest,
22
28
  errorRoute: '/admin-error',
23
29
  },
24
30
  actions: {},
@@ -57,3 +57,8 @@ export async function adminLogin(email: string, password: string) {
57
57
  export function isAuthenticated(): boolean {
58
58
  return !!localStorage.getItem(TOKEN_KEY);
59
59
  }
60
+
61
+ /** Auth-token provider for the platform loaders (`Authorization: Bearer …`). */
62
+ export function getAuthToken(): string | null {
63
+ return localStorage.getItem(TOKEN_KEY);
64
+ }
@@ -0,0 +1,15 @@
1
+ // BootLoader + ManifestLoader built from the same endpoint constant that
2
+ // `main.ts` passes to `createSuperAdminApp()` — endpoints live in exactly
3
+ // one place (handbook §8.1).
4
+
5
+ import { createPlatformLoaders, type SuperAdminEndpoints } from '@saasicat/ui-vue';
6
+ import { getAuthToken, platformHttp } from './http';
7
+
8
+ export const ADMIN_ENDPOINTS: SuperAdminEndpoints = { apiBase: '__API_BASE__' };
9
+
10
+ export const loaders = createPlatformLoaders({
11
+ endpoints: ADMIN_ENDPOINTS,
12
+ http: platformHttp,
13
+ storageKeyPrefix: '__PROJECT_KEY__:',
14
+ getAuthToken,
15
+ });
@@ -0,0 +1,10 @@
1
+ // Manifest Pinia store — the router guard in `main.ts` awaits
2
+ // `ensureLoaded()` before rendering admin routes (handbook §8.2).
3
+
4
+ import { createManifestStore } from '@saasicat/ui-vue';
5
+ import { loaders } from '../services/platform-loaders';
6
+
7
+ export const useManifestStore = createManifestStore({
8
+ loader: loaders.manifestLoader,
9
+ id: 'admin-manifest',
10
+ });
@@ -1,10 +1,18 @@
1
+ import { fileURLToPath } from 'node:url';
1
2
  import { defineConfig } from 'vite';
2
3
  import vue from '@vitejs/plugin-vue';
3
4
  import { quasar } from '@quasar/vite-plugin';
4
5
 
5
6
  export default defineConfig({
6
7
  base: '/admin/',
7
- plugins: [vue(), quasar({ sassVariables: 'src/styles/theme.scss' })],
8
+ plugins: [
9
+ vue(),
10
+ quasar({
11
+ // Absolute path — sass resolves plain relative paths against the
12
+ // importing file inside node_modules/quasar, not the project root.
13
+ sassVariables: fileURLToPath(new URL('./src/styles/theme.scss', import.meta.url)),
14
+ }),
15
+ ],
8
16
  server: {
9
17
  port: __DEV_PORT__,
10
18
  proxy: {