create-saasicat-admin 0.25.0 → 0.26.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/README.md CHANGED
@@ -41,15 +41,15 @@ pnpm dev # http://localhost:9100/admin/login
41
41
 
42
42
  ## Options
43
43
 
44
- | Flag | Default | Purpose |
45
- | ---------------- | --------------- | -------------------------------------------------- |
46
- | `--project-key` | `app` | used as prefix in storage keys + tokens |
47
- | `--brand-name` | `App` | shown in the AdminLayout header |
48
- | `--logo-text` | `AP` | two-letter badge in the logo |
49
- | `--api-base` | `/api/v1/admin` | backend endpoint prefix |
50
- | `--dev-port` | `9100` | Vite dev server port |
51
- | `--backend-port` | `3000` | backend port for the Vite proxy |
52
- | `--no-install` | false | only generate files, skip the final `pnpm install` |
44
+ | Flag | Default | Purpose |
45
+ | ---------------- | --------------- | ------------------------------------------------------- |
46
+ | `--project-key` | `app` | catalogue this admin administers; also a storage prefix |
47
+ | `--brand-name` | `App` | shown in the AdminLayout header |
48
+ | `--logo-text` | `AP` | two-letter badge in the logo |
49
+ | `--api-base` | `/api/v1/admin` | backend endpoint prefix |
50
+ | `--dev-port` | `9100` | Vite dev server port |
51
+ | `--backend-port` | `3000` | backend port for the Vite proxy |
52
+ | `--no-install` | false | only generate files, skip the final `pnpm install` |
53
53
 
54
54
  ## What is left to do afterwards
55
55
 
package/bin/create.js CHANGED
@@ -119,7 +119,8 @@ async function main() {
119
119
  console.log('Usage: pnpm create saasicat-admin <dir> [flags]');
120
120
  console.log('');
121
121
  console.log('Flags:');
122
- console.log(' --project-key=app storage key prefix');
122
+ console.log(' --project-key=app the catalogue this admin administers');
123
+ console.log(' (also the storage-key prefix)');
123
124
  console.log(' --brand-name=App brand name in the header');
124
125
  console.log(' --logo-text=AP two-letter badge');
125
126
  console.log(' --api-base=/api/v1/admin backend prefix');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-saasicat-admin",
3
- "version": "0.25.0",
3
+ "version": "0.26.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": {
@@ -4,7 +4,7 @@
4
4
  // storage are app-specific.
5
5
 
6
6
  import axios from 'axios';
7
- import type { HttpClient, HttpResponse } from '@saasicat/ui-vue';
7
+ import { createAxiosHttpClient } from '@saasicat/ui-vue';
8
8
 
9
9
  const TOKEN_KEY = '__PROJECT_KEY__-admin-token';
10
10
 
@@ -15,29 +15,9 @@ api.interceptors.request.use((cfg) => {
15
15
  return cfg;
16
16
  });
17
17
 
18
- export const platformHttp: HttpClient = async (url, init) => {
19
- const stripped = url.startsWith('/api/v1') ? url.slice(7) : url;
20
- const r = await api.request({
21
- url: stripped,
22
- method: (init?.method ?? 'GET') as 'GET' | 'POST',
23
- headers: init?.headers,
24
- data: init?.body,
25
- validateStatus: (s) => s < 500,
26
- });
27
- const res: HttpResponse = {
28
- status: r.status,
29
- headers: {
30
- get: (n) => {
31
- const v = r.headers[n.toLowerCase()];
32
- return v == null ? null : String(v);
33
- },
34
- },
35
- json: async () => r.data,
36
- text: async () =>
37
- typeof r.data === 'string' ? r.data : JSON.stringify(r.data),
38
- };
39
- return res;
40
- };
18
+ // The instance already carries `/api/v1` as its baseURL and the platform passes
19
+ // fully-qualified paths, so the prefix is stripped back off before the request.
20
+ export const platformHttp = createAxiosHttpClient(api, { stripPrefix: '/api/v1' });
41
21
 
42
22
  export async function adminLogin(email: string, password: string) {
43
23
  try {
@@ -5,7 +5,13 @@
5
5
  import { createPlatformLoaders, type SuperAdminEndpoints } from '@saasicat/ui-vue';
6
6
  import { getAuthToken, platformHttp } from './http';
7
7
 
8
- export const ADMIN_ENDPOINTS: SuperAdminEndpoints = { apiBase: '__API_BASE__' };
8
+ // `projectKey` names the catalogue this admin administers — the same key your
9
+ // backend configuration uses. The shell hands it to every platform resource,
10
+ // so a catalogue page does not have to carry it as a prop.
11
+ export const ADMIN_ENDPOINTS: SuperAdminEndpoints = {
12
+ apiBase: '__API_BASE__',
13
+ projectKey: '__PROJECT_KEY__',
14
+ };
9
15
 
10
16
  export const loaders = createPlatformLoaders({
11
17
  endpoints: ADMIN_ENDPOINTS,