vtasks-automate-cli 0.3.0 → 0.4.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.
- package/init.js +9 -0
- package/package.json +1 -1
package/init.js
CHANGED
|
@@ -113,9 +113,13 @@ const main = async () => {
|
|
|
113
113
|
const __dirname = dirname(__filename);
|
|
114
114
|
|
|
115
115
|
const carpetaDestino = path.join(process.cwd(), "vTasks");
|
|
116
|
+
const githooksFolder = path.join(process.cwd(), ".githooks");
|
|
117
|
+
|
|
116
118
|
const archivoOrigen = path.join(__dirname, "content", "index.js");
|
|
117
119
|
const archivoDestino = path.join(carpetaDestino, "index.js");
|
|
118
120
|
const archivoConfig = path.join(carpetaDestino, "config.js");
|
|
121
|
+
const postCommitFile = path.join(githooksFolder, "post-checkout");
|
|
122
|
+
|
|
119
123
|
if (fs.existsSync(carpetaDestino)) {
|
|
120
124
|
console.error(LOG_COLORS.RED, "Error: vTasks directory already exist");
|
|
121
125
|
process.exit(1);
|
|
@@ -128,7 +132,12 @@ const main = async () => {
|
|
|
128
132
|
vTasksUrl: '${VTASKS_CONFIG_URL}'
|
|
129
133
|
};
|
|
130
134
|
`;
|
|
135
|
+
const postCommitContent = `#!/bin/bash
|
|
136
|
+
|
|
137
|
+
echo -e "\e[34mSwitching current branch\e[0m"
|
|
138
|
+
node ./vTasks/index.js`;
|
|
131
139
|
fs.writeFileSync(archivoConfig, configContent);
|
|
140
|
+
fs.writeFileSync(postCommitFile, postCommitContent);
|
|
132
141
|
|
|
133
142
|
console.log(LOG_COLORS.GREEN, "Set Up completed ✓");
|
|
134
143
|
};
|