vtasks-automate-cli 0.4.6 → 0.4.8
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/init.js +27 -9
- package/package.json +1 -1
package/init.js
CHANGED
|
@@ -185,7 +185,9 @@ const main = async () => {
|
|
|
185
185
|
|
|
186
186
|
echo -e "\e[34mSwitching current branch\e[0m"
|
|
187
187
|
node ./vTasks/index.js`;
|
|
188
|
+
console.log(LOG_COLORS.GREEN, "vTasks config file added");
|
|
188
189
|
fs.writeFileSync(archivoConfig, configContent);
|
|
190
|
+
console.log(LOG_COLORS.GREEN, "Post-checkout hook added");
|
|
189
191
|
fs.writeFileSync(postCommitFile, postCommitContent);
|
|
190
192
|
|
|
191
193
|
if (fs.existsSync(gitIgnoreFile)) {
|
|
@@ -195,6 +197,7 @@ node ./vTasks/index.js`;
|
|
|
195
197
|
gitIgnoreContent += "#vTasks config\n";
|
|
196
198
|
gitIgnoreContent += "vTasks/config.js\n";
|
|
197
199
|
fs.writeFileSync(gitIgnoreFile, gitIgnoreContent);
|
|
200
|
+
console.log(LOG_COLORS.GREEN, "vTasks config added to .gitignore file");
|
|
198
201
|
} else {
|
|
199
202
|
console.log(LOG_COLORS.YELLOW, ".gitignore file not found");
|
|
200
203
|
}
|
|
@@ -203,9 +206,14 @@ node ./vTasks/index.js`;
|
|
|
203
206
|
const packagePath = path.join(reactPath, PKJSON);
|
|
204
207
|
let packageContent = fs.readFileSync(packagePath, "utf-8");
|
|
205
208
|
const oldCmd = getCmdContent(packageContent, "start");
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
+
if (oldCmd) {
|
|
210
|
+
const newCmd = `node ../vTasks/index.js && ${oldCmd}`;
|
|
211
|
+
const newContent = packageContent.replace(oldCmd, newCmd);
|
|
212
|
+
fs.writeFileSync(packagePath, newContent);
|
|
213
|
+
console.log(LOG_COLORS.GREEN, "React app start script modified");
|
|
214
|
+
} else {
|
|
215
|
+
console.log(LOG_COLORS.YELLOW, "React app start script not found");
|
|
216
|
+
}
|
|
209
217
|
} else {
|
|
210
218
|
console.log(LOG_COLORS.YELLOW, "React app not found");
|
|
211
219
|
}
|
|
@@ -213,9 +221,14 @@ node ./vTasks/index.js`;
|
|
|
213
221
|
const packagePath = path.join(nextPath, PKJSON);
|
|
214
222
|
let packageContent = fs.readFileSync(packagePath, "utf-8");
|
|
215
223
|
const oldCmd = getCmdContent(packageContent, "dev");
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
224
|
+
if (oldCmd) {
|
|
225
|
+
const newCmd = `node ../vTasks/index.js && ${oldCmd}`;
|
|
226
|
+
const newContent = packageContent.replace(oldCmd, newCmd);
|
|
227
|
+
fs.writeFileSync(packagePath, newContent);
|
|
228
|
+
console.log(LOG_COLORS.GREEN, "Next app dev script modified");
|
|
229
|
+
} else {
|
|
230
|
+
console.log(LOG_COLORS.YELLOW, "Next app dev script not found");
|
|
231
|
+
}
|
|
219
232
|
} else {
|
|
220
233
|
console.log(LOG_COLORS.YELLOW, "Next app not found");
|
|
221
234
|
}
|
|
@@ -223,9 +236,14 @@ node ./vTasks/index.js`;
|
|
|
223
236
|
const packagePath = path.join(serverPath, PKJSON);
|
|
224
237
|
let packageContent = fs.readFileSync(packagePath, "utf-8");
|
|
225
238
|
const oldCmd = getCmdContent(packageContent, "start");
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
239
|
+
if (oldCmd) {
|
|
240
|
+
const newCmd = `node ../vTasks/index.js && ${oldCmd}`;
|
|
241
|
+
const newContent = packageContent.replace(oldCmd, newCmd);
|
|
242
|
+
fs.writeFileSync(packagePath, newContent);
|
|
243
|
+
console.log(LOG_COLORS.GREEN, "Server app start script modified");
|
|
244
|
+
} else {
|
|
245
|
+
console.log(LOG_COLORS.YELLOW, "Server app start script not found");
|
|
246
|
+
}
|
|
229
247
|
} else {
|
|
230
248
|
console.log(LOG_COLORS.YELLOW, "Server app not found");
|
|
231
249
|
}
|