@matthesketh/fleet 1.11.0 → 1.11.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/dist/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function notifyCommand(args: string[]): Promise<void>;
|
package/dist/commands/notify.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { loadNotifyConfig, sendNotification } from '../core/notify.js';
|
|
2
|
-
import { success, error, warn } from '../ui/output.js';
|
|
3
|
-
const HELP = `fleet notify - send a message via configured notify adapters
|
|
4
|
-
|
|
5
|
-
Usage:
|
|
6
|
-
fleet notify <message>
|
|
7
|
-
fleet notify - # read message from stdin
|
|
8
|
-
echo "msg" | fleet notify -
|
|
9
|
-
|
|
10
|
-
Reads adapter config from /etc/fleet/notify.json (telegram / bluebubbles).
|
|
11
|
-
Exits 0 if at least one adapter delivered the message, 1 otherwise.
|
|
12
|
-
`;
|
|
13
|
-
async function readStdin() {
|
|
14
|
-
const chunks = [];
|
|
15
|
-
for await (const chunk of process.stdin) {
|
|
16
|
-
chunks.push(chunk);
|
|
17
|
-
}
|
|
18
|
-
return Buffer.concat(chunks).toString('utf-8').trim();
|
|
19
|
-
}
|
|
20
|
-
export async function notifyCommand(args) {
|
|
21
|
-
if (args.length === 0 || args.includes('-h') || args.includes('--help')) {
|
|
22
|
-
process.stdout.write(HELP);
|
|
23
|
-
if (args.length === 0)
|
|
24
|
-
process.exit(1);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
let message;
|
|
28
|
-
if (args[0] === '-') {
|
|
29
|
-
message = await readStdin();
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
message = args.join(' ');
|
|
33
|
-
}
|
|
34
|
-
if (!message) {
|
|
35
|
-
error('Empty message');
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
const config = loadNotifyConfig();
|
|
39
|
-
if (!config) {
|
|
40
|
-
warn('No notify config at /etc/fleet/notify.json — message not sent');
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
const sent = await sendNotification(config, message);
|
|
44
|
-
if (sent) {
|
|
45
|
-
success('Notification sent');
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
error('Failed to send notification (no adapter succeeded)');
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { EasEnv } from './types.js';
|
|
2
|
-
export declare function easVersion(): string | null;
|
|
3
|
-
export declare function easBuild(projectPath: string, profile: string, env: EasEnv): number;
|
|
4
|
-
export declare function easSubmit(projectPath: string, profile: string, env: EasEnv): number;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { execSafe } from '../exec.js';
|
|
3
|
-
// the eas cli is invoked through npx so a global install isn't required.
|
|
4
|
-
function npxArgs(rest) {
|
|
5
|
-
return ['--yes', 'eas-cli', ...rest];
|
|
6
|
-
}
|
|
7
|
-
// version string of the eas cli, or null when it can't be resolved.
|
|
8
|
-
export function easVersion() {
|
|
9
|
-
const res = execSafe('npx', npxArgs(['--version']), { timeout: 120_000 });
|
|
10
|
-
if (!res.ok || !res.stdout)
|
|
11
|
-
return null;
|
|
12
|
-
return res.stdout.split('\n').map(l => l.trim()).filter(Boolean).pop() ?? null;
|
|
13
|
-
}
|
|
14
|
-
// run an eas cli subcommand in the mobile project with stdio inherited so a
|
|
15
|
-
// long-running build/submit streams its progress live. returns the exit code.
|
|
16
|
-
function easLive(projectPath, env, rest) {
|
|
17
|
-
const result = spawnSync('npx', npxArgs(rest), {
|
|
18
|
-
cwd: projectPath,
|
|
19
|
-
stdio: 'inherit',
|
|
20
|
-
env: { ...process.env, ...env },
|
|
21
|
-
encoding: 'utf-8',
|
|
22
|
-
});
|
|
23
|
-
return result.status ?? 1;
|
|
24
|
-
}
|
|
25
|
-
// build the ios app for the given eas profile.
|
|
26
|
-
export function easBuild(projectPath, profile, env) {
|
|
27
|
-
return easLive(projectPath, env, [
|
|
28
|
-
'build', '--platform', 'ios', '--profile', profile, '--non-interactive',
|
|
29
|
-
]);
|
|
30
|
-
}
|
|
31
|
-
// submit the latest ios build to testflight. when no app store connect record
|
|
32
|
-
// exists for the bundle id yet, eas submit creates one — this is the "new
|
|
33
|
-
// entry" path.
|
|
34
|
-
export function easSubmit(projectPath, profile, env) {
|
|
35
|
-
return easLive(projectPath, env, [
|
|
36
|
-
'submit', '--platform', 'ios', '--profile', profile, '--non-interactive',
|
|
37
|
-
]);
|
|
38
|
-
}
|