gaji 0.1.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.
- package/bin/gaji.js +66 -0
- package/lib/base.d.ts +143 -0
- package/lib/index.d.ts +92 -0
- package/lib/index.js +187 -0
- package/package.json +49 -0
- package/scripts/postinstall.js +29 -0
package/bin/gaji.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
|
|
7
|
+
const PLATFORMS = {
|
|
8
|
+
"linux-x64": "@gaji/linux-x64",
|
|
9
|
+
"linux-arm64": "@gaji/linux-arm64",
|
|
10
|
+
"darwin-x64": "@gaji/darwin-x64",
|
|
11
|
+
"darwin-arm64": "@gaji/darwin-arm64",
|
|
12
|
+
"win32-x64": "@gaji/win32-x64",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function getBinaryPath() {
|
|
16
|
+
const override = process.env.GAJI_BINARY_PATH;
|
|
17
|
+
if (override) {
|
|
18
|
+
return override;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
22
|
+
const packageName = PLATFORMS[platformKey];
|
|
23
|
+
|
|
24
|
+
if (!packageName) {
|
|
25
|
+
console.error(
|
|
26
|
+
`Unsupported platform: ${platformKey}\n` +
|
|
27
|
+
`gaji supports: ${Object.keys(PLATFORMS).join(", ")}\n` +
|
|
28
|
+
`You can install from source: cargo install gaji`
|
|
29
|
+
);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const binName = process.platform === "win32" ? "gaji.exe" : "gaji";
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
const pkgPath = require.resolve(`${packageName}/package.json`);
|
|
37
|
+
const binPath = path.join(path.dirname(pkgPath), "bin", binName);
|
|
38
|
+
if (fs.existsSync(binPath)) {
|
|
39
|
+
return binPath;
|
|
40
|
+
}
|
|
41
|
+
} catch (_) {
|
|
42
|
+
// Package not found
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.error(
|
|
46
|
+
`Could not find gaji binary for ${platformKey}.\n` +
|
|
47
|
+
`The platform package ${packageName} may not have been installed.\n` +
|
|
48
|
+
`Try: npm install ${packageName}\n` +
|
|
49
|
+
`Or install from source: cargo install gaji`
|
|
50
|
+
);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
const binPath = getBinaryPath();
|
|
56
|
+
execFileSync(binPath, process.argv.slice(2), {
|
|
57
|
+
stdio: "inherit",
|
|
58
|
+
env: process.env,
|
|
59
|
+
});
|
|
60
|
+
} catch (e) {
|
|
61
|
+
if (e.status !== undefined) {
|
|
62
|
+
process.exit(e.status);
|
|
63
|
+
}
|
|
64
|
+
console.error(e.message);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
package/lib/base.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// Base types for gaji
|
|
2
|
+
// Auto-generated - Do not edit manually
|
|
3
|
+
|
|
4
|
+
export interface JobStep {
|
|
5
|
+
name?: string;
|
|
6
|
+
uses?: string;
|
|
7
|
+
with?: Record<string, unknown>;
|
|
8
|
+
run?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
if?: string;
|
|
11
|
+
env?: Record<string, string>;
|
|
12
|
+
'working-directory'?: string;
|
|
13
|
+
shell?: string;
|
|
14
|
+
'continue-on-error'?: boolean;
|
|
15
|
+
'timeout-minutes'?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type Step = JobStep;
|
|
19
|
+
|
|
20
|
+
export interface JobDefinition {
|
|
21
|
+
'runs-on': string | string[];
|
|
22
|
+
needs?: string | string[];
|
|
23
|
+
if?: string;
|
|
24
|
+
steps: JobStep[];
|
|
25
|
+
env?: Record<string, string>;
|
|
26
|
+
defaults?: {
|
|
27
|
+
run?: {
|
|
28
|
+
shell?: string;
|
|
29
|
+
'working-directory'?: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
strategy?: {
|
|
33
|
+
matrix?: Record<string, unknown>;
|
|
34
|
+
'fail-fast'?: boolean;
|
|
35
|
+
'max-parallel'?: number;
|
|
36
|
+
};
|
|
37
|
+
'continue-on-error'?: boolean;
|
|
38
|
+
'timeout-minutes'?: number;
|
|
39
|
+
services?: Record<string, Service>;
|
|
40
|
+
container?: Container;
|
|
41
|
+
outputs?: Record<string, string>;
|
|
42
|
+
permissions?: Permissions;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface Service {
|
|
46
|
+
image: string;
|
|
47
|
+
credentials?: {
|
|
48
|
+
username: string;
|
|
49
|
+
password: string;
|
|
50
|
+
};
|
|
51
|
+
env?: Record<string, string>;
|
|
52
|
+
ports?: (string | number)[];
|
|
53
|
+
volumes?: string[];
|
|
54
|
+
options?: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface Container {
|
|
58
|
+
image: string;
|
|
59
|
+
credentials?: {
|
|
60
|
+
username: string;
|
|
61
|
+
password: string;
|
|
62
|
+
};
|
|
63
|
+
env?: Record<string, string>;
|
|
64
|
+
ports?: (string | number)[];
|
|
65
|
+
volumes?: string[];
|
|
66
|
+
options?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type Permissions = 'read-all' | 'write-all' | {
|
|
70
|
+
actions?: 'read' | 'write' | 'none';
|
|
71
|
+
checks?: 'read' | 'write' | 'none';
|
|
72
|
+
contents?: 'read' | 'write' | 'none';
|
|
73
|
+
deployments?: 'read' | 'write' | 'none';
|
|
74
|
+
'id-token'?: 'read' | 'write' | 'none';
|
|
75
|
+
issues?: 'read' | 'write' | 'none';
|
|
76
|
+
packages?: 'read' | 'write' | 'none';
|
|
77
|
+
'pull-requests'?: 'read' | 'write' | 'none';
|
|
78
|
+
'repository-projects'?: 'read' | 'write' | 'none';
|
|
79
|
+
'security-events'?: 'read' | 'write' | 'none';
|
|
80
|
+
statuses?: 'read' | 'write' | 'none';
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export interface WorkflowTrigger {
|
|
84
|
+
branches?: string[];
|
|
85
|
+
'branches-ignore'?: string[];
|
|
86
|
+
tags?: string[];
|
|
87
|
+
'tags-ignore'?: string[];
|
|
88
|
+
paths?: string[];
|
|
89
|
+
'paths-ignore'?: string[];
|
|
90
|
+
types?: string[];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface ScheduleTrigger {
|
|
94
|
+
cron: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface WorkflowDispatchInput {
|
|
98
|
+
description?: string;
|
|
99
|
+
required?: boolean;
|
|
100
|
+
default?: string;
|
|
101
|
+
type?: 'string' | 'boolean' | 'choice' | 'environment';
|
|
102
|
+
options?: string[];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface WorkflowOn {
|
|
106
|
+
push?: WorkflowTrigger;
|
|
107
|
+
pull_request?: WorkflowTrigger;
|
|
108
|
+
pull_request_target?: WorkflowTrigger;
|
|
109
|
+
schedule?: ScheduleTrigger[];
|
|
110
|
+
workflow_dispatch?: {
|
|
111
|
+
inputs?: Record<string, WorkflowDispatchInput>;
|
|
112
|
+
};
|
|
113
|
+
workflow_call?: {
|
|
114
|
+
inputs?: Record<string, WorkflowDispatchInput>;
|
|
115
|
+
outputs?: Record<string, { description?: string; value: string }>;
|
|
116
|
+
secrets?: Record<string, { description?: string; required?: boolean }>;
|
|
117
|
+
};
|
|
118
|
+
release?: { types?: string[] };
|
|
119
|
+
issues?: { types?: string[] };
|
|
120
|
+
issue_comment?: { types?: string[] };
|
|
121
|
+
[key: string]: unknown;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface WorkflowConfig {
|
|
125
|
+
name?: string;
|
|
126
|
+
on: WorkflowOn;
|
|
127
|
+
env?: Record<string, string>;
|
|
128
|
+
defaults?: {
|
|
129
|
+
run?: {
|
|
130
|
+
shell?: string;
|
|
131
|
+
'working-directory'?: string;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
concurrency?: {
|
|
135
|
+
group: string;
|
|
136
|
+
'cancel-in-progress'?: boolean;
|
|
137
|
+
} | string;
|
|
138
|
+
permissions?: Permissions;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface WorkflowDefinition extends WorkflowConfig {
|
|
142
|
+
jobs: Record<string, JobDefinition>;
|
|
143
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// gaji runtime type declarations
|
|
2
|
+
// https://github.com/gaji-ts/gaji
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
JobStep,
|
|
6
|
+
JobDefinition,
|
|
7
|
+
WorkflowConfig,
|
|
8
|
+
WorkflowDefinition,
|
|
9
|
+
Permissions,
|
|
10
|
+
} from './base';
|
|
11
|
+
|
|
12
|
+
export declare function getAction<T extends string>(
|
|
13
|
+
ref: T
|
|
14
|
+
): (config?: {
|
|
15
|
+
name?: string;
|
|
16
|
+
with?: Record<string, unknown>;
|
|
17
|
+
id?: string;
|
|
18
|
+
if?: string;
|
|
19
|
+
env?: Record<string, string>;
|
|
20
|
+
}) => JobStep;
|
|
21
|
+
|
|
22
|
+
export declare class Job {
|
|
23
|
+
constructor(runsOn: string | string[], options?: Partial<JobDefinition>);
|
|
24
|
+
addStep(step: JobStep): this;
|
|
25
|
+
needs(deps: string | string[]): this;
|
|
26
|
+
env(env: Record<string, string>): this;
|
|
27
|
+
when(condition: string): this;
|
|
28
|
+
permissions(perms: Permissions): this;
|
|
29
|
+
outputs(outputs: Record<string, string>): this;
|
|
30
|
+
strategy(s: {
|
|
31
|
+
matrix?: Record<string, unknown>;
|
|
32
|
+
'fail-fast'?: boolean;
|
|
33
|
+
'max-parallel'?: number;
|
|
34
|
+
}): this;
|
|
35
|
+
continueOnError(v: boolean): this;
|
|
36
|
+
timeoutMinutes(m: number): this;
|
|
37
|
+
toJSON(): JobDefinition;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export declare class Workflow {
|
|
41
|
+
constructor(config: WorkflowConfig);
|
|
42
|
+
addJob(id: string, job: Job): this;
|
|
43
|
+
static fromObject(def: WorkflowDefinition, id?: string): Workflow;
|
|
44
|
+
toJSON(): WorkflowDefinition;
|
|
45
|
+
build(id?: string): void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export declare class CompositeAction {
|
|
49
|
+
constructor(config: {
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
inputs?: Record<string, unknown>;
|
|
53
|
+
outputs?: Record<string, unknown>;
|
|
54
|
+
});
|
|
55
|
+
addStep(step: JobStep): this;
|
|
56
|
+
toJSON(): object;
|
|
57
|
+
build(id?: string): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare class CallJob {
|
|
61
|
+
constructor(uses: string);
|
|
62
|
+
with(inputs: Record<string, unknown>): this;
|
|
63
|
+
secrets(s: Record<string, unknown> | 'inherit'): this;
|
|
64
|
+
needs(deps: string | string[]): this;
|
|
65
|
+
when(condition: string): this;
|
|
66
|
+
permissions(perms: Permissions): this;
|
|
67
|
+
toJSON(): object;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export declare class CallAction {
|
|
71
|
+
constructor(uses: string);
|
|
72
|
+
static from(action: CompositeAction): CallAction;
|
|
73
|
+
toJSON(): JobStep;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type {
|
|
77
|
+
JobStep,
|
|
78
|
+
JobStep as Step,
|
|
79
|
+
JobDefinition,
|
|
80
|
+
WorkflowConfig,
|
|
81
|
+
WorkflowDefinition,
|
|
82
|
+
Permissions,
|
|
83
|
+
} from './base';
|
|
84
|
+
|
|
85
|
+
export type {
|
|
86
|
+
Service,
|
|
87
|
+
Container,
|
|
88
|
+
WorkflowTrigger,
|
|
89
|
+
ScheduleTrigger,
|
|
90
|
+
WorkflowDispatchInput,
|
|
91
|
+
WorkflowOn,
|
|
92
|
+
} from './base';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// gaji runtime library
|
|
2
|
+
// https://github.com/gaji-ts/gaji
|
|
3
|
+
|
|
4
|
+
export function getAction(ref) {
|
|
5
|
+
return function(config) {
|
|
6
|
+
if (config === undefined) config = {};
|
|
7
|
+
var step = {
|
|
8
|
+
uses: ref,
|
|
9
|
+
};
|
|
10
|
+
if (config.name !== undefined) step.name = config.name;
|
|
11
|
+
if (config.with !== undefined) step.with = config.with;
|
|
12
|
+
if (config.id !== undefined) step.id = config.id;
|
|
13
|
+
if (config["if"] !== undefined) step["if"] = config["if"];
|
|
14
|
+
if (config.env !== undefined) step.env = config.env;
|
|
15
|
+
return step;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class Job {
|
|
20
|
+
constructor(runsOn, options) {
|
|
21
|
+
if (options === undefined) options = {};
|
|
22
|
+
this._runsOn = runsOn;
|
|
23
|
+
this._steps = [];
|
|
24
|
+
this._needs = options.needs;
|
|
25
|
+
this._env = options.env;
|
|
26
|
+
this._if = options["if"];
|
|
27
|
+
this._permissions = options.permissions;
|
|
28
|
+
this._outputs = options.outputs;
|
|
29
|
+
this._strategy = options.strategy;
|
|
30
|
+
this._continueOnError = options["continue-on-error"];
|
|
31
|
+
this._timeoutMinutes = options["timeout-minutes"];
|
|
32
|
+
this._defaults = options.defaults;
|
|
33
|
+
this._services = options.services;
|
|
34
|
+
this._container = options.container;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
addStep(step) { this._steps.push(step); return this; }
|
|
38
|
+
needs(deps) { this._needs = deps; return this; }
|
|
39
|
+
env(e) { this._env = e; return this; }
|
|
40
|
+
when(condition) { this._if = condition; return this; }
|
|
41
|
+
permissions(p) { this._permissions = p; return this; }
|
|
42
|
+
outputs(o) { this._outputs = o; return this; }
|
|
43
|
+
strategy(s) { this._strategy = s; return this; }
|
|
44
|
+
continueOnError(v) { this._continueOnError = v; return this; }
|
|
45
|
+
timeoutMinutes(m) { this._timeoutMinutes = m; return this; }
|
|
46
|
+
|
|
47
|
+
toJSON() {
|
|
48
|
+
var obj = {
|
|
49
|
+
"runs-on": this._runsOn,
|
|
50
|
+
steps: this._steps,
|
|
51
|
+
};
|
|
52
|
+
if (this._needs !== undefined) obj.needs = this._needs;
|
|
53
|
+
if (this._env !== undefined) obj.env = this._env;
|
|
54
|
+
if (this._if !== undefined) obj["if"] = this._if;
|
|
55
|
+
if (this._permissions !== undefined) obj.permissions = this._permissions;
|
|
56
|
+
if (this._outputs !== undefined) obj.outputs = this._outputs;
|
|
57
|
+
if (this._strategy !== undefined) obj.strategy = this._strategy;
|
|
58
|
+
if (this._continueOnError !== undefined) obj["continue-on-error"] = this._continueOnError;
|
|
59
|
+
if (this._timeoutMinutes !== undefined) obj["timeout-minutes"] = this._timeoutMinutes;
|
|
60
|
+
if (this._defaults !== undefined) obj.defaults = this._defaults;
|
|
61
|
+
if (this._services !== undefined) obj.services = this._services;
|
|
62
|
+
if (this._container !== undefined) obj.container = this._container;
|
|
63
|
+
return obj;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export class Workflow {
|
|
68
|
+
constructor(config) {
|
|
69
|
+
this._name = config.name;
|
|
70
|
+
this._on = config.on;
|
|
71
|
+
this._env = config.env;
|
|
72
|
+
this._defaults = config.defaults;
|
|
73
|
+
this._concurrency = config.concurrency;
|
|
74
|
+
this._permissions = config.permissions;
|
|
75
|
+
this._jobs = {};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
addJob(id, job) {
|
|
79
|
+
this._jobs[id] = job;
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static fromObject(def, id) {
|
|
84
|
+
var wf = new Workflow({ name: id, on: {} });
|
|
85
|
+
wf.__rawDef = def;
|
|
86
|
+
return wf;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
toJSON() {
|
|
90
|
+
if (this.__rawDef) return this.__rawDef;
|
|
91
|
+
var obj = {};
|
|
92
|
+
if (this._name !== undefined) obj.name = this._name;
|
|
93
|
+
obj.on = this._on;
|
|
94
|
+
if (this._env !== undefined) obj.env = this._env;
|
|
95
|
+
if (this._defaults !== undefined) obj.defaults = this._defaults;
|
|
96
|
+
if (this._concurrency !== undefined) obj.concurrency = this._concurrency;
|
|
97
|
+
if (this._permissions !== undefined) obj.permissions = this._permissions;
|
|
98
|
+
obj.jobs = this._jobs;
|
|
99
|
+
return obj;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
build(id) {
|
|
103
|
+
if (typeof __gha_build !== "undefined") {
|
|
104
|
+
__gha_build(id || "workflow", JSON.stringify(this), "workflow");
|
|
105
|
+
} else {
|
|
106
|
+
console.log(JSON.stringify(this, null, 2));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export class CompositeAction {
|
|
112
|
+
constructor(config) {
|
|
113
|
+
this._name = config.name;
|
|
114
|
+
this._description = config.description;
|
|
115
|
+
this._inputs = config.inputs;
|
|
116
|
+
this._outputs = config.outputs;
|
|
117
|
+
this._steps = [];
|
|
118
|
+
this._buildId = undefined;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
addStep(step) { this._steps.push(step); return this; }
|
|
122
|
+
|
|
123
|
+
toJSON() {
|
|
124
|
+
var obj = {
|
|
125
|
+
name: this._name,
|
|
126
|
+
description: this._description,
|
|
127
|
+
runs: {
|
|
128
|
+
using: "composite",
|
|
129
|
+
steps: this._steps,
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
if (this._inputs !== undefined) obj.inputs = this._inputs;
|
|
133
|
+
if (this._outputs !== undefined) obj.outputs = this._outputs;
|
|
134
|
+
return obj;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
build(id) {
|
|
138
|
+
this._buildId = id || "action";
|
|
139
|
+
if (typeof __gha_build !== "undefined") {
|
|
140
|
+
__gha_build(this._buildId, JSON.stringify(this), "action");
|
|
141
|
+
} else {
|
|
142
|
+
console.log(JSON.stringify(this, null, 2));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export class CallJob {
|
|
148
|
+
constructor(uses) {
|
|
149
|
+
this._uses = uses;
|
|
150
|
+
this._with = undefined;
|
|
151
|
+
this._secrets = undefined;
|
|
152
|
+
this._needs = undefined;
|
|
153
|
+
this._if = undefined;
|
|
154
|
+
this._permissions = undefined;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
with(inputs) { this._with = inputs; return this; }
|
|
158
|
+
secrets(s) { this._secrets = s; return this; }
|
|
159
|
+
needs(deps) { this._needs = deps; return this; }
|
|
160
|
+
when(condition) { this._if = condition; return this; }
|
|
161
|
+
permissions(p) { this._permissions = p; return this; }
|
|
162
|
+
|
|
163
|
+
toJSON() {
|
|
164
|
+
var obj = { uses: this._uses };
|
|
165
|
+
if (this._with !== undefined) obj.with = this._with;
|
|
166
|
+
if (this._secrets !== undefined) obj.secrets = this._secrets;
|
|
167
|
+
if (this._needs !== undefined) obj.needs = this._needs;
|
|
168
|
+
if (this._if !== undefined) obj["if"] = this._if;
|
|
169
|
+
if (this._permissions !== undefined) obj.permissions = this._permissions;
|
|
170
|
+
return obj;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export class CallAction {
|
|
175
|
+
constructor(uses) {
|
|
176
|
+
this._uses = uses;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
static from(compositeAction) {
|
|
180
|
+
var path = "./.github/actions/" + (compositeAction._buildId || compositeAction._name);
|
|
181
|
+
return new CallAction(path);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
toJSON() {
|
|
185
|
+
return { uses: this._uses };
|
|
186
|
+
}
|
|
187
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gaji",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Type-safe GitHub Actions workflows in TypeScript",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/gaji-ts/gaji"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"gaji": "bin/gaji.js"
|
|
12
|
+
},
|
|
13
|
+
"main": "lib/index.js",
|
|
14
|
+
"types": "lib/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./lib/index.d.ts",
|
|
18
|
+
"default": "./lib/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./base": {
|
|
21
|
+
"types": "./lib/base.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"bin/",
|
|
26
|
+
"lib/",
|
|
27
|
+
"scripts/"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"postinstall": "node scripts/postinstall.js"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"provenance": true
|
|
34
|
+
},
|
|
35
|
+
"optionalDependencies": {
|
|
36
|
+
"@gaji/linux-x64": "0.1.0",
|
|
37
|
+
"@gaji/linux-arm64": "0.1.0",
|
|
38
|
+
"@gaji/darwin-x64": "0.1.0",
|
|
39
|
+
"@gaji/darwin-arm64": "0.1.0",
|
|
40
|
+
"@gaji/win32-x64": "0.1.0"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"github-actions",
|
|
44
|
+
"typescript",
|
|
45
|
+
"ci-cd",
|
|
46
|
+
"workflow",
|
|
47
|
+
"type-safe"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const PLATFORMS = {
|
|
2
|
+
"linux-x64": "@gaji/linux-x64",
|
|
3
|
+
"linux-arm64": "@gaji/linux-arm64",
|
|
4
|
+
"darwin-x64": "@gaji/darwin-x64",
|
|
5
|
+
"darwin-arm64": "@gaji/darwin-arm64",
|
|
6
|
+
"win32-x64": "@gaji/win32-x64",
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
10
|
+
const packageName = PLATFORMS[platformKey];
|
|
11
|
+
|
|
12
|
+
if (!packageName) {
|
|
13
|
+
console.warn(
|
|
14
|
+
`[gaji] Warning: Unsupported platform ${platformKey}. ` +
|
|
15
|
+
`The CLI binary will not be available. ` +
|
|
16
|
+
`Install from source: cargo install gaji`
|
|
17
|
+
);
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
require.resolve(`${packageName}/package.json`);
|
|
23
|
+
} catch (_) {
|
|
24
|
+
console.warn(
|
|
25
|
+
`[gaji] Warning: Platform package ${packageName} was not installed. ` +
|
|
26
|
+
`This can happen with --no-optional. ` +
|
|
27
|
+
`The CLI binary will not work, but the runtime library is still available.`
|
|
28
|
+
);
|
|
29
|
+
}
|