shipd 0.1.0 → 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.
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 = [];
94
95
  const distPath = resolve2(__dirname2, "../../template");
96
+ triedPaths.push(distPath);
95
97
  if (existsSync2(distPath)) {
96
98
  return distPath;
97
99
  }
98
100
  const srcPath = resolve2(__dirname2, "../../../template");
101
+ triedPaths.push(srcPath);
99
102
  if (existsSync2(srcPath)) {
100
103
  return srcPath;
101
104
  }
105
+ let currentDir = __dirname2;
106
+ for (let i = 0; i < 10; i++) {
107
+ const pkgJsonPath = join(currentDir, "package.json");
108
+ if (existsSync2(pkgJsonPath)) {
109
+ const templatePath = join(currentDir, "template");
110
+ triedPaths.push(templatePath);
111
+ if (existsSync2(templatePath)) {
112
+ return templatePath;
113
+ }
114
+ const parentTemplatePath = join(resolve2(currentDir, ".."), "template");
115
+ triedPaths.push(parentTemplatePath);
116
+ if (existsSync2(parentTemplatePath)) {
117
+ return parentTemplatePath;
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.1",
4
4
  "description": "Generate production-ready SaaS applications with authentication, billing, and more",
5
5
  "type": "module",
6
6
  "bin": {