@c15t/cli 1.7.0 → 1.7.1
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/commands/generate/options/c15t-mode.d.ts.map +1 -1
- package/dist/commands/generate/options/offline-mode.d.ts +2 -1
- package/dist/commands/generate/options/offline-mode.d.ts.map +1 -1
- package/dist/commands/generate/options/self-hosted-mode.d.ts.map +1 -1
- package/dist/commands/generate/options/shared/scripts.d.ts +8 -0
- package/dist/commands/generate/options/shared/scripts.d.ts.map +1 -0
- package/dist/commands/generate/options/utils/dependencies.d.ts +2 -2
- package/dist/commands/generate/options/utils/dependencies.d.ts.map +1 -1
- package/dist/commands/generate/options/utils/shared-frontend.d.ts +1 -0
- package/dist/commands/generate/options/utils/shared-frontend.d.ts.map +1 -1
- package/dist/commands/generate/templates/next/pages/components.d.ts.map +1 -1
- package/dist/commands/generate/templates/next/pages/layout.d.ts.map +1 -1
- package/dist/commands/self-host/migrate/migrator-result.d.ts.map +1 -1
- package/dist/context/package-manager-detection.d.ts +1 -1
- package/dist/context/package-manager-detection.d.ts.map +1 -1
- package/dist/index.mjs +84 -32
- package/package.json +3 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c15t-mode.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/options/c15t-mode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKvD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IACjD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,eAAgB,SAAQ,WAAW;IAC5C,OAAO,EAAE,UAAU,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AA8GD;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CAAC,EACnC,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,YAAY,GACZ,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"c15t-mode.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/options/c15t-mode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKvD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IACjD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,eAAgB,SAAQ,WAAW;IAC5C,OAAO,EAAE,UAAU,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AA8GD;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CAAC,EACnC,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,YAAY,GACZ,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAsC3C"}
|
|
@@ -10,6 +10,7 @@ export interface OfflineModeResult extends BaseResult {
|
|
|
10
10
|
interface OfflineModeOptions extends BaseOptions {
|
|
11
11
|
context: CliContext;
|
|
12
12
|
spinner: ReturnType<typeof p.spinner>;
|
|
13
|
+
handleCancel?: (value: unknown) => boolean;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Handles the setup process for offline mode (browser storage)
|
|
@@ -20,6 +21,6 @@ interface OfflineModeOptions extends BaseOptions {
|
|
|
20
21
|
* @param handleCancel - Function to handle prompt cancellations
|
|
21
22
|
* @returns Configuration data for the offline mode
|
|
22
23
|
*/
|
|
23
|
-
export declare function setupOfflineMode({ context, spinner, }: OfflineModeOptions): Promise<OfflineModeResult>;
|
|
24
|
+
export declare function setupOfflineMode({ context, spinner, handleCancel, }: OfflineModeOptions): Promise<OfflineModeResult>;
|
|
24
25
|
export {};
|
|
25
26
|
//# sourceMappingURL=offline-mode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offline-mode.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/options/offline-mode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"offline-mode.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/options/offline-mode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIvD;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACpD,mBAAmB,EAAE,MAAM,CAAC;CAC5B;AAED,UAAU,kBAAmB,SAAQ,WAAW;IAC/C,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;IACtC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CAC3C;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,YAAY,GACZ,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAwBjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"self-hosted-mode.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/options/self-hosted-mode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAMzD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIvD,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACrD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,mBAAoB,SAAQ,WAAW;IAChD,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;IACtC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CAC3C;AAED,wBAAsB,mBAAmB,CAAC,EACzC,OAAO,EACP,OAAO,EACP,YAAY,GACZ,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"self-hosted-mode.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/options/self-hosted-mode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAMzD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIvD,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACrD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,mBAAoB,SAAQ,WAAW;IAChD,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;IACtC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CAC3C;AAED,wBAAsB,mBAAmB,CAAC,EACzC,OAAO,EACP,OAAO,EACP,YAAY,GACZ,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAgFnD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CliContext } from '../../../../context/types';
|
|
2
|
+
interface GetScriptsToAddOptions {
|
|
3
|
+
context: CliContext;
|
|
4
|
+
handleCancel?: (value: unknown) => boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function getScriptsToAdd({ context, handleCancel, }: GetScriptsToAddOptions): Promise<boolean | symbol>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=scripts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scripts.d.ts","sourceRoot":"","sources":["../../../../../src/commands/generate/options/shared/scripts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,UAAU,sBAAsB;IAC/B,OAAO,EAAE,UAAU,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CAC3C;AAED,wBAAsB,eAAe,CAAC,EACrC,OAAO,EACP,YAAY,GACZ,EAAE,sBAAsB,6BAkBxB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import type { PackageManager } from '../../../../context/package-manager-detection';
|
|
1
2
|
import type { CliContext } from '../../../../context/types';
|
|
2
|
-
export type PackageManager = 'npm' | 'yarn' | 'pnpm';
|
|
3
3
|
/**
|
|
4
4
|
* Installs dependencies using the detected package manager
|
|
5
5
|
*
|
|
6
6
|
* @param projectRoot - The root directory of the project
|
|
7
7
|
* @param dependencies - Array of package names to install
|
|
8
|
-
* @param packageManager - The package manager to use (npm, yarn, pnpm)
|
|
8
|
+
* @param packageManager - The package manager to use (npm, yarn, pnpm, bun)
|
|
9
9
|
* @returns Promise that resolves when installation is complete
|
|
10
10
|
*/
|
|
11
11
|
export declare function addAndInstallDependenciesViaPM(projectRoot: string, dependencies: string[], packageManager: PackageManager): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../../../src/commands/generate/options/utils/dependencies.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../../../src/commands/generate/options/utils/dependencies.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD;;;;;;;GAOG;AACH,wBAAsB,8BAA8B,CACnD,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EAAE,EACtB,cAAc,EAAE,cAAc,GAC5B,OAAO,CAAC,IAAI,CAAC,CA2Cf;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACtC,YAAY,EAAE,MAAM,EAAE,EACtB,cAAc,EAAE,cAAc,GAC5B,MAAM,CAaR;AAED,UAAU,0BAA0B;IACnC,OAAO,EAAE,UAAU,CAAC;IACpB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,mBAAmB,CAAC,EACzC,OAAO,EACP,iBAAiB,EACjB,YAAY,EACZ,WAAmB,GACnB,EAAE,0BAA0B;;;GAiE5B"}
|
|
@@ -7,6 +7,7 @@ interface SharedFrontendOptions {
|
|
|
7
7
|
interface SharedFrontendResult {
|
|
8
8
|
proxyNextjs?: boolean;
|
|
9
9
|
useEnvFile?: boolean;
|
|
10
|
+
dependenciesToAdd: string[];
|
|
10
11
|
}
|
|
11
12
|
export declare function getSharedFrontendOptions({ backendURL, context, handleCancel, }: SharedFrontendOptions): Promise<SharedFrontendResult>;
|
|
12
13
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-frontend.d.ts","sourceRoot":"","sources":["../../../../../src/commands/generate/options/utils/shared-frontend.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"shared-frontend.d.ts","sourceRoot":"","sources":["../../../../../src/commands/generate/options/utils/shared-frontend.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,UAAU,qBAAqB;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,UAAU,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CAC3C;AAED,UAAU,oBAAoB;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,wBAAsB,wBAAwB,CAAC,EAC9C,UAAU,EACV,OAAO,EACP,YAAY,GACZ,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA6DvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/generate/templates/next/pages/components.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/generate/templates/next/pages/components.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAgE1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/generate/templates/next/pages/layout.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAIvE,UAAU,wBAAwB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,iBAAiB,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,kBAAkB;IAC3B,cAAc,EAAE,MAAM,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/generate/templates/next/pages/layout.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAIvE,UAAU,wBAAwB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,iBAAiB,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,kBAAkB;IAC3B,cAAc,EAAE,MAAM,CAAC;CACvB;AAwSD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CAAC,EACvC,WAAW,EACX,IAAI,EACJ,UAAU,EACV,UAAU,EACV,WAAW,GACX,EAAE,wBAAwB,GAAG,OAAO,CAAC;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACpC,CAAC,CAoFD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrator-result.d.ts","sourceRoot":"","sources":["../../../../src/commands/self-host/migrate/migrator-result.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrator-result.d.ts","sourceRoot":"","sources":["../../../../src/commands/self-host/migrate/migrator-result.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,wBAAsB,qBAAqB,CAC1C,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,eAAe,iBAgDvB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CliLogger } from '../utils/logger';
|
|
2
|
-
export type PackageManager = 'npm' | 'yarn' | 'pnpm';
|
|
2
|
+
export type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';
|
|
3
3
|
export declare const SUPPORTED_PACKAGE_MANAGERS: PackageManager[];
|
|
4
4
|
export interface PackageManagerResult {
|
|
5
5
|
name: PackageManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager-detection.d.ts","sourceRoot":"","sources":["../../src/context/package-manager-detection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"package-manager-detection.d.ts","sourceRoot":"","sources":["../../src/context/package-manager-detection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAC7D,eAAO,MAAM,0BAA0B,EAAE,cAAc,EAKtD,CAAC;AACF,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAoBD;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACzC,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,SAAS,GAChB,OAAO,CAAC,oBAAoB,CAAC,CAsD/B"}
|
package/dist/index.mjs
CHANGED
|
@@ -371,6 +371,13 @@ async function addAndInstallDependenciesViaPM(projectRoot, dependencies, package
|
|
|
371
371
|
...dependencies
|
|
372
372
|
];
|
|
373
373
|
break;
|
|
374
|
+
case 'bun':
|
|
375
|
+
command = 'bun';
|
|
376
|
+
args = [
|
|
377
|
+
'add',
|
|
378
|
+
...dependencies
|
|
379
|
+
];
|
|
380
|
+
break;
|
|
374
381
|
default:
|
|
375
382
|
throw new Error(`Unsupported package manager for dependency addition: ${packageManager}`);
|
|
376
383
|
}
|
|
@@ -388,6 +395,8 @@ function getManualInstallCommand(dependencies, packageManager) {
|
|
|
388
395
|
return `yarn add ${dependencies.join(' ')}`;
|
|
389
396
|
case 'pnpm':
|
|
390
397
|
return `pnpm add ${dependencies.join(' ')}`;
|
|
398
|
+
case 'bun':
|
|
399
|
+
return `bun add ${dependencies.join(' ')}`;
|
|
391
400
|
default:
|
|
392
401
|
return `npm install ${dependencies.join(' ')}`;
|
|
393
402
|
}
|
|
@@ -894,6 +903,7 @@ import {
|
|
|
894
903
|
ConsentManagerDialog,
|
|
895
904
|
ConsentManagerProvider,
|
|
896
905
|
CookieBanner,
|
|
906
|
+
type InitialDataPromise
|
|
897
907
|
} from '@c15t/nextjs/pages';
|
|
898
908
|
// For client-only apps (non-SSR), you can use:
|
|
899
909
|
// import { ConsentManagerProvider } from '@c15t/nextjs/client';
|
|
@@ -921,7 +931,7 @@ import {
|
|
|
921
931
|
* @example
|
|
922
932
|
* \`\`\`tsx
|
|
923
933
|
* // In your pages/_app.tsx
|
|
924
|
-
* import { ConsentManager } from '
|
|
934
|
+
* import { ConsentManager } from '../components/consent-manager';
|
|
925
935
|
*
|
|
926
936
|
* export default function MyApp({ Component, pageProps }) {
|
|
927
937
|
* return (
|
|
@@ -937,7 +947,7 @@ export function ConsentManager({
|
|
|
937
947
|
initialData,
|
|
938
948
|
}: {
|
|
939
949
|
children: ReactNode;
|
|
940
|
-
initialData?:
|
|
950
|
+
initialData?: InitialDataPromise;
|
|
941
951
|
}) {
|
|
942
952
|
return (
|
|
943
953
|
<ConsentManagerProvider
|
|
@@ -1005,9 +1015,14 @@ function wrapPagesJsxContent(originalJsx) {
|
|
|
1005
1015
|
return `(${wrappedContent})`;
|
|
1006
1016
|
}
|
|
1007
1017
|
async function createConsentManagerComponent(projectRoot, pagesDir, optionsText) {
|
|
1008
|
-
|
|
1018
|
+
let componentsDir;
|
|
1019
|
+
componentsDir = pagesDir.includes('src') ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join('src', 'components') : 'components';
|
|
1020
|
+
const componentsDirPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(projectRoot, componentsDir);
|
|
1021
|
+
await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].mkdir(componentsDirPath, {
|
|
1022
|
+
recursive: true
|
|
1023
|
+
});
|
|
1009
1024
|
const consentManagerContent = components_generateConsentManagerTemplate(optionsText);
|
|
1010
|
-
const consentManagerPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(
|
|
1025
|
+
const consentManagerPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(componentsDirPath, 'consent-manager.tsx');
|
|
1011
1026
|
await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].writeFile(consentManagerPath, consentManagerContent, 'utf-8');
|
|
1012
1027
|
return {
|
|
1013
1028
|
consentManager: consentManagerPath
|
|
@@ -1056,7 +1071,10 @@ async function updatePagesLayout({ projectRoot, mode, backendURL, useEnvFile, pr
|
|
|
1056
1071
|
const appFilePath = appFile.getFilePath();
|
|
1057
1072
|
const pagesDir = getPagesDirectory(appFilePath);
|
|
1058
1073
|
const existingImports = appFile.getImportDeclarations();
|
|
1059
|
-
const hasConsentManagerImport = existingImports.some((importDecl)=>
|
|
1074
|
+
const hasConsentManagerImport = existingImports.some((importDecl)=>{
|
|
1075
|
+
const specifier = importDecl.getModuleSpecifierValue();
|
|
1076
|
+
return specifier.endsWith('/consent-manager') || specifier.endsWith('/consent-manager.tsx') || './consent-manager' === specifier || './consent-manager.tsx' === specifier;
|
|
1077
|
+
});
|
|
1060
1078
|
if (hasConsentManagerImport) return {
|
|
1061
1079
|
updated: false,
|
|
1062
1080
|
filePath: appFilePath,
|
|
@@ -1639,12 +1657,25 @@ async function generateFiles({ context, mode, spinner, useEnvFile, proxyNextjs,
|
|
|
1639
1657
|
});
|
|
1640
1658
|
return result;
|
|
1641
1659
|
}
|
|
1660
|
+
async function getScriptsToAdd({ context, handleCancel }) {
|
|
1661
|
+
context.logger.info("@c15t/scripts has various prebuilt scripts for you to use. Learn more: https://c15t.com/docs/integrations");
|
|
1662
|
+
const addScriptsSelection = await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.confirm({
|
|
1663
|
+
message: "Do you want to add @c15t/scripts to your project?",
|
|
1664
|
+
initialValue: true
|
|
1665
|
+
});
|
|
1666
|
+
if (handleCancel?.(addScriptsSelection)) context.error.handleCancel('Setup cancelled.', {
|
|
1667
|
+
command: 'onboarding',
|
|
1668
|
+
stage: "scripts_addition"
|
|
1669
|
+
});
|
|
1670
|
+
return addScriptsSelection;
|
|
1671
|
+
}
|
|
1642
1672
|
async function getSharedFrontendOptions({ backendURL, context, handleCancel }) {
|
|
1643
1673
|
let useEnvFile = false;
|
|
1644
1674
|
let proxyNextjs;
|
|
1645
1675
|
if (!backendURL) return {
|
|
1646
1676
|
proxyNextjs: void 0,
|
|
1647
|
-
useEnvFile: void 0
|
|
1677
|
+
useEnvFile: void 0,
|
|
1678
|
+
dependenciesToAdd: []
|
|
1648
1679
|
};
|
|
1649
1680
|
const useEnvFileSelection = await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.confirm({
|
|
1650
1681
|
message: 'Store the backendURL in a .env file? (Recommended, URL is public)',
|
|
@@ -1667,9 +1698,18 @@ async function getSharedFrontendOptions({ backendURL, context, handleCancel }) {
|
|
|
1667
1698
|
});
|
|
1668
1699
|
proxyNextjs = proxyNextjsSelection;
|
|
1669
1700
|
}
|
|
1701
|
+
const addScriptsSelection = await getScriptsToAdd({
|
|
1702
|
+
context,
|
|
1703
|
+
handleCancel
|
|
1704
|
+
});
|
|
1705
|
+
const dependenciesToAdd = [
|
|
1706
|
+
context.framework.pkg
|
|
1707
|
+
];
|
|
1708
|
+
if (addScriptsSelection) dependenciesToAdd.push("@c15t/scripts");
|
|
1670
1709
|
return {
|
|
1671
1710
|
proxyNextjs,
|
|
1672
|
-
useEnvFile
|
|
1711
|
+
useEnvFile,
|
|
1712
|
+
dependenciesToAdd
|
|
1673
1713
|
};
|
|
1674
1714
|
}
|
|
1675
1715
|
async function handleAccountCreation(context, handleCancel) {
|
|
@@ -1733,7 +1773,7 @@ async function getBackendURL(context, initialBackendURL, handleCancel) {
|
|
|
1733
1773
|
async function setupC15tMode({ context, spinner, initialBackendURL, handleCancel }) {
|
|
1734
1774
|
await handleAccountCreation(context, handleCancel);
|
|
1735
1775
|
const backendURL = await getBackendURL(context, initialBackendURL, handleCancel);
|
|
1736
|
-
const { useEnvFile, proxyNextjs } = await getSharedFrontendOptions({
|
|
1776
|
+
const { useEnvFile, proxyNextjs, dependenciesToAdd } = await getSharedFrontendOptions({
|
|
1737
1777
|
backendURL: backendURL,
|
|
1738
1778
|
context,
|
|
1739
1779
|
handleCancel
|
|
@@ -1748,9 +1788,7 @@ async function setupC15tMode({ context, spinner, initialBackendURL, handleCancel
|
|
|
1748
1788
|
});
|
|
1749
1789
|
const { ranInstall, installDepsConfirmed } = await installDependencies({
|
|
1750
1790
|
context,
|
|
1751
|
-
dependenciesToAdd
|
|
1752
|
-
context.framework.pkg
|
|
1753
|
-
],
|
|
1791
|
+
dependenciesToAdd,
|
|
1754
1792
|
handleCancel
|
|
1755
1793
|
});
|
|
1756
1794
|
return {
|
|
@@ -1782,17 +1820,23 @@ async function setupCustomMode({ context, spinner }) {
|
|
|
1782
1820
|
ranInstall
|
|
1783
1821
|
};
|
|
1784
1822
|
}
|
|
1785
|
-
async function setupOfflineMode({ context, spinner }) {
|
|
1823
|
+
async function setupOfflineMode({ context, spinner, handleCancel }) {
|
|
1824
|
+
const addScriptsSelection = await getScriptsToAdd({
|
|
1825
|
+
context,
|
|
1826
|
+
handleCancel
|
|
1827
|
+
});
|
|
1786
1828
|
const result = await generateFiles({
|
|
1787
1829
|
context,
|
|
1788
1830
|
mode: 'offline',
|
|
1789
1831
|
spinner
|
|
1790
1832
|
});
|
|
1833
|
+
const dependenciesToAdd = [
|
|
1834
|
+
context.framework.pkg
|
|
1835
|
+
];
|
|
1836
|
+
if (addScriptsSelection) dependenciesToAdd.push("@c15t/scripts");
|
|
1791
1837
|
const { ranInstall, installDepsConfirmed } = await installDependencies({
|
|
1792
1838
|
context,
|
|
1793
|
-
dependenciesToAdd
|
|
1794
|
-
context.framework.pkg
|
|
1795
|
-
]
|
|
1839
|
+
dependenciesToAdd
|
|
1796
1840
|
});
|
|
1797
1841
|
return {
|
|
1798
1842
|
clientConfigContent: result.configContent ?? '',
|
|
@@ -2133,16 +2177,20 @@ async function handleMigrationResult(context, result) {
|
|
|
2133
2177
|
telemetry.trackEvent(TelemetryEventName.MIGRATION_PLANNED, {
|
|
2134
2178
|
success: true
|
|
2135
2179
|
});
|
|
2136
|
-
const
|
|
2137
|
-
message: '
|
|
2180
|
+
const saveSQL = await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.confirm({
|
|
2181
|
+
message: 'Save SQL to file?',
|
|
2138
2182
|
initialValue: true
|
|
2139
2183
|
});
|
|
2140
|
-
if (__WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.isCancel(
|
|
2141
|
-
|
|
2184
|
+
if (__WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.isCancel(saveSQL)) return void telemetry.trackEvent(TelemetryEventName.MIGRATION_FAILED, {
|
|
2185
|
+
saveSql: false
|
|
2142
2186
|
});
|
|
2143
|
-
if (
|
|
2187
|
+
if (saveSQL) {
|
|
2144
2188
|
const sql = result.getSQL?.() ?? '';
|
|
2145
|
-
|
|
2189
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
2190
|
+
const filename = `migration-${timestamp}.sql`;
|
|
2191
|
+
const filepath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(process.cwd(), filename);
|
|
2192
|
+
await (0, __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__.writeFile)(filepath, sql, 'utf-8');
|
|
2193
|
+
logger.success(`SQL saved to: ${filename}`);
|
|
2146
2194
|
}
|
|
2147
2195
|
const execute = await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.confirm({
|
|
2148
2196
|
message: 'Execute this migration?',
|
|
@@ -2227,18 +2275,16 @@ async function migrate(context) {
|
|
|
2227
2275
|
else await handleMigrationResult(context, result);
|
|
2228
2276
|
}
|
|
2229
2277
|
async function setupSelfHostedMode({ context, spinner, handleCancel }) {
|
|
2230
|
-
const dependenciesToAdd = [
|
|
2278
|
+
const dependenciesToAdd = new Set([
|
|
2231
2279
|
context.framework.pkg,
|
|
2232
2280
|
'@c15t/backend'
|
|
2233
|
-
];
|
|
2281
|
+
]);
|
|
2234
2282
|
const targetPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(context.cwd, 'c15t-backend.config.ts');
|
|
2235
2283
|
let createBackendConfig = false;
|
|
2236
2284
|
if (!await pathExists(targetPath)) {
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
dependenciesToAdd.push(...config?.dependencies ?? []);
|
|
2241
|
-
}
|
|
2285
|
+
const config = await ensureBackendConfig(context);
|
|
2286
|
+
createBackendConfig = true;
|
|
2287
|
+
for (const dep of config?.dependencies ?? [])dependenciesToAdd.add(dep);
|
|
2242
2288
|
}
|
|
2243
2289
|
const backendURL = await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.text({
|
|
2244
2290
|
message: 'Enter the backend URL:',
|
|
@@ -2248,11 +2294,12 @@ async function setupSelfHostedMode({ context, spinner, handleCancel }) {
|
|
|
2248
2294
|
command: 'onboarding',
|
|
2249
2295
|
stage: 'self_hosted_backend_url_setup'
|
|
2250
2296
|
});
|
|
2251
|
-
const { useEnvFile, proxyNextjs } = await getSharedFrontendOptions({
|
|
2297
|
+
const { useEnvFile, proxyNextjs, dependenciesToAdd: sharedDependenciesToAdd } = await getSharedFrontendOptions({
|
|
2252
2298
|
backendURL: backendURL,
|
|
2253
2299
|
context,
|
|
2254
2300
|
handleCancel
|
|
2255
2301
|
});
|
|
2302
|
+
for (const dep of sharedDependenciesToAdd)dependenciesToAdd.add(dep);
|
|
2256
2303
|
await generateFiles({
|
|
2257
2304
|
context,
|
|
2258
2305
|
mode: 'c15t',
|
|
@@ -2263,7 +2310,7 @@ async function setupSelfHostedMode({ context, spinner, handleCancel }) {
|
|
|
2263
2310
|
});
|
|
2264
2311
|
const { ranInstall, installDepsConfirmed } = await installDependencies({
|
|
2265
2312
|
context,
|
|
2266
|
-
dependenciesToAdd,
|
|
2313
|
+
dependenciesToAdd: Array.from(dependenciesToAdd),
|
|
2267
2314
|
handleCancel
|
|
2268
2315
|
});
|
|
2269
2316
|
const runMigrations = await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.confirm({
|
|
@@ -2681,7 +2728,8 @@ function createFileSystem(context) {
|
|
|
2681
2728
|
const SUPPORTED_PACKAGE_MANAGERS = [
|
|
2682
2729
|
'npm',
|
|
2683
2730
|
'yarn',
|
|
2684
|
-
'pnpm'
|
|
2731
|
+
'pnpm',
|
|
2732
|
+
'bun'
|
|
2685
2733
|
];
|
|
2686
2734
|
async function getPackageManagerVersion(pm) {
|
|
2687
2735
|
try {
|
|
@@ -2722,6 +2770,10 @@ async function detectPackageManager(projectRoot, logger) {
|
|
|
2722
2770
|
{
|
|
2723
2771
|
value: 'pnpm',
|
|
2724
2772
|
label: 'pnpm'
|
|
2773
|
+
},
|
|
2774
|
+
{
|
|
2775
|
+
value: 'bun',
|
|
2776
|
+
label: 'bun'
|
|
2725
2777
|
}
|
|
2726
2778
|
],
|
|
2727
2779
|
initialValue: 'npm'
|
|
@@ -2857,7 +2909,7 @@ function createUserInteraction(context) {
|
|
|
2857
2909
|
}
|
|
2858
2910
|
async function createCliContext(rawArgs, cwd, commands) {
|
|
2859
2911
|
const { commandName, commandArgs, parsedFlags } = parseCliArgs(rawArgs, commands);
|
|
2860
|
-
let desiredLogLevel = '
|
|
2912
|
+
let desiredLogLevel = 'info';
|
|
2861
2913
|
const levelArg = parsedFlags.logger;
|
|
2862
2914
|
if ('string' == typeof levelArg) if (validLogLevels.includes(levelArg)) desiredLogLevel = levelArg;
|
|
2863
2915
|
else console.warn(`[CLI Setup] Invalid log level '${levelArg}' provided via --logger. Using default 'info'.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c15t/cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "CLI for rapid c15t setup. Scaffold React and Next.js cookie banners and a preferences centre, generate types and config, and run migration tooling for self-hosted deployments.",
|
|
5
5
|
"homepage": "https://c15t.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,14 +35,13 @@
|
|
|
35
35
|
"posthog-node": "^4.11.7",
|
|
36
36
|
"ts-morph": "^25.0.1",
|
|
37
37
|
"zod": "^3.24.2",
|
|
38
|
-
"@c15t/backend": "1.7.
|
|
38
|
+
"@c15t/backend": "1.7.1",
|
|
39
39
|
"@c15t/logger": "1.0.0",
|
|
40
|
-
"@c15t/react": "1.7.
|
|
40
|
+
"@c15t/react": "1.7.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/figlet": "^1.7.0",
|
|
44
44
|
"@types/fs-extra": "^11.0.4",
|
|
45
|
-
"vitest": "^3.1.1",
|
|
46
45
|
"@c15t/typescript-config": "0.0.1-beta.1",
|
|
47
46
|
"@c15t/vitest-config": "1.0.0"
|
|
48
47
|
},
|