valent-pipeline 0.2.11 → 0.2.13
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/package.json +1 -1
- package/src/commands/init.js +19 -0
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -29,6 +29,14 @@ export async function init(options = {}) {
|
|
|
29
29
|
|
|
30
30
|
console.log('\nInitializing valent-pipeline...\n');
|
|
31
31
|
|
|
32
|
+
// 0. Initialize git repo if needed
|
|
33
|
+
if (!existsSync(join(projectRoot, '.git')) && (options.yes || config.init_git)) {
|
|
34
|
+
console.log(' Initializing git repository...');
|
|
35
|
+
const { execSync } = await import('child_process');
|
|
36
|
+
execSync('git init', { cwd: projectRoot, stdio: 'pipe' });
|
|
37
|
+
console.log(' Initialized git repository');
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
// 1. Copy pipeline infrastructure
|
|
33
41
|
const pipelineSrc = join(PACKAGE_ROOT, 'pipeline');
|
|
34
42
|
const pipelineDest = join(projectRoot, '.valent-pipeline');
|
|
@@ -170,6 +178,17 @@ async function runWizard() {
|
|
|
170
178
|
|
|
171
179
|
console.log('\n valent-pipeline init\n');
|
|
172
180
|
|
|
181
|
+
// Git repo check
|
|
182
|
+
if (!existsSync(join(process.cwd(), '.git'))) {
|
|
183
|
+
const { initGit } = await inquirer.prompt([{
|
|
184
|
+
type: 'confirm',
|
|
185
|
+
name: 'initGit',
|
|
186
|
+
message: 'No git repository detected. Initialize one?',
|
|
187
|
+
default: true,
|
|
188
|
+
}]);
|
|
189
|
+
config.init_git = initGit;
|
|
190
|
+
}
|
|
191
|
+
|
|
173
192
|
// Project type
|
|
174
193
|
const { projectType } = await inquirer.prompt([{
|
|
175
194
|
type: 'list',
|