resend-cli 1.2.2 → 1.3.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/README.md +25 -10
- package/dist/cli.cjs +539 -0
- package/package.json +31 -12
- package/.claude/settings.local.json +0 -5
- package/.github/scripts/pr-title-check.js +0 -34
- package/.github/workflows/ci.yml +0 -32
- package/.github/workflows/pr-title-check.yml +0 -13
- package/.github/workflows/release.yml +0 -120
- package/.github/workflows/test-install-windows.yml +0 -48
- package/CHANGELOG.md +0 -31
- package/biome.json +0 -36
- package/bun.lock +0 -73
- package/bunfig.toml +0 -2
- package/docs/agent-dx-gaps.md +0 -167
- package/docs/missing-commands.md +0 -58
- package/docs/production-readiness.md +0 -99
- package/docs/secure-key-storage.md +0 -174
- package/install.ps1 +0 -141
- package/install.sh +0 -301
- package/renovate.json +0 -4
- package/src/cli.ts +0 -92
- package/src/commands/api-keys/create.ts +0 -114
- package/src/commands/api-keys/delete.ts +0 -47
- package/src/commands/api-keys/index.ts +0 -26
- package/src/commands/api-keys/list.ts +0 -35
- package/src/commands/api-keys/utils.ts +0 -8
- package/src/commands/auth/index.ts +0 -20
- package/src/commands/auth/login.ts +0 -234
- package/src/commands/auth/logout.ts +0 -105
- package/src/commands/broadcasts/create.ts +0 -196
- package/src/commands/broadcasts/delete.ts +0 -46
- package/src/commands/broadcasts/get.ts +0 -59
- package/src/commands/broadcasts/index.ts +0 -43
- package/src/commands/broadcasts/list.ts +0 -60
- package/src/commands/broadcasts/send.ts +0 -56
- package/src/commands/broadcasts/update.ts +0 -95
- package/src/commands/broadcasts/utils.ts +0 -35
- package/src/commands/contact-properties/create.ts +0 -118
- package/src/commands/contact-properties/delete.ts +0 -48
- package/src/commands/contact-properties/get.ts +0 -46
- package/src/commands/contact-properties/index.ts +0 -48
- package/src/commands/contact-properties/list.ts +0 -68
- package/src/commands/contact-properties/update.ts +0 -88
- package/src/commands/contact-properties/utils.ts +0 -17
- package/src/commands/contacts/add-segment.ts +0 -78
- package/src/commands/contacts/create.ts +0 -122
- package/src/commands/contacts/delete.ts +0 -49
- package/src/commands/contacts/get.ts +0 -53
- package/src/commands/contacts/index.ts +0 -58
- package/src/commands/contacts/list.ts +0 -57
- package/src/commands/contacts/remove-segment.ts +0 -48
- package/src/commands/contacts/segments.ts +0 -39
- package/src/commands/contacts/topics.ts +0 -45
- package/src/commands/contacts/update-topics.ts +0 -90
- package/src/commands/contacts/update.ts +0 -77
- package/src/commands/contacts/utils.ts +0 -119
- package/src/commands/doctor.ts +0 -216
- package/src/commands/domains/create.ts +0 -83
- package/src/commands/domains/delete.ts +0 -42
- package/src/commands/domains/get.ts +0 -47
- package/src/commands/domains/index.ts +0 -35
- package/src/commands/domains/list.ts +0 -53
- package/src/commands/domains/update.ts +0 -75
- package/src/commands/domains/utils.ts +0 -44
- package/src/commands/domains/verify.ts +0 -38
- package/src/commands/emails/batch.ts +0 -140
- package/src/commands/emails/index.ts +0 -24
- package/src/commands/emails/receiving/attachment.ts +0 -55
- package/src/commands/emails/receiving/attachments.ts +0 -68
- package/src/commands/emails/receiving/get.ts +0 -58
- package/src/commands/emails/receiving/index.ts +0 -28
- package/src/commands/emails/receiving/list.ts +0 -59
- package/src/commands/emails/receiving/utils.ts +0 -38
- package/src/commands/emails/send.ts +0 -189
- package/src/commands/open.ts +0 -24
- package/src/commands/segments/create.ts +0 -50
- package/src/commands/segments/delete.ts +0 -47
- package/src/commands/segments/get.ts +0 -38
- package/src/commands/segments/index.ts +0 -36
- package/src/commands/segments/list.ts +0 -58
- package/src/commands/segments/utils.ts +0 -7
- package/src/commands/teams/index.ts +0 -10
- package/src/commands/teams/list.ts +0 -35
- package/src/commands/teams/remove.ts +0 -86
- package/src/commands/teams/switch.ts +0 -76
- package/src/commands/topics/create.ts +0 -73
- package/src/commands/topics/delete.ts +0 -47
- package/src/commands/topics/get.ts +0 -42
- package/src/commands/topics/index.ts +0 -42
- package/src/commands/topics/list.ts +0 -34
- package/src/commands/topics/update.ts +0 -59
- package/src/commands/topics/utils.ts +0 -16
- package/src/commands/webhooks/create.ts +0 -128
- package/src/commands/webhooks/delete.ts +0 -49
- package/src/commands/webhooks/get.ts +0 -42
- package/src/commands/webhooks/index.ts +0 -44
- package/src/commands/webhooks/list.ts +0 -55
- package/src/commands/webhooks/update.ts +0 -83
- package/src/commands/webhooks/utils.ts +0 -36
- package/src/commands/whoami.ts +0 -71
- package/src/lib/actions.ts +0 -157
- package/src/lib/client.ts +0 -37
- package/src/lib/config.ts +0 -217
- package/src/lib/files.ts +0 -15
- package/src/lib/help-text.ts +0 -38
- package/src/lib/output.ts +0 -54
- package/src/lib/pagination.ts +0 -36
- package/src/lib/prompts.ts +0 -149
- package/src/lib/spinner.ts +0 -100
- package/src/lib/table.ts +0 -57
- package/src/lib/tty.ts +0 -28
- package/src/lib/update-check.ts +0 -172
- package/src/lib/version.ts +0 -4
- package/tests/commands/api-keys/create.test.ts +0 -195
- package/tests/commands/api-keys/delete.test.ts +0 -156
- package/tests/commands/api-keys/list.test.ts +0 -133
- package/tests/commands/auth/login.test.ts +0 -156
- package/tests/commands/auth/logout.test.ts +0 -146
- package/tests/commands/broadcasts/create.test.ts +0 -447
- package/tests/commands/broadcasts/delete.test.ts +0 -182
- package/tests/commands/broadcasts/get.test.ts +0 -146
- package/tests/commands/broadcasts/list.test.ts +0 -196
- package/tests/commands/broadcasts/send.test.ts +0 -161
- package/tests/commands/broadcasts/update.test.ts +0 -283
- package/tests/commands/contact-properties/create.test.ts +0 -250
- package/tests/commands/contact-properties/delete.test.ts +0 -183
- package/tests/commands/contact-properties/get.test.ts +0 -144
- package/tests/commands/contact-properties/list.test.ts +0 -180
- package/tests/commands/contact-properties/update.test.ts +0 -216
- package/tests/commands/contacts/add-segment.test.ts +0 -188
- package/tests/commands/contacts/create.test.ts +0 -270
- package/tests/commands/contacts/delete.test.ts +0 -192
- package/tests/commands/contacts/get.test.ts +0 -148
- package/tests/commands/contacts/list.test.ts +0 -175
- package/tests/commands/contacts/remove-segment.test.ts +0 -166
- package/tests/commands/contacts/segments.test.ts +0 -167
- package/tests/commands/contacts/topics.test.ts +0 -163
- package/tests/commands/contacts/update-topics.test.ts +0 -247
- package/tests/commands/contacts/update.test.ts +0 -205
- package/tests/commands/doctor.test.ts +0 -165
- package/tests/commands/domains/create.test.ts +0 -192
- package/tests/commands/domains/delete.test.ts +0 -156
- package/tests/commands/domains/get.test.ts +0 -137
- package/tests/commands/domains/list.test.ts +0 -164
- package/tests/commands/domains/update.test.ts +0 -223
- package/tests/commands/domains/verify.test.ts +0 -117
- package/tests/commands/emails/batch.test.ts +0 -313
- package/tests/commands/emails/receiving/attachment.test.ts +0 -140
- package/tests/commands/emails/receiving/attachments.test.ts +0 -168
- package/tests/commands/emails/receiving/get.test.ts +0 -140
- package/tests/commands/emails/receiving/list.test.ts +0 -181
- package/tests/commands/emails/send.test.ts +0 -309
- package/tests/commands/segments/create.test.ts +0 -163
- package/tests/commands/segments/delete.test.ts +0 -182
- package/tests/commands/segments/get.test.ts +0 -137
- package/tests/commands/segments/list.test.ts +0 -173
- package/tests/commands/teams/list.test.ts +0 -63
- package/tests/commands/teams/remove.test.ts +0 -103
- package/tests/commands/teams/switch.test.ts +0 -96
- package/tests/commands/topics/create.test.ts +0 -191
- package/tests/commands/topics/delete.test.ts +0 -156
- package/tests/commands/topics/get.test.ts +0 -125
- package/tests/commands/topics/list.test.ts +0 -124
- package/tests/commands/topics/update.test.ts +0 -177
- package/tests/commands/webhooks/create.test.ts +0 -224
- package/tests/commands/webhooks/delete.test.ts +0 -156
- package/tests/commands/webhooks/get.test.ts +0 -125
- package/tests/commands/webhooks/list.test.ts +0 -177
- package/tests/commands/webhooks/update.test.ts +0 -206
- package/tests/commands/whoami.test.ts +0 -99
- package/tests/helpers.ts +0 -93
- package/tests/lib/client.test.ts +0 -71
- package/tests/lib/config.test.ts +0 -445
- package/tests/lib/files.test.ts +0 -65
- package/tests/lib/help-text.test.ts +0 -97
- package/tests/lib/output.test.ts +0 -127
- package/tests/lib/prompts.test.ts +0 -178
- package/tests/lib/spinner.test.ts +0 -146
- package/tests/lib/table.test.ts +0 -63
- package/tests/lib/tty.test.ts +0 -85
- package/tests/lib/update-check.test.ts +0 -169
- package/tsconfig.json +0 -14
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, spyOn, test } from 'bun:test';
|
|
2
|
-
import {
|
|
3
|
-
existsSync,
|
|
4
|
-
mkdirSync,
|
|
5
|
-
readFileSync,
|
|
6
|
-
rmSync,
|
|
7
|
-
writeFileSync,
|
|
8
|
-
} from 'node:fs';
|
|
9
|
-
import { tmpdir } from 'node:os';
|
|
10
|
-
import { join } from 'node:path';
|
|
11
|
-
import { checkForUpdates } from '../../src/lib/update-check';
|
|
12
|
-
import { VERSION } from '../../src/lib/version';
|
|
13
|
-
import { captureTestEnv } from '../helpers';
|
|
14
|
-
|
|
15
|
-
// Use a version guaranteed to be "newer" than whatever VERSION is
|
|
16
|
-
const NEWER_VERSION = '99.0.0';
|
|
17
|
-
|
|
18
|
-
const testConfigDir = join(tmpdir(), `resend-update-check-test-${process.pid}`);
|
|
19
|
-
const testResendDir = join(testConfigDir, 'resend');
|
|
20
|
-
const statePath = join(testResendDir, 'update-state.json');
|
|
21
|
-
|
|
22
|
-
describe('checkForUpdates', () => {
|
|
23
|
-
const restoreEnv = captureTestEnv();
|
|
24
|
-
let stderrOutput: string;
|
|
25
|
-
let stderrSpy: ReturnType<typeof spyOn>;
|
|
26
|
-
let fetchSpy: ReturnType<typeof spyOn>;
|
|
27
|
-
|
|
28
|
-
beforeEach(() => {
|
|
29
|
-
mkdirSync(testResendDir, { recursive: true });
|
|
30
|
-
stderrOutput = '';
|
|
31
|
-
stderrSpy = spyOn(process.stderr, 'write').mockImplementation((chunk) => {
|
|
32
|
-
stderrOutput += String(chunk);
|
|
33
|
-
return true;
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// Point getConfigDir() at our temp dir via XDG_CONFIG_HOME
|
|
37
|
-
process.env.XDG_CONFIG_HOME = testConfigDir;
|
|
38
|
-
|
|
39
|
-
// Ensure TTY and no CI
|
|
40
|
-
Object.defineProperty(process.stdout, 'isTTY', {
|
|
41
|
-
value: true,
|
|
42
|
-
writable: true,
|
|
43
|
-
});
|
|
44
|
-
delete process.env.CI;
|
|
45
|
-
delete process.env.GITHUB_ACTIONS;
|
|
46
|
-
delete process.env.RESEND_NO_UPDATE_NOTIFIER;
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
afterEach(() => {
|
|
50
|
-
stderrSpy.mockRestore();
|
|
51
|
-
if (fetchSpy) {
|
|
52
|
-
fetchSpy.mockRestore();
|
|
53
|
-
}
|
|
54
|
-
restoreEnv();
|
|
55
|
-
if (existsSync(testConfigDir)) {
|
|
56
|
-
rmSync(testConfigDir, { recursive: true, force: true });
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
function mockFetch(tagName: string, extra: Record<string, unknown> = {}) {
|
|
61
|
-
fetchSpy = spyOn(globalThis, 'fetch').mockResolvedValue({
|
|
62
|
-
ok: true,
|
|
63
|
-
json: async () => ({ tag_name: tagName, ...extra }),
|
|
64
|
-
} as Response);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function mockFetchFailure() {
|
|
68
|
-
fetchSpy = spyOn(globalThis, 'fetch').mockRejectedValue(
|
|
69
|
-
new Error('network error'),
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
test('skips check when RESEND_NO_UPDATE_NOTIFIER=1', async () => {
|
|
74
|
-
process.env.RESEND_NO_UPDATE_NOTIFIER = '1';
|
|
75
|
-
await checkForUpdates();
|
|
76
|
-
expect(stderrOutput).toBe('');
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test('skips check when CI=true', async () => {
|
|
80
|
-
process.env.CI = 'true';
|
|
81
|
-
await checkForUpdates();
|
|
82
|
-
expect(stderrOutput).toBe('');
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
test('skips check when not a TTY', async () => {
|
|
86
|
-
Object.defineProperty(process.stdout, 'isTTY', {
|
|
87
|
-
value: undefined,
|
|
88
|
-
writable: true,
|
|
89
|
-
});
|
|
90
|
-
await checkForUpdates();
|
|
91
|
-
expect(stderrOutput).toBe('');
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
test('prints notice when newer version available from fresh fetch', async () => {
|
|
95
|
-
mockFetch(`v${NEWER_VERSION}`);
|
|
96
|
-
await checkForUpdates();
|
|
97
|
-
|
|
98
|
-
expect(stderrOutput).toContain('Update available');
|
|
99
|
-
expect(stderrOutput).toContain(`v${VERSION}`);
|
|
100
|
-
expect(stderrOutput).toContain(`v${NEWER_VERSION}`);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
test('prints nothing when already on latest', async () => {
|
|
104
|
-
mockFetch(`v${VERSION}`);
|
|
105
|
-
await checkForUpdates();
|
|
106
|
-
expect(stderrOutput).toBe('');
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
test('uses cached state when fresh (no fetch)', async () => {
|
|
110
|
-
writeFileSync(
|
|
111
|
-
statePath,
|
|
112
|
-
JSON.stringify({ lastChecked: Date.now(), latestVersion: NEWER_VERSION }),
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
mockFetch(`v${NEWER_VERSION}`);
|
|
116
|
-
await checkForUpdates();
|
|
117
|
-
|
|
118
|
-
expect(fetchSpy).not.toHaveBeenCalled();
|
|
119
|
-
expect(stderrOutput).toContain(`v${NEWER_VERSION}`);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
test('refetches when cache is stale', async () => {
|
|
123
|
-
const staleTime = Date.now() - 25 * 60 * 60 * 1000; // 25 hours ago
|
|
124
|
-
writeFileSync(
|
|
125
|
-
statePath,
|
|
126
|
-
JSON.stringify({ lastChecked: staleTime, latestVersion: VERSION }),
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
mockFetch(`v${NEWER_VERSION}`);
|
|
130
|
-
await checkForUpdates();
|
|
131
|
-
|
|
132
|
-
expect(fetchSpy).toHaveBeenCalled();
|
|
133
|
-
expect(stderrOutput).toContain(`v${NEWER_VERSION}`);
|
|
134
|
-
// Verify cache was updated
|
|
135
|
-
const state = JSON.parse(readFileSync(statePath, 'utf-8'));
|
|
136
|
-
expect(state.latestVersion).toBe(NEWER_VERSION);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
test('handles fetch failure gracefully', async () => {
|
|
140
|
-
mockFetchFailure();
|
|
141
|
-
await checkForUpdates();
|
|
142
|
-
expect(stderrOutput).toBe('');
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
test('writes state file after successful fetch', async () => {
|
|
146
|
-
mockFetch(`v${VERSION}`);
|
|
147
|
-
await checkForUpdates();
|
|
148
|
-
|
|
149
|
-
expect(existsSync(statePath)).toBe(true);
|
|
150
|
-
const state = JSON.parse(readFileSync(statePath, 'utf-8'));
|
|
151
|
-
expect(state.latestVersion).toBe(VERSION);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
test('ignores prerelease versions', async () => {
|
|
155
|
-
fetchSpy = spyOn(globalThis, 'fetch').mockResolvedValue({
|
|
156
|
-
ok: true,
|
|
157
|
-
json: async () => ({ tag_name: 'v99.0.0', prerelease: true }),
|
|
158
|
-
} as Response);
|
|
159
|
-
|
|
160
|
-
await checkForUpdates();
|
|
161
|
-
expect(stderrOutput).toBe('');
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
test('ignores non-semver tag names', async () => {
|
|
165
|
-
mockFetch('canary-20260311');
|
|
166
|
-
await checkForUpdates();
|
|
167
|
-
expect(stderrOutput).toBe('');
|
|
168
|
-
});
|
|
169
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"outDir": "./dist",
|
|
10
|
-
"rootDir": "./src",
|
|
11
|
-
"types": ["bun"]
|
|
12
|
-
},
|
|
13
|
-
"include": ["src/**/*.ts"]
|
|
14
|
-
}
|