@waypoint-framework/cli 0.2.2-rc.1 → 0.2.2-rc.2

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.
@@ -0,0 +1,7 @@
1
+ export interface InitOptions {
2
+ dir: string;
3
+ workflow: string;
4
+ version: string;
5
+ tag?: string;
6
+ }
7
+ export declare function init(options: InitOptions): Promise<number>;
@@ -0,0 +1,7 @@
1
+ export interface UpdateOptions {
2
+ dir: string;
3
+ check: boolean;
4
+ major: boolean;
5
+ validate: boolean;
6
+ }
7
+ export declare function update(options: UpdateOptions): Promise<number>;
@@ -0,0 +1,6 @@
1
+ export interface ValidateOptions {
2
+ local: boolean;
3
+ all: boolean;
4
+ dir: string;
5
+ }
6
+ export declare function validate(options: ValidateOptions): Promise<number>;
@@ -0,0 +1,5 @@
1
+ export interface VersionOptions {
2
+ dir: string;
3
+ checkUpstream: boolean;
4
+ }
5
+ export declare function version(options: VersionOptions): Promise<number>;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,17 @@
1
+ export interface GitExecOptions {
2
+ cwd: string;
3
+ silent?: boolean;
4
+ }
5
+ export declare function git(args: string, opts: GitExecOptions): string;
6
+ export declare function hasRemote(name: string, cwd: string): boolean;
7
+ export declare function getUpstreamUrl(cwd: string): string | undefined;
8
+ export declare function fetchUpstream(cwd: string, refspec?: string): void;
9
+ export declare function getUpstreamTags(cwd: string): string[];
10
+ export declare function commitsBehindUpstream(cwd: string, releaseBranch: string): number;
11
+ export declare function mergeUpstream(cwd: string, releaseBranch: string): {
12
+ success: boolean;
13
+ output: string;
14
+ };
15
+ export declare function abortMerge(cwd: string): void;
16
+ export declare function hasUncommittedChanges(cwd: string): boolean;
17
+ export declare function addUpstreamRemote(cwd: string, url: string): void;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.git = git;
4
+ exports.hasRemote = hasRemote;
5
+ exports.getUpstreamUrl = getUpstreamUrl;
6
+ exports.fetchUpstream = fetchUpstream;
7
+ exports.getUpstreamTags = getUpstreamTags;
8
+ exports.commitsBehindUpstream = commitsBehindUpstream;
9
+ exports.mergeUpstream = mergeUpstream;
10
+ exports.abortMerge = abortMerge;
11
+ exports.hasUncommittedChanges = hasUncommittedChanges;
12
+ exports.addUpstreamRemote = addUpstreamRemote;
13
+ const child_process_1 = require("child_process");
14
+ function git(args, opts) {
15
+ try {
16
+ return (0, child_process_1.execSync)(`git ${args}`, {
17
+ cwd: opts.cwd,
18
+ encoding: 'utf-8',
19
+ stdio: opts.silent ? ['pipe', 'pipe', 'pipe'] : undefined,
20
+ }).trim();
21
+ }
22
+ catch (err) {
23
+ if (opts.silent)
24
+ return '';
25
+ throw new Error(`git ${args} failed: ${err.stderr || err.message}`);
26
+ }
27
+ }
28
+ function hasRemote(name, cwd) {
29
+ const remotes = git('remote', { cwd, silent: true });
30
+ return remotes.split('\n').includes(name);
31
+ }
32
+ function getUpstreamUrl(cwd) {
33
+ if (!hasRemote('upstream', cwd))
34
+ return undefined;
35
+ return git('remote get-url upstream', { cwd, silent: true }) || undefined;
36
+ }
37
+ function fetchUpstream(cwd, refspec) {
38
+ const ref = refspec ? ` ${refspec}` : '';
39
+ git(`fetch upstream${ref}`, { cwd });
40
+ }
41
+ function getUpstreamTags(cwd) {
42
+ fetchUpstream(cwd, '--tags');
43
+ const output = git('tag -l "v*"', { cwd, silent: true });
44
+ if (!output)
45
+ return [];
46
+ return output.split('\n').filter(Boolean);
47
+ }
48
+ function commitsBehindUpstream(cwd, releaseBranch) {
49
+ const count = git(`rev-list HEAD..upstream/${releaseBranch} --count`, { cwd, silent: true });
50
+ return parseInt(count, 10) || 0;
51
+ }
52
+ function mergeUpstream(cwd, releaseBranch) {
53
+ try {
54
+ const output = git(`merge upstream/${releaseBranch} --no-edit`, { cwd });
55
+ return { success: true, output };
56
+ }
57
+ catch (err) {
58
+ return { success: false, output: err.message || 'Merge failed' };
59
+ }
60
+ }
61
+ function abortMerge(cwd) {
62
+ git('merge --abort', { cwd, silent: true });
63
+ }
64
+ function hasUncommittedChanges(cwd) {
65
+ const status = git('status --porcelain', { cwd, silent: true });
66
+ return status.length > 0;
67
+ }
68
+ function addUpstreamRemote(cwd, url) {
69
+ if (hasRemote('upstream', cwd)) {
70
+ git(`remote set-url upstream ${url}`, { cwd });
71
+ }
72
+ else {
73
+ git(`remote add upstream ${url}`, { cwd });
74
+ }
75
+ }
76
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/util/git.ts"],"names":[],"mappings":";;AAOA,kBAWC;AAED,8BAGC;AAED,wCAGC;AAED,sCAGC;AAED,0CAKC;AAED,sDAMC;AAED,sCAOC;AAED,gCAEC;AAED,sDAGC;AAED,8CAMC;AA1ED,iDAAyC;AAOzC,SAAgB,GAAG,CAAC,IAAY,EAAE,IAAoB;IAClD,IAAI,CAAC;QACD,OAAO,IAAA,wBAAQ,EAAC,OAAO,IAAI,EAAE,EAAE;YAC3B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;SAC5D,CAAC,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAChB,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,YAAY,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;AACL,CAAC;AAED,SAAgB,SAAS,CAAC,IAAY,EAAE,GAAW;IAC/C,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,MAAM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AG,GAAG,CAAC,kBAAkB,aAAa,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QACzE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACrC,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAChB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,IAAI,cAAc,EAAE,CAAC;IACrE,CAAC;AACL,CAAC;AAED,SAAgB,UAAU,CAAC,GAAW;IAClC,GAAG,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAChD,CAAC;AAED,SAAgB,qBAAqB,CAAC,GAAW;IAC7C,MAAM,MAAM,GAAG,GAAG,CAAC,oBAAoB,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED,SAAgB,iBAAiB,CAAC,GAAW,EAAE,GAAW;IACtD,IAAI,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,CAAC;QAC7B,GAAG,CAAC,2BAA2B,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IACnD,CAAC;SAAM,CAAC;QACJ,GAAG,CAAC,uBAAuB,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waypoint-framework/cli",
3
- "version": "0.2.2-rc.1",
3
+ "version": "0.2.2-rc.2",
4
4
  "description": "CLI for local validation and workflow versioning in Waypoint Framework projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",