@octoberswimmer/aer-sf-plugin 0.0.1 → 0.0.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.
- package/LICENSE +20 -0
- package/README.md +28 -2
- package/lib/aer.d.ts +1 -2
- package/lib/aer.js +3 -6
- package/lib/aer.js.map +1 -1
- package/lib/aerBinary.d.ts +37 -0
- package/lib/aerBinary.js +296 -0
- package/lib/aerBinary.js.map +1 -0
- package/lib/commands/aer/apex/run/test.js +8 -1
- package/lib/commands/aer/apex/run/test.js.map +1 -1
- package/messages/aer.apex.run.test.md +6 -1
- package/oclif.manifest.json +2 -2
- package/package.json +7 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
aer License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 October Swimmer LLC. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This software is licensed, not sold. You may use the following features free of charge:
|
|
6
|
+
- Language Server Protocol (LSP) features.
|
|
7
|
+
- The test runner to execute up to 100 tests at a time.
|
|
8
|
+
- The debugger for up to five minutes per debugging session.
|
|
9
|
+
|
|
10
|
+
Any other use requires an active license, which can be obtained at
|
|
11
|
+
https://www.octoberswimmer.com/tools/aer/subscribe/. You may not bypass or
|
|
12
|
+
exceed the free-use limits without a valid license.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -20,9 +20,10 @@ copy.
|
|
|
20
20
|
## Requirements
|
|
21
21
|
|
|
22
22
|
- [Salesforce CLI](https://developer.salesforce.com/tools/salesforcecli) (`sf`)
|
|
23
|
-
- [aer](https://github.com/octoberswimmer/aer-dist) on `PATH` (or set
|
|
24
|
-
`AER_BIN=/abs/path/to/aer`)
|
|
25
23
|
- Node.js >= 18
|
|
24
|
+
- [aer](https://github.com/octoberswimmer/aer-dist) — the plugin will offer to
|
|
25
|
+
download the right build for your platform on first use if it can't find one
|
|
26
|
+
already (see [Locating the aer binary](#locating-the-aer-binary) below).
|
|
26
27
|
|
|
27
28
|
## Install
|
|
28
29
|
|
|
@@ -64,6 +65,31 @@ With code coverage:
|
|
|
64
65
|
sf aer apex run test --code-coverage --output-dir test-results
|
|
65
66
|
```
|
|
66
67
|
|
|
68
|
+
## Locating the aer binary
|
|
69
|
+
|
|
70
|
+
When the plugin needs to invoke `aer`, it tries these sources in order:
|
|
71
|
+
|
|
72
|
+
1. The `AER_BIN` environment variable, when it points to an executable file.
|
|
73
|
+
2. A copy previously downloaded by this plugin, stored under a platform-specific
|
|
74
|
+
data directory:
|
|
75
|
+
- Linux: `$XDG_DATA_HOME/aer-sf-plugin/aer-bin/` (default
|
|
76
|
+
`~/.local/share/aer-sf-plugin/aer-bin/`)
|
|
77
|
+
- macOS: `~/Library/Application Support/aer-sf-plugin/aer-bin/`
|
|
78
|
+
- Windows: `%LOCALAPPDATA%\aer-sf-plugin\aer-bin\`
|
|
79
|
+
3. `aer` discovered on `PATH`.
|
|
80
|
+
4. If none of the above match and the terminal is interactive, the plugin asks
|
|
81
|
+
for confirmation, then downloads the latest
|
|
82
|
+
[aer-dist](https://github.com/octoberswimmer/aer-dist) release for your
|
|
83
|
+
platform, extracts it into the data directory above, and uses it for that
|
|
84
|
+
run and all later runs.
|
|
85
|
+
|
|
86
|
+
To update a downloaded copy, delete the contents of the `aer-bin/` directory
|
|
87
|
+
(or the whole `aer-sf-plugin/` directory) and the next run will offer to
|
|
88
|
+
re-download.
|
|
89
|
+
|
|
90
|
+
In non-interactive environments (CI, `--json`) the plugin will not prompt; set
|
|
91
|
+
`AER_BIN` or install `aer` on `PATH` ahead of time.
|
|
92
|
+
|
|
67
93
|
## How source is staged
|
|
68
94
|
|
|
69
95
|
The plugin copies the project's Apex source into a temp directory before
|
package/lib/aer.d.ts
CHANGED
|
@@ -8,5 +8,4 @@ export type AerInvocation = {
|
|
|
8
8
|
verbose: boolean;
|
|
9
9
|
};
|
|
10
10
|
export declare function buildAerArgs(inv: AerInvocation): string[];
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function runAer(args: string[], cwd: string): Promise<number>;
|
|
11
|
+
export declare function runAer(binaryPath: string, args: string[], cwd: string): Promise<number>;
|
package/lib/aer.js
CHANGED
|
@@ -19,18 +19,15 @@ export function buildAerArgs(inv) {
|
|
|
19
19
|
}
|
|
20
20
|
return args;
|
|
21
21
|
}
|
|
22
|
-
export function
|
|
23
|
-
return process.env.AER_BIN ?? 'aer';
|
|
24
|
-
}
|
|
25
|
-
export async function runAer(args, cwd) {
|
|
22
|
+
export async function runAer(binaryPath, args, cwd) {
|
|
26
23
|
return new Promise((resolvePromise, rejectPromise) => {
|
|
27
|
-
const child = spawn(
|
|
24
|
+
const child = spawn(binaryPath, args, {
|
|
28
25
|
cwd,
|
|
29
26
|
stdio: 'inherit',
|
|
30
27
|
});
|
|
31
28
|
child.on('error', (err) => {
|
|
32
29
|
if (err.code === 'ENOENT') {
|
|
33
|
-
rejectPromise(new Error(`Could not
|
|
30
|
+
rejectPromise(new Error(`Could not execute aer at ${binaryPath}. The file may have been moved or deleted.`));
|
|
34
31
|
return;
|
|
35
32
|
}
|
|
36
33
|
rejectPromise(err);
|
package/lib/aer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"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CACD,CAAC;gBACF,OAAO;YACR,CAAC;YACD,aAAa,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YACjC,IAAI,MAAM,EAAE,CAAC;gBACZ,cAAc,CAAC,GAAG,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACjF,CAAC;iBAAM,CAAC;gBACP,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;YAC3B,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type ConfirmFn = (message: string) => Promise<boolean>;
|
|
2
|
+
export type LogFn = (message: string) => void;
|
|
3
|
+
export type EnsureAerOptions = {
|
|
4
|
+
/** When false, never prompt — throw if binary cannot be resolved. Defaults to true. */
|
|
5
|
+
allowPrompt?: boolean;
|
|
6
|
+
/** Prompt callback for yes/no confirmation. Required when allowPrompt is true. */
|
|
7
|
+
confirm?: ConfirmFn;
|
|
8
|
+
/** Informational log callback. */
|
|
9
|
+
log?: LogFn;
|
|
10
|
+
/** Warning log callback. */
|
|
11
|
+
warn?: LogFn;
|
|
12
|
+
/** Override the storage directory (for testing). */
|
|
13
|
+
storageDir?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the aer binary path. Resolution order:
|
|
17
|
+
* 1. AER_BIN env var (must be executable).
|
|
18
|
+
* 2. Previously downloaded copy in the plugin's storage dir.
|
|
19
|
+
* 3. `aer` on PATH.
|
|
20
|
+
* 4. Prompt to download the latest release into the plugin's storage dir.
|
|
21
|
+
*/
|
|
22
|
+
export declare function ensureAerBinary(opts?: EnsureAerOptions): Promise<string>;
|
|
23
|
+
/** For tests: forget any cached binary path so the next call re-resolves. */
|
|
24
|
+
export declare function _resetAerBinaryCache(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Default storage directory for binaries downloaded by this plugin. Mirrors the
|
|
27
|
+
* conventions used by `envPaths` / oclif: respects XDG on Linux, Library/Application
|
|
28
|
+
* Support on macOS, and LOCALAPPDATA on Windows.
|
|
29
|
+
*/
|
|
30
|
+
export declare function defaultStorageDir(): string;
|
|
31
|
+
export declare function platformDetails(version: string): {
|
|
32
|
+
platformKey: 'linux' | 'darwin' | 'windows';
|
|
33
|
+
cpuKey: 'amd64' | 'arm64';
|
|
34
|
+
binaryName: string;
|
|
35
|
+
archiveName: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function readStoredVersion(storageDir: string): Promise<string | null>;
|
package/lib/aerBinary.js
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { chmod, mkdir, mkdtemp, readFile, rm, stat, writeFile, access } from 'node:fs/promises';
|
|
2
|
+
import { constants as fsConstants, createWriteStream } from 'node:fs';
|
|
3
|
+
import { delimiter, join, resolve } from 'node:path';
|
|
4
|
+
import { homedir, tmpdir } from 'node:os';
|
|
5
|
+
import { get as httpsGet } from 'node:https';
|
|
6
|
+
import AdmZip from 'adm-zip';
|
|
7
|
+
const REPO = 'octoberswimmer/aer-dist';
|
|
8
|
+
const BINARY_NAME = process.platform === 'win32' ? 'aer.exe' : 'aer';
|
|
9
|
+
const VERSION_FILE = 'VERSION';
|
|
10
|
+
const PLUGIN_DIR_NAME = 'aer-sf-plugin';
|
|
11
|
+
const BIN_SUBDIR = 'aer-bin';
|
|
12
|
+
let cachedAerPath = null;
|
|
13
|
+
let resolving = null;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the aer binary path. Resolution order:
|
|
16
|
+
* 1. AER_BIN env var (must be executable).
|
|
17
|
+
* 2. Previously downloaded copy in the plugin's storage dir.
|
|
18
|
+
* 3. `aer` on PATH.
|
|
19
|
+
* 4. Prompt to download the latest release into the plugin's storage dir.
|
|
20
|
+
*/
|
|
21
|
+
export async function ensureAerBinary(opts = {}) {
|
|
22
|
+
if (resolving) {
|
|
23
|
+
return resolving;
|
|
24
|
+
}
|
|
25
|
+
const log = opts.log ?? (() => { });
|
|
26
|
+
const warn = opts.warn ?? (() => { });
|
|
27
|
+
const allowPrompt = opts.allowPrompt ?? true;
|
|
28
|
+
const storageDir = opts.storageDir ?? defaultStorageDir();
|
|
29
|
+
resolving = (async () => {
|
|
30
|
+
const envBin = process.env.AER_BIN;
|
|
31
|
+
if (envBin) {
|
|
32
|
+
const resolved = await resolveExecutable(envBin);
|
|
33
|
+
if (resolved) {
|
|
34
|
+
cachedAerPath = resolved;
|
|
35
|
+
return resolved;
|
|
36
|
+
}
|
|
37
|
+
warn(`AER_BIN is set to "${envBin}" but the file was not found or is not executable; falling back.`);
|
|
38
|
+
}
|
|
39
|
+
const downloaded = join(storageDir, BIN_SUBDIR, BINARY_NAME);
|
|
40
|
+
if (await isExecutable(downloaded)) {
|
|
41
|
+
cachedAerPath = downloaded;
|
|
42
|
+
return downloaded;
|
|
43
|
+
}
|
|
44
|
+
const fromPath = await resolveExecutable('aer');
|
|
45
|
+
if (fromPath) {
|
|
46
|
+
cachedAerPath = fromPath;
|
|
47
|
+
return fromPath;
|
|
48
|
+
}
|
|
49
|
+
if (cachedAerPath && (await isExecutable(cachedAerPath))) {
|
|
50
|
+
return cachedAerPath;
|
|
51
|
+
}
|
|
52
|
+
if (!allowPrompt || !opts.confirm) {
|
|
53
|
+
throw new Error(`Could not find the 'aer' binary. Install aer from https://github.com/${REPO}, set AER_BIN to its absolute path, or rerun interactively to download it automatically.`);
|
|
54
|
+
}
|
|
55
|
+
const yes = await opts.confirm("aer was not found on PATH. Download the latest release from GitHub?");
|
|
56
|
+
if (!yes) {
|
|
57
|
+
throw new Error(`aer is required but was not installed.`);
|
|
58
|
+
}
|
|
59
|
+
const binPath = await downloadLatest(storageDir, log);
|
|
60
|
+
cachedAerPath = binPath;
|
|
61
|
+
return binPath;
|
|
62
|
+
})().finally(() => {
|
|
63
|
+
resolving = null;
|
|
64
|
+
});
|
|
65
|
+
return resolving;
|
|
66
|
+
}
|
|
67
|
+
/** For tests: forget any cached binary path so the next call re-resolves. */
|
|
68
|
+
export function _resetAerBinaryCache() {
|
|
69
|
+
cachedAerPath = null;
|
|
70
|
+
resolving = null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Default storage directory for binaries downloaded by this plugin. Mirrors the
|
|
74
|
+
* conventions used by `envPaths` / oclif: respects XDG on Linux, Library/Application
|
|
75
|
+
* Support on macOS, and LOCALAPPDATA on Windows.
|
|
76
|
+
*/
|
|
77
|
+
export function defaultStorageDir() {
|
|
78
|
+
const home = homedir();
|
|
79
|
+
switch (process.platform) {
|
|
80
|
+
case 'win32': {
|
|
81
|
+
const base = process.env.LOCALAPPDATA ?? join(home, 'AppData', 'Local');
|
|
82
|
+
return join(base, PLUGIN_DIR_NAME);
|
|
83
|
+
}
|
|
84
|
+
case 'darwin':
|
|
85
|
+
return join(home, 'Library', 'Application Support', PLUGIN_DIR_NAME);
|
|
86
|
+
default: {
|
|
87
|
+
const base = process.env.XDG_DATA_HOME ?? join(home, '.local', 'share');
|
|
88
|
+
return join(base, PLUGIN_DIR_NAME);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async function downloadLatest(storageDir, log) {
|
|
93
|
+
const version = await resolveLatestVersion();
|
|
94
|
+
log(`Downloading aer ${version}…`);
|
|
95
|
+
return downloadAndExtract(storageDir, version, log);
|
|
96
|
+
}
|
|
97
|
+
async function downloadAndExtract(storageDir, version, log) {
|
|
98
|
+
const { binaryName, archiveName } = platformDetails(version);
|
|
99
|
+
const url = `https://github.com/${REPO}/releases/download/${version}/${archiveName}`;
|
|
100
|
+
const binDir = join(storageDir, BIN_SUBDIR);
|
|
101
|
+
await mkdir(binDir, { recursive: true, mode: 0o755 });
|
|
102
|
+
const tempDir = await mkdtemp(join(tmpdir(), 'aer-download-'));
|
|
103
|
+
const archivePath = join(tempDir, archiveName);
|
|
104
|
+
try {
|
|
105
|
+
log(`Fetching ${url}`);
|
|
106
|
+
await downloadFile(url, archivePath);
|
|
107
|
+
log(`Extracting ${binaryName}…`);
|
|
108
|
+
const extractedPath = extractBinary(archivePath, binaryName, binDir);
|
|
109
|
+
if (process.platform !== 'win32') {
|
|
110
|
+
await chmod(extractedPath, 0o755);
|
|
111
|
+
}
|
|
112
|
+
await writeFile(join(binDir, VERSION_FILE), version, 'utf8');
|
|
113
|
+
log(`Installed aer ${version} to ${extractedPath}`);
|
|
114
|
+
return extractedPath;
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export function platformDetails(version) {
|
|
121
|
+
const platformKey = normalizeOS();
|
|
122
|
+
const cpuKey = normalizeArch();
|
|
123
|
+
const binaryName = platformKey === 'windows' ? 'aer.exe' : 'aer';
|
|
124
|
+
const archiveName = `aer_${platformKey}_${cpuKey}_${version}.zip`;
|
|
125
|
+
return { platformKey, cpuKey, binaryName, archiveName };
|
|
126
|
+
}
|
|
127
|
+
function normalizeOS() {
|
|
128
|
+
switch (process.platform) {
|
|
129
|
+
case 'linux':
|
|
130
|
+
return 'linux';
|
|
131
|
+
case 'darwin':
|
|
132
|
+
return 'darwin';
|
|
133
|
+
case 'win32':
|
|
134
|
+
return 'windows';
|
|
135
|
+
default:
|
|
136
|
+
throw new Error(`Unsupported operating system: ${process.platform}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function normalizeArch() {
|
|
140
|
+
switch (process.arch) {
|
|
141
|
+
case 'x64':
|
|
142
|
+
return 'amd64';
|
|
143
|
+
case 'arm64':
|
|
144
|
+
return 'arm64';
|
|
145
|
+
default:
|
|
146
|
+
throw new Error(`Unsupported architecture: ${process.arch}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
export async function readStoredVersion(storageDir) {
|
|
150
|
+
try {
|
|
151
|
+
const contents = await readFile(join(storageDir, BIN_SUBDIR, VERSION_FILE), 'utf8');
|
|
152
|
+
return contents.trim() || null;
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
async function resolveLatestVersion() {
|
|
159
|
+
const latest = await requestJson(`https://api.github.com/repos/${REPO}/releases/latest`);
|
|
160
|
+
if (latest.statusCode === 404) {
|
|
161
|
+
return latestFromList();
|
|
162
|
+
}
|
|
163
|
+
if (latest.statusCode >= 400) {
|
|
164
|
+
throw new Error(`GitHub API returned ${latest.statusCode} while resolving latest aer release.`);
|
|
165
|
+
}
|
|
166
|
+
const tag = latest.body?.tag_name;
|
|
167
|
+
if (!tag) {
|
|
168
|
+
throw new Error('Latest aer release response is missing tag_name.');
|
|
169
|
+
}
|
|
170
|
+
return String(tag);
|
|
171
|
+
}
|
|
172
|
+
async function latestFromList() {
|
|
173
|
+
const res = await requestJson(`https://api.github.com/repos/${REPO}/releases?per_page=10`);
|
|
174
|
+
if (res.statusCode >= 400) {
|
|
175
|
+
throw new Error(`GitHub API returned ${res.statusCode} while listing aer releases.`);
|
|
176
|
+
}
|
|
177
|
+
if (!Array.isArray(res.body)) {
|
|
178
|
+
throw new Error('Unexpected response while listing aer releases.');
|
|
179
|
+
}
|
|
180
|
+
for (const rel of res.body) {
|
|
181
|
+
if (!rel?.draft && rel?.tag_name) {
|
|
182
|
+
return String(rel.tag_name);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
throw new Error('No published aer releases were found.');
|
|
186
|
+
}
|
|
187
|
+
async function resolveExecutable(cmd) {
|
|
188
|
+
if (cmd.includes('/') || cmd.includes('\\')) {
|
|
189
|
+
const candidate = resolve(cmd);
|
|
190
|
+
return (await isExecutable(candidate)) ? candidate : null;
|
|
191
|
+
}
|
|
192
|
+
const pathVar = process.env.PATH ?? '';
|
|
193
|
+
const extensions = process.platform === 'win32' ? ['.exe', '.cmd', '.bat', ''] : [''];
|
|
194
|
+
for (const segment of pathVar.split(delimiter)) {
|
|
195
|
+
if (!segment)
|
|
196
|
+
continue;
|
|
197
|
+
for (const ext of extensions) {
|
|
198
|
+
const candidate = join(segment, cmd + ext);
|
|
199
|
+
if (await isExecutable(candidate)) {
|
|
200
|
+
return candidate;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
async function isExecutable(filePath) {
|
|
207
|
+
try {
|
|
208
|
+
const stats = await stat(filePath);
|
|
209
|
+
if (!stats.isFile())
|
|
210
|
+
return false;
|
|
211
|
+
if (process.platform === 'win32')
|
|
212
|
+
return true;
|
|
213
|
+
await access(filePath, fsConstants.X_OK);
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function extractBinary(archivePath, binaryName, destDir) {
|
|
221
|
+
const zip = new AdmZip(archivePath);
|
|
222
|
+
const entry = zip
|
|
223
|
+
.getEntries()
|
|
224
|
+
.find((e) => !e.isDirectory && e.entryName.replace(/\/$/, '').endsWith(binaryName));
|
|
225
|
+
if (!entry) {
|
|
226
|
+
throw new Error(`${binaryName} was not found inside the downloaded archive.`);
|
|
227
|
+
}
|
|
228
|
+
zip.extractEntryTo(entry, destDir, false, true);
|
|
229
|
+
return join(destDir, binaryName);
|
|
230
|
+
}
|
|
231
|
+
async function requestJson(url) {
|
|
232
|
+
const res = await httpRequest(url);
|
|
233
|
+
try {
|
|
234
|
+
return { statusCode: res.statusCode, body: JSON.parse(res.text) };
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
return { statusCode: res.statusCode, body: null };
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
async function downloadFile(url, dest) {
|
|
241
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
242
|
+
const file = createWriteStream(dest);
|
|
243
|
+
const handle = (currentUrl, redirects) => {
|
|
244
|
+
const req = httpsGet(currentUrl, { headers: requestHeaders() }, (res) => {
|
|
245
|
+
if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
246
|
+
if (redirects > 5) {
|
|
247
|
+
rejectPromise(new Error('Too many redirects while downloading aer.'));
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
res.resume();
|
|
251
|
+
req.destroy();
|
|
252
|
+
handle(res.headers.location, redirects + 1);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (!res.statusCode || res.statusCode >= 400) {
|
|
256
|
+
file.close();
|
|
257
|
+
rejectPromise(new Error(`Failed to download aer (HTTP ${res.statusCode ?? 'unknown'}).`));
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
res.pipe(file);
|
|
261
|
+
res.on('error', (err) => {
|
|
262
|
+
file.close();
|
|
263
|
+
rejectPromise(err);
|
|
264
|
+
});
|
|
265
|
+
file.on('finish', () => file.close((err) => (err ? rejectPromise(err) : resolvePromise())));
|
|
266
|
+
file.on('error', rejectPromise);
|
|
267
|
+
});
|
|
268
|
+
req.on('error', (err) => {
|
|
269
|
+
file.close();
|
|
270
|
+
rejectPromise(err);
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
handle(url, 0);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
async function httpRequest(url) {
|
|
277
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
278
|
+
const req = httpsGet(url, { headers: requestHeaders() }, (res) => {
|
|
279
|
+
let data = '';
|
|
280
|
+
res.on('data', (chunk) => {
|
|
281
|
+
data += chunk;
|
|
282
|
+
});
|
|
283
|
+
res.on('end', () => {
|
|
284
|
+
resolvePromise({ statusCode: res.statusCode ?? 0, text: data });
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
req.on('error', rejectPromise);
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function requestHeaders() {
|
|
291
|
+
return {
|
|
292
|
+
'User-Agent': '@octoberswimmer/aer-sf-plugin',
|
|
293
|
+
Accept: 'application/vnd.github+json',
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=aerBinary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aerBinary.js","sourceRoot":"","sources":["../src/aerBinary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,GAAG,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,MAAM,IAAI,GAAG,yBAAyB,CAAC;AACvC,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;AACrE,MAAM,YAAY,GAAG,SAAS,CAAC;AAC/B,MAAM,eAAe,GAAG,eAAe,CAAC;AACxC,MAAM,UAAU,GAAG,SAAS,CAAC;AAkB7B,IAAI,aAAa,GAAkB,IAAI,CAAC;AACxC,IAAI,SAAS,GAA2B,IAAI,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAyB,EAAE;IAChE,IAAI,SAAS,EAAE,CAAC;QACf,OAAO,SAAS,CAAC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ClB,cAAc,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YACjE,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc;IACtB,OAAO;QACN,YAAY,EAAE,+BAA+B;QAC7C,MAAM,EAAE,6BAA6B;KACrC,CAAC;AACH,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
|
4
4
|
import { Messages, SfProject } from '@salesforce/core';
|
|
5
5
|
import { stageSource } from '../../../../staging.js';
|
|
6
6
|
import { buildAerArgs, runAer } from '../../../../aer.js';
|
|
7
|
+
import { ensureAerBinary } from '../../../../aerBinary.js';
|
|
7
8
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
8
9
|
const messages = Messages.loadMessages('@octoberswimmer/aer-sf-plugin', 'aer.apex.run.test');
|
|
9
10
|
export default class AerApexRunTest extends SfCommand {
|
|
@@ -113,6 +114,12 @@ export default class AerApexRunTest extends SfCommand {
|
|
|
113
114
|
if (ignoredFlags.length > 0) {
|
|
114
115
|
this.warn(messages.getMessage('warn.ignoredFlags', [ignoredFlags.join(', ')]));
|
|
115
116
|
}
|
|
117
|
+
const aerPath = await ensureAerBinary({
|
|
118
|
+
allowPrompt: !this.jsonEnabled() && Boolean(process.stdin.isTTY),
|
|
119
|
+
confirm: (message) => this.confirm({ message }),
|
|
120
|
+
log: (m) => this.log(m),
|
|
121
|
+
warn: (m) => this.warn(m),
|
|
122
|
+
});
|
|
116
123
|
const staged = await stageSource({
|
|
117
124
|
projectRoot,
|
|
118
125
|
packageDirectories,
|
|
@@ -148,7 +155,7 @@ export default class AerApexRunTest extends SfCommand {
|
|
|
148
155
|
});
|
|
149
156
|
let exitCode = 0;
|
|
150
157
|
try {
|
|
151
|
-
exitCode = await runAer(args, projectRoot);
|
|
158
|
+
exitCode = await runAer(aerPath, args, projectRoot);
|
|
152
159
|
}
|
|
153
160
|
finally {
|
|
154
161
|
await staged.cleanup();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../../src/commands/aer/apex/run/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAA2C,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../../src/commands/aer/apex/run/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAA2C,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,Y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AM,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QACrD,CAAC;gBAAS,CAAC;YACV,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACxB,CAAC;QAED,IAAI,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YAC3C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,CAAC;QAED,OAAO;YACN,SAAS,EAAE,MAAM,CAAC,GAAG;YACrB,OAAO;YACP,QAAQ;SACR,CAAC;IACH,CAAC;;AAGF,SAAS,YAAY,CAAC,UAAgC,EAAE,KAA2B;IAClF,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,EAAE,IAAI,UAAU,IAAI,EAAE,EAAE,CAAC;QACnC,wFAAwF;QACxF,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACrB,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;QAC7B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACb,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -13,7 +13,12 @@ Source is staged into a temporary directory before invoking aer. The staging ste
|
|
|
13
13
|
1. When the same Apex class name appears in more than one packageDirectories entry, the copy whose full path sorts alphabetically last wins.
|
|
14
14
|
2. The `replacements` configuration in sfdx-project.json (stringToReplace / regexToReplace + replaceWithFile / replaceWithEnv) is applied to file contents during staging.
|
|
15
15
|
|
|
16
|
-
The `aer` binary (https://github.com/octoberswimmer/aer-dist)
|
|
16
|
+
The `aer` binary (https://github.com/octoberswimmer/aer-dist) is resolved in the following order:
|
|
17
|
+
|
|
18
|
+
1. The `AER_BIN` environment variable, when set to an executable file.
|
|
19
|
+
2. A copy previously downloaded by this plugin (stored under a platform-specific data directory, e.g. `~/.local/share/aer-sf-plugin/aer-bin/`).
|
|
20
|
+
3. `aer` discovered on `PATH`.
|
|
21
|
+
4. If none of the above match and the terminal is interactive, you'll be prompted to download the latest release for your platform from GitHub; the binary is then stored in the plugin's data directory and used for subsequent runs.
|
|
17
22
|
|
|
18
23
|
# examples
|
|
19
24
|
|
package/oclif.manifest.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"aer:apex:run:test": {
|
|
4
4
|
"aliases": [],
|
|
5
5
|
"args": {},
|
|
6
|
-
"description": "Run Apex tests against a local sandbox using aer instead of submitting them to a Salesforce org.\n\nThis command accepts the same flags as `sf apex run test` so it can be used as a drop-in replacement, but flags that only make sense when running against a real org (--target-org, --wait, --poll-interval, --synchronous, --api-version) are accepted for compatibility and otherwise ignored.\n\nSource is staged into a temporary directory before invoking aer. The staging step reproduces two behaviors of `sf project deploy start` that aer does not implement natively:\n\n1. When the same Apex class name appears in more than one packageDirectories entry, the copy whose full path sorts alphabetically last wins.\n2. The `replacements` configuration in sfdx-project.json (stringToReplace / regexToReplace + replaceWithFile / replaceWithEnv) is applied to file contents during staging.\n\nThe `aer` binary (https://github.com/octoberswimmer/aer-dist)
|
|
6
|
+
"description": "Run Apex tests against a local sandbox using aer instead of submitting them to a Salesforce org.\n\nThis command accepts the same flags as `sf apex run test` so it can be used as a drop-in replacement, but flags that only make sense when running against a real org (--target-org, --wait, --poll-interval, --synchronous, --api-version) are accepted for compatibility and otherwise ignored.\n\nSource is staged into a temporary directory before invoking aer. The staging step reproduces two behaviors of `sf project deploy start` that aer does not implement natively:\n\n1. When the same Apex class name appears in more than one packageDirectories entry, the copy whose full path sorts alphabetically last wins.\n2. The `replacements` configuration in sfdx-project.json (stringToReplace / regexToReplace + replaceWithFile / replaceWithEnv) is applied to file contents during staging.\n\nThe `aer` binary (https://github.com/octoberswimmer/aer-dist) is resolved in the following order:\n\n1. The `AER_BIN` environment variable, when set to an executable file.\n2. A copy previously downloaded by this plugin (stored under a platform-specific data directory, e.g. `~/.local/share/aer-sf-plugin/aer-bin/`).\n3. `aer` discovered on `PATH`.\n4. If none of the above match and the terminal is interactive, you'll be prompted to download the latest release for your platform from GitHub; the binary is then stored in the plugin's data directory and used for subsequent runs.",
|
|
7
7
|
"examples": [
|
|
8
8
|
"Run every Apex test in the project:\n<%= config.bin %> <%= command.id %>",
|
|
9
9
|
"Run a specific Apex test class:\n<%= config.bin %> <%= command.id %> --class-names MyClassTest",
|
|
@@ -197,5 +197,5 @@
|
|
|
197
197
|
]
|
|
198
198
|
}
|
|
199
199
|
},
|
|
200
|
-
"version": "0.0.
|
|
200
|
+
"version": "0.0.2"
|
|
201
201
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octoberswimmer/aer-sf-plugin",
|
|
3
3
|
"description": "Salesforce CLI plugin that runs Apex tests locally using aer.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2",
|
|
5
5
|
"author": "Christian G. Warden",
|
|
6
6
|
"bugs": "https://github.com/octoberswimmer/aer-sf-plugin/issues",
|
|
7
7
|
"homepage": "https://github.com/octoberswimmer/aer-sf-plugin",
|
|
8
|
-
"repository":
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/octoberswimmer/aer-sf-plugin.git"
|
|
11
|
+
},
|
|
9
12
|
"type": "module",
|
|
10
13
|
"exports": "./lib/index.js",
|
|
11
14
|
"engines": {
|
|
@@ -58,9 +61,11 @@
|
|
|
58
61
|
"@oclif/core": "^4",
|
|
59
62
|
"@salesforce/core": "^8",
|
|
60
63
|
"@salesforce/sf-plugins-core": "^12",
|
|
64
|
+
"adm-zip": "0.5.17",
|
|
61
65
|
"minimatch": "^9"
|
|
62
66
|
},
|
|
63
67
|
"devDependencies": {
|
|
68
|
+
"@types/adm-zip": "0.5.8",
|
|
64
69
|
"@types/chai": "^4.3.16",
|
|
65
70
|
"@types/mocha": "^10.0.6",
|
|
66
71
|
"@types/node": "^20.12.12",
|