create-puck-app 0.12.0-canary.5caf0ab → 0.12.0-canary.889b4c7
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +16 -14
- package/package.json +1 -1
- package/templates/gitignore +3 -3
- package/templates/next/app/layout.tsx +1 -1
- package/templates/next/database.json +1 -0
- package/templates/next/gitignore +0 -2
package/index.js
CHANGED
@@ -103,7 +103,7 @@ program
|
|
103
103
|
return;
|
104
104
|
}
|
105
105
|
|
106
|
-
|
106
|
+
fs.mkdirSync(appName);
|
107
107
|
|
108
108
|
const packageManager = !!options.useNpm
|
109
109
|
? "npm"
|
@@ -130,7 +130,7 @@ program
|
|
130
130
|
let data;
|
131
131
|
|
132
132
|
if (path.extname(filePath) === ".hbs") {
|
133
|
-
const templateString =
|
133
|
+
const templateString = fs.readFileSync(filePath, "utf-8");
|
134
134
|
|
135
135
|
const template = Handlebars.compile(templateString);
|
136
136
|
data = template({
|
@@ -139,14 +139,14 @@ program
|
|
139
139
|
puckVersion: `^${packageJson.version}`,
|
140
140
|
});
|
141
141
|
} else {
|
142
|
-
data =
|
142
|
+
data = fs.readFileSync(filePath, "utf-8");
|
143
143
|
}
|
144
144
|
|
145
145
|
const dir = path.dirname(targetPath);
|
146
146
|
|
147
|
-
|
147
|
+
fs.mkdirSync(dir, { recursive: true });
|
148
148
|
|
149
|
-
|
149
|
+
fs.writeFileSync(targetPath, data);
|
150
150
|
}
|
151
151
|
|
152
152
|
if (packageManager === "yarn") {
|
@@ -159,22 +159,24 @@ program
|
|
159
159
|
|
160
160
|
try {
|
161
161
|
inGitRepo =
|
162
|
-
execSync("git status", {
|
163
|
-
cwd: appPath,
|
164
|
-
})
|
162
|
+
execSync("git status", { cwd: appPath })
|
165
163
|
.toString()
|
166
164
|
.indexOf("fatal:") !== 0;
|
167
165
|
} catch {}
|
168
166
|
|
169
167
|
// Only commit if this is a new repo
|
170
168
|
if (!inGitRepo) {
|
171
|
-
|
169
|
+
try {
|
170
|
+
execSync("git init", { cwd: appPath, stdio: "inherit" });
|
172
171
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
172
|
+
execSync("git add .", { cwd: appPath, stdio: "inherit" });
|
173
|
+
execSync('git commit -m "build(puck): generate app"', {
|
174
|
+
cwd: appPath,
|
175
|
+
stdio: "inherit",
|
176
|
+
});
|
177
|
+
} catch (error) {
|
178
|
+
console.log("Failed to commit git changes");
|
179
|
+
}
|
178
180
|
}
|
179
181
|
})
|
180
182
|
.parse(process.argv);
|
package/package.json
CHANGED
package/templates/gitignore
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"/":{"content":[{"type":"HeadingBlock","props":{"title":"Edit this page by adding /edit to the end of the URL","id":"HeadingBlock-1694032984497"}}],"root":{"title":""}}}
|