@erwininteractive/mvc 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/cli.js CHANGED
@@ -9,7 +9,7 @@ const program = new commander_1.Command();
9
9
  program
10
10
  .name("erwinmvc")
11
11
  .description("CLI for @erwininteractive/mvc framework")
12
- .version("0.1.1");
12
+ .version("0.1.3");
13
13
  // Init command - scaffold a new application
14
14
  program
15
15
  .command("init <dir>")
@@ -8,6 +8,17 @@ const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const child_process_1 = require("child_process");
10
10
  const paths_1 = require("./paths");
11
+ // Get version from package.json
12
+ function getFrameworkVersion() {
13
+ try {
14
+ const pkgPath = path_1.default.join((0, paths_1.getPackageRoot)(), "package.json");
15
+ const pkg = JSON.parse(fs_1.default.readFileSync(pkgPath, "utf-8"));
16
+ return pkg.version || "0.1.1";
17
+ }
18
+ catch {
19
+ return "0.1.1";
20
+ }
21
+ }
11
22
  /**
12
23
  * Scaffold a new MVC application.
13
24
  */
@@ -21,21 +32,25 @@ async function initApp(dir, options = {}) {
21
32
  }
22
33
  // Copy app scaffold templates
23
34
  copyDirRecursive(templateDir, targetDir);
24
- // Copy .env.example
25
- const envExample = (0, paths_1.getEnvExamplePath)();
26
- if (fs_1.default.existsSync(envExample)) {
27
- fs_1.default.copyFileSync(envExample, path_1.default.join(targetDir, ".env.example"));
35
+ // Rename dotfiles (npm doesn't publish dotfiles, so we use .txt extensions)
36
+ const renames = [
37
+ ["gitignore.txt", ".gitignore"],
38
+ ["env.example.txt", ".env.example"],
39
+ ];
40
+ for (const [src, dest] of renames) {
41
+ const srcPath = path_1.default.join(targetDir, src);
42
+ const destPath = path_1.default.join(targetDir, dest);
43
+ if (fs_1.default.existsSync(srcPath)) {
44
+ fs_1.default.renameSync(srcPath, destPath);
45
+ }
28
46
  }
29
- // Update package.json with app name and framework path
47
+ // Update package.json with app name and framework version
30
48
  const appPackageJson = path_1.default.join(targetDir, "package.json");
31
49
  if (fs_1.default.existsSync(appPackageJson)) {
32
50
  const pkg = JSON.parse(fs_1.default.readFileSync(appPackageJson, "utf-8"));
33
51
  pkg.name = path_1.default.basename(dir);
34
- // Use relative path to framework for local development
35
- // When published, this would be the npm package version
36
- const frameworkRoot = (0, paths_1.getPackageRoot)();
37
- const relativePath = path_1.default.relative(targetDir, frameworkRoot);
38
- pkg.dependencies["@erwininteractive/mvc"] = `file:${relativePath}`;
52
+ // Use npm package version (not file path)
53
+ pkg.dependencies["@erwininteractive/mvc"] = `^${getFrameworkVersion()}`;
39
54
  fs_1.default.writeFileSync(appPackageJson, JSON.stringify(pkg, null, 2));
40
55
  }
41
56
  console.log("Application scaffolded successfully!");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erwininteractive/mvc",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A lightweight, full-featured MVC framework for Node.js with Express, Prisma, and EJS",
5
5
  "main": "dist/framework/index.js",
6
6
  "types": "dist/framework/index.d.ts",
@@ -0,0 +1,6 @@
1
+ DATABASE_URL="postgresql://USER:PASSWORD@localhost:5432/yourdb?schema=public"
2
+ REDIS_URL="redis://localhost:6379"
3
+ JWT_SECRET="change-me"
4
+ SESSION_SECRET="change-me-session"
5
+ PORT=3000
6
+ NODE_ENV=development
@@ -0,0 +1,8 @@
1
+ node_modules/
2
+ dist/
3
+ .env
4
+ .env.*
5
+ !.env.example
6
+ coverage/
7
+ npm-debug.log*
8
+ .DS_Store