just-ship-it 0.0.1
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/LICENSE +201 -0
- package/README.md +431 -0
- package/bin/just-ship-it.js +2 -0
- package/dist/ai.d.ts +20 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +210 -0
- package/dist/ai.js.map +1 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +49 -0
- package/dist/config.js.map +1 -0
- package/dist/git.d.ts +33 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +153 -0
- package/dist/git.js.map +1 -0
- package/dist/github.d.ts +22 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +237 -0
- package/dist/github.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +187 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +17 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +54 -0
- package/dist/logger.js.map +1 -0
- package/dist/release.d.ts +3 -0
- package/dist/release.d.ts.map +1 -0
- package/dist/release.js +752 -0
- package/dist/release.js.map +1 -0
- package/dist/types.d.ts +67 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/workspace.d.ts +19 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +185 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +44 -0
package/dist/github.js
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { logger } from './logger.js';
|
|
3
|
+
export class GitHubOperations {
|
|
4
|
+
config;
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.config = config;
|
|
7
|
+
}
|
|
8
|
+
exec(command) {
|
|
9
|
+
logger.detail(`Running: ${command}`);
|
|
10
|
+
return execSync(command, { encoding: 'utf-8' }).trim();
|
|
11
|
+
}
|
|
12
|
+
execJson(command) {
|
|
13
|
+
const output = this.exec(command);
|
|
14
|
+
return JSON.parse(output);
|
|
15
|
+
}
|
|
16
|
+
async createPullRequest(branchName, title, body) {
|
|
17
|
+
logger.detail(`Creating PR: ${title}`);
|
|
18
|
+
logger.detail(` Head: ${branchName}`);
|
|
19
|
+
logger.detail(` Base: ${this.config.baseBranch}`);
|
|
20
|
+
// Create the PR (returns the URL)
|
|
21
|
+
const prUrl = this.exec(`gh pr create \
|
|
22
|
+
--repo "${this.config.owner}/${this.config.repo}" \
|
|
23
|
+
--head "${branchName}" \
|
|
24
|
+
--base "${this.config.baseBranch}" \
|
|
25
|
+
--title "${title.replace(/"/g, '\\"')}" \
|
|
26
|
+
--body "${body.replace(/"/g, '\\"')}"`);
|
|
27
|
+
// Extract PR number from URL (e.g., https://github.com/owner/repo/pull/123)
|
|
28
|
+
const prNumberMatch = prUrl.match(/\/pull\/(\d+)/);
|
|
29
|
+
if (!prNumberMatch) {
|
|
30
|
+
throw new Error(`Could not parse PR number from URL: ${prUrl}`);
|
|
31
|
+
}
|
|
32
|
+
const prNumber = parseInt(prNumberMatch[1], 10);
|
|
33
|
+
// Get full PR details
|
|
34
|
+
const result = this.execJson(`gh pr view ${prNumber} \
|
|
35
|
+
--repo "${this.config.owner}/${this.config.repo}" \
|
|
36
|
+
--json number,url,headRefName,headRefOid,state`);
|
|
37
|
+
return {
|
|
38
|
+
number: result.number,
|
|
39
|
+
html_url: result.url,
|
|
40
|
+
head: {
|
|
41
|
+
ref: result.headRefName,
|
|
42
|
+
sha: result.headRefOid,
|
|
43
|
+
},
|
|
44
|
+
state: result.state,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
async getPullRequest(prNumber) {
|
|
48
|
+
const result = this.execJson(`gh pr view ${prNumber} \
|
|
49
|
+
--repo "${this.config.owner}/${this.config.repo}" \
|
|
50
|
+
--json number,url,headRefName,headRefOid,state,mergeable,merged`);
|
|
51
|
+
return {
|
|
52
|
+
number: result.number,
|
|
53
|
+
html_url: result.url,
|
|
54
|
+
head: {
|
|
55
|
+
ref: result.headRefName,
|
|
56
|
+
sha: result.headRefOid,
|
|
57
|
+
},
|
|
58
|
+
state: result.state,
|
|
59
|
+
mergeable: result.mergeable === 'MERGEABLE',
|
|
60
|
+
merged: result.merged,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async getCheckRuns(prNumber) {
|
|
64
|
+
try {
|
|
65
|
+
const result = this.execJson(`gh pr checks ${prNumber} \
|
|
66
|
+
--repo "${this.config.owner}/${this.config.repo}" \
|
|
67
|
+
--json name,status,conclusion,workflowName 2>/dev/null || echo '{"statusCheckRollup":[]}'`);
|
|
68
|
+
if (!result.statusCheckRollup) {
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
return result.statusCheckRollup.map((check) => ({
|
|
72
|
+
id: 0,
|
|
73
|
+
name: check.workflowName || check.name,
|
|
74
|
+
status: this.mapStatus(check.status),
|
|
75
|
+
conclusion: this.mapConclusion(check.conclusion),
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
mapStatus(status) {
|
|
83
|
+
switch (status?.toUpperCase()) {
|
|
84
|
+
case 'COMPLETED':
|
|
85
|
+
return 'completed';
|
|
86
|
+
case 'IN_PROGRESS':
|
|
87
|
+
case 'PENDING':
|
|
88
|
+
return 'in_progress';
|
|
89
|
+
default:
|
|
90
|
+
return 'queued';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
mapConclusion(conclusion) {
|
|
94
|
+
switch (conclusion?.toUpperCase()) {
|
|
95
|
+
case 'SUCCESS':
|
|
96
|
+
return 'success';
|
|
97
|
+
case 'FAILURE':
|
|
98
|
+
return 'failure';
|
|
99
|
+
case 'NEUTRAL':
|
|
100
|
+
return 'neutral';
|
|
101
|
+
case 'CANCELLED':
|
|
102
|
+
return 'cancelled';
|
|
103
|
+
case 'SKIPPED':
|
|
104
|
+
return 'skipped';
|
|
105
|
+
case 'TIMED_OUT':
|
|
106
|
+
return 'timed_out';
|
|
107
|
+
default:
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async waitForChecks(prNumber, timeoutMs = 30 * 60 * 1000, pollIntervalMs = 15000) {
|
|
112
|
+
const startTime = Date.now();
|
|
113
|
+
while (Date.now() - startTime < timeoutMs) {
|
|
114
|
+
// Use gh pr checks which shows the status nicely
|
|
115
|
+
let checks;
|
|
116
|
+
try {
|
|
117
|
+
const output = this.exec(`gh pr checks ${prNumber} --repo "${this.config.owner}/${this.config.repo}" 2>&1 || true`);
|
|
118
|
+
// Parse the tabular output from gh pr checks
|
|
119
|
+
const lines = output.split('\n').filter(line => line.trim());
|
|
120
|
+
checks = [];
|
|
121
|
+
for (const line of lines) {
|
|
122
|
+
// Skip header or empty lines
|
|
123
|
+
if (line.includes('Some checks are still pending') ||
|
|
124
|
+
line.includes('All checks were successful') ||
|
|
125
|
+
line.includes('Some checks were not successful')) {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
// Parse line format: "NAME\tSTATUS\tTIME\tURL"
|
|
129
|
+
const parts = line.split('\t');
|
|
130
|
+
if (parts.length >= 2) {
|
|
131
|
+
const name = parts[0].trim();
|
|
132
|
+
const statusStr = parts[1].trim().toLowerCase();
|
|
133
|
+
let status = 'queued';
|
|
134
|
+
let conclusion = null;
|
|
135
|
+
if (statusStr === 'pass' || statusStr === 'success') {
|
|
136
|
+
status = 'completed';
|
|
137
|
+
conclusion = 'success';
|
|
138
|
+
}
|
|
139
|
+
else if (statusStr === 'fail' || statusStr === 'failure') {
|
|
140
|
+
status = 'completed';
|
|
141
|
+
conclusion = 'failure';
|
|
142
|
+
}
|
|
143
|
+
else if (statusStr === 'pending' || statusStr === 'in_progress') {
|
|
144
|
+
status = 'in_progress';
|
|
145
|
+
}
|
|
146
|
+
else if (statusStr === 'skipping' || statusStr === 'skipped') {
|
|
147
|
+
status = 'completed';
|
|
148
|
+
conclusion = 'skipped';
|
|
149
|
+
}
|
|
150
|
+
if (name) {
|
|
151
|
+
checks.push({ id: 0, name, status, conclusion });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
checks = [];
|
|
158
|
+
}
|
|
159
|
+
if (checks.length === 0) {
|
|
160
|
+
logger.detail('No checks found yet, waiting...');
|
|
161
|
+
await this.sleep(pollIntervalMs);
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const allCompleted = checks.every(check => check.status === 'completed');
|
|
165
|
+
logger.blank();
|
|
166
|
+
logger.info(`Check status (${checks.length} checks):`);
|
|
167
|
+
for (const check of checks) {
|
|
168
|
+
logger.checkStatus(check.name, check.status, check.conclusion);
|
|
169
|
+
}
|
|
170
|
+
if (allCompleted) {
|
|
171
|
+
const allSuccess = checks.every(check => check.conclusion === 'success' || check.conclusion === 'skipped');
|
|
172
|
+
return { success: allSuccess, checks };
|
|
173
|
+
}
|
|
174
|
+
const completed = checks.filter(c => c.status === 'completed').length;
|
|
175
|
+
const inProgress = checks.filter(c => c.status === 'in_progress').length;
|
|
176
|
+
const queued = checks.filter(c => c.status === 'queued').length;
|
|
177
|
+
logger.detail(`Progress: ${completed}/${checks.length} complete, ${inProgress} in progress, ${queued} queued`);
|
|
178
|
+
await this.sleep(pollIntervalMs);
|
|
179
|
+
}
|
|
180
|
+
throw new Error('Timeout waiting for checks to complete');
|
|
181
|
+
}
|
|
182
|
+
async mergePullRequest(prNumber, mergeMethod = 'squash') {
|
|
183
|
+
logger.detail(`Merging PR #${prNumber} using ${mergeMethod} (admin)...`);
|
|
184
|
+
this.exec(`gh pr merge ${prNumber} \
|
|
185
|
+
--repo "${this.config.owner}/${this.config.repo}" \
|
|
186
|
+
--${mergeMethod} \
|
|
187
|
+
--admin \
|
|
188
|
+
--delete-branch`);
|
|
189
|
+
logger.detail('PR merged successfully');
|
|
190
|
+
}
|
|
191
|
+
async deleteBranch(branchName) {
|
|
192
|
+
// Branch deletion is handled by --delete-branch in merge
|
|
193
|
+
logger.detail(`Branch ${branchName} will be deleted with PR merge`);
|
|
194
|
+
}
|
|
195
|
+
async findVersionPackagesPR() {
|
|
196
|
+
logger.detail('Looking for Version Packages PR...');
|
|
197
|
+
try {
|
|
198
|
+
const result = this.execJson(`gh pr list \
|
|
199
|
+
--repo "${this.config.owner}/${this.config.repo}" \
|
|
200
|
+
--state open \
|
|
201
|
+
--head "changeset-release/${this.config.baseBranch}" \
|
|
202
|
+
--json number,url,headRefName,headRefOid,state,title`);
|
|
203
|
+
if (result.length > 0) {
|
|
204
|
+
const pr = result[0];
|
|
205
|
+
return {
|
|
206
|
+
number: pr.number,
|
|
207
|
+
html_url: pr.url,
|
|
208
|
+
head: {
|
|
209
|
+
ref: pr.headRefName,
|
|
210
|
+
sha: pr.headRefOid,
|
|
211
|
+
},
|
|
212
|
+
state: pr.state,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
// No PR found
|
|
218
|
+
}
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
async waitForVersionPackagesPR(timeoutMs = 10 * 60 * 1000, pollIntervalMs = 10000) {
|
|
222
|
+
const startTime = Date.now();
|
|
223
|
+
while (Date.now() - startTime < timeoutMs) {
|
|
224
|
+
const pr = await this.findVersionPackagesPR();
|
|
225
|
+
if (pr) {
|
|
226
|
+
return pr;
|
|
227
|
+
}
|
|
228
|
+
logger.detail('Version Packages PR not found yet, waiting...');
|
|
229
|
+
await this.sleep(pollIntervalMs);
|
|
230
|
+
}
|
|
231
|
+
throw new Error('Timeout waiting for Version Packages PR');
|
|
232
|
+
}
|
|
233
|
+
sleep(ms) {
|
|
234
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
//# sourceMapping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G,KAAK;QAEtB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,SAAS,EAAE,CAAC;YAC1C,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAE9C,IAAI,EAAE,EAAE,CAAC;gBACP,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,MAAM,CAAC,MAAM,CAAC,+CAA+C,CAAC,CAAC;YAC/D,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACnC,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IAEO,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { text, select, isCancel, cancel, confirm } from '@clack/prompts';
|
|
4
|
+
import { getRepoConfig, addRepoConfig, listRepos } from './config.js';
|
|
5
|
+
import { runRelease } from './release.js';
|
|
6
|
+
import { logger } from './logger.js';
|
|
7
|
+
const program = new Command();
|
|
8
|
+
program
|
|
9
|
+
.name('just-ship-it')
|
|
10
|
+
.description('CLI tool to automate changeset-based releases powered by OpenRouter')
|
|
11
|
+
.version('0.0.1');
|
|
12
|
+
program
|
|
13
|
+
.argument('[repo]', 'Repository name to release')
|
|
14
|
+
.option('-t, --type <type>', 'Release type (patch, minor, major)')
|
|
15
|
+
.option('-m, --message <message>', 'Release message')
|
|
16
|
+
.option('-y, --yes', 'Skip confirmations')
|
|
17
|
+
.option('--model <model>', 'AI model to use')
|
|
18
|
+
.action(async (repo, opts) => {
|
|
19
|
+
if (opts.model) {
|
|
20
|
+
process.env.OPENROUTER_MODEL = opts.model;
|
|
21
|
+
}
|
|
22
|
+
// If no repo specified, show list and prompt
|
|
23
|
+
if (!repo) {
|
|
24
|
+
const repos = listRepos();
|
|
25
|
+
if (repos.length === 0) {
|
|
26
|
+
logger.error('No repositories configured.');
|
|
27
|
+
logger.info('Add a repository with: npx just-ship-it add <name>');
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
const selected = await select({
|
|
31
|
+
message: 'Select a repository to release:',
|
|
32
|
+
options: repos.map(r => ({ label: r, value: r })),
|
|
33
|
+
});
|
|
34
|
+
if (isCancel(selected)) {
|
|
35
|
+
cancel('Operation cancelled');
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
repo = selected;
|
|
39
|
+
}
|
|
40
|
+
const config = getRepoConfig(repo);
|
|
41
|
+
if (!config) {
|
|
42
|
+
logger.error(`Repository "${repo}" not found.`);
|
|
43
|
+
logger.info('Available repositories: ' + listRepos().join(', '));
|
|
44
|
+
logger.info('Add a new repository with: npx just-ship-it add <name>');
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
const options = {
|
|
48
|
+
skipConfirmations: opts.yes,
|
|
49
|
+
};
|
|
50
|
+
if (opts.type && ['patch', 'minor', 'major'].includes(opts.type)) {
|
|
51
|
+
options.type = opts.type;
|
|
52
|
+
}
|
|
53
|
+
if (opts.message) {
|
|
54
|
+
options.message = opts.message;
|
|
55
|
+
}
|
|
56
|
+
await runRelease(config, options);
|
|
57
|
+
});
|
|
58
|
+
program
|
|
59
|
+
.command('add <name>')
|
|
60
|
+
.description('Add a new repository configuration')
|
|
61
|
+
.option('--model <model>', 'Default model for this repository')
|
|
62
|
+
.option('--monorepo', 'Configure as monorepo')
|
|
63
|
+
.option('--lockstep', 'Use lockstep versioning (all packages bump together)')
|
|
64
|
+
.option('--selective', 'Use selective versioning (only changed packages bump)')
|
|
65
|
+
.action(async (name, opts) => {
|
|
66
|
+
logger.info(`Adding repository: ${name}`);
|
|
67
|
+
const ownerResult = await text({
|
|
68
|
+
message: 'GitHub owner (org or user):',
|
|
69
|
+
validate: (v) => {
|
|
70
|
+
if (!v || v.length === 0)
|
|
71
|
+
return 'Owner is required';
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
if (isCancel(ownerResult)) {
|
|
75
|
+
cancel('Operation cancelled');
|
|
76
|
+
process.exit(0);
|
|
77
|
+
}
|
|
78
|
+
const owner = ownerResult;
|
|
79
|
+
const repoResult = await text({
|
|
80
|
+
message: 'Repository name:',
|
|
81
|
+
defaultValue: name,
|
|
82
|
+
validate: (v) => {
|
|
83
|
+
if (!v || v.length === 0)
|
|
84
|
+
return 'Repo is required';
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
if (isCancel(repoResult)) {
|
|
88
|
+
cancel('Operation cancelled');
|
|
89
|
+
process.exit(0);
|
|
90
|
+
}
|
|
91
|
+
const repo = repoResult;
|
|
92
|
+
const baseBranchResult = await text({
|
|
93
|
+
message: 'Base branch:',
|
|
94
|
+
defaultValue: 'main',
|
|
95
|
+
});
|
|
96
|
+
if (isCancel(baseBranchResult)) {
|
|
97
|
+
cancel('Operation cancelled');
|
|
98
|
+
process.exit(0);
|
|
99
|
+
}
|
|
100
|
+
const baseBranch = baseBranchResult;
|
|
101
|
+
const cloneUrl = `https://github.com/${owner}/${repo}.git`;
|
|
102
|
+
const modelResult = opts.model || await text({
|
|
103
|
+
message: 'AI model (optional, press Enter for default):',
|
|
104
|
+
placeholder: 'anthropic/claude-opus-4.5',
|
|
105
|
+
defaultValue: '',
|
|
106
|
+
});
|
|
107
|
+
if (isCancel(modelResult)) {
|
|
108
|
+
cancel('Operation cancelled');
|
|
109
|
+
process.exit(0);
|
|
110
|
+
}
|
|
111
|
+
const model = modelResult;
|
|
112
|
+
// Monorepo configuration
|
|
113
|
+
let monorepoConfig;
|
|
114
|
+
if (opts.monorepo || opts.lockstep || opts.selective) {
|
|
115
|
+
// User specified via flags
|
|
116
|
+
const mode = opts.lockstep ? 'lockstep' : 'selective';
|
|
117
|
+
monorepoConfig = { mode };
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
// Prompt user
|
|
121
|
+
const isMonorepo = await confirm({
|
|
122
|
+
message: 'Is this a monorepo with multiple packages?',
|
|
123
|
+
initialValue: false,
|
|
124
|
+
});
|
|
125
|
+
if (isCancel(isMonorepo)) {
|
|
126
|
+
cancel('Operation cancelled');
|
|
127
|
+
process.exit(0);
|
|
128
|
+
}
|
|
129
|
+
if (isMonorepo) {
|
|
130
|
+
const modeResult = await select({
|
|
131
|
+
message: 'Versioning mode:',
|
|
132
|
+
options: [
|
|
133
|
+
{
|
|
134
|
+
label: 'selective - Only bump changed packages',
|
|
135
|
+
value: 'selective',
|
|
136
|
+
hint: 'Recommended for independent packages'
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
label: 'lockstep - Bump all packages together',
|
|
140
|
+
value: 'lockstep',
|
|
141
|
+
hint: 'Use for tightly coupled packages'
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
initialValue: 'selective',
|
|
145
|
+
});
|
|
146
|
+
if (isCancel(modeResult)) {
|
|
147
|
+
cancel('Operation cancelled');
|
|
148
|
+
process.exit(0);
|
|
149
|
+
}
|
|
150
|
+
monorepoConfig = { mode: modeResult };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const config = {
|
|
154
|
+
owner,
|
|
155
|
+
repo,
|
|
156
|
+
baseBranch,
|
|
157
|
+
cloneUrl,
|
|
158
|
+
...(model && { model }),
|
|
159
|
+
...(monorepoConfig && { monorepo: monorepoConfig }),
|
|
160
|
+
};
|
|
161
|
+
addRepoConfig(name, config);
|
|
162
|
+
logger.success(`Repository "${name}" added!`);
|
|
163
|
+
logger.detail(`Clone URL: ${cloneUrl}`);
|
|
164
|
+
if (monorepoConfig) {
|
|
165
|
+
logger.detail(`Monorepo mode: ${monorepoConfig.mode}`);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
program
|
|
169
|
+
.command('list')
|
|
170
|
+
.description('List configured repositories')
|
|
171
|
+
.action(() => {
|
|
172
|
+
const repos = listRepos();
|
|
173
|
+
if (repos.length === 0) {
|
|
174
|
+
logger.info('No repositories configured.');
|
|
175
|
+
logger.info('Add a repository with: npx just-ship-it add <name>');
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
logger.info('Configured repositories:');
|
|
179
|
+
for (const repo of repos) {
|
|
180
|
+
const config = getRepoConfig(repo);
|
|
181
|
+
if (config) {
|
|
182
|
+
console.log(` - ${repo} (${config.owner}/${config.repo})`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
program.parse();
|
|
187
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,cAAc,CAAC;KACpB,WAAW,CAAC,qEAAqE,CAAC;KAClF,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,QAAQ,CAAC,QAAQ,EAAE,4BAA4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AC,IAAI,GAAG,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class Logger {
|
|
2
|
+
private verbose;
|
|
3
|
+
constructor(verbose?: boolean);
|
|
4
|
+
info(message: string): void;
|
|
5
|
+
success(message: string): void;
|
|
6
|
+
warn(message: string): void;
|
|
7
|
+
error(message: string): void;
|
|
8
|
+
step(step: number, total: number, message: string): void;
|
|
9
|
+
detail(message: string): void;
|
|
10
|
+
blank(): void;
|
|
11
|
+
header(message: string): void;
|
|
12
|
+
divider(): void;
|
|
13
|
+
waiting(message: string): void;
|
|
14
|
+
checkStatus(name: string, status: string, conclusion: string | null): void;
|
|
15
|
+
}
|
|
16
|
+
export declare const logger: Logger;
|
|
17
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,UAAO;IAI1B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI9B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxD,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM7B,KAAK,IAAI,IAAI;IAIb,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAQ7B,OAAO,IAAI,IAAI;IAIf,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI9B,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;CAS3E;AAED,eAAO,MAAM,MAAM,QAAe,CAAC"}
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
export class Logger {
|
|
3
|
+
verbose;
|
|
4
|
+
constructor(verbose = true) {
|
|
5
|
+
this.verbose = verbose;
|
|
6
|
+
}
|
|
7
|
+
info(message) {
|
|
8
|
+
console.log(chalk.blue('[info]'), message);
|
|
9
|
+
}
|
|
10
|
+
success(message) {
|
|
11
|
+
console.log(chalk.green('[ok]'), message);
|
|
12
|
+
}
|
|
13
|
+
warn(message) {
|
|
14
|
+
console.log(chalk.yellow('[warn]'), message);
|
|
15
|
+
}
|
|
16
|
+
error(message) {
|
|
17
|
+
console.log(chalk.red('[error]'), message);
|
|
18
|
+
}
|
|
19
|
+
step(step, total, message) {
|
|
20
|
+
console.log(chalk.cyan(`[${step}/${total}]`), message);
|
|
21
|
+
}
|
|
22
|
+
detail(message) {
|
|
23
|
+
if (this.verbose) {
|
|
24
|
+
console.log(chalk.gray(' >'), chalk.gray(message));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
blank() {
|
|
28
|
+
console.log();
|
|
29
|
+
}
|
|
30
|
+
header(message) {
|
|
31
|
+
console.log();
|
|
32
|
+
console.log(chalk.bold.magenta('='.repeat(50)));
|
|
33
|
+
console.log(chalk.bold.magenta(message));
|
|
34
|
+
console.log(chalk.bold.magenta('='.repeat(50)));
|
|
35
|
+
console.log();
|
|
36
|
+
}
|
|
37
|
+
divider() {
|
|
38
|
+
console.log(chalk.gray('-'.repeat(50)));
|
|
39
|
+
}
|
|
40
|
+
waiting(message) {
|
|
41
|
+
console.log(chalk.yellow('[wait]'), message);
|
|
42
|
+
}
|
|
43
|
+
checkStatus(name, status, conclusion) {
|
|
44
|
+
const icon = conclusion === 'success'
|
|
45
|
+
? chalk.green('[ok]')
|
|
46
|
+
: conclusion === 'failure'
|
|
47
|
+
? chalk.red('[x]')
|
|
48
|
+
: chalk.yellow('[.]');
|
|
49
|
+
const statusText = conclusion || status;
|
|
50
|
+
console.log(` ${icon} ${name}: ${statusText}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export const logger = new Logger();
|
|
54
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,OAAO,MAAM;IACT,OAAO,CAAU;IAEzB,YAAY,OAAO,GAAG,IAAI;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,IAAI,CAAC,OAAe;QAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,CAAC,OAAe;QACrB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,CAAC,OAAe;QAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,OAAe;QACnB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,IAAY,EAAE,KAAa,EAAE,OAAe;QAC/C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;I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