scaffy-tool 0.1.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/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "scaffy-tool",
3
+ "type": "commonjs",
4
+ "version": "0.1.1",
5
+ "description": "One command. Any framework. Ready to code.",
6
+ "author": "Md Tanvir Hossen <tanvirhossen112@gmail.com>",
7
+ "license": "MIT",
8
+ "main": "cli.js",
9
+ "bin": {
10
+ "scaffy": "cli.js"
11
+ },
12
+ "engines": {
13
+ "node": ">=18.0.0"
14
+ },
15
+ "keywords": [
16
+ "scaffolding",
17
+ "cli",
18
+ "laravel",
19
+ "nestjs",
20
+ "vuejs",
21
+ "django",
22
+ "framework",
23
+ "generator",
24
+ "boilerplate",
25
+ "project-setup"
26
+ ],
27
+ "files": [
28
+ "cli.js",
29
+ "core/",
30
+ "registry/",
31
+ "!core/tests/",
32
+ "!registry/**/tests/"
33
+ ],
34
+ "homepage": "https://github.com/TanvirHossen112/scaffy",
35
+ "bugs": {
36
+ "url": "https://github.com/TanvirHossen112/scaffy/issues"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/TanvirHossen112/scaffy.git"
41
+ },
42
+ "scripts": {
43
+ "start": "node cli.js",
44
+ "test": "jest",
45
+ "test:watch": "jest --watch",
46
+ "test:coverage": "jest --coverage",
47
+ "test:ci": "jest --coverage --ci --runInBand",
48
+ "lint": "eslint .",
49
+ "lint:fix": "eslint . --fix",
50
+ "format": "prettier --write .",
51
+ "format:check": "prettier --check .",
52
+ "prepare": "husky install"
53
+ },
54
+ "dependencies": {
55
+ "chalk": "^4.1.2",
56
+ "commander": "^11.1.0",
57
+ "figlet": "^1.10.0",
58
+ "inquirer": "^8.2.6",
59
+ "ora": "^5.4.1",
60
+ "semver": "^7.7.4"
61
+ },
62
+ "devDependencies": {
63
+ "@jest/globals": "^30.2.0",
64
+ "eslint": "^8.57.1",
65
+ "eslint-config-prettier": "^10.1.8",
66
+ "eslint-plugin-node": "^11.1.0",
67
+ "husky": "^8.0.3",
68
+ "jest": "^29.7.0",
69
+ "lint-staged": "^15.5.2",
70
+ "prettier": "^3.8.1"
71
+ },
72
+ "lint-staged": {
73
+ "!(jest.config).js": [
74
+ "eslint --fix",
75
+ "prettier --write",
76
+ "jest --bail --findRelatedTests"
77
+ ],
78
+ "*.json": [
79
+ "prettier --write"
80
+ ]
81
+ }
82
+ }
@@ -0,0 +1,85 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "frameworks": [
4
+ {
5
+ "name": "Laravel",
6
+ "alias": ["laravel"],
7
+ "language": "php",
8
+ "latest": "v11",
9
+ "versions": ["v11", "v10"],
10
+ "path": "php/laravel"
11
+ },
12
+ {
13
+ "name": "Symfony",
14
+ "alias": ["symfony"],
15
+ "language": "php",
16
+ "latest": "v7",
17
+ "versions": ["v7"],
18
+ "path": "php/symfony"
19
+ },
20
+ {
21
+ "name": "NestJS",
22
+ "alias": ["nestjs", "nest"],
23
+ "language": "javascript",
24
+ "latest": "v10",
25
+ "versions": ["v10"],
26
+ "path": "javascript/nestjs"
27
+ },
28
+ {
29
+ "name": "VueJS",
30
+ "alias": ["vue", "vuejs"],
31
+ "language": "javascript",
32
+ "latest": "v3",
33
+ "versions": ["v3"],
34
+ "path": "javascript/vuejs"
35
+ },
36
+ {
37
+ "name": "NextJS",
38
+ "alias": ["next", "nextjs"],
39
+ "language": "javascript",
40
+ "latest": "v14",
41
+ "versions": ["v14"],
42
+ "path": "javascript/nextjs"
43
+ },
44
+ {
45
+ "name": "ExpressJS",
46
+ "alias": ["express", "expressjs"],
47
+ "language": "javascript",
48
+ "latest": "v4",
49
+ "versions": ["v4"],
50
+ "path": "javascript/expressjs"
51
+ },
52
+ {
53
+ "name": "Django",
54
+ "alias": ["django"],
55
+ "language": "python",
56
+ "latest": "v5",
57
+ "versions": ["v5"],
58
+ "path": "python/django"
59
+ },
60
+ {
61
+ "name": "FastAPI",
62
+ "alias": ["fastapi"],
63
+ "language": "python",
64
+ "latest": "v0",
65
+ "versions": ["v0"],
66
+ "path": "python/fastapi"
67
+ },
68
+ {
69
+ "name": "Flask",
70
+ "alias": ["flask"],
71
+ "language": "python",
72
+ "latest": "v3",
73
+ "versions": ["v3"],
74
+ "path": "python/flask"
75
+ },
76
+ {
77
+ "name": "Gin",
78
+ "alias": ["gin"],
79
+ "language": "go",
80
+ "latest": "v1",
81
+ "versions": ["v1"],
82
+ "path": "go/gin"
83
+ }
84
+ ]
85
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "NestJS",
3
+ "alias": ["nestjs", "nest"],
4
+ "language": "javascript",
5
+ "latest": "v10",
6
+ "versions": ["v10"],
7
+ "description": "A progressive Node.js framework for building efficient and scalable server-side applications",
8
+ "requires": [
9
+ {
10
+ "tool": "node",
11
+ "checkCommand": "node --version",
12
+ "parseVersion": "v([0-9.]+)",
13
+ "minVersion": "16.0.0",
14
+ "installGuide": {
15
+ "mac": "brew install node",
16
+ "linux": "sudo apt install nodejs npm",
17
+ "windows": "https://nodejs.org/en/download",
18
+ "docs": "https://nodejs.org"
19
+ }
20
+ }
21
+ ],
22
+ "packageManagerQuestion": {
23
+ "tool": "packageManager",
24
+ "message": "Package manager:",
25
+ "choices": [
26
+ {
27
+ "name": "npm",
28
+ "value": "npm",
29
+ "checkCommand": "npm --version"
30
+ },
31
+ {
32
+ "name": "yarn",
33
+ "value": "yarn",
34
+ "checkCommand": "yarn --version"
35
+ },
36
+ {
37
+ "name": "pnpm",
38
+ "value": "pnpm",
39
+ "checkCommand": "pnpm --version"
40
+ }
41
+ ]
42
+ },
43
+ "maintainer": "community"
44
+ }
@@ -0,0 +1,59 @@
1
+ const { detectAvailableChoices } = require('../../../../core/detector');
2
+ const pluginMeta = require('../plugin.json');
3
+
4
+ module.exports = async () => {
5
+ const availableManagers = await detectAvailableChoices(
6
+ pluginMeta.packageManagerQuestion.choices
7
+ );
8
+
9
+ return [
10
+ {
11
+ type: 'input',
12
+ name: 'projectName',
13
+ message: 'Project name:',
14
+ default: 'my-nest-app',
15
+ validate: input => {
16
+ if (!input.trim()) return 'Project name is required';
17
+ if (!/^[a-z0-9-_]+$/.test(input)) {
18
+ return 'Only lowercase letters, numbers, hyphens and underscores';
19
+ }
20
+ return true;
21
+ },
22
+ },
23
+ {
24
+ type: 'list',
25
+ name: 'packageManager',
26
+ message: pluginMeta.packageManagerQuestion.message,
27
+ choices: availableManagers.map(m => ({
28
+ name: m.name,
29
+ value: m.value,
30
+ })),
31
+ default: availableManagers[0].value,
32
+ },
33
+ {
34
+ type: 'list',
35
+ name: 'database',
36
+ message: 'Database:',
37
+ choices: [
38
+ { name: 'None', value: 'none' },
39
+ { name: 'PostgreSQL (TypeORM)', value: 'postgres' },
40
+ { name: 'MySQL (TypeORM)', value: 'mysql' },
41
+ { name: 'MongoDB (Mongoose)', value: 'mongodb' },
42
+ { name: 'SQLite (TypeORM)', value: 'sqlite' },
43
+ ],
44
+ default: 'none',
45
+ },
46
+ {
47
+ type: 'confirm',
48
+ name: 'auth',
49
+ message: 'Add JWT authentication (Passport)?',
50
+ default: false,
51
+ },
52
+ {
53
+ type: 'confirm',
54
+ name: 'docker',
55
+ message: 'Add Dockerfile?',
56
+ default: false,
57
+ },
58
+ ];
59
+ };
@@ -0,0 +1,94 @@
1
+ module.exports = async (answers, utils) => {
2
+ const { projectName, packageManager, database, auth, docker } = answers;
3
+
4
+ // ─── Step 1 — Install NestJS CLI + Create Project ──
5
+ utils.title('Creating NestJS v10 Project');
6
+ utils.step(1, `Scaffolding ${projectName}...`);
7
+
8
+ await utils.run(
9
+ `npx @nestjs/cli@10 new ${projectName} --package-manager ${packageManager} --skip-git`
10
+ );
11
+
12
+ // ─── Step 2 — Database ────────────────────────────
13
+ if (database !== 'none') {
14
+ utils.step(2, `Installing ${database} database packages...`);
15
+
16
+ if (database === 'mongodb') {
17
+ await utils.runInProject(
18
+ projectName,
19
+ `${packageManager} ${packageManager === 'yarn' ? 'add' : 'install'} @nestjs/mongoose mongoose`
20
+ );
21
+ } else {
22
+ // TypeORM based (postgres, mysql, sqlite)
23
+ const dbDriver = {
24
+ postgres: 'pg',
25
+ mysql: 'mysql2',
26
+ sqlite: 'sqlite3',
27
+ };
28
+
29
+ await utils.runInProject(
30
+ projectName,
31
+ `${packageManager} ${packageManager === 'yarn' ? 'add' : 'install'} @nestjs/typeorm typeorm ${dbDriver[database]}`
32
+ );
33
+ }
34
+ }
35
+
36
+ // ─── Step 3 — Auth ────────────────────────────────
37
+ if (auth) {
38
+ utils.step(3, 'Installing Passport JWT authentication...');
39
+ await utils.runInProject(
40
+ projectName,
41
+ `${packageManager} ${packageManager === 'yarn' ? 'add' : 'install'} @nestjs/passport passport passport-jwt @nestjs/jwt`
42
+ );
43
+ await utils.runInProject(
44
+ projectName,
45
+ `${packageManager} ${packageManager === 'yarn' ? 'add' : 'install'} -D @types/passport-jwt`
46
+ );
47
+ }
48
+
49
+ // ─── Step 4 — Docker ──────────────────────────────
50
+ if (docker) {
51
+ utils.step(4, 'Adding Dockerfile...');
52
+
53
+ await utils.createFile(
54
+ `${projectName}/Dockerfile`,
55
+ `FROM node:20-alpine AS builder
56
+ WORKDIR /app
57
+ COPY package*.json ./
58
+ RUN npm ci
59
+ COPY . .
60
+ RUN npm run build
61
+
62
+ FROM node:20-alpine AS production
63
+ WORKDIR /app
64
+ COPY package*.json ./
65
+ RUN npm ci --only=production
66
+ COPY --from=builder /app/dist ./dist
67
+ EXPOSE 3000
68
+ CMD ["node", "dist/main"]
69
+ `
70
+ );
71
+
72
+ await utils.createFile(
73
+ `${projectName}/.dockerignore`,
74
+ `node_modules
75
+ dist
76
+ .git
77
+ .env
78
+ `
79
+ );
80
+ }
81
+
82
+ // ─── Done ─────────────────────────────────────────
83
+ utils.success(`✅ NestJS v10 project ready!`);
84
+ utils.log(` cd ${projectName}`);
85
+
86
+ if (docker) {
87
+ utils.log(` docker build -t ${projectName} .`);
88
+ utils.log(` docker run -p 3000:3000 ${projectName}`);
89
+ } else {
90
+ utils.log(` ${packageManager} run start:dev`);
91
+ }
92
+
93
+ utils.log('');
94
+ };
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "VueJS",
3
+ "alias": ["vue", "vuejs"],
4
+ "language": "javascript",
5
+ "latest": "v3",
6
+ "versions": ["v3"],
7
+ "description": "The progressive JavaScript framework for building user interfaces",
8
+ "requires": [
9
+ {
10
+ "tool": "node",
11
+ "checkCommand": "node --version",
12
+ "parseVersion": "v([0-9.]+)",
13
+ "minVersion": "18.0.0",
14
+ "installGuide": {
15
+ "mac": "brew install node",
16
+ "linux": "sudo apt install nodejs npm",
17
+ "windows": "https://nodejs.org/en/download",
18
+ "docs": "https://nodejs.org"
19
+ }
20
+ }
21
+ ],
22
+ "packageManagerQuestion": {
23
+ "tool": "packageManager",
24
+ "message": "Package manager:",
25
+ "choices": [
26
+ {
27
+ "name": "npm",
28
+ "value": "npm",
29
+ "checkCommand": "npm --version"
30
+ },
31
+ {
32
+ "name": "yarn",
33
+ "value": "yarn",
34
+ "checkCommand": "yarn --version"
35
+ },
36
+ {
37
+ "name": "pnpm",
38
+ "value": "pnpm",
39
+ "checkCommand": "pnpm --version"
40
+ }
41
+ ]
42
+ },
43
+ "maintainer": "community"
44
+ }
@@ -0,0 +1,64 @@
1
+ const { detectAvailableChoices } = require('../../../../core/detector');
2
+ const pluginMeta = require('../plugin.json');
3
+
4
+ module.exports = async () => {
5
+ const availableManagers = await detectAvailableChoices(
6
+ pluginMeta.packageManagerQuestion.choices
7
+ );
8
+
9
+ return [
10
+ {
11
+ type: 'input',
12
+ name: 'projectName',
13
+ message: 'Project name:',
14
+ default: 'my-vue-app',
15
+ validate: input => {
16
+ if (!input.trim()) return 'Project name is required';
17
+ if (!/^[a-z0-9-_]+$/.test(input)) {
18
+ return 'Only lowercase letters, numbers, hyphens and underscores';
19
+ }
20
+ return true;
21
+ },
22
+ },
23
+ {
24
+ type: 'list',
25
+ name: 'packageManager',
26
+ message: pluginMeta.packageManagerQuestion.message,
27
+ choices: availableManagers.map(m => ({
28
+ name: m.name,
29
+ value: m.value,
30
+ })),
31
+ default: availableManagers[0].value,
32
+ },
33
+ {
34
+ type: 'confirm',
35
+ name: 'router',
36
+ message: 'Add Vue Router?',
37
+ default: true,
38
+ },
39
+ {
40
+ type: 'confirm',
41
+ name: 'pinia',
42
+ message: 'Add Pinia (state management)?',
43
+ default: true,
44
+ },
45
+ {
46
+ type: 'confirm',
47
+ name: 'vitest',
48
+ message: 'Add Vitest (unit testing)?',
49
+ default: false,
50
+ },
51
+ {
52
+ type: 'confirm',
53
+ name: 'typescript',
54
+ message: 'Add TypeScript?',
55
+ default: false,
56
+ },
57
+ {
58
+ type: 'confirm',
59
+ name: 'eslint',
60
+ message: 'Add ESLint?',
61
+ default: true,
62
+ },
63
+ ];
64
+ };
@@ -0,0 +1,53 @@
1
+ module.exports = async (answers, utils) => {
2
+ const {
3
+ projectName,
4
+ packageManager,
5
+ router,
6
+ pinia,
7
+ vitest,
8
+ typescript,
9
+ eslint,
10
+ } = answers;
11
+
12
+ // ─── Step 1 — Build create-vue flags ──────────────
13
+ utils.title('Creating VueJS v3 Project');
14
+ utils.step(1, `Scaffolding ${projectName}...`);
15
+
16
+ const flags = [
17
+ router ? '--router' : '--no-router',
18
+ pinia ? '--pinia' : '--no-pinia',
19
+ typescript ? '--typescript' : '--no-typescript',
20
+ eslint ? '--eslint' : '--no-eslint',
21
+ ].join(' ');
22
+
23
+ await utils.run(`npx create-vue@3 ${projectName} ${flags}`);
24
+
25
+ // ─── Step 2 — Install Dependencies ────────────────
26
+ utils.step(2, 'Installing dependencies...');
27
+
28
+ const installCmd =
29
+ packageManager === 'yarn'
30
+ ? 'yarn'
31
+ : packageManager === 'pnpm'
32
+ ? 'pnpm install'
33
+ : 'npm install';
34
+
35
+ await utils.runInProject(projectName, installCmd);
36
+
37
+ // ─── Step 3 — TypeScript extras ───────────────────
38
+ if (typescript) {
39
+ utils.step(3, 'Configuring TypeScript...');
40
+ await utils.runInProject(
41
+ projectName,
42
+ `${packageManager === 'yarn' ? 'yarn add' : packageManager + ' install'} -D vue-tsc`
43
+ );
44
+ }
45
+
46
+ // ─── Done ─────────────────────────────────────────
47
+ utils.success(`✅ VueJS v3 project ready!`);
48
+ utils.log(` cd ${projectName}`);
49
+ utils.log(
50
+ ` ${packageManager === 'yarn' ? 'yarn' : packageManager + ' run'} dev`
51
+ );
52
+ utils.log('');
53
+ };
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "Laravel",
3
+ "alias": ["laravel"],
4
+ "language": "php",
5
+ "latest": "v11",
6
+ "versions": ["v11", "v10"],
7
+ "description": "The PHP Framework for Web Artisans",
8
+ "requires": [
9
+ {
10
+ "tool": "php",
11
+ "checkCommand": "php --version",
12
+ "parseVersion": "PHP ([0-9.]+)",
13
+ "minVersion": "8.2.0",
14
+ "installGuide": {
15
+ "mac": "brew install php",
16
+ "linux": "sudo apt install php8.2",
17
+ "windows": "https://windows.php.net/download",
18
+ "docs": "https://www.php.net"
19
+ }
20
+ },
21
+ {
22
+ "tool": "composer",
23
+ "checkCommand": "composer --version",
24
+ "parseVersion": "Composer version ([0-9.]+)",
25
+ "installGuide": {
26
+ "mac": "brew install composer",
27
+ "linux": "sudo apt install composer",
28
+ "windows": "https://getcomposer.org/Composer-Setup.exe",
29
+ "docs": "https://getcomposer.org"
30
+ }
31
+ }
32
+ ],
33
+ "maintainer": "community"
34
+ }
@@ -0,0 +1,44 @@
1
+ module.exports = [
2
+ {
3
+ type: 'input',
4
+ name: 'projectName',
5
+ message: 'Project name:',
6
+ default: 'my-laravel-app',
7
+ validate: input => {
8
+ if (!input.trim()) return 'Project name is required';
9
+ if (!/^[a-z0-9-_]+$/.test(input)) {
10
+ return 'Only lowercase letters, numbers, hyphens and underscores';
11
+ }
12
+ return true;
13
+ },
14
+ },
15
+ {
16
+ type: 'list',
17
+ name: 'starterKit',
18
+ message: 'Starter kit:',
19
+ choices: [
20
+ { name: 'None', value: 'none' },
21
+ { name: 'Breeze (lightweight auth)', value: 'breeze' },
22
+ { name: 'Jetstream (full featured auth)', value: 'jetstream' },
23
+ ],
24
+ default: 'none',
25
+ },
26
+ {
27
+ type: 'list',
28
+ name: 'database',
29
+ message: 'Database:',
30
+ choices: [
31
+ { name: 'SQLite (default)', value: 'sqlite' },
32
+ { name: 'MySQL', value: 'mysql' },
33
+ { name: 'PostgreSQL', value: 'pgsql' },
34
+ { name: 'SQL Server', value: 'sqlsrv' },
35
+ ],
36
+ default: 'sqlite',
37
+ },
38
+ {
39
+ type: 'confirm',
40
+ name: 'docker',
41
+ message: 'Add Laravel Sail (Docker)?',
42
+ default: false,
43
+ },
44
+ ];
@@ -0,0 +1,74 @@
1
+ module.exports = async (answers, utils) => {
2
+ const { projectName, starterKit, database, docker } = answers;
3
+
4
+ // ─── Step 1 — Create Laravel Project ──────────────
5
+ utils.title('Creating Laravel v11 Project');
6
+ utils.step(1, `Scaffolding ${projectName}...`);
7
+
8
+ await utils.run(
9
+ `composer create-project laravel/laravel:^11.0 ${projectName}`
10
+ );
11
+
12
+ // ─── Step 2 — Configure Database ──────────────────
13
+ utils.step(2, `Configuring ${database} database...`);
14
+
15
+ await utils.setEnv(projectName, {
16
+ DB_CONNECTION: database,
17
+ APP_NAME: projectName,
18
+ });
19
+
20
+ // ─── Step 3 — Generate App Key ─────────────────────
21
+ utils.step(3, 'Generating application key...');
22
+ await utils.runInProject(projectName, 'php artisan key:generate');
23
+
24
+ // ─── Step 4 — Starter Kit ─────────────────────────
25
+ if (starterKit === 'breeze') {
26
+ utils.step(4, 'Installing Laravel Breeze...');
27
+ await utils.runInProject(
28
+ projectName,
29
+ 'composer require laravel/breeze --dev'
30
+ );
31
+ await utils.runInProject(
32
+ projectName,
33
+ 'php artisan breeze:install blade --quiet'
34
+ );
35
+ await utils.runInProject(projectName, 'npm install');
36
+ await utils.runInProject(projectName, 'npm run build');
37
+ }
38
+
39
+ if (starterKit === 'jetstream') {
40
+ utils.step(4, 'Installing Laravel Jetstream...');
41
+ await utils.runInProject(projectName, 'composer require laravel/jetstream');
42
+ await utils.runInProject(
43
+ projectName,
44
+ 'php artisan jetstream:install livewire'
45
+ );
46
+ await utils.runInProject(projectName, 'npm install');
47
+ await utils.runInProject(projectName, 'npm run build');
48
+ }
49
+
50
+ // ─── Step 5 — Docker / Sail ───────────────────────
51
+ if (docker) {
52
+ utils.step(5, 'Installing Laravel Sail...');
53
+ await utils.runInProject(
54
+ projectName,
55
+ 'composer require laravel/sail --dev'
56
+ );
57
+ await utils.runInProject(
58
+ projectName,
59
+ 'php artisan sail:install --with=mysql,redis'
60
+ );
61
+ }
62
+
63
+ // ─── Done ─────────────────────────────────────────
64
+ utils.success(`✅ Laravel v11 project ready!`);
65
+ utils.log(` cd ${projectName}`);
66
+
67
+ if (docker) {
68
+ utils.log(` ./vendor/bin/sail up`);
69
+ } else {
70
+ utils.log(` php artisan serve`);
71
+ }
72
+
73
+ utils.log('');
74
+ };