create-fullstack-boilerplate 2.0.0 → 2.1.0

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.
Files changed (2) hide show
  1. package/index.js +25 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  (async () => {
4
4
  const argv = process.argv.slice(2);
@@ -25,11 +25,34 @@
25
25
 
26
26
  const fs = require("fs-extra");
27
27
 
28
+
29
+ // Resolve template folder dynamically
30
+ let templateDir;
31
+
32
+ // Try __dirname first (works for local/dev)
33
+ const localTemplate = path.join(__dirname, "template");
34
+ if (fs.existsSync(localTemplate)) {
35
+ templateDir = localTemplate;
36
+ } else {
37
+ // Fallback for npx (temp folder)
38
+ const pkg = require.resolve("create-fullstack-boilerplate/package.json");
39
+ templateDir = path.join(path.dirname(pkg), "template");
40
+ }
41
+
42
+ if (!fs.existsSync(templateDir)) {
43
+ throw new Error(
44
+ "Template folder not found! Make sure it is included in package.json 'files' and published."
45
+ );
46
+ }
47
+
48
+ console.log("Using template folder:", templateDir);
49
+
50
+
28
51
  try {
29
52
  console.log("\nšŸŽ›ļø Setting Up Full Stack Project...\n");
30
53
 
31
54
  const answers = await mainPrompts();
32
- const templateDir = path.join(__dirname, "template");
55
+ // const templateDir = path.join(__dirname, "template");
33
56
  const targetDir = path.join(process.cwd(), answers.projectName);
34
57
 
35
58
  await copyProject(templateDir, targetDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fullstack-boilerplate",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "A Full Stack Application Comprised of React for Frontend, Express & Sequelize with Node js for Backend to help developers get started on real implementation instead of spending time setting up projects.",
5
5
  "main": "index.js",
6
6
  "bin": {