@mvp-kit/create 0.0.10 → 0.0.11

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/utils.js CHANGED
@@ -1,8 +1,3 @@
1
- import path from 'path';
2
- import fs from 'fs';
3
- import { fileURLToPath } from 'url';
4
- const __filename = fileURLToPath(import.meta.url);
5
- const __dirname = path.dirname(__filename);
6
1
  export function validateProjectName(name) {
7
2
  if (!name) {
8
3
  throw new Error('Project name is required');
@@ -12,87 +7,4 @@ export function validateProjectName(name) {
12
7
  }
13
8
  return name;
14
9
  }
15
- export function generateTemplateVariables(projectName, options = {}, packageManager = 'pnpm', packageManagerVersion) {
16
- const validatedName = validateProjectName(projectName);
17
- // Generate different case variations
18
- const kebabCase = validatedName.toLowerCase().replace(/[_\s]+/g, '-');
19
- const camelCase = kebabCase.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
20
- const displayName = kebabCase.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
21
- // Generate package scope (user can override later)
22
- const packageScope = `@${kebabCase}`;
23
- return {
24
- projectName: validatedName,
25
- projectDisplayName: options.description || displayName,
26
- projectDescription: options.description || `A new MVPKit Core application: ${displayName}`,
27
- projectKebabCase: kebabCase,
28
- projectCamelCase: camelCase,
29
- domainName: options.domain,
30
- packageManager,
31
- packageManagerVersion,
32
- packageScope,
33
- frontendPackageName: `${packageScope}/frontend`,
34
- backendPackageName: `${packageScope}/backend`,
35
- apiPackageName: `${packageScope}/api`,
36
- configPackageName: `${packageScope}/config`,
37
- workersName: `${kebabCase}-backend`,
38
- pagesName: `${kebabCase}-frontend`,
39
- };
40
- }
41
- export function getCoreRepositoryPath() {
42
- // Find the mvpkit root directory
43
- let currentDir = __dirname;
44
- // Go up from the built CLI package to find mvpkit root
45
- // Path: /mvpkit/cli/packages/@mvp-kit-create/dist -> /mvpkit
46
- while (currentDir && currentDir !== path.parse(currentDir).root) {
47
- if (path.basename(currentDir) === 'mvpkit') {
48
- break;
49
- }
50
- currentDir = path.dirname(currentDir);
51
- }
52
- if (!currentDir || path.basename(currentDir) !== 'mvpkit') {
53
- // Fallback: try relative from current working directory
54
- const cwd = process.cwd();
55
- const possiblePaths = [
56
- path.resolve(cwd, '../core'), // from cli/test-output
57
- path.resolve(cwd, '../../core'), // from cli/packages/@mvp-kit-create
58
- path.resolve(cwd, '../../../core'), // from deeper nesting
59
- ];
60
- for (const possiblePath of possiblePaths) {
61
- if (fs.existsSync(possiblePath)) {
62
- return possiblePath;
63
- }
64
- }
65
- }
66
- const coreDir = path.join(currentDir, 'core');
67
- return coreDir;
68
- }
69
- export function shouldSkipFile(filePath, skipPatterns) {
70
- const fileName = path.basename(filePath);
71
- const relativePath = filePath;
72
- return skipPatterns.some(pattern => {
73
- if (pattern.startsWith('/')) {
74
- return relativePath.startsWith(pattern.slice(1));
75
- }
76
- if (pattern.endsWith('/')) {
77
- return relativePath.startsWith(pattern) || relativePath.includes(pattern);
78
- }
79
- // Exact filename match
80
- if (fileName === pattern) {
81
- return true;
82
- }
83
- return fileName.includes(pattern) || relativePath.includes(pattern);
84
- });
85
- }
86
- export function transformFileName(fileName, variables) {
87
- return fileName
88
- .replace(/mvpkit-core/g, variables.projectKebabCase)
89
- .replace(/mvpkit/g, variables.projectKebabCase);
90
- }
91
- export const DEFAULT_SKIP_PATTERNS = [
92
- '.git/',
93
- '.github/',
94
- '.serena',
95
- 'examples/',
96
- 'cleanup.sh'
97
- ];
98
10
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAGnC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC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","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;IAC7C,CAAC;IAED,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,mGAAmG,CAAC,CAAA;IACtH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mvp-kit/create",
3
- "version": "0.0.10",
4
- "description": "Create MVPKit applications - Universal CLI for all MVPKit templates",
3
+ "version": "0.0.11",
4
+ "description": "Create MVPKit applications - Universal Create CLI for all MVPKit templates",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "mvpkit",
@@ -13,6 +13,10 @@
13
13
  "ai"
14
14
  ],
15
15
  "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/mvp-kit/create.git"
19
+ },
16
20
  "bin": {
17
21
  "@mvp-kit/create": "dist/index.js"
18
22
  },
@@ -23,35 +27,28 @@
23
27
  "engines": {
24
28
  "node": ">=20.0.0"
25
29
  },
26
- "scripts": {
27
- "build": "tsc",
28
- "dev": "tsc --watch",
29
- "test": "vitest",
30
- "test:integration": "node dist/test.js",
31
- "validate": "pnpm build && pnpm test:integration",
32
- "typecheck": "tsc --noEmit",
33
- "lint": "echo 'No linting configured for CLI'",
34
- "clean": "rm -rf dist"
35
- },
36
30
  "dependencies": {
37
- "commander": "^11.0.0",
38
- "inquirer": "^9.0.0",
39
- "handlebars": "^4.7.8",
31
+ "@types/prompts": "^2.4.9",
40
32
  "chalk": "^5.3.0",
41
- "ora": "^7.0.1",
33
+ "commander": "^11.0.0",
42
34
  "fs-extra": "^11.0.0",
43
35
  "glob": "^10.3.0",
44
- "node-fetch": "^3.3.2",
45
- "yauzl": "^3.1.3",
46
- "tmp": "^0.2.3"
36
+ "handlebars": "^4.7.8",
37
+ "inquirer": "^9.0.0",
38
+ "node-fetch": "^3.3.0",
39
+ "ora": "^7.0.1",
40
+ "prompts": "^2.4.2"
47
41
  },
48
42
  "devDependencies": {
49
43
  "@types/fs-extra": "^11.0.4",
50
44
  "@types/inquirer": "^9.0.0",
51
45
  "@types/node": "^20.0.0",
52
- "@types/tmp": "^0.2.6",
53
- "@types/yauzl": "^2.10.3",
54
- "typescript": "^5.9.2",
55
- "vitest": "^1.0.0"
46
+ "typescript": "^5.9.2"
47
+ },
48
+ "scripts": {
49
+ "build": "tsc && chmod +x dist/index.js",
50
+ "dev": "tsc --watch",
51
+ "clean": "rm -rf dist",
52
+ "typecheck": "tsc --noEmit"
56
53
  }
57
- }
54
+ }
package/dist/database.js DELETED
@@ -1,105 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import chalk from 'chalk';
3
- import ora from 'ora';
4
- import path from 'path';
5
- import fs from 'fs-extra';
6
- function detectPackageManager(dir) {
7
- // Check how CLI was invoked (highest priority)
8
- const invocation = detectInvocationMethod();
9
- if (invocation) {
10
- return invocation;
11
- }
12
- // Check for lock files in priority order
13
- if (fs.existsSync(path.join(dir, 'bun.lockb')))
14
- return 'bun';
15
- if (fs.existsSync(path.join(dir, 'pnpm-lock.yaml')))
16
- return 'pnpm';
17
- // Default to pnpm
18
- return 'pnpm';
19
- }
20
- function detectInvocationMethod() {
21
- // Check process.execArgv and process.argv to see how we were invoked
22
- const execPath = process.execPath;
23
- const argv = process.argv;
24
- const userAgent = process.env.npm_config_user_agent || '';
25
- // Check if invoked via bunx
26
- if (execPath.includes('bun') || userAgent.startsWith('bun')) {
27
- return 'bun';
28
- }
29
- // Check argv for package manager indicators
30
- const commandLine = argv.join(' ');
31
- if (commandLine.includes('bunx') || commandLine.includes('bun run')) {
32
- return 'bun';
33
- }
34
- if (commandLine.includes('pnpm') || commandLine.includes('pnpx')) {
35
- return 'pnpm';
36
- }
37
- if (commandLine.includes('npx') || commandLine.includes('npm create')) {
38
- return 'pnpm';
39
- }
40
- // Check user agent string
41
- if (userAgent.startsWith('pnpm'))
42
- return 'pnpm';
43
- if (userAgent.startsWith('bun'))
44
- return 'bun';
45
- if (userAgent.startsWith('npm'))
46
- return 'pnpm';
47
- return null;
48
- }
49
- function getPackageManagerCommand(pm) {
50
- const commands = {
51
- npm: 'npm',
52
- pnpm: 'pnpm',
53
- bun: 'bun'
54
- };
55
- return commands[pm];
56
- }
57
- export async function setupDatabase(projectPath, variables) {
58
- const spinner = ora('Setting up database...').start();
59
- const backendPath = path.join(projectPath, 'apps', 'backend');
60
- const packageManager = detectPackageManager(projectPath);
61
- const pmCommand = getPackageManagerCommand(packageManager);
62
- try {
63
- // Initialize local database directory structure
64
- spinner.text = 'Initializing local database...';
65
- execSync(`${pmCommand} run db:init`, { cwd: backendPath, stdio: 'ignore' });
66
- // Generate fresh migrations
67
- spinner.text = 'Generating database migrations...';
68
- execSync(`${pmCommand} run db:generate`, { cwd: backendPath, stdio: 'ignore' });
69
- // Set up local database by running migrations
70
- spinner.text = 'Setting up local database...';
71
- execSync(`${pmCommand} run db:migrate:local`, { cwd: backendPath, stdio: 'ignore' });
72
- spinner.succeed('Database setup completed!');
73
- return true;
74
- }
75
- catch (error) {
76
- spinner.fail('Database setup failed');
77
- console.log(chalk.yellow('⚠️ Set up the database manually:'));
78
- console.log(chalk.gray(' cd apps/backend'));
79
- console.log(chalk.gray(` ${pmCommand} run db:init`));
80
- console.log(chalk.gray(` ${pmCommand} run db:generate`));
81
- console.log(chalk.gray(` ${pmCommand} run db:migrate:local`));
82
- return false;
83
- }
84
- }
85
- export function checkDatabaseRequirements() {
86
- const errors = [];
87
- let hasWrangler = false;
88
- let hasNode = false;
89
- try {
90
- execSync('node --version', { stdio: 'ignore' });
91
- hasNode = true;
92
- }
93
- catch {
94
- errors.push('Node.js is required but not found');
95
- }
96
- try {
97
- execSync('wrangler --version', { stdio: 'ignore' });
98
- hasWrangler = true;
99
- }
100
- catch {
101
- errors.push('Wrangler CLI is required for database setup');
102
- }
103
- return { hasWrangler, hasNode, errors };
104
- }
105
- //# sourceMappingURL=database.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,UAAU,CAAA;AAGzB,SAAS,oBAAoB,CAAC,GAAW;IACvC,+CAA+C;IAC/C,MAAM,UAAU,GAAG,sBAAsB,EAAE,CAAA;IAC3C,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,yCAAyC;IACzC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA;IAC5D,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;QAAE,OAAO,MAAM,CAAA;IAElE,kBAAkB;IAClB,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,sBAAsB;IAC7B,qEAAqE;IACrE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IACjC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IACzB,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAA;IAEzD,4BAA4B;IAC5B,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAA;IACd,CAAC;IAED,4C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AAA;IACd,CAAC;AACH,CAAC;AAGD,MAAM,UAAU,yBAAyB;IAKvC,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,WAAW,GAAG,KAAK,CAAA;IACvB,IAAI,OAAO,GAAG,KAAK,CAAA;IAEnB,IAAI,CAAC;QACH,QAAQ,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;QAC/C,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAA;IAClD,CAAC;IAED,IAAI,CAAC;QACH,QAAQ,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;QACnD,WAAW,GAAG,IAAI,CAAA;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAA;IAC5D,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AACzC,CAAC"}
@@ -1,248 +0,0 @@
1
- import fetch from 'node-fetch';
2
- import fs from 'fs-extra';
3
- import path from 'path';
4
- import yauzl from 'yauzl';
5
- import tmp from 'tmp';
6
- import { pipeline } from 'stream/promises';
7
- import chalk from 'chalk';
8
- import ora from 'ora';
9
- // Template registry for different kits
10
- export const TEMPLATE_REGISTRY = {
11
- core: {
12
- name: 'core',
13
- displayName: 'MVPKit Core',
14
- description: 'Free Cloudflare-native starter with React 19, tRPC, and Drizzle ORM',
15
- source: {
16
- // Default to GitHub (production), use --dev flag for development
17
- type: 'github-zip',
18
- url: 'https://github.com/mvp-kit/core/archive/refs/heads/main.zip',
19
- cacheable: false
20
- },
21
- features: ['React 19', 'Cloudflare Workers', 'tRPC', 'Drizzle ORM', 'Better Auth'],
22
- license: 'free'
23
- },
24
- saas: {
25
- name: 'saas',
26
- displayName: 'MVPKit SaaS',
27
- description: 'Production SaaS kit with payments, subscriptions, and multi-tenancy',
28
- source: {
29
- type: 'protected-url',
30
- url: 'https://api.mvpkit.dev/templates/saas/latest.zip',
31
- auth: { type: 'jwt' },
32
- cacheable: false
33
- },
34
- features: ['Everything in Core', 'Stripe Integration', 'Multi-tenancy', 'Admin Dashboard'],
35
- license: 'paid'
36
- },
37
- ai: {
38
- name: 'ai',
39
- displayName: 'MVPKit AI',
40
- description: 'AI-powered applications with LLM integrations and vector databases',
41
- source: {
42
- type: 'protected-url',
43
- url: 'https://api.mvpkit.dev/templates/ai/latest.zip',
44
- auth: { type: 'jwt' },
45
- cacheable: false
46
- },
47
- features: ['Everything in Core', 'OpenAI Integration', 'Vector DB', 'AI Components'],
48
- license: 'paid'
49
- }
50
- };
51
- export class TemplateDownloader {
52
- cacheDir;
53
- constructor() {
54
- // Create cache directory in user's home
55
- this.cacheDir = path.join(process.env.HOME || process.env.USERPROFILE || '/tmp', '.mvpkit', 'cache');
56
- fs.ensureDirSync(this.cacheDir);
57
- }
58
- async downloadTemplate(templateName, licenseKey, useDev = false) {
59
- const config = TEMPLATE_REGISTRY[templateName];
60
- if (!config) {
61
- throw new Error(`Unknown template: ${templateName}. Available templates: ${Object.keys(TEMPLATE_REGISTRY).join(', ')}`);
62
- }
63
- // Validate license for paid templates
64
- if (config.license === 'paid' && !licenseKey) {
65
- throw new Error(`Template '${templateName}' requires a license key. Use --license YOUR_LICENSE_KEY`);
66
- }
67
- const spinner = ora(`Downloading ${config.displayName} template...`).start();
68
- try {
69
- // Override source type if --dev flag is used
70
- const source = useDev && config.name === 'core'
71
- ? { ...config.source, type: 'local' }
72
- : config.source;
73
- const templatePath = await this.downloadFromSource(source, licenseKey);
74
- spinner.succeed(`Template downloaded: ${config.displayName}`);
75
- return templatePath;
76
- }
77
- catch (error) {
78
- spinner.fail('Failed to download template');
79
- throw error;
80
- }
81
- }
82
- async downloadFromSource(source, licenseKey) {
83
- switch (source.type) {
84
- case 'local':
85
- return this.getLocalTemplate();
86
- case 'github-zip':
87
- return this.downloadZip(source.url, {}, source.cacheable);
88
- case 'protected-url':
89
- if (!licenseKey) {
90
- throw new Error('License key required for protected template');
91
- }
92
- // For now, simulate license validation
93
- // In production, this would validate with mvpkit.dev API
94
- const token = await this.validateLicense(licenseKey);
95
- return this.downloadZip(source.url, {
96
- 'Authorization': `Bearer ${token}`
97
- }, false);
98
- default:
99
- throw new Error(`Unsupported template source type: ${source.type}`);
100
- }
101
- }
102
- async getLocalTemplate() {
103
- // Use existing local path resolution for development
104
- const { getCoreRepositoryPath } = await import('./utils.js');
105
- return getCoreRepositoryPath();
106
- }
107
- async downloadZip(url, headers = {}, cacheable = false) {
108
- // Check cache first if cacheable
109
- if (cacheable) {
110
- const cacheKey = this.getCacheKey(url);
111
- const cachedPath = path.join(this.cacheDir, cacheKey);
112
- const cacheInfoPath = path.join(this.cacheDir, `${cacheKey}.info`);
113
- if (fs.existsSync(cachedPath) && fs.existsSync(cacheInfoPath)) {
114
- // Check if cache is still fresh (4 hours TTL)
115
- const cacheInfo = JSON.parse(fs.readFileSync(cacheInfoPath, 'utf8'));
116
- const cacheAge = Date.now() - cacheInfo.timestamp;
117
- const fourHours = 4 * 60 * 60 * 1000;
118
- if (cacheAge < fourHours) {
119
- console.log('Using cached template...');
120
- return cachedPath;
121
- }
122
- else {
123
- console.log('Cache expired, downloading fresh template...');
124
- // Clean up expired cache
125
- fs.removeSync(cachedPath);
126
- fs.removeSync(cacheInfoPath);
127
- }
128
- }
129
- }
130
- // Download ZIP file
131
- const response = await fetch(url, { headers });
132
- if (!response.ok) {
133
- throw new Error(`Failed to download template: ${response.status} ${response.statusText}`);
134
- }
135
- // Create temporary file for ZIP
136
- const tempZip = tmp.fileSync({ postfix: '.zip' });
137
- try {
138
- // Download to temporary file
139
- await pipeline(response.body, fs.createWriteStream(tempZip.name));
140
- // Extract ZIP to temporary directory
141
- const extractDir = tmp.dirSync({ unsafeCleanup: true });
142
- await this.extractZip(tempZip.name, extractDir.name);
143
- // Find the actual template directory (usually core-main/ from GitHub)
144
- const extractedContents = fs.readdirSync(extractDir.name);
145
- const templateDir = extractedContents.find(item => {
146
- const itemPath = path.join(extractDir.name, item);
147
- return fs.statSync(itemPath).isDirectory();
148
- });
149
- if (!templateDir) {
150
- throw new Error('No template directory found in downloaded ZIP');
151
- }
152
- // GitHub repo root IS the template (no core/ subdirectory)
153
- const finalTemplatePath = path.join(extractDir.name, templateDir);
154
- // Cache if requested
155
- if (cacheable) {
156
- const cacheKey = this.getCacheKey(url);
157
- const cachedPath = path.join(this.cacheDir, cacheKey);
158
- const cacheInfoPath = path.join(this.cacheDir, `${cacheKey}.info`);
159
- await fs.copy(finalTemplatePath, cachedPath);
160
- await fs.writeFile(cacheInfoPath, JSON.stringify({
161
- timestamp: Date.now(),
162
- url: url
163
- }));
164
- return cachedPath;
165
- }
166
- return finalTemplatePath;
167
- }
168
- finally {
169
- // Cleanup temporary ZIP file
170
- tempZip.removeCallback();
171
- }
172
- }
173
- async extractZip(zipPath, extractTo) {
174
- return new Promise((resolve, reject) => {
175
- yauzl.open(zipPath, { lazyEntries: true }, (err, zipfile) => {
176
- if (err)
177
- return reject(err);
178
- zipfile.readEntry();
179
- zipfile.on('entry', (entry) => {
180
- if (/\/$/.test(entry.fileName)) {
181
- // Directory entry
182
- zipfile.readEntry();
183
- }
184
- else {
185
- // File entry
186
- const outputPath = path.join(extractTo, entry.fileName);
187
- fs.ensureDirSync(path.dirname(outputPath));
188
- zipfile.openReadStream(entry, (err, readStream) => {
189
- if (err)
190
- return reject(err);
191
- const writeStream = fs.createWriteStream(outputPath);
192
- readStream.pipe(writeStream);
193
- writeStream.on('close', () => zipfile.readEntry());
194
- writeStream.on('error', reject);
195
- });
196
- }
197
- });
198
- zipfile.on('end', resolve);
199
- zipfile.on('error', reject);
200
- });
201
- });
202
- }
203
- getCacheKey(url) {
204
- // Simple cache key from URL
205
- return url.replace(/[^a-zA-Z0-9]/g, '_');
206
- }
207
- async validateLicense(licenseKey) {
208
- // TODO: Implement proper license validation with mvpkit.dev API
209
- // For now, use demo validation until API is ready
210
- if (licenseKey === 'demo') {
211
- console.log(chalk.yellow('⚠️ Using demo license for testing'));
212
- return 'mock-jwt-token';
213
- }
214
- // In production, validate with API
215
- try {
216
- const response = await fetch('https://api.mvpkit.dev/validate-license', {
217
- method: 'POST',
218
- headers: { 'Content-Type': 'application/json' },
219
- body: JSON.stringify({ licenseKey })
220
- });
221
- if (!response.ok) {
222
- throw new Error(`License validation failed: ${response.status}`);
223
- }
224
- const result = await response.json();
225
- return result.token;
226
- }
227
- catch (error) {
228
- throw new Error(`Invalid or expired license key. Visit https://mvpkit.dev to get a license.`);
229
- }
230
- }
231
- listTemplates() {
232
- console.log(chalk.yellow('🆓 MVPKit Core Template'));
233
- console.log(chalk.gray('Production-ready React TypeScript starter with Cloudflare Workers'));
234
- console.log();
235
- console.log(chalk.yellow('💡 Usage: ') + chalk.cyan('npx @mvp-kit/create my-app'));
236
- console.log();
237
- }
238
- clearCache() {
239
- if (fs.existsSync(this.cacheDir)) {
240
- fs.removeSync(this.cacheDir);
241
- console.log(chalk.green('✅ Template cache cleared'));
242
- }
243
- else {
244
- console.log(chalk.gray('Cache already empty'));
245
- }
246
- }
247
- }
248
- //# sourceMappingURL=template-downloader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-downloader.js","sourceRoot":"","sources":["../src/template-downloader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAA;AAC9B,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,GAAG,MAAM,KAAK,CAAA;AAuBrB,uCAAuC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAAmC;IA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