shipd 0.1.0 → 0.1.2

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/dist/index.js +27 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -91,22 +91,46 @@ import { fileURLToPath } from "url";
91
91
  var __filename = fileURLToPath(import.meta.url);
92
92
  var __dirname2 = dirname(__filename);
93
93
  function getTemplatePath() {
94
+ const triedPaths = [];
95
+ const bundledPath = resolve2(__dirname2, "../template");
96
+ triedPaths.push(bundledPath);
97
+ if (existsSync2(bundledPath)) {
98
+ return bundledPath;
99
+ }
94
100
  const distPath = resolve2(__dirname2, "../../template");
101
+ triedPaths.push(distPath);
95
102
  if (existsSync2(distPath)) {
96
103
  return distPath;
97
104
  }
98
105
  const srcPath = resolve2(__dirname2, "../../../template");
106
+ triedPaths.push(srcPath);
99
107
  if (existsSync2(srcPath)) {
100
108
  return srcPath;
101
109
  }
110
+ let currentDir = __dirname2;
111
+ for (let i = 0; i < 10; i++) {
112
+ const pkgJsonPath = join(currentDir, "package.json");
113
+ if (existsSync2(pkgJsonPath)) {
114
+ const templatePath = join(currentDir, "template");
115
+ triedPaths.push(templatePath);
116
+ if (existsSync2(templatePath)) {
117
+ return templatePath;
118
+ }
119
+ break;
120
+ }
121
+ const parentDir = resolve2(currentDir, "..");
122
+ if (parentDir === currentDir) {
123
+ break;
124
+ }
125
+ currentDir = parentDir;
126
+ }
102
127
  const absolutePath = resolve2(__dirname2, "../../../../packages/template");
128
+ triedPaths.push(absolutePath);
103
129
  if (existsSync2(absolutePath)) {
104
130
  return absolutePath;
105
131
  }
106
132
  throw new Error(`Template directory not found. Tried paths:
107
- - ${distPath}
108
- - ${srcPath}
109
- - ${absolutePath}`);
133
+ ${triedPaths.map((p) => ` - ${p}`).join("\n")}`);
110
134
  }
111
135
  async function loadTemplateConfig() {
112
136
  const templatePath = getTemplatePath();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shipd",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Generate production-ready SaaS applications with authentication, billing, and more",
5
5
  "type": "module",
6
6
  "bin": {