@leverege/build-tools 2.4.9 → 2.5.0-beta.40
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/README.md +0 -1
- package/lib/server/build-tools.js +144 -0
- package/lib/server/getfbcfg.js +25 -0
- package/lib/server/getjson.js +74 -0
- package/lib/server/npm-scripts/postinstall.js +19 -0
- package/lib/server/overwhelm.js +373 -0
- package/lib/server/repo-init/Config.js +45 -0
- package/lib/server/repo-init/RepoInit.js +176 -0
- package/lib/server/repo-init/config.tgz +0 -0
- package/lib/server/repo-init/gitter/Gitter.js +241 -0
- package/lib/server/repo-init/gitter/RepoHosting.js +106 -0
- package/lib/server/repo-init/gitter/index.js +9 -0
- package/lib/server/repo-init/index.js +6 -0
- package/lib/server/repo-init/templates/Templates.js +279 -0
- package/lib/server/repo-init/templates/ToBuildSpec.js +95 -0
- package/lib/server/repo-init/templates/index.js +9 -0
- package/lib/server/repo-init/utils/Shell.js +102 -0
- package/lib/server/repo-init/utils/VersionCheck.js +82 -0
- package/lib/server/repo-init/utils/index.js +67 -0
- package/lib/web/build-tools.js +144 -0
- package/lib/web/getfbcfg.js +25 -0
- package/lib/web/getjson.js +74 -0
- package/lib/web/npm-scripts/postinstall.js +19 -0
- package/lib/web/overwhelm.js +373 -0
- package/package.json +30 -29
- package/src/bash-funcs +61 -0
- package/src/build-tools.js +137 -0
- package/src/{getfbcfg → getfbcfg.js} +7 -6
- package/src/getjson.js +74 -0
- package/src/helmdn +1 -1
- package/src/npm-scripts/postinstall.js +17 -0
- package/src/{overwhelm → overwhelm.js} +83 -83
- package/lib/server/packleate/Packleator.js +0 -280
- package/lib/server/packleate/index.js +0 -98
- package/lib/server/packleate/logo-ansi.js +0 -17
- package/lib/web/packleate/Packleator.js +0 -623
- package/lib/web/packleate/index.js +0 -163
- package/lib/web/packleate/logo-ansi.js +0 -3
- package/src/getjson +0 -48
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
|
|
5
|
+
const cliArgs = require('command-line-args');
|
|
6
|
+
|
|
7
|
+
const cliHelp = require('command-line-usage');
|
|
8
|
+
|
|
9
|
+
const execa = require('execa');
|
|
10
|
+
|
|
11
|
+
const figlet = require('figlet');
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
Config
|
|
15
|
+
} = require('./Config');
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
Gitter
|
|
19
|
+
} = require('./gitter');
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
Templates
|
|
23
|
+
} = require('./templates');
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
clear,
|
|
27
|
+
condir,
|
|
28
|
+
proceed,
|
|
29
|
+
Shell,
|
|
30
|
+
VersionCheck
|
|
31
|
+
} = require('./utils');
|
|
32
|
+
|
|
33
|
+
const thisPackage = require(`${Shell.findRepoRoot()}/package.json`); // eslint-disable-line
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
const thisVersion = thisPackage.version;
|
|
37
|
+
const optionList = [// Use optionList to tie into the Usage statements
|
|
38
|
+
{
|
|
39
|
+
name: 'help',
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
description: 'display this help screen'
|
|
43
|
+
}, {
|
|
44
|
+
name: 'version',
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false,
|
|
47
|
+
description: 'returns the build-tools repo version'
|
|
48
|
+
}, {
|
|
49
|
+
name: 'verbose',
|
|
50
|
+
alias: 'v',
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false,
|
|
53
|
+
description: 'emit additional info at run time'
|
|
54
|
+
}];
|
|
55
|
+
const sections = [{
|
|
56
|
+
header: 'The Leverege Repository Initialization Tool',
|
|
57
|
+
content: `
|
|
58
|
+
Generate something {italic very} important.
|
|
59
|
+
More stuff {blue rawr}
|
|
60
|
+
`
|
|
61
|
+
}, {
|
|
62
|
+
header: 'Options',
|
|
63
|
+
optionList
|
|
64
|
+
}];
|
|
65
|
+
const args = cliArgs(optionList, {
|
|
66
|
+
partial: true
|
|
67
|
+
});
|
|
68
|
+
const help = cliHelp(sections);
|
|
69
|
+
|
|
70
|
+
if (args.version) {
|
|
71
|
+
console.log(`v${thisVersion}`);
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (args.help) {
|
|
76
|
+
console.log(help);
|
|
77
|
+
process.exit(0);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Checks the node and build-tools versions.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
const doVersionChecks = async () => {
|
|
85
|
+
/**
|
|
86
|
+
* Verify that node meets our minimum needs.
|
|
87
|
+
*/
|
|
88
|
+
try {
|
|
89
|
+
VersionCheck.validate({
|
|
90
|
+
current: process.version,
|
|
91
|
+
// this is the node version
|
|
92
|
+
minimum: '12.16',
|
|
93
|
+
maximum: '13',
|
|
94
|
+
// must be less than this
|
|
95
|
+
preferred: '12.18.3'
|
|
96
|
+
});
|
|
97
|
+
} catch (err) {
|
|
98
|
+
console.log(err);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Check to see if we're running the latest version of build-tools.
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
await execa('build-tools', ['--latest'], {
|
|
108
|
+
stdout: 'inherit'
|
|
109
|
+
});
|
|
110
|
+
} catch (err) {
|
|
111
|
+
/**
|
|
112
|
+
* An exitCode of 1 is simply how build-tools lets us know that an update
|
|
113
|
+
* exists for the build-tools repository.
|
|
114
|
+
*/
|
|
115
|
+
if (err.exitCode !== 1) {
|
|
116
|
+
console.error(err);
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Presents the opening greeting and then to proceed, or not to proceed,
|
|
123
|
+
* that is the question.
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
const greet = async () => {
|
|
128
|
+
clear();
|
|
129
|
+
console.log(chalk.keyword('orange').bold(figlet.textSync('repo-init', {
|
|
130
|
+
horizontalLayout: 'full'
|
|
131
|
+
})), chalk.green`
|
|
132
|
+
|
|
133
|
+
Welcome to the Leverege repository bootstrapping utility. This utility
|
|
134
|
+
will help with the creation of a new git repository based on the standard
|
|
135
|
+
templates that are currently supported. It will also attempt to tune the
|
|
136
|
+
initial files based on the answers provided during this process.
|
|
137
|
+
`);
|
|
138
|
+
await doVersionChecks();
|
|
139
|
+
await proceed();
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Usage:
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
const start = async () => {
|
|
147
|
+
await greet();
|
|
148
|
+
const config = new Config();
|
|
149
|
+
const gitter = new Gitter(config);
|
|
150
|
+
const gitSpec = await gitter.runInquiry();
|
|
151
|
+
const templates = new Templates(config);
|
|
152
|
+
const templateSpec = await templates.runInquiry(gitSpec);
|
|
153
|
+
const npmActions = ['install'];
|
|
154
|
+
const buildSpec = { ...gitSpec,
|
|
155
|
+
...templateSpec,
|
|
156
|
+
npmActions
|
|
157
|
+
};
|
|
158
|
+
condir('Current Build Spec', buildSpec); // TODO: Clean this up to be a better info dump
|
|
159
|
+
|
|
160
|
+
await proceed('Proceed to populate and build the repository?');
|
|
161
|
+
await templates.build(buildSpec);
|
|
162
|
+
await gitter.build(buildSpec);
|
|
163
|
+
console.log(chalk.green.bold`
|
|
164
|
+
Repository setup complete.
|
|
165
|
+
|
|
166
|
+
Still to work out:`, chalk.yellow`
|
|
167
|
+
- figure out better approach for partial file read on transform
|
|
168
|
+
- add / flesh out remaining templates
|
|
169
|
+
- express-server
|
|
170
|
+
- library
|
|
171
|
+
- ui-lib
|
|
172
|
+
- ui-???
|
|
173
|
+
`);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
exports.start = start;
|
|
Binary file
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* All git interactions come through here.
|
|
5
|
+
*/
|
|
6
|
+
const chalk = require('chalk');
|
|
7
|
+
|
|
8
|
+
const execa = require('execa');
|
|
9
|
+
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
|
|
12
|
+
const inquirer = require('inquirer');
|
|
13
|
+
|
|
14
|
+
const Ora = require('ora');
|
|
15
|
+
|
|
16
|
+
const SimpleGit = require('simple-git');
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
pause,
|
|
20
|
+
Shell
|
|
21
|
+
} = require('../utils');
|
|
22
|
+
|
|
23
|
+
const repoHosting = require('./RepoHosting');
|
|
24
|
+
|
|
25
|
+
class Gitter {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.git = new SimpleGit();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async runInquiry() {
|
|
31
|
+
if (await this.git.checkIsRepo()) {
|
|
32
|
+
console.log(chalk.keyword('orange').bold(`
|
|
33
|
+
The current working directory is a git repository, and continuing this
|
|
34
|
+
operation would create a nested repository, which is not supported. Try
|
|
35
|
+
changing to a plain old subdirectory before attempting to run repo-init.
|
|
36
|
+
|
|
37
|
+
`));
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Validates the name and checks to see if the subdirectory already exists.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
const verifyRepositoryName = name => {
|
|
46
|
+
if (!RegExp('^\\w+(\\-*\\w*)+$').test(name)) {
|
|
47
|
+
console.log(chalk.yellow.bold(`
|
|
48
|
+
Invalid git repo name => [${chalk.red.bold(name)}]`));
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (fs.existsSync(name)) {
|
|
53
|
+
console.log(chalk.yellow.bold(`
|
|
54
|
+
A local file or directory named ${name} already exists - remove it and try again.`));
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return true;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The questions that we need to ask about this git build.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
const gitterQs = [{
|
|
66
|
+
type: 'input',
|
|
67
|
+
name: 'git.name',
|
|
68
|
+
message: 'What is the desired name of the git repository?',
|
|
69
|
+
validate: value => {
|
|
70
|
+
return verifyRepositoryName(value);
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
type: 'list',
|
|
74
|
+
name: 'git.host',
|
|
75
|
+
message: 'Where will the repository be hosted?',
|
|
76
|
+
choices: ['bitbucket', 'github', 'local']
|
|
77
|
+
}, {
|
|
78
|
+
type: 'list',
|
|
79
|
+
name: 'git.owner',
|
|
80
|
+
message: 'Who is the owner of the git repository?',
|
|
81
|
+
choices: ['leverege', 'cox2m'],
|
|
82
|
+
when: answer => {
|
|
83
|
+
return answer.git.host !== 'local';
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
type: 'list',
|
|
87
|
+
name: 'git.createRemote',
|
|
88
|
+
message: 'Let repo-init create the remote git repository?',
|
|
89
|
+
choices: ['yes', 'skip'],
|
|
90
|
+
when: answer => {
|
|
91
|
+
return answer.git.host !== 'local';
|
|
92
|
+
}
|
|
93
|
+
}];
|
|
94
|
+
return inquirer.prompt(gitterQs);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async build(buildSpec) {
|
|
98
|
+
if (!fs.existsSync(buildSpec.git.name)) {
|
|
99
|
+
console.log(chalk.yellow.bold(`
|
|
100
|
+
${chalk.red.bold('***ERROR: source directory does not exist')}
|
|
101
|
+
Did the template generation for ${chalk.red.bold(buildSpec.git.name)} fail?
|
|
102
|
+
`));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const initialCommit = `repo-init => bootstrapped ${buildSpec.template.type} ${buildSpec.template.subType}`;
|
|
106
|
+
/**
|
|
107
|
+
* We need to have an initialized git repo before attempting to do an
|
|
108
|
+
* npm install since there are husky rules and it needs git.
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
const git = SimpleGit(buildSpec.git.name);
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
await git.init().add(['--all', '--force']); // we want it all!
|
|
115
|
+
} catch (initErr) {
|
|
116
|
+
console.log(initErr);
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Keep in mind that all of the git commands will be relevant to the cwd
|
|
121
|
+
* at the time the SimpleGit interface was instantiated. That has nothing
|
|
122
|
+
* to do with the set of commands that are about to execute.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
Shell.pushd(buildSpec.git.name);
|
|
127
|
+
const spinner = new Ora();
|
|
128
|
+
|
|
129
|
+
if (buildSpec.config.npmCheck) {
|
|
130
|
+
console.log(chalk.keyword('orange').bold(`
|
|
131
|
+
Running npm-check-updates interactively to verify all of the package
|
|
132
|
+
versions in package.json are up to date prior to committing everything.`), chalk.yellow.bold(`
|
|
133
|
+
|
|
134
|
+
Pay attention! You may be asked to answer Y/n if any are out of date!`));
|
|
135
|
+
spinner.start('Preparing for dependency checks prior to install.');
|
|
136
|
+
await pause(3000);
|
|
137
|
+
spinner.succeed();
|
|
138
|
+
await execa('npm', ['install', 'npm-check-updates'], {
|
|
139
|
+
stdio: 'inherit'
|
|
140
|
+
});
|
|
141
|
+
await execa('npm', ['run', 'npm-check-updates'], {
|
|
142
|
+
stdio: 'inherit'
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
try {
|
|
147
|
+
for (let i = 0; i < buildSpec.npmActions.length; i++) {
|
|
148
|
+
const npmAction = buildSpec.npmActions[i];
|
|
149
|
+
spinner.start(`Running npm ${npmAction}`);
|
|
150
|
+
await pause(2000); // eslint-disable-line
|
|
151
|
+
|
|
152
|
+
spinner.stop();
|
|
153
|
+
await execa('npm', npmAction.split(' '), {
|
|
154
|
+
stdio: 'inherit'
|
|
155
|
+
}); // eslint-disable-line
|
|
156
|
+
|
|
157
|
+
spinner.succeed();
|
|
158
|
+
await pause(1000); // eslint-disable-line
|
|
159
|
+
}
|
|
160
|
+
} catch (err) {
|
|
161
|
+
console.error(`${chalk.red.bold(err)}\n\n`);
|
|
162
|
+
spinner.fail('Running npm install');
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (buildSpec.template.helmify) {
|
|
167
|
+
try {
|
|
168
|
+
await execa('helmify', {
|
|
169
|
+
stdio: 'inherit'
|
|
170
|
+
});
|
|
171
|
+
} catch (err) {
|
|
172
|
+
console.log(err);
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
Shell.popd();
|
|
178
|
+
/**
|
|
179
|
+
* Complete the standard git repo setup by adding all,
|
|
180
|
+
* to push to host unless the repo already exists.
|
|
181
|
+
*/
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
spinner.start('Adding all source to the git repository');
|
|
185
|
+
await git.add(['--all']).commit(initialCommit).branch(['development']).checkout(['development']);
|
|
186
|
+
spinner.succeed();
|
|
187
|
+
} catch (err) {
|
|
188
|
+
console.log(err);
|
|
189
|
+
spinner.fail('Repository initialization failed - this is very bad');
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (buildSpec.template.type === 'ingestor') {
|
|
194
|
+
/**
|
|
195
|
+
* Drop back down into the newly created git repo before creating the
|
|
196
|
+
* .env file in the repository. This file will not be tracked. Note that
|
|
197
|
+
* the pause here is an artificial delay to make this step noticable to
|
|
198
|
+
* the user.
|
|
199
|
+
*/
|
|
200
|
+
Shell.pushd(buildSpec.git.name);
|
|
201
|
+
const makeDot = 'scripts/make-dot';
|
|
202
|
+
spinner.start(`Executing ${chalk.green.bold(makeDot)} to generate a simple .env file.`);
|
|
203
|
+
await execa('bash', [makeDot]);
|
|
204
|
+
await pause(1500); // eslint-disable-line
|
|
205
|
+
|
|
206
|
+
spinner.succeed();
|
|
207
|
+
Shell.popd();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (buildSpec.git.host === 'local' || buildSpec.git.createRemote === 'skip') {
|
|
211
|
+
console.log(chalk.keyword('orange').bold(`
|
|
212
|
+
The repository is now configured with the initial commit and a development
|
|
213
|
+
branch. Since you selected to skip the creation of the remote hosted repository
|
|
214
|
+
it is up to you to complete those step manually.`));
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
await repoHosting.build(buildSpec);
|
|
219
|
+
console.log(chalk.keyword('orange').bold(`
|
|
220
|
+
The repository is now configured with the initial commit and a development
|
|
221
|
+
branch. The upstream push may take up to 30 seconds to complete.
|
|
222
|
+
`));
|
|
223
|
+
|
|
224
|
+
try {
|
|
225
|
+
spinner.start(`Pushing ${buildSpec.git.name} repository upstream`);
|
|
226
|
+
await git.addRemote('origin', repoHosting.getGitURL('remote', buildSpec)).push(['--set-upstream', 'origin', 'master']).push(['--set-upstream', 'origin', 'development']).checkout(['development']);
|
|
227
|
+
spinner.succeed();
|
|
228
|
+
} catch (err) {
|
|
229
|
+
console.log(err);
|
|
230
|
+
spinner.fail(`git push ${buildSpec.git.name}`);
|
|
231
|
+
process.exit(1);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
await repoHosting.openAdmin(buildSpec);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
module.exports = {
|
|
240
|
+
Gitter
|
|
241
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
|
|
5
|
+
const clipboardy = require('clipboardy');
|
|
6
|
+
|
|
7
|
+
const open = require('open');
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
clear,
|
|
11
|
+
proceed
|
|
12
|
+
} = require('../utils');
|
|
13
|
+
|
|
14
|
+
const greet = async () => {
|
|
15
|
+
console.log(chalk.keyword('orange').bold(`
|
|
16
|
+
Setting up the initial repository on the git hosting service is a manual
|
|
17
|
+
process which will require the setting of a handful of fields via the UI.
|
|
18
|
+
Proceeding forward with this step will result in a browser window being
|
|
19
|
+
opened at the repository creation page.
|
|
20
|
+
`));
|
|
21
|
+
await proceed('Do you wish to continue to the repo creation page?');
|
|
22
|
+
clear();
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* This could come from a config file but we're keeping it simple, for now.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const getGitURL = (type, buildSpec) => {
|
|
30
|
+
const gitHostURLs = {
|
|
31
|
+
control: {
|
|
32
|
+
admin: 'admin',
|
|
33
|
+
create: 'create',
|
|
34
|
+
remote: 'remote'
|
|
35
|
+
},
|
|
36
|
+
bitbucket: {
|
|
37
|
+
admin: `https://bitbucket.org/${buildSpec.git.owner}/${buildSpec.git.name}/admin`,
|
|
38
|
+
create: `https://bitbucket.org/repo/create?owner=${buildSpec.git.owner}`,
|
|
39
|
+
remote: `git@bitbucket-leverege:${buildSpec.git.owner}/${buildSpec.git.name}.git`
|
|
40
|
+
},
|
|
41
|
+
github: {
|
|
42
|
+
admin: `https://github.com/${buildSpec.git.owner}/${buildSpec.git.name}/settings/branches`,
|
|
43
|
+
create: `https://github.com/organizations/${buildSpec.git.owner}/repositories/new`,
|
|
44
|
+
remote: `git@github.com:${buildSpec.git.owner}/${buildSpec.git.name}.git`
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if (!Object.keys(gitHostURLs.control).includes(type)) {
|
|
49
|
+
throw new Error(`Unknown git URL type of ${type}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return gitHostURLs[buildSpec.git.host][type];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
const build = async buildSpec => {
|
|
59
|
+
await greet();
|
|
60
|
+
console.log(`${chalk.keyword('orange').bold(`
|
|
61
|
+
Before proceeding you will want to verify that your browser has access to the
|
|
62
|
+
git hosting service you are about to use. The easiest way to do this is to
|
|
63
|
+
simply open a browser window on bitbuck or github with the desired account.
|
|
64
|
+
|
|
65
|
+
Once you proceed from this step a browser window will be opened and you will
|
|
66
|
+
enter the relevant information into the repository creation page. Click the
|
|
67
|
+
${chalk.blue.bold('Create repository')} button to complete the process.
|
|
68
|
+
${chalk.keyword('green').bold(`
|
|
69
|
+
Git Host => ${chalk.yellow.bold(buildSpec.git.host)}
|
|
70
|
+
Project => ${chalk.yellow.bold('Testing or something appropriate')}
|
|
71
|
+
Repository name => ${chalk.yellow.bold(buildSpec.git.name)} <= copied to clipboard`)}
|
|
72
|
+
|
|
73
|
+
${chalk.red.bold('DO NOT initialize a README, gitignore or License file')}
|
|
74
|
+
|
|
75
|
+
This window may be covered by the browser window so be sure to come back here
|
|
76
|
+
after you ${chalk.blue.bold('create the repository')}.`)}
|
|
77
|
+
`);
|
|
78
|
+
await proceed(`You at least read the ${chalk.red.bold('red')} line above and are ready to proceed?`);
|
|
79
|
+
clipboardy.writeSync(buildSpec.git.name);
|
|
80
|
+
await open(getGitURL('create', buildSpec));
|
|
81
|
+
console.log(`${chalk.keyword('orange').bold('Waiting on repo creation to complete...')}`);
|
|
82
|
+
await proceed('Continue after the initial repository has been created?');
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
const openAdmin = async buildSpec => {
|
|
89
|
+
console.log(chalk.keyword('orange').bold(`
|
|
90
|
+
The admin page for the repository will now be opened in the browser. Please
|
|
91
|
+
take a moment to tweak the following settings:
|
|
92
|
+
|
|
93
|
+
${chalk.keyword('green')('Project')} - adjust if the original selection was slightly off
|
|
94
|
+
${chalk.keyword('green').bold('Description')} - a few words here wouldn't hurt
|
|
95
|
+
${chalk.keyword('green').bold('Language')} - set this to Node.js or Javascript?
|
|
96
|
+
${chalk.keyword('green').bold('Main branch')} - set that to ${chalk.keyword('red').bold('development')}, ok?
|
|
97
|
+
`));
|
|
98
|
+
await open(getGitURL('admin', buildSpec));
|
|
99
|
+
await proceed('Please take a moment to at least set the Language and Main branch?');
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
module.exports = {
|
|
103
|
+
build,
|
|
104
|
+
getGitURL,
|
|
105
|
+
openAdmin
|
|
106
|
+
};
|