@cellajs/create-cella 0.1.1 → 0.1.3
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/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/create.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { Command, InvalidArgumentError } from "commander";
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
15
|
name: "@cellajs/create-cella",
|
|
16
|
-
version: "0.1.
|
|
16
|
+
version: "0.1.3",
|
|
17
17
|
private: false,
|
|
18
18
|
license: "MIT",
|
|
19
19
|
description: "Cella is a TypeScript template to create web apps with sync and offline capabilities.",
|
|
@@ -482,7 +482,7 @@ async function create({
|
|
|
482
482
|
console.info(colors2.cyan(` ${packageManager2} dev`));
|
|
483
483
|
console.info(colors2.cyan(` ${packageManager2} seed`));
|
|
484
484
|
console.info();
|
|
485
|
-
console.info(`
|
|
485
|
+
console.info(`Once running, you can sign in using:`);
|
|
486
486
|
console.info(`email: ${colors2.greenBright("admin-test@cellajs.com")}`);
|
|
487
487
|
console.info(`password: ${colors2.greenBright("12345678")}`);
|
|
488
488
|
console.info();
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/cli.ts","../package.json","../src/constants.ts","../src/utils/validate-project-name.ts","../src/utils/is-empty-directory.ts","../src/create.ts","../src/utils/run-package-manager-command.ts","../src/utils/clean-template.ts","../src/utils/run-git-command.ts","../src/add-remote.ts"],"sourcesContent":["#!/usr/bin/env tsx\n\nimport { basename, resolve } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport colors from 'picocolors';\n\nimport { input, confirm, select } from '@inquirer/prompts';\n\nimport { cli } from './cli';\nimport { validateProjectName } from './utils/validate-project-name.ts';\nimport { isEmptyDirectory } from './utils/is-empty-directory.ts';\nimport { create } from './create.ts';\nimport { LOGO, VERSION, WEBSITE, AUTHOR, GITHUB, DESCRIPTION } from './constants.ts';\n\ninterface CreateOptions {\n projectName: string;\n targetFolder: string;\n newBranchName?: string | null;\n skipInstall: boolean;\n skipGit: boolean;\n skipClean: boolean;\n skipGenerate: boolean;\n packageManager: string;\n}\n\nasync function main(): Promise<void> {\n console.info(LOGO);\n\n // Display CLI version and created by information\n console.info();\n console.info(DESCRIPTION);\n console.info();\n console.info(`Version ${colors.green(VERSION)}`);\n console.info(`Created by ${AUTHOR}`);\n console.info(`${GITHUB} | ${WEBSITE}`);\n console.info();\n\n // Skip creating a new branch if --skipNewBranch flag is provided or git is skipped\n if (cli.options.skipNewBranch || cli.options.skipGit) {\n cli.createNewBranch = false;\n cli.newBranchName = null;\n }\n\n // Skip generating sql files if --skipGenerate flag is provided\n if (cli.options.skipGenerate === true) {\n cli.options.skipGenerate = true;\n }\n\n // Skip installing packages if --skipInstall flag is provided\n if (cli.options.skipInstall === true) {\n cli.options.skipInstall = true;\n }\n\n // Skip cleaning the template if --skipClean flag is provided\n if (cli.options.skipClean === true) {\n cli.options.skipClean = true;\n }\n\n // Skip initializing git if --skipGit flag is provided\n if (cli.options.skipGit === true) {\n cli.options.skipGit = true;\n }\n\n // Prompt for project name if not provided\n if (!cli.directory) {\n cli.directory = await input({\n message: 'Enter your project name',\n default: 'my-cella-app',\n validate: (name) => {\n const validation = validateProjectName(basename(resolve(name)));\n return validation.valid ? true : `Invalid project name: ${validation.problems[0]}`;\n },\n });\n }\n\n // Prompt to create a new branch besides the main branch (if not skipped)\n if (cli.createNewBranch === null) {\n cli.createNewBranch = await confirm({\n message: 'Would you like to create a new branch (besides \"main\")?',\n default: true,\n });\n }\n\n // Prompt for new branch name, only if user opted to create a new branch\n if (!cli.newBranchName && cli.createNewBranch) {\n cli.newBranchName = await input({\n message: 'Enter the new branch name',\n default: 'development',\n validate: (name) => {\n const validation = validateProjectName(basename(resolve(name)));\n return validation.valid ? true : `Invalid branch name: ${validation.problems[0]}`;\n },\n });\n }\n\n const targetFolder = resolve(cli.directory);\n const projectName = basename(targetFolder);\n\n // Check if the target folder exists and is not empty\n if (existsSync(targetFolder) && !(await isEmptyDirectory(targetFolder))) {\n const dirName = cli.directory === '.' ? 'Current directory' : `Target directory \"${targetFolder}\"`;\n const message = `${dirName} is not empty. Please choose how you would like to proceed:`;\n\n const action = await select({\n message,\n choices: [\n { name: 'Cancel and exit', value: 'cancel' },\n { name: 'Ignore existing files and continue', value: 'ignore' },\n ],\n });\n\n if (action === 'cancel') {\n process.exit(1);\n }\n }\n\n // Proceed with the project creation\n const createOptions: CreateOptions = {\n projectName,\n targetFolder,\n newBranchName: cli.newBranchName,\n skipInstall: cli.options.skipInstall,\n skipGit: cli.options.skipGit,\n skipClean: cli.options.skipClean,\n skipGenerate: cli.options.skipGenerate,\n packageManager: cli.packageManager,\n };\n\n await create(createOptions);\n}\n\nmain().catch(console.error);\n","import { basename, resolve } from 'node:path';\nimport { Command, InvalidArgumentError } from 'commander';\n\nimport { NAME, VERSION } from './constants.ts';\nimport { validateProjectName } from './utils/validate-project-name.ts';\n\n// Define types for CLI options\ninterface CLIOptions {\n skipNewBranch: boolean;\n skipClean: boolean;\n skipGit: boolean;\n skipInstall: boolean;\n skipGenerate: boolean;\n newBranchName?: string;\n}\n\n// Define CLI configuration\ninterface CLIConfig {\n options: CLIOptions;\n args: string[];\n directory: string | null;\n newBranchName: string | null;\n createNewBranch: boolean | null;\n packageManager: string;\n}\n\n// Initialize CLI variables\nlet directory: string | null = null;\nlet newBranchName: string | null = null;\nlet createNewBranch: boolean | null = null;\nconst packageManager = 'pnpm';\n\n// Set up the CLI command using Commander\nexport const command = new Command(NAME)\n .version(\n VERSION,\n '-v, --version',\n `Output the current version of ${NAME}.`\n )\n .argument('[directory]', 'The directory name for the new project.')\n .usage('[directory] [options]')\n .helpOption('-h, --help', 'Display this help message.')\n .option('--skip-new-branch', 'Skip creating a new branch during initialization.', false)\n .option('--skip-install', 'Skip the installation of packages.', false)\n .option('--skip-generate', 'Skip generating SQL files.', false)\n .option('--skip-clean', 'Skip cleaning the `cella` template.', false)\n .option('--skip-git', 'Skip initializing a git repository.', false)\n .option(\n '--new-branch-name <name>',\n 'Specify a new branch name to create and use.',\n (name: string) => {\n if (typeof name === 'string') {\n name = name.trim();\n }\n\n if (name) {\n const validation = validateProjectName(basename(resolve(name)));\n\n if (!validation.valid) {\n throw new InvalidArgumentError(\n `Invalid branch name: ${validation.problems[0]}`\n );\n }\n \n createNewBranch = true;\n newBranchName = name;\n }\n }\n )\n .action((name: string) => {\n if (typeof name === 'string') {\n name = name.trim();\n }\n\n if (name) {\n const validation = validateProjectName(basename(resolve(name)));\n\n if (!validation.valid) {\n throw new InvalidArgumentError(\n `Invalid project name: ${validation.problems[0]}`\n );\n }\n\n directory = name;\n }\n })\n .parse();\n\n// Gather the CLI options and arguments\nconst options: CLIOptions = command.opts<CLIOptions>({\n skipNewBranch: false,\n skipClean: false,\n skipGit: false,\n skipInstall: false,\n skipGenerate: false,\n});\n\n// Export the CLI configuration for use in other modules\nexport const cli: CLIConfig = {\n options,\n args: command.args,\n directory,\n newBranchName,\n createNewBranch,\n packageManager,\n};\n","{\n \"name\": \"@cellajs/create-cella\",\n \"version\": \"0.1.1\",\n \"private\": false,\n \"license\": \"MIT\",\n \"description\": \"Cella is a TypeScript template to create web apps with sync and offline capabilities.\",\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/cellajs/cella\",\n \"directory\": \"cli/create-cella\"\n },\n \"homepage\": \"https://cellajs.com\",\n \"author\": \"CellaJS <info@cellajs.com>\",\n \"engines\": {\n \"node\": \">=20.14.0\"\n },\n \"type\": \"module\",\n \"main\": \"./src/index.ts\",\n \"bin\": {\n \"create-cella\": \"index.js\"\n },\n \"scripts\": {\n \"start\": \"tsx ./src/index.ts\",\n \"clean\": \"rimraf ./dist\",\n \"build\": \"tsup\",\n \"test-build\": \"pnpm run build && node index.js\",\n \"prepublishOnly\": \"pnpm run build\"\n },\n \"packageManager\": \"pnpm@9.11.0\",\n \"dependencies\": {\n \"@inquirer/prompts\": \"^6.0.1\",\n \"commander\": \"^12.1.0\",\n \"cross-spawn\": \"^7.0.3\",\n \"giget\": \"^1.2.3\",\n \"picocolors\": \"^1.1.0\",\n \"validate-npm-package-name\": \"^5.0.1\",\n \"yocto-spinner\": \"^0.1.0\"\n },\n \"devDependencies\": {\n \"tsup\": \"^8.3.5\",\n \"tsx\": \"^4.19.2\"\n }\n}\n","export const NAME = 'create-cella';\n\n// URL of the template repository\nexport const TEMPLATE_URL = 'github:cellajs/cella';\n\n// URL to the repository\nexport const CELLA_REMOTE_URL: string = 'git@github.com:cellajs/cella.git';\n\n// Import package.json dynamically for version and website information\nimport packageJson from '../package.json' assert { type: 'json' };\n\n// Export details from package.json\nexport const DESCRIPTION: string = packageJson.description;\nexport const VERSION: string = packageJson.version;\nexport const AUTHOR: string = packageJson.author;\nexport const WEBSITE: string = packageJson.homepage;\nexport const GITHUB: string = packageJson.repository.url;\n\n// Files or folders to be removed from the template after downloading\nexport const TO_REMOVE: string[] = [\n 'info',\n './cli/create-cella',\n];\n\n// Specific folder contents to be cleaned out from the template\nexport const TO_CLEAN: string[] = [\n './backend/drizzle',\n];\n\n// Files to copy/paste after downloading\nexport const TO_COPY: Record<string, string> = {\n './backend/.env.example': './backend/.env',\n './frontend/.env.example': './frontend/.env',\n './tus/.env.example': './tus/.env',\n './info/QUICKSTART.md': 'README.md',\n};\n\n// ASCII logo for the CLI output\nexport const LOGO = `\n _ _ \n ▒▓█████▓▒ ___ ___| | | __ _\n ▒▓█ █▓▒ / __/ _ \\\\ | |/ _\\` |\n ▒▓█ █▓▒ | (_| __/ | | (_| |\n ▒▓█████▓▒ \\\\___\\\\___|_|_|\\\\__,_|\n`;\n","import validate from 'validate-npm-package-name';\n\ninterface ValidationResult {\n valid: boolean;\n problems?: string[];\n}\n\nexport function validateProjectName(name: string): ValidationResult {\n const nameValidation = validate(name);\n\n if (nameValidation.validForNewPackages) {\n return { valid: true };\n }\n\n return {\n valid: false,\n problems: [\n ...(nameValidation.errors || []),\n ...(nameValidation.warnings || []),\n ],\n };\n}\n","import { readdir } from 'node:fs/promises';\n\n/**\n * Checks if a directory is empty or only contains a .git directory.\n * \n * @param path - The path of the directory to check.\n * @returns Resolves to true if the directory is empty or contains only a .git folder, false otherwise.\n * @throws Throws an error if the path is not a directory or if there's an issue reading the directory.\n */\nexport async function isEmptyDirectory(path: string): Promise<boolean> {\n const files = await readdir(path);\n\n // Check if directory is empty or contains only the .git directory\n return files.length === 0 || (files.length === 1 && files[0] === '.git');\n}\n","import { mkdir } from 'node:fs/promises';\nimport { existsSync } from 'node:fs';\nimport { join, relative } from 'node:path';\nimport colors from 'picocolors';\nimport { downloadTemplate } from 'giget';\nimport yoctoSpinner from 'yocto-spinner';\n\nimport { TEMPLATE_URL } from './constants.ts';\n\nimport { install, generate } from './utils/run-package-manager-command.ts';\nimport { cleanTemplate } from './utils/clean-template.ts';\nimport { runGitCommand } from './utils/run-git-command.ts';\nimport { addRemote } from './add-remote.ts';\n\ninterface CreateOptions {\n projectName: string;\n targetFolder: string;\n newBranchName?: string | null;\n skipInstall: boolean;\n skipGit: boolean;\n skipClean: boolean;\n skipGenerate: boolean;\n packageManager: string;\n}\n\nexport async function create({\n projectName,\n targetFolder,\n newBranchName,\n skipInstall,\n skipGit,\n skipClean,\n skipGenerate,\n packageManager,\n}: CreateOptions): Promise<void> {\n // Save the original working directory\n const originalCwd = process.cwd();\n\n console.info();\n\n // Create the target folder if it doesn't exist\n const createFolderSpinner = yoctoSpinner({\n text: 'Creating project folder',\n }).start();\n\n await mkdir(targetFolder, { recursive: true });\n process.chdir(targetFolder);\n\n createFolderSpinner.success('Project folder created');\n\n // Download the template from the specified URL\n const downloadSpinner = yoctoSpinner({\n text: 'Downloading `cella` template',\n }).start();\n\n await downloadTemplate(TEMPLATE_URL, {\n cwd: process.cwd(),\n dir: targetFolder,\n force: true,\n provider: 'github',\n });\n\n downloadSpinner.success('`cella` template downloaded');\n\n // Clean the template if the skipClean flag is not set\n if (!skipClean) {\n const cleanSpinner = yoctoSpinner({\n text: 'cleaning `cella` template',\n }).start();\n\n try {\n await cleanTemplate({\n targetFolder,\n projectName,\n });\n cleanSpinner.success('`cella` template cleaned');\n } catch (e) {\n console.error(e);\n cleanSpinner.error('Failed to clean `cella` template');\n process.exit(1);\n }\n } else {\n console.info(`${colors.yellow('⚠')} --skip-clean > Skip cleaning \\`cella\\` template`);\n }\n\n // Install dependencies if the skipInstall flag is not set\n if (!skipInstall) {\n const installSpinner = yoctoSpinner({\n text: 'installing dependencies',\n }).start();\n\n try {\n await install(packageManager);\n installSpinner.success('Dependencies installed');\n } catch (e) {\n console.error(e);\n installSpinner.error('Failed to install dependencies');\n process.exit(1);\n }\n } else {\n console.info(`${colors.yellow('⚠')} --skip-install > Skip installing dependencies`);\n }\n\n // Generate SQL files if the skipGenerate flag is not set\n if (!skipGenerate) {\n const generateSpinner = yoctoSpinner({\n text: 'generating SQL files',\n }).start();\n\n try {\n await generate(packageManager);\n generateSpinner.success('SQL files generated');\n } catch (e) {\n console.error(e);\n generateSpinner.error('Failed to generate SQL files');\n process.exit(1);\n }\n } else {\n console.info(`${colors.yellow('⚠')} --skip-generate > Skip generating SQL files`);\n }\n\n // Initialize Git repository if skipGit flag is not set\n if (!skipGit) {\n const gitSpinner = yoctoSpinner({\n text: 'initializing git repository',\n }).start();\n\n const gitFolderPath = join(targetFolder, '.git');\n\n if (!existsSync(gitFolderPath)) {\n try {\n // Run Git commands to initialize the repository and make the first commit\n await runGitCommand({ targetFolder, command: 'init' });\n await runGitCommand({ targetFolder, command: 'add .' });\n await runGitCommand({ targetFolder, command: 'commit -m \"Initial commit\"' });\n\n // If a new branch name is specified, create and checkout the branch\n if (newBranchName) {\n await runGitCommand({ targetFolder, command: `branch ${newBranchName}` });\n await runGitCommand({ targetFolder, command: `checkout ${newBranchName}` });\n gitSpinner.success(`Git repository initialized, initial commit created, and new branch ${newBranchName} created`);\n } else {\n gitSpinner.success('Git repository initialized and initial commit created');\n }\n } catch (e) {\n console.error(e);\n gitSpinner.error('Failed to initialize Git repository or create branch');\n process.exit(1);\n }\n } else {\n gitSpinner.warning('Git repository already initialized > Skip git init');\n }\n } else {\n console.info(`${colors.yellow('⚠')} --skip-git > Skip git init`);\n }\n\n // Add Cella as upstream remote\n await addRemote({ targetFolder });\n\n // Final success message indicating project creation\n console.info();\n console.info(`${colors.green('Success')} Created ${projectName} at ${targetFolder}`);\n console.info();\n\n // Check if the working directory needs to be changed\n const needsCd = originalCwd !== targetFolder;\n const relativePath = relative(originalCwd, targetFolder);\n\n if (needsCd) {\n // Calculate the relative path between the original working directory and the target folder\n console.info('now go to your project using:');\n console.info(colors.cyan(` cd ${relativePath}`)); // Adding './' to make it clear it's a relative path\n console.info();\n }\n\n console.info(`${needsCd ? 'then ' : ''}quick start using pglite with:`);\n console.info(colors.cyan(` ${packageManager} quick`));\n console.info();\n\n console.info('Already have docker installed? Then you can run a full setup:');\n console.info(colors.cyan(` ${packageManager} docker`));\n console.info(colors.cyan(` ${packageManager} dev`));\n console.info(colors.cyan(` ${packageManager} seed`));\n console.info();\n\n console.info(`You can directly sign in using:`);\n console.info(`email: ${colors.greenBright('admin-test@cellajs.com')}`);\n console.info(`password: ${colors.greenBright('12345678')}`);\n console.info();\n console.info(`For more info, check out: ${relativePath}/README.md`);\n console.info(`Enjoy building ${projectName} using cella! 🎉`);\n console.info();\n}\n","import spawn from 'cross-spawn';\n\n/**\n * Executes a command using the specified package manager (e.g., pnpm).\n * \n * @param packageManager - The package manager to use (e.g., 'pnpm').\n * @param args - The arguments to pass to the package manager command.\n * @param env - Additional environment variables to set during command execution.\n * @returns A promise that resolves if the command executes successfully; otherwise, it rejects with an error message.\n */\nexport async function runPackageManagerCommand(\n packageManager: string,\n args: string[],\n env: Record<string, string> = {}\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const child = spawn(packageManager, args, {\n env: {\n ...process.env,\n ...env,\n },\n stdio: ['pipe', 'pipe', 'pipe'],\n });\n\n // Buffer for capturing stderr and stdout output\n let stderrBuffer = '';\n let stdoutBuffer = '';\n\n // Capture stderr output\n child.stderr?.on('data', (data: Buffer) => {\n stderrBuffer += data.toString();\n });\n\n // Capture stdout output\n child.stdout?.on('data', (data: Buffer) => {\n stdoutBuffer += data.toString();\n });\n\n // Handle process exit\n child.on('close', (code: number | null) => {\n if (code !== 0) {\n reject(\n `\"${packageManager} ${args.join(' ')}\" failed ${stdoutBuffer} ${stderrBuffer}`\n );\n return;\n }\n resolve();\n });\n });\n}\n\n/**\n * Installs dependencies using the specified package manager.\n * \n * @param packageManager - The package manager to use for installation (e.g., 'pnpm').\n * @returns A promise that resolves if the installation completes successfully; otherwise, it rejects with an error.\n */\nexport async function install(packageManager: string): Promise<void> {\n return runPackageManagerCommand(packageManager, ['install'], {\n NODE_ENV: 'development',\n });\n}\n\n/**\n * Generates SQL files using the specified package manager.\n * \n * @param packageManager - The package manager to use for generation (e.g., 'pnpm').\n * @returns A promise that resolves if the generation completes successfully; otherwise, it rejects with an error.\n */\nexport async function generate(packageManager: string): Promise<void> {\n return runPackageManagerCommand(packageManager, ['generate'], {\n NODE_ENV: 'development',\n });\n}\n","import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport colors from 'picocolors';\n\nimport { TO_CLEAN, TO_REMOVE, TO_COPY } from '../constants.ts';\n\n/**\n * Cleans the specified template by removing designated folders and files.\n * @param params - Parameters containing the target folder and project name.\n */\nexport async function cleanTemplate({\n targetFolder,\n projectName,\n}: {\n targetFolder: string;\n projectName: string;\n}): Promise<void> {\n // Change the current working directory to targetFolder if not already set\n if (process.cwd() !== targetFolder) {\n process.chdir(targetFolder);\n }\n\n return new Promise<void>(async (resolve, reject) => {\n try {\n // Copy specified files\n for (const [src, dest] of Object.entries(TO_COPY)) {\n const srcAbsolutePath = path.resolve(targetFolder, src);\n const destAbsolutePath = path.resolve(targetFolder, dest);\n await copyFile(srcAbsolutePath, destAbsolutePath);\n }\n\n // Clean specified folder contents\n await Promise.all(\n TO_CLEAN.map((folderPath) => {\n const absolutePath = path.resolve(targetFolder, folderPath);\n return removeFolderContents(absolutePath);\n })\n );\n\n // Remove specified files and folders\n await Promise.all(\n TO_REMOVE.map((filePath) => {\n const absolutePath = path.resolve(targetFolder, filePath);\n return removeFileOrFolder(absolutePath);\n })\n );\n\n resolve();\n } catch (err) {\n reject(`Error during the cleaning process: ${err}`);\n }\n });\n}\n\n/**\n * Removes all contents within a specified folder.\n * @param folderPath - The path of the folder to clean.\n */\nexport async function removeFolderContents(folderPath: string): Promise<void> {\n // List all files in the folder\n const files = await fs.readdir(folderPath);\n\n await Promise.all(\n files.map(async (file) => {\n const filePath = path.join(folderPath, file);\n\n // Get the file or folder statistics\n const stat = await fs.lstat(filePath);\n\n // If it's a directory, remove it and all its contents\n if (stat.isDirectory()) {\n await fs.rm(filePath, { recursive: true, force: true });\n } else {\n // If it's a file, remove it\n await fs.rm(filePath);\n }\n })\n );\n}\n\n/**\n * Removes a specified file or folder.\n * @param pathToRemove - The path to the file or folder to remove.\n */\nexport async function removeFileOrFolder(pathToRemove: string): Promise<void> {\n await fs.rm(pathToRemove, { recursive: true, force: true });\n}\n\n/**\n * Helper function to copy files if the source exists.\n * @param src - The source file path.\n * @param dest - The destination file path.\n */\nexport async function copyFile(src: string, dest: string): Promise<void> {\n try {\n // Check if the source file exists\n await fs.access(src);\n\n // Ensure the destination directory exists\n await fs.mkdir(path.dirname(dest), { recursive: true });\n\n // Copy the file\n await fs.copyFile(src, dest);\n } catch (err: any) {\n if (err.code === 'ENOENT') {\n console.info(`\\n${colors.yellow('⚠')} Source file \"${src}\" does not exist > Skip copy`);\n } else {\n throw err;\n }\n }\n}\n","import { spawn } from 'node:child_process';\n\ntype GitCommandType = 'merge' | 'diff' | 'other';\n\ninterface RunGitCommandOptions {\n targetFolder: string;\n command: string;\n}\n\n// Helper to determine the type of Git command for custom handling\nfunction getGitCommandType(command: string): GitCommandType {\n if (command.startsWith('merge')) return 'merge';\n if (command.startsWith('diff')) return 'diff';\n return 'other';\n}\n\n// Helper to check if a Git command is successful\nfunction isGitCommandSuccess(gitCommand: GitCommandType, code: number | null, errOutput: string): boolean {\n if (gitCommand === 'merge') return code === 0 || (code === 1 && !errOutput);\n if (gitCommand === 'diff') return code === 0 || (code === 2 && !errOutput);\n return code === 0;\n}\n\n// Function to run a Git command and handle its output\nexport async function runGitCommand({ targetFolder, command }: RunGitCommandOptions): Promise<string> {\n return new Promise((resolve, reject) => {\n const gitCommand = getGitCommandType(command);\n const child = spawn(`git ${command}`, [], { cwd: targetFolder, shell: true, timeout: 60000 });\n\n let output = '';\n let errOutput = '';\n\n child.on('error', (error: Error) => {\n reject(error);\n });\n\n child.on('exit', (code: number | null) => {\n if (isGitCommandSuccess(gitCommand, code, errOutput)) {\n resolve(output.trim());\n } else {\n reject(\n `Git ${gitCommand} command failed with exit code ${code}, stderr: \"${errOutput.trim()}\", stdout: \"${output.trim()}\"`\n );\n }\n });\n\n // Collect stdout data\n child.stdout.on('data', (data: Buffer) => {\n output += data.toString();\n });\n\n // Collect stderr data\n child.stderr.on('data', (data: Buffer) => {\n errOutput += data.toString();\n });\n });\n}\n","import yoctoSpinner from 'yocto-spinner';\nimport { runGitCommand } from './utils/run-git-command.ts';\nimport { CELLA_REMOTE_URL } from './constants.ts';\n\ninterface AddRemoteOptions {\n targetFolder: string;\n remoteUrl?: string; // Optional, defaults to CELLA_REMOTE_URL\n remoteName?: string; // Optional, defaults to 'upstream'\n}\n\nexport async function addRemote({\n targetFolder,\n remoteUrl = CELLA_REMOTE_URL,\n remoteName = 'upstream',\n}: AddRemoteOptions): Promise<void> {\n\n // Spinner for adding remote\n const remoteSpinner = yoctoSpinner({\n text: 'Adding remote',\n }).start();\n\n try {\n // Check if the remote exists\n let remote: string | null = null;\n\n try {\n remote = await runGitCommand({ targetFolder, command: `remote get-url ${remoteName}` });\n } catch (error: any) {\n // If the remote doesn't exist, it throws a fatal error\n remote = null;\n }\n\n // Add or update the remote if it doesn't exist or differs from `remoteUrl`\n if (!remote) {\n await runGitCommand({ targetFolder, command: `remote add ${remoteName} ${remoteUrl}` });\n remoteSpinner.success('Remote added successfully.');\n } else if (remote !== remoteUrl) {\n // Remove existing remote and set the new URL\n await runGitCommand({ targetFolder, command: `remote remove ${remoteName}` });\n await runGitCommand({ targetFolder, command: `remote add ${remoteName} ${remoteUrl}` });\n remoteSpinner.success('Remote updated successfully.');\n } else {\n remoteSpinner.success('Remote is already configured correctly.');\n }\n } catch (error) {\n console.error(error);\n remoteSpinner.error('Failed to add remote.');\n process.exit(1);\n }\n}\n"],"mappings":";;;AAEA,SAAS,YAAAA,WAAU,WAAAC,gBAAe;AAClC,SAAS,cAAAC,mBAAkB;AAC3B,OAAOC,aAAY;AAEnB,SAAS,OAAO,SAAS,cAAc;;;ACNvC,SAAS,UAAU,eAAe;AAClC,SAAS,SAAS,4BAA4B;;;ACD9C;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,SAAW;AAAA,EACX,SAAW;AAAA,EACX,aAAe;AAAA,EACf,eAAiB;AAAA,IACf,QAAU;AAAA,EACZ;AAAA,EACA,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,UAAY;AAAA,EACZ,QAAU;AAAA,EACV,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,MAAQ;AAAA,EACR,MAAQ;AAAA,EACR,KAAO;AAAA,IACL,gBAAgB;AAAA,EAClB;AAAA,EACA,SAAW;AAAA,IACT,OAAS;AAAA,IACT,OAAS;AAAA,IACT,OAAS;AAAA,IACT,cAAc;AAAA,IACd,gBAAkB;AAAA,EACpB;AAAA,EACA,gBAAkB;AAAA,EAClB,cAAgB;AAAA,IACd,qBAAqB;AAAA,IACrB,WAAa;AAAA,IACb,eAAe;AAAA,IACf,OAAS;AAAA,IACT,YAAc;AAAA,IACd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iBAAiB,YAAY,GAAI;AACvE,UAAM,UAAU,IAAI,cAAc,MAAM,sBAAsB,qBAAqB,YAAY;AAC/F,UAAM,UAAU,GAAG,OAAO;AAE1B,UAAM,SAAS,MAAM,OAAO;AAAA,MAC1B;AAAA,MACA,SAAS;AAAA,QACP,EAAE,MAAM,mBAAmB,OAAO,SAAS;AAAA,QAC3C,EAAE,MAAM,sCAAsC,OAAO,SAAS;AAAA,MAChE;AAAA,IACF,CAAC;AAED,QAAI,WAAW,UAAU;AACvB,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AAGA,QAAM,gBAA+B;AAAA,IACnC;AAAA,IACA;AAAA,IACA,eAAe,IAAI;AAAA,IACnB,aAAa,IAAI,QAAQ;AAAA,IACzB,SAAS,IAAI,QAAQ;AAAA,IACrB,WAAW,IAAI,QAAQ;AAAA,IACvB,cAAc,IAAI,QAAQ;AAAA,IAC1B,gBAAgB,IAAI;AAAA,EACtB;AAEA,QAAM,OAAO,aAAa;AAC5B;AAEA,KAAK,EAAE,MAAM,QAAQ,KAAK;","names":["basename","resolve","existsSync","colors","path","colors","yoctoSpinner","packageManager","resolve","resolve","spawn","command","resolve","newBranchName","packageManager","yoctoSpinner","colors","colors","basename","resolve","existsSync"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/cli.ts","../package.json","../src/constants.ts","../src/utils/validate-project-name.ts","../src/utils/is-empty-directory.ts","../src/create.ts","../src/utils/run-package-manager-command.ts","../src/utils/clean-template.ts","../src/utils/run-git-command.ts","../src/add-remote.ts"],"sourcesContent":["#!/usr/bin/env tsx\n\nimport { basename, resolve } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport colors from 'picocolors';\n\nimport { input, confirm, select } from '@inquirer/prompts';\n\nimport { cli } from './cli';\nimport { validateProjectName } from './utils/validate-project-name.ts';\nimport { isEmptyDirectory } from './utils/is-empty-directory.ts';\nimport { create } from './create.ts';\nimport { LOGO, VERSION, WEBSITE, AUTHOR, GITHUB, DESCRIPTION } from './constants.ts';\n\ninterface CreateOptions {\n projectName: string;\n targetFolder: string;\n newBranchName?: string | null;\n skipInstall: boolean;\n skipGit: boolean;\n skipClean: boolean;\n skipGenerate: boolean;\n packageManager: string;\n}\n\nasync function main(): Promise<void> {\n console.info(LOGO);\n\n // Display CLI version and created by information\n console.info();\n console.info(DESCRIPTION);\n console.info();\n console.info(`Version ${colors.green(VERSION)}`);\n console.info(`Created by ${AUTHOR}`);\n console.info(`${GITHUB} | ${WEBSITE}`);\n console.info();\n\n // Skip creating a new branch if --skipNewBranch flag is provided or git is skipped\n if (cli.options.skipNewBranch || cli.options.skipGit) {\n cli.createNewBranch = false;\n cli.newBranchName = null;\n }\n\n // Skip generating sql files if --skipGenerate flag is provided\n if (cli.options.skipGenerate === true) {\n cli.options.skipGenerate = true;\n }\n\n // Skip installing packages if --skipInstall flag is provided\n if (cli.options.skipInstall === true) {\n cli.options.skipInstall = true;\n }\n\n // Skip cleaning the template if --skipClean flag is provided\n if (cli.options.skipClean === true) {\n cli.options.skipClean = true;\n }\n\n // Skip initializing git if --skipGit flag is provided\n if (cli.options.skipGit === true) {\n cli.options.skipGit = true;\n }\n\n // Prompt for project name if not provided\n if (!cli.directory) {\n cli.directory = await input({\n message: 'Enter your project name',\n default: 'my-cella-app',\n validate: (name) => {\n const validation = validateProjectName(basename(resolve(name)));\n return validation.valid ? true : `Invalid project name: ${validation.problems[0]}`;\n },\n });\n }\n\n // Prompt to create a new branch besides the main branch (if not skipped)\n if (cli.createNewBranch === null) {\n cli.createNewBranch = await confirm({\n message: 'Would you like to create a new branch (besides \"main\")?',\n default: true,\n });\n }\n\n // Prompt for new branch name, only if user opted to create a new branch\n if (!cli.newBranchName && cli.createNewBranch) {\n cli.newBranchName = await input({\n message: 'Enter the new branch name',\n default: 'development',\n validate: (name) => {\n const validation = validateProjectName(basename(resolve(name)));\n return validation.valid ? true : `Invalid branch name: ${validation.problems[0]}`;\n },\n });\n }\n\n const targetFolder = resolve(cli.directory);\n const projectName = basename(targetFolder);\n\n // Check if the target folder exists and is not empty\n if (existsSync(targetFolder) && !(await isEmptyDirectory(targetFolder))) {\n const dirName = cli.directory === '.' ? 'Current directory' : `Target directory \"${targetFolder}\"`;\n const message = `${dirName} is not empty. Please choose how you would like to proceed:`;\n\n const action = await select({\n message,\n choices: [\n { name: 'Cancel and exit', value: 'cancel' },\n { name: 'Ignore existing files and continue', value: 'ignore' },\n ],\n });\n\n if (action === 'cancel') {\n process.exit(1);\n }\n }\n\n // Proceed with the project creation\n const createOptions: CreateOptions = {\n projectName,\n targetFolder,\n newBranchName: cli.newBranchName,\n skipInstall: cli.options.skipInstall,\n skipGit: cli.options.skipGit,\n skipClean: cli.options.skipClean,\n skipGenerate: cli.options.skipGenerate,\n packageManager: cli.packageManager,\n };\n\n await create(createOptions);\n}\n\nmain().catch(console.error);\n","import { basename, resolve } from 'node:path';\nimport { Command, InvalidArgumentError } from 'commander';\n\nimport { NAME, VERSION } from './constants.ts';\nimport { validateProjectName } from './utils/validate-project-name.ts';\n\n// Define types for CLI options\ninterface CLIOptions {\n skipNewBranch: boolean;\n skipClean: boolean;\n skipGit: boolean;\n skipInstall: boolean;\n skipGenerate: boolean;\n newBranchName?: string;\n}\n\n// Define CLI configuration\ninterface CLIConfig {\n options: CLIOptions;\n args: string[];\n directory: string | null;\n newBranchName: string | null;\n createNewBranch: boolean | null;\n packageManager: string;\n}\n\n// Initialize CLI variables\nlet directory: string | null = null;\nlet newBranchName: string | null = null;\nlet createNewBranch: boolean | null = null;\nconst packageManager = 'pnpm';\n\n// Set up the CLI command using Commander\nexport const command = new Command(NAME)\n .version(\n VERSION,\n '-v, --version',\n `Output the current version of ${NAME}.`\n )\n .argument('[directory]', 'The directory name for the new project.')\n .usage('[directory] [options]')\n .helpOption('-h, --help', 'Display this help message.')\n .option('--skip-new-branch', 'Skip creating a new branch during initialization.', false)\n .option('--skip-install', 'Skip the installation of packages.', false)\n .option('--skip-generate', 'Skip generating SQL files.', false)\n .option('--skip-clean', 'Skip cleaning the `cella` template.', false)\n .option('--skip-git', 'Skip initializing a git repository.', false)\n .option(\n '--new-branch-name <name>',\n 'Specify a new branch name to create and use.',\n (name: string) => {\n if (typeof name === 'string') {\n name = name.trim();\n }\n\n if (name) {\n const validation = validateProjectName(basename(resolve(name)));\n\n if (!validation.valid) {\n throw new InvalidArgumentError(\n `Invalid branch name: ${validation.problems[0]}`\n );\n }\n \n createNewBranch = true;\n newBranchName = name;\n }\n }\n )\n .action((name: string) => {\n if (typeof name === 'string') {\n name = name.trim();\n }\n\n if (name) {\n const validation = validateProjectName(basename(resolve(name)));\n\n if (!validation.valid) {\n throw new InvalidArgumentError(\n `Invalid project name: ${validation.problems[0]}`\n );\n }\n\n directory = name;\n }\n })\n .parse();\n\n// Gather the CLI options and arguments\nconst options: CLIOptions = command.opts<CLIOptions>({\n skipNewBranch: false,\n skipClean: false,\n skipGit: false,\n skipInstall: false,\n skipGenerate: false,\n});\n\n// Export the CLI configuration for use in other modules\nexport const cli: CLIConfig = {\n options,\n args: command.args,\n directory,\n newBranchName,\n createNewBranch,\n packageManager,\n};\n","{\n \"name\": \"@cellajs/create-cella\",\n \"version\": \"0.1.3\",\n \"private\": false,\n \"license\": \"MIT\",\n \"description\": \"Cella is a TypeScript template to create web apps with sync and offline capabilities.\",\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/cellajs/cella\",\n \"directory\": \"cli/create-cella\"\n },\n \"homepage\": \"https://cellajs.com\",\n \"author\": \"CellaJS <info@cellajs.com>\",\n \"engines\": {\n \"node\": \">=20.14.0\"\n },\n \"type\": \"module\",\n \"main\": \"./src/index.ts\",\n \"bin\": {\n \"create-cella\": \"index.js\"\n },\n \"scripts\": {\n \"start\": \"tsx ./src/index.ts\",\n \"clean\": \"rimraf ./dist\",\n \"build\": \"tsup\",\n \"test-build\": \"pnpm run build && node index.js\",\n \"prepublishOnly\": \"pnpm run build\"\n },\n \"packageManager\": \"pnpm@9.11.0\",\n \"dependencies\": {\n \"@inquirer/prompts\": \"^6.0.1\",\n \"commander\": \"^12.1.0\",\n \"cross-spawn\": \"^7.0.3\",\n \"giget\": \"^1.2.3\",\n \"picocolors\": \"^1.1.0\",\n \"validate-npm-package-name\": \"^5.0.1\",\n \"yocto-spinner\": \"^0.1.0\"\n },\n \"devDependencies\": {\n \"tsup\": \"^8.3.5\",\n \"tsx\": \"^4.19.2\"\n }\n}\n","export const NAME = 'create-cella';\n\n// URL of the template repository\nexport const TEMPLATE_URL = 'github:cellajs/cella';\n\n// URL to the repository\nexport const CELLA_REMOTE_URL: string = 'git@github.com:cellajs/cella.git';\n\n// Import package.json dynamically for version and website information\nimport packageJson from '../package.json' assert { type: 'json' };\n\n// Export details from package.json\nexport const DESCRIPTION: string = packageJson.description;\nexport const VERSION: string = packageJson.version;\nexport const AUTHOR: string = packageJson.author;\nexport const WEBSITE: string = packageJson.homepage;\nexport const GITHUB: string = packageJson.repository.url;\n\n// Files or folders to be removed from the template after downloading\nexport const TO_REMOVE: string[] = [\n 'info',\n './cli/create-cella',\n];\n\n// Specific folder contents to be cleaned out from the template\nexport const TO_CLEAN: string[] = [\n './backend/drizzle',\n];\n\n// Files to copy/paste after downloading\nexport const TO_COPY: Record<string, string> = {\n './backend/.env.example': './backend/.env',\n './frontend/.env.example': './frontend/.env',\n './tus/.env.example': './tus/.env',\n './info/QUICKSTART.md': 'README.md',\n};\n\n// ASCII logo for the CLI output\nexport const LOGO = `\n _ _ \n ▒▓█████▓▒ ___ ___| | | __ _\n ▒▓█ █▓▒ / __/ _ \\\\ | |/ _\\` |\n ▒▓█ █▓▒ | (_| __/ | | (_| |\n ▒▓█████▓▒ \\\\___\\\\___|_|_|\\\\__,_|\n`;\n","import validate from 'validate-npm-package-name';\n\ninterface ValidationResult {\n valid: boolean;\n problems?: string[];\n}\n\nexport function validateProjectName(name: string): ValidationResult {\n const nameValidation = validate(name);\n\n if (nameValidation.validForNewPackages) {\n return { valid: true };\n }\n\n return {\n valid: false,\n problems: [\n ...(nameValidation.errors || []),\n ...(nameValidation.warnings || []),\n ],\n };\n}\n","import { readdir } from 'node:fs/promises';\n\n/**\n * Checks if a directory is empty or only contains a .git directory.\n * \n * @param path - The path of the directory to check.\n * @returns Resolves to true if the directory is empty or contains only a .git folder, false otherwise.\n * @throws Throws an error if the path is not a directory or if there's an issue reading the directory.\n */\nexport async function isEmptyDirectory(path: string): Promise<boolean> {\n const files = await readdir(path);\n\n // Check if directory is empty or contains only the .git directory\n return files.length === 0 || (files.length === 1 && files[0] === '.git');\n}\n","import { mkdir } from 'node:fs/promises';\nimport { existsSync } from 'node:fs';\nimport { join, relative } from 'node:path';\nimport colors from 'picocolors';\nimport { downloadTemplate } from 'giget';\nimport yoctoSpinner from 'yocto-spinner';\n\nimport { TEMPLATE_URL } from './constants.ts';\n\nimport { install, generate } from './utils/run-package-manager-command.ts';\nimport { cleanTemplate } from './utils/clean-template.ts';\nimport { runGitCommand } from './utils/run-git-command.ts';\nimport { addRemote } from './add-remote.ts';\n\ninterface CreateOptions {\n projectName: string;\n targetFolder: string;\n newBranchName?: string | null;\n skipInstall: boolean;\n skipGit: boolean;\n skipClean: boolean;\n skipGenerate: boolean;\n packageManager: string;\n}\n\nexport async function create({\n projectName,\n targetFolder,\n newBranchName,\n skipInstall,\n skipGit,\n skipClean,\n skipGenerate,\n packageManager,\n}: CreateOptions): Promise<void> {\n // Save the original working directory\n const originalCwd = process.cwd();\n\n console.info();\n\n // Create the target folder if it doesn't exist\n const createFolderSpinner = yoctoSpinner({\n text: 'Creating project folder',\n }).start();\n\n await mkdir(targetFolder, { recursive: true });\n process.chdir(targetFolder);\n\n createFolderSpinner.success('Project folder created');\n\n // Download the template from the specified URL\n const downloadSpinner = yoctoSpinner({\n text: 'Downloading `cella` template',\n }).start();\n\n await downloadTemplate(TEMPLATE_URL, {\n cwd: process.cwd(),\n dir: targetFolder,\n force: true,\n provider: 'github',\n });\n\n downloadSpinner.success('`cella` template downloaded');\n\n // Clean the template if the skipClean flag is not set\n if (!skipClean) {\n const cleanSpinner = yoctoSpinner({\n text: 'cleaning `cella` template',\n }).start();\n\n try {\n await cleanTemplate({\n targetFolder,\n projectName,\n });\n cleanSpinner.success('`cella` template cleaned');\n } catch (e) {\n console.error(e);\n cleanSpinner.error('Failed to clean `cella` template');\n process.exit(1);\n }\n } else {\n console.info(`${colors.yellow('⚠')} --skip-clean > Skip cleaning \\`cella\\` template`);\n }\n\n // Install dependencies if the skipInstall flag is not set\n if (!skipInstall) {\n const installSpinner = yoctoSpinner({\n text: 'installing dependencies',\n }).start();\n\n try {\n await install(packageManager);\n installSpinner.success('Dependencies installed');\n } catch (e) {\n console.error(e);\n installSpinner.error('Failed to install dependencies');\n process.exit(1);\n }\n } else {\n console.info(`${colors.yellow('⚠')} --skip-install > Skip installing dependencies`);\n }\n\n // Generate SQL files if the skipGenerate flag is not set\n if (!skipGenerate) {\n const generateSpinner = yoctoSpinner({\n text: 'generating SQL files',\n }).start();\n\n try {\n await generate(packageManager);\n generateSpinner.success('SQL files generated');\n } catch (e) {\n console.error(e);\n generateSpinner.error('Failed to generate SQL files');\n process.exit(1);\n }\n } else {\n console.info(`${colors.yellow('⚠')} --skip-generate > Skip generating SQL files`);\n }\n\n // Initialize Git repository if skipGit flag is not set\n if (!skipGit) {\n const gitSpinner = yoctoSpinner({\n text: 'initializing git repository',\n }).start();\n\n const gitFolderPath = join(targetFolder, '.git');\n\n if (!existsSync(gitFolderPath)) {\n try {\n // Run Git commands to initialize the repository and make the first commit\n await runGitCommand({ targetFolder, command: 'init' });\n await runGitCommand({ targetFolder, command: 'add .' });\n await runGitCommand({ targetFolder, command: 'commit -m \"Initial commit\"' });\n\n // If a new branch name is specified, create and checkout the branch\n if (newBranchName) {\n await runGitCommand({ targetFolder, command: `branch ${newBranchName}` });\n await runGitCommand({ targetFolder, command: `checkout ${newBranchName}` });\n gitSpinner.success(`Git repository initialized, initial commit created, and new branch ${newBranchName} created`);\n } else {\n gitSpinner.success('Git repository initialized and initial commit created');\n }\n } catch (e) {\n console.error(e);\n gitSpinner.error('Failed to initialize Git repository or create branch');\n process.exit(1);\n }\n } else {\n gitSpinner.warning('Git repository already initialized > Skip git init');\n }\n } else {\n console.info(`${colors.yellow('⚠')} --skip-git > Skip git init`);\n }\n\n // Add Cella as upstream remote\n await addRemote({ targetFolder });\n\n // Final success message indicating project creation\n console.info();\n console.info(`${colors.green('Success')} Created ${projectName} at ${targetFolder}`);\n console.info();\n\n // Check if the working directory needs to be changed\n const needsCd = originalCwd !== targetFolder;\n const relativePath = relative(originalCwd, targetFolder);\n\n if (needsCd) {\n // Calculate the relative path between the original working directory and the target folder\n console.info('now go to your project using:');\n console.info(colors.cyan(` cd ${relativePath}`)); // Adding './' to make it clear it's a relative path\n console.info();\n }\n\n console.info(`${needsCd ? 'then ' : ''}quick start using pglite with:`);\n console.info(colors.cyan(` ${packageManager} quick`));\n console.info();\n\n console.info('Already have docker installed? Then you can run a full setup:');\n console.info(colors.cyan(` ${packageManager} docker`));\n console.info(colors.cyan(` ${packageManager} dev`));\n console.info(colors.cyan(` ${packageManager} seed`));\n console.info();\n\n console.info(`Once running, you can sign in using:`);\n console.info(`email: ${colors.greenBright('admin-test@cellajs.com')}`);\n console.info(`password: ${colors.greenBright('12345678')}`);\n console.info();\n console.info(`For more info, check out: ${relativePath}/README.md`);\n console.info(`Enjoy building ${projectName} using cella! 🎉`);\n console.info();\n}\n","import spawn from 'cross-spawn';\n\n/**\n * Executes a command using the specified package manager (e.g., pnpm).\n * \n * @param packageManager - The package manager to use (e.g., 'pnpm').\n * @param args - The arguments to pass to the package manager command.\n * @param env - Additional environment variables to set during command execution.\n * @returns A promise that resolves if the command executes successfully; otherwise, it rejects with an error message.\n */\nexport async function runPackageManagerCommand(\n packageManager: string,\n args: string[],\n env: Record<string, string> = {}\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const child = spawn(packageManager, args, {\n env: {\n ...process.env,\n ...env,\n },\n stdio: ['pipe', 'pipe', 'pipe'],\n });\n\n // Buffer for capturing stderr and stdout output\n let stderrBuffer = '';\n let stdoutBuffer = '';\n\n // Capture stderr output\n child.stderr?.on('data', (data: Buffer) => {\n stderrBuffer += data.toString();\n });\n\n // Capture stdout output\n child.stdout?.on('data', (data: Buffer) => {\n stdoutBuffer += data.toString();\n });\n\n // Handle process exit\n child.on('close', (code: number | null) => {\n if (code !== 0) {\n reject(\n `\"${packageManager} ${args.join(' ')}\" failed ${stdoutBuffer} ${stderrBuffer}`\n );\n return;\n }\n resolve();\n });\n });\n}\n\n/**\n * Installs dependencies using the specified package manager.\n * \n * @param packageManager - The package manager to use for installation (e.g., 'pnpm').\n * @returns A promise that resolves if the installation completes successfully; otherwise, it rejects with an error.\n */\nexport async function install(packageManager: string): Promise<void> {\n return runPackageManagerCommand(packageManager, ['install'], {\n NODE_ENV: 'development',\n });\n}\n\n/**\n * Generates SQL files using the specified package manager.\n * \n * @param packageManager - The package manager to use for generation (e.g., 'pnpm').\n * @returns A promise that resolves if the generation completes successfully; otherwise, it rejects with an error.\n */\nexport async function generate(packageManager: string): Promise<void> {\n return runPackageManagerCommand(packageManager, ['generate'], {\n NODE_ENV: 'development',\n });\n}\n","import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport colors from 'picocolors';\n\nimport { TO_CLEAN, TO_REMOVE, TO_COPY } from '../constants.ts';\n\n/**\n * Cleans the specified template by removing designated folders and files.\n * @param params - Parameters containing the target folder and project name.\n */\nexport async function cleanTemplate({\n targetFolder,\n projectName,\n}: {\n targetFolder: string;\n projectName: string;\n}): Promise<void> {\n // Change the current working directory to targetFolder if not already set\n if (process.cwd() !== targetFolder) {\n process.chdir(targetFolder);\n }\n\n return new Promise<void>(async (resolve, reject) => {\n try {\n // Copy specified files\n for (const [src, dest] of Object.entries(TO_COPY)) {\n const srcAbsolutePath = path.resolve(targetFolder, src);\n const destAbsolutePath = path.resolve(targetFolder, dest);\n await copyFile(srcAbsolutePath, destAbsolutePath);\n }\n\n // Clean specified folder contents\n await Promise.all(\n TO_CLEAN.map((folderPath) => {\n const absolutePath = path.resolve(targetFolder, folderPath);\n return removeFolderContents(absolutePath);\n })\n );\n\n // Remove specified files and folders\n await Promise.all(\n TO_REMOVE.map((filePath) => {\n const absolutePath = path.resolve(targetFolder, filePath);\n return removeFileOrFolder(absolutePath);\n })\n );\n\n resolve();\n } catch (err) {\n reject(`Error during the cleaning process: ${err}`);\n }\n });\n}\n\n/**\n * Removes all contents within a specified folder.\n * @param folderPath - The path of the folder to clean.\n */\nexport async function removeFolderContents(folderPath: string): Promise<void> {\n // List all files in the folder\n const files = await fs.readdir(folderPath);\n\n await Promise.all(\n files.map(async (file) => {\n const filePath = path.join(folderPath, file);\n\n // Get the file or folder statistics\n const stat = await fs.lstat(filePath);\n\n // If it's a directory, remove it and all its contents\n if (stat.isDirectory()) {\n await fs.rm(filePath, { recursive: true, force: true });\n } else {\n // If it's a file, remove it\n await fs.rm(filePath);\n }\n })\n );\n}\n\n/**\n * Removes a specified file or folder.\n * @param pathToRemove - The path to the file or folder to remove.\n */\nexport async function removeFileOrFolder(pathToRemove: string): Promise<void> {\n await fs.rm(pathToRemove, { recursive: true, force: true });\n}\n\n/**\n * Helper function to copy files if the source exists.\n * @param src - The source file path.\n * @param dest - The destination file path.\n */\nexport async function copyFile(src: string, dest: string): Promise<void> {\n try {\n // Check if the source file exists\n await fs.access(src);\n\n // Ensure the destination directory exists\n await fs.mkdir(path.dirname(dest), { recursive: true });\n\n // Copy the file\n await fs.copyFile(src, dest);\n } catch (err: any) {\n if (err.code === 'ENOENT') {\n console.info(`\\n${colors.yellow('⚠')} Source file \"${src}\" does not exist > Skip copy`);\n } else {\n throw err;\n }\n }\n}\n","import { spawn } from 'node:child_process';\n\ntype GitCommandType = 'merge' | 'diff' | 'other';\n\ninterface RunGitCommandOptions {\n targetFolder: string;\n command: string;\n}\n\n// Helper to determine the type of Git command for custom handling\nfunction getGitCommandType(command: string): GitCommandType {\n if (command.startsWith('merge')) return 'merge';\n if (command.startsWith('diff')) return 'diff';\n return 'other';\n}\n\n// Helper to check if a Git command is successful\nfunction isGitCommandSuccess(gitCommand: GitCommandType, code: number | null, errOutput: string): boolean {\n if (gitCommand === 'merge') return code === 0 || (code === 1 && !errOutput);\n if (gitCommand === 'diff') return code === 0 || (code === 2 && !errOutput);\n return code === 0;\n}\n\n// Function to run a Git command and handle its output\nexport async function runGitCommand({ targetFolder, command }: RunGitCommandOptions): Promise<string> {\n return new Promise((resolve, reject) => {\n const gitCommand = getGitCommandType(command);\n const child = spawn(`git ${command}`, [], { cwd: targetFolder, shell: true, timeout: 60000 });\n\n let output = '';\n let errOutput = '';\n\n child.on('error', (error: Error) => {\n reject(error);\n });\n\n child.on('exit', (code: number | null) => {\n if (isGitCommandSuccess(gitCommand, code, errOutput)) {\n resolve(output.trim());\n } else {\n reject(\n `Git ${gitCommand} command failed with exit code ${code}, stderr: \"${errOutput.trim()}\", stdout: \"${output.trim()}\"`\n );\n }\n });\n\n // Collect stdout data\n child.stdout.on('data', (data: Buffer) => {\n output += data.toString();\n });\n\n // Collect stderr data\n child.stderr.on('data', (data: Buffer) => {\n errOutput += data.toString();\n });\n });\n}\n","import yoctoSpinner from 'yocto-spinner';\nimport { runGitCommand } from './utils/run-git-command.ts';\nimport { CELLA_REMOTE_URL } from './constants.ts';\n\ninterface AddRemoteOptions {\n targetFolder: string;\n remoteUrl?: string; // Optional, defaults to CELLA_REMOTE_URL\n remoteName?: string; // Optional, defaults to 'upstream'\n}\n\nexport async function addRemote({\n targetFolder,\n remoteUrl = CELLA_REMOTE_URL,\n remoteName = 'upstream',\n}: AddRemoteOptions): Promise<void> {\n\n // Spinner for adding remote\n const remoteSpinner = yoctoSpinner({\n text: 'Adding remote',\n }).start();\n\n try {\n // Check if the remote exists\n let remote: string | null = null;\n\n try {\n remote = await runGitCommand({ targetFolder, command: `remote get-url ${remoteName}` });\n } catch (error: any) {\n // If the remote doesn't exist, it throws a fatal error\n remote = null;\n }\n\n // Add or update the remote if it doesn't exist or differs from `remoteUrl`\n if (!remote) {\n await runGitCommand({ targetFolder, command: `remote add ${remoteName} ${remoteUrl}` });\n remoteSpinner.success('Remote added successfully.');\n } else if (remote !== remoteUrl) {\n // Remove existing remote and set the new URL\n await runGitCommand({ targetFolder, command: `remote remove ${remoteName}` });\n await runGitCommand({ targetFolder, command: `remote add ${remoteName} ${remoteUrl}` });\n remoteSpinner.success('Remote updated successfully.');\n } else {\n remoteSpinner.success('Remote is already configured correctly.');\n }\n } catch (error) {\n console.error(error);\n remoteSpinner.error('Failed to add remote.');\n process.exit(1);\n }\n}\n"],"mappings":";;;AAEA,SAAS,YAAAA,WAAU,WAAAC,gBAAe;AAClC,SAAS,cAAAC,mBAAkB;AAC3B,OAAOC,aAAY;AAEnB,SAAS,OAAO,SAAS,cAAc;;;ACNvC,SAAS,UAAU,eAAe;AAClC,SAAS,SAAS,4BAA4B;;;ACD9C;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,SAAW;AAAA,EACX,SAAW;AAAA,EACX,aAAe;AAAA,EACf,eAAiB;AAAA,IACf,QAAU;AAAA,EACZ;AAAA,EACA,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,UAAY;AAAA,EACZ,QAAU;AAAA,EACV,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,MAAQ;AAAA,EACR,MAAQ;AAAA,EACR,KAAO;AAAA,IACL,gBAAgB;AAAA,EAClB;AAAA,EACA,SAAW;AAAA,IACT,OAAS;AAAA,IACT,OAAS;AAAA,IACT,OAAS;AAAA,IACT,cAAc;AAAA,IACd,gBAAkB;AAAA,EACpB;AAAA,EACA,gBAAkB;AAAA,EAClB,cAAgB;AAAA,IACd,qBAAqB;AAAA,IACrB,WAAa;AAAA,IACb,eAAe;AAAA,IACf,OAAS;AAAA,IACT,YAAc;AAAA,IACd,6BAA6B;AAAA,IAC7B,i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,UAAM,UAAU,IAAI,cAAc,MAAM,sBAAsB,qBAAqB,YAAY;AAC/F,UAAM,UAAU,GAAG,OAAO;AAE1B,UAAM,SAAS,MAAM,OAAO;AAAA,MAC1B;AAAA,MACA,SAAS;AAAA,QACP,EAAE,MAAM,mBAAmB,OAAO,SAAS;AAAA,QAC3C,EAAE,MAAM,sCAAsC,OAAO,SAAS;AAAA,MAChE;AAAA,IACF,CAAC;AAED,QAAI,WAAW,UAAU;AACvB,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AAGA,QAAM,gBAA+B;AAAA,IACnC;AAAA,IACA;AAAA,IACA,eAAe,IAAI;AAAA,IACnB,aAAa,IAAI,QAAQ;AAAA,IACzB,SAAS,IAAI,QAAQ;AAAA,IACrB,WAAW,IAAI,QAAQ;AAAA,IACvB,cAAc,IAAI,QAAQ;AAAA,IAC1B,gBAAgB,IAAI;AAAA,EACtB;AAEA,QAAM,OAAO,aAAa;AAC5B;AAEA,KAAK,EAAE,MAAM,QAAQ,KAAK;","names":["basename","resolve","existsSync","colors","path","colors","yoctoSpinner","packageManager","resolve","resolve","spawn","command","resolve","newBranchName","packageManager","yoctoSpinner","colors","colors","basename","resolve","existsSync"]}
|
package/package.json
CHANGED
package/src/create.ts
CHANGED
|
@@ -183,7 +183,7 @@ export async function create({
|
|
|
183
183
|
console.info(colors.cyan(` ${packageManager} seed`));
|
|
184
184
|
console.info();
|
|
185
185
|
|
|
186
|
-
console.info(`
|
|
186
|
+
console.info(`Once running, you can sign in using:`);
|
|
187
187
|
console.info(`email: ${colors.greenBright('admin-test@cellajs.com')}`);
|
|
188
188
|
console.info(`password: ${colors.greenBright('12345678')}`);
|
|
189
189
|
console.info();
|