vtasks-automate-cli 0.2.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.
Files changed (2) hide show
  1. package/init.js +19 -0
  2. package/package.json +1 -1
package/init.js CHANGED
@@ -19,6 +19,8 @@ class ApiHelpers {
19
19
  }
20
20
  }
21
21
 
22
+ const VTASKS_CONFIG_URL = "http://localhost:3040/project/action/track";
23
+
22
24
  const LOG_COLORS = {
23
25
  RED: "\x1b[31m",
24
26
  GREEN: "\x1b[32m",
@@ -111,8 +113,13 @@ const main = async () => {
111
113
  const __dirname = dirname(__filename);
112
114
 
113
115
  const carpetaDestino = path.join(process.cwd(), "vTasks");
116
+ const githooksFolder = path.join(process.cwd(), ".githooks");
117
+
114
118
  const archivoOrigen = path.join(__dirname, "content", "index.js");
115
119
  const archivoDestino = path.join(carpetaDestino, "index.js");
120
+ const archivoConfig = path.join(carpetaDestino, "config.js");
121
+ const postCommitFile = path.join(githooksFolder, "post-checkout");
122
+
116
123
  if (fs.existsSync(carpetaDestino)) {
117
124
  console.error(LOG_COLORS.RED, "Error: vTasks directory already exist");
118
125
  process.exit(1);
@@ -120,6 +127,18 @@ const main = async () => {
120
127
  fs.mkdirSync(carpetaDestino, { recursive: true });
121
128
  fs.copyFileSync(archivoOrigen, archivoDestino);
122
129
 
130
+ const configContent = `module.exports = {
131
+ projectName: '${projectName}',
132
+ vTasksUrl: '${VTASKS_CONFIG_URL}'
133
+ };
134
+ `;
135
+ const postCommitContent = `#!/bin/bash
136
+
137
+ echo -e "\e[34mSwitching current branch\e[0m"
138
+ node ./vTasks/index.js`;
139
+ fs.writeFileSync(archivoConfig, configContent);
140
+ fs.writeFileSync(postCommitFile, postCommitContent);
141
+
123
142
  console.log(LOG_COLORS.GREEN, "Set Up completed ✓");
124
143
  };
125
144
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vtasks-automate-cli",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Automate your vTasks workflow with ease — move tasks between states without opening the app",
5
5
  "bin": {
6
6
  "vtasks-automate": "init.js"