@cellajs/create-cella 0.2.0 → 0.2.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.
@@ -1,19 +0,0 @@
1
- import validate from 'validate-npm-package-name';
2
-
3
- interface ValidationResult {
4
- valid: boolean;
5
- problems?: string[];
6
- }
7
-
8
- export function validateProjectName(name: string): ValidationResult {
9
- const nameValidation = validate(name);
10
-
11
- if (nameValidation.validForNewPackages) {
12
- return { valid: true };
13
- }
14
-
15
- return {
16
- valid: false,
17
- problems: [...(nameValidation.errors || []), ...(nameValidation.warnings || [])],
18
- };
19
- }
package/tests/e2e.test.ts DELETED
@@ -1,108 +0,0 @@
1
- import { existsSync, readdirSync, readFileSync, rmSync } from 'node:fs';
2
- import { tmpdir } from 'node:os';
3
- import { join } from 'node:path';
4
- import { afterAll, beforeAll, describe, expect, it } from 'vitest';
5
- import { create } from '#/create';
6
-
7
- /**
8
- * E2E test for create-cella CLI.
9
- * This test does a full install and verifies the project is set up correctly.
10
- * Note: This test is slow (~60s+) as it runs pnpm install and generate.
11
- */
12
- describe('create-cella e2e', () => {
13
- const projectName = `cella-e2e-test-${Date.now()}`;
14
- const targetFolder = join(tmpdir(), projectName);
15
-
16
- beforeAll(async () => {
17
- // Create a full project with all steps
18
- await create({
19
- projectName,
20
- targetFolder,
21
- newBranchName: 'development',
22
- packageManager: 'pnpm',
23
- silent: true,
24
- });
25
- }, 120000); // 2 minute timeout for full install
26
-
27
- afterAll(() => {
28
- // Cleanup
29
- if (existsSync(targetFolder)) {
30
- rmSync(targetFolder, { recursive: true, force: true });
31
- }
32
- });
33
-
34
- describe('project structure', () => {
35
- it('should create essential directories', () => {
36
- expect(existsSync(join(targetFolder, 'backend'))).toBe(true);
37
- expect(existsSync(join(targetFolder, 'frontend'))).toBe(true);
38
- expect(existsSync(join(targetFolder, 'config'))).toBe(true);
39
- expect(existsSync(join(targetFolder, 'locales'))).toBe(true);
40
- });
41
-
42
- it('should have node_modules installed', () => {
43
- expect(existsSync(join(targetFolder, 'node_modules'))).toBe(true);
44
- expect(existsSync(join(targetFolder, 'backend', 'node_modules'))).toBe(true);
45
- expect(existsSync(join(targetFolder, 'frontend', 'node_modules'))).toBe(true);
46
- });
47
- });
48
-
49
- describe('README.md (from QUICKSTART)', () => {
50
- it('should have README.md with quickstart content', () => {
51
- const readmePath = join(targetFolder, 'README.md');
52
- expect(existsSync(readmePath)).toBe(true);
53
-
54
- const content = readFileSync(readmePath, 'utf-8');
55
- // Check for QUICKSTART.md content markers
56
- expect(content).toContain('# Quickstart');
57
- expect(content).toContain('pnpm quick');
58
- expect(content).toContain('pnpm docker');
59
- });
60
- });
61
-
62
- describe('.env files', () => {
63
- it('should have backend .env file', () => {
64
- const envPath = join(targetFolder, 'backend', '.env');
65
- expect(existsSync(envPath)).toBe(true);
66
- });
67
-
68
- it('should have frontend .env file', () => {
69
- const envPath = join(targetFolder, 'frontend', '.env');
70
- expect(existsSync(envPath)).toBe(true);
71
- });
72
- });
73
-
74
- describe('database migrations', () => {
75
- it('should have generated drizzle migrations', () => {
76
- const drizzlePath = join(targetFolder, 'backend', 'drizzle');
77
- expect(existsSync(drizzlePath)).toBe(true);
78
-
79
- // Check that migration files exist (at least one .sql file)
80
- const files = readdirSync(drizzlePath);
81
- const sqlFiles = files.filter((f) => f.endsWith('.sql'));
82
- expect(sqlFiles.length).toBeGreaterThan(0);
83
- });
84
-
85
- it('should have drizzle meta folder', () => {
86
- const metaPath = join(targetFolder, 'backend', 'drizzle', 'meta');
87
- expect(existsSync(metaPath)).toBe(true);
88
- });
89
- });
90
-
91
- describe('git repository', () => {
92
- it('should have initialized git', () => {
93
- expect(existsSync(join(targetFolder, '.git'))).toBe(true);
94
- });
95
-
96
- it('should be on development branch', () => {
97
- const gitHead = readFileSync(join(targetFolder, '.git', 'HEAD'), 'utf-8');
98
- expect(gitHead.trim()).toBe('ref: refs/heads/development');
99
- });
100
-
101
- it('should have upstream remote configured', () => {
102
- const configPath = join(targetFolder, '.git', 'config');
103
- const config = readFileSync(configPath, 'utf-8');
104
- expect(config).toContain('[remote "upstream"]');
105
- expect(config).toContain('cellajs/cella');
106
- });
107
- });
108
- });
@@ -1,22 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import { validateProjectName } from '#/utils/validate-project-name';
4
-
5
- describe('validateProjectName', () => {
6
- it('should accept valid project names', () => {
7
- expect(validateProjectName('my-app')).toEqual({ valid: true });
8
- expect(validateProjectName('my-cella-app')).toEqual({ valid: true });
9
- expect(validateProjectName('app123')).toEqual({ valid: true });
10
- });
11
-
12
- it('should reject invalid project names', () => {
13
- const result = validateProjectName('My App');
14
- expect(result.valid).toBe(false);
15
- expect(result.problems).toBeDefined();
16
- });
17
-
18
- it('should reject names starting with dots or underscores', () => {
19
- expect(validateProjectName('.hidden').valid).toBe(false);
20
- expect(validateProjectName('_private').valid).toBe(false);
21
- });
22
- });
package/tsconfig.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "allowImportingTsExtensions": true,
5
- "noEmit": true,
6
- "target": "ESNext",
7
- "module": "ESNext",
8
- "strict": true,
9
- "incremental": true,
10
- "tsBuildInfoFile": ".tsbuildinfo",
11
- "declaration": true,
12
- "composite": false,
13
- "skipLibCheck": true,
14
- "types": ["node"],
15
- "paths": {
16
- "#/*": ["./src/*"]
17
- }
18
- },
19
- "include": ["src", "tests", "index.js", "tsup.config.ts"]
20
- }
package/tsup.config.ts DELETED
@@ -1,23 +0,0 @@
1
- import { resolve } from 'node:path';
2
- import { defineConfig } from 'tsup';
3
-
4
- export default defineConfig({
5
- entry: { index: 'src/create-cella-cli.ts' },
6
- outDir: 'dist',
7
- clean: true,
8
- minify: false,
9
- format: ['esm'],
10
- target: 'esnext',
11
- splitting: false,
12
- sourcemap: true,
13
- dts: false,
14
- esbuildOptions(options) {
15
- options.alias = {
16
- '#': resolve(__dirname, './src'),
17
- };
18
- options.platform = 'node';
19
- options.mainFields = ['module', 'main'];
20
- options.conditions = ['module'];
21
- },
22
- external: [],
23
- });
package/vitest.config.ts DELETED
@@ -1,17 +0,0 @@
1
- import { resolve } from 'node:path';
2
- import { defineConfig } from 'vitest/config';
3
-
4
- export default defineConfig({
5
- resolve: {
6
- alias: {
7
- '#': resolve(__dirname, './src'),
8
- },
9
- },
10
- test: {
11
- globals: true,
12
- environment: 'node',
13
- include: ['src/**/*.test.ts', 'tests/**/*.test.ts'],
14
- testTimeout: 120000, // 2 minutes for E2E tests
15
- onConsoleLog: () => false, // Suppress console output during tests
16
- },
17
- });