@lukoweb/apitogo 0.1.48 → 0.1.50

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/dist/cli/cli.js CHANGED
@@ -4133,7 +4133,7 @@ import {
4133
4133
  // package.json
4134
4134
  var package_default = {
4135
4135
  name: "@lukoweb/apitogo",
4136
- version: "0.1.48",
4136
+ version: "0.1.50",
4137
4137
  type: "module",
4138
4138
  sideEffects: [
4139
4139
  "**/*.css",
@@ -7115,6 +7115,9 @@ var DevPortalLocalManifestSchema = z10.object({
7115
7115
  title: z10.string().optional(),
7116
7116
  logoUrl: z10.string().optional()
7117
7117
  }).optional(),
7118
+ pricing: z10.object({
7119
+ enabled: z10.boolean().optional()
7120
+ }).optional(),
7118
7121
  plans: z10.array(ManifestPlanInputSchema).optional(),
7119
7122
  backend: z10.object({
7120
7123
  sourceDirectory: z10.string().optional(),
@@ -7135,6 +7138,17 @@ var DevPortalLocalManifestSchema = z10.object({
7135
7138
  projectId: z10.string().optional(),
7136
7139
  projectName: z10.string().optional()
7137
7140
  });
7141
+ function isPricingEnabled(manifest) {
7142
+ return manifest?.pricing?.enabled === true;
7143
+ }
7144
+ function manifestToPreviewCatalog(manifest) {
7145
+ const plans = manifest?.plans;
7146
+ const catalog = plansToPreviewCatalog(plans);
7147
+ return {
7148
+ pricingEnabled: isPricingEnabled(manifest),
7149
+ plans: catalog.plans
7150
+ };
7151
+ }
7138
7152
  function normalizeBillingPeriod(period) {
7139
7153
  if (!period) {
7140
7154
  return "monthly";
@@ -7184,6 +7198,9 @@ function mergeManifest(base, override) {
7184
7198
  if (override.branding) {
7185
7199
  merged.branding = { ...base.branding, ...override.branding };
7186
7200
  }
7201
+ if (override.pricing) {
7202
+ merged.pricing = { ...base.pricing, ...override.pricing };
7203
+ }
7187
7204
  if (override.backend) {
7188
7205
  merged.backend = { ...base.backend, ...override.backend };
7189
7206
  }
@@ -7204,10 +7221,7 @@ function manifestFilePath(rootDir, filename) {
7204
7221
  function manifestPathsForEnv(rootDir, env) {
7205
7222
  const resolvedRoot = path15.resolve(rootDir);
7206
7223
  const basePath = path15.join(resolvedRoot, APITOGO_MANIFEST_BASE_FILENAME);
7207
- const overridePath = path15.join(
7208
- resolvedRoot,
7209
- APITOGO_MANIFEST_ENV_FILES[env]
7210
- );
7224
+ const overridePath = path15.join(resolvedRoot, APITOGO_MANIFEST_ENV_FILES[env]);
7211
7225
  return {
7212
7226
  basePath,
7213
7227
  overridePath,
@@ -7286,12 +7300,10 @@ var viteLocalManifestPlugin = () => {
7286
7300
  let watchPaths = [];
7287
7301
  const loadManifestModule = async () => {
7288
7302
  const env = resolveManifestEnv(viteMode);
7289
- let catalog = {
7290
- plans: []
7291
- };
7303
+ let catalog = manifestToPreviewCatalog(null);
7292
7304
  try {
7293
7305
  const manifest = await readEffectiveManifest(rootDir, env);
7294
- catalog = plansToPreviewCatalog(manifest?.plans);
7306
+ catalog = manifestToPreviewCatalog(manifest);
7295
7307
  } catch {
7296
7308
  }
7297
7309
  return `export default ${JSON.stringify(catalog)};`;
@@ -27,6 +27,9 @@ export declare const DevPortalLocalManifestSchema: z.ZodObject<{
27
27
  title: z.ZodOptional<z.ZodString>;
28
28
  logoUrl: z.ZodOptional<z.ZodString>;
29
29
  }, z.core.$strip>>;
30
+ pricing: z.ZodOptional<z.ZodObject<{
31
+ enabled: z.ZodOptional<z.ZodBoolean>;
32
+ }, z.core.$strip>>;
30
33
  plans: z.ZodOptional<z.ZodArray<z.ZodObject<{
31
34
  sku: z.ZodString;
32
35
  displayName: z.ZodString;
@@ -77,10 +80,13 @@ export type DevPortalPreviewPlan = {
77
80
  includedActionKeys: string[];
78
81
  };
79
82
  export type DevPortalPreviewPlanCatalog = {
83
+ pricingEnabled: boolean;
80
84
  plans: DevPortalPreviewPlan[];
81
85
  };
86
+ export declare function isPricingEnabled(manifest: DevPortalLocalManifest | null | undefined): boolean;
87
+ export declare function manifestToPreviewCatalog(manifest: DevPortalLocalManifest | null | undefined): DevPortalPreviewPlanCatalog;
82
88
  export declare function normalizeBillingPeriod(period?: string): string;
83
- export declare function plansToPreviewCatalog(plans: ManifestPlanInput[] | undefined): DevPortalPreviewPlanCatalog;
89
+ export declare function plansToPreviewCatalog(plans: ManifestPlanInput[] | undefined): Pick<DevPortalPreviewPlanCatalog, "plans">;
84
90
  export declare function resolveManifestEnv(viteMode: string): ApitogoManifestEnv;
85
91
  export declare function mergePlansBySku(existing: ManifestPlanInput[] | undefined, patch: ManifestPlanInput[]): ManifestPlanInput[];
86
92
  export declare function mergeManifest(base: DevPortalLocalManifest, override: DevPortalLocalManifest): DevPortalLocalManifest;
@@ -51,11 +51,11 @@ message that sign-in unlocks after publish. Docs and API reference remain public
51
51
 
52
52
  ### Dev portal configuration files
53
53
 
54
- | Concern | File |
55
- | ----------------------------------------------------------------- | ---------------------------- |
56
- | Site nav, docs, plugins, auth wiring | `apitogo.config.tsx` |
54
+ | Concern | File |
55
+ | ----------------------------------------------------------------- | ---------------------------------------------------------------- |
56
+ | Site nav, docs, plugins, auth wiring | `apitogo.config.tsx` |
57
57
  | Plans, rate limits, `includedActionKeys`, project/deploy metadata | `apitogo.json` (+ env overrides — see [Manifest](./manifest.md)) |
58
- | OIDC and Stripe for publish (MCP only) | `apitogo.local.secrets.json` |
58
+ | OIDC and Stripe for publish (MCP only) | `apitogo.local.secrets.json` |
59
59
 
60
60
  **Production:** Register one OIDC app with redirect URI `https://{backend}/signin-oidc` (see MCP
61
61
  `manualSteps.oidcRedirectUri`). The frontend uses cookie sessions via `credentials: "include"` on
@@ -9,12 +9,12 @@ files override values without duplicating the full config.
9
9
 
10
10
  ## Files
11
11
 
12
- | File | When used | Purpose |
13
- | ---- | --------- | ------- |
14
- | `apitogo.json` | Always (base) | Committed defaults: `siteName`, `branding`, `plans`, `backend`, `gateway` |
15
- | `apitogo.local.json` | `npm run dev` | Local-only overrides (optional) |
16
- | `apitogo.prod.json` | `npm run build` | Production build overrides (optional) |
17
- | `apitogo.local.secrets.json` | MCP publish only | OIDC and Stripe credentials — never loaded by the dev server |
12
+ | File | When used | Purpose |
13
+ | ---------------------------- | ---------------- | ------------------------------------------------------------------------- |
14
+ | `apitogo.json` | Always (base) | Committed defaults: `siteName`, `branding`, `plans`, `backend`, `gateway` |
15
+ | `apitogo.local.json` | `npm run dev` | Local-only overrides (optional) |
16
+ | `apitogo.prod.json` | `npm run build` | Production build overrides (optional) |
17
+ | `apitogo.local.secrets.json` | MCP publish only | OIDC and Stripe credentials — never loaded by the dev server |
18
18
 
19
19
  New scaffolds ship `apitogo.json` plus `apitogo.local.example.json` and `apitogo.prod.example.json`
20
20
  to show how overrides work. Copy or rename the examples when you need environment-specific values.
@@ -95,20 +95,20 @@ Example production override (`apitogo.prod.json`):
95
95
 
96
96
  ## What to put where
97
97
 
98
- | Concern | Recommended file |
99
- | ------- | ---------------- |
100
- | Plans, rate limits, `includedActionKeys` | `apitogo.json` (shared) |
101
- | Branding, site name | `apitogo.json` |
102
- | Backend paths, OpenAPI location | `apitogo.json`; machine-specific paths in `apitogo.local.json` |
103
- | `projectId` after bootstrap | `apitogo.local.json` until MCP writes to the correct file |
104
- | Production-only plan pricing or deploy flags | `apitogo.prod.json` |
105
- | OIDC / Stripe | `apitogo.local.secrets.json` (see [Authentication](./authentication.md)) |
98
+ | Concern | Recommended file |
99
+ | -------------------------------------------- | ------------------------------------------------------------------------ |
100
+ | Plans, rate limits, `includedActionKeys` | `apitogo.json` (shared) |
101
+ | Branding, site name | `apitogo.json` |
102
+ | Backend paths, OpenAPI location | `apitogo.json`; machine-specific paths in `apitogo.local.json` |
103
+ | `projectId` after bootstrap | `apitogo.local.json` until MCP writes to the correct file |
104
+ | Production-only plan pricing or deploy flags | `apitogo.prod.json` |
105
+ | OIDC / Stripe | `apitogo.local.secrets.json` (see [Authentication](./authentication.md)) |
106
106
 
107
107
  ## Hot reload
108
108
 
109
109
  During `npm run dev`, changes to `apitogo.json` or `apitogo.local.json` hot-reload on `/pricing`
110
- without restarting the server. Restart the dev server after changing `VITE_APITOGO_DEV_PORTAL_API_URL`
111
- in `.env`.
110
+ without restarting the server. Restart the dev server after changing
111
+ `VITE_APITOGO_DEV_PORTAL_API_URL` in `.env`.
112
112
 
113
113
  ## Related configuration
114
114
 
@@ -25,8 +25,8 @@ have you up and running with a modern, customizable site that your developers wi
25
25
  npm create @lukoweb/apitogo@latest
26
26
  ```
27
27
 
28
- The CLI will walk you through setting up your project with interactive prompts. Choose from
29
- templates like API documentation, developer portals, or start from scratch.
28
+ The CLI will walk you through setting up your project with interactive prompts. By default you
29
+ get an empty dev-portal site; opt in to include starter example docs and an OpenAPI spec.
30
30
 
31
31
  1. **Navigate to your project:**
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -35,6 +35,11 @@ export const DevPortalLocalManifestSchema = z.object({
35
35
  logoUrl: z.string().optional(),
36
36
  })
37
37
  .optional(),
38
+ pricing: z
39
+ .object({
40
+ enabled: z.boolean().optional(),
41
+ })
42
+ .optional(),
38
43
  plans: z.array(ManifestPlanInputSchema).optional(),
39
44
  backend: z
40
45
  .object({
@@ -77,9 +82,27 @@ export type DevPortalPreviewPlan = {
77
82
  };
78
83
 
79
84
  export type DevPortalPreviewPlanCatalog = {
85
+ pricingEnabled: boolean;
80
86
  plans: DevPortalPreviewPlan[];
81
87
  };
82
88
 
89
+ export function isPricingEnabled(
90
+ manifest: DevPortalLocalManifest | null | undefined,
91
+ ): boolean {
92
+ return manifest?.pricing?.enabled === true;
93
+ }
94
+
95
+ export function manifestToPreviewCatalog(
96
+ manifest: DevPortalLocalManifest | null | undefined,
97
+ ): DevPortalPreviewPlanCatalog {
98
+ const plans = manifest?.plans;
99
+ const catalog = plansToPreviewCatalog(plans);
100
+ return {
101
+ pricingEnabled: isPricingEnabled(manifest),
102
+ plans: catalog.plans,
103
+ };
104
+ }
105
+
83
106
  export function normalizeBillingPeriod(period?: string): string {
84
107
  if (!period) {
85
108
  return "monthly";
@@ -97,7 +120,7 @@ export function normalizeBillingPeriod(period?: string): string {
97
120
 
98
121
  export function plansToPreviewCatalog(
99
122
  plans: ManifestPlanInput[] | undefined,
100
- ): DevPortalPreviewPlanCatalog {
123
+ ): Pick<DevPortalPreviewPlanCatalog, "plans"> {
101
124
  if (!plans?.length) {
102
125
  return { plans: [] };
103
126
  }
@@ -144,6 +167,9 @@ export function mergeManifest(
144
167
  if (override.branding) {
145
168
  merged.branding = { ...base.branding, ...override.branding };
146
169
  }
170
+ if (override.pricing) {
171
+ merged.pricing = { ...base.pricing, ...override.pricing };
172
+ }
147
173
  if (override.backend) {
148
174
  merged.backend = { ...base.backend, ...override.backend };
149
175
  }
@@ -170,10 +196,7 @@ export function manifestPathsForEnv(
170
196
  ): { basePath: string; overridePath: string; watchPaths: string[] } {
171
197
  const resolvedRoot = path.resolve(rootDir);
172
198
  const basePath = path.join(resolvedRoot, APITOGO_MANIFEST_BASE_FILENAME);
173
- const overridePath = path.join(
174
- resolvedRoot,
175
- APITOGO_MANIFEST_ENV_FILES[env],
176
- );
199
+ const overridePath = path.join(resolvedRoot, APITOGO_MANIFEST_ENV_FILES[env]);
177
200
 
178
201
  return {
179
202
  basePath,
@@ -2,7 +2,7 @@ import path from "node:path";
2
2
  import type { Plugin, ResolvedConfig } from "vite";
3
3
  import {
4
4
  manifestPathsForEnv,
5
- plansToPreviewCatalog,
5
+ manifestToPreviewCatalog,
6
6
  readEffectiveManifest,
7
7
  resolveManifestEnv,
8
8
  } from "../config/local-manifest.js";
@@ -19,13 +19,11 @@ const viteLocalManifestPlugin = (): Plugin => {
19
19
 
20
20
  const loadManifestModule = async (): Promise<string> => {
21
21
  const env = resolveManifestEnv(viteMode);
22
- let catalog = {
23
- plans: [] as ReturnType<typeof plansToPreviewCatalog>["plans"],
24
- };
22
+ let catalog = manifestToPreviewCatalog(null);
25
23
 
26
24
  try {
27
25
  const manifest = await readEffectiveManifest(rootDir, env);
28
- catalog = plansToPreviewCatalog(manifest?.plans);
26
+ catalog = manifestToPreviewCatalog(manifest);
29
27
  } catch {
30
28
  // Missing or invalid manifest — empty catalog for preview.
31
29
  }