periapsis 1.0.6 → 1.0.8
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/TODO.md +8 -0
- package/bin/periapsis.mjs +10 -1
- package/package.json +1 -1
- package/sbom-licenses.json +1 -1
- package/test/cli.test.mjs +10 -1
package/TODO.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# TODO
|
|
2
|
+
|
|
3
|
+
## Test Coverage
|
|
4
|
+
|
|
5
|
+
- Add schema validation tests in `test/policy.test.mjs`:
|
|
6
|
+
- Invalid `date-time` rejection for `validateExceptionRecordSchema` and `validateLicenseRecordSchema` (e.g. `"not-a-date"`, `"2025-13-01T00:00:00Z"`)
|
|
7
|
+
- `formatSchemaErrors` output when ajv returns errors (currently untested)
|
|
8
|
+
- Update SPXD reference json for this quarter for any new references added to the standard
|
package/bin/periapsis.mjs
CHANGED
|
@@ -696,7 +696,16 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
696
696
|
cmdCheck(root, args);
|
|
697
697
|
}
|
|
698
698
|
|
|
699
|
-
|
|
699
|
+
export function isDirectExecution(entryFilename = __filename, argv1 = process.argv[1]) {
|
|
700
|
+
if (!argv1) return false;
|
|
701
|
+
try {
|
|
702
|
+
return fs.realpathSync(argv1) === entryFilename;
|
|
703
|
+
} catch {
|
|
704
|
+
return path.resolve(argv1) === entryFilename;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
if (isDirectExecution()) {
|
|
700
709
|
main().catch((err) => {
|
|
701
710
|
console.error(err.message);
|
|
702
711
|
process.exit(1);
|
package/package.json
CHANGED
package/sbom-licenses.json
CHANGED
package/test/cli.test.mjs
CHANGED
|
@@ -2,7 +2,8 @@ import test from 'node:test';
|
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
|
-
import {
|
|
5
|
+
import { isDirectExecution } from '../bin/periapsis.mjs';
|
|
6
|
+
import { BIN, createTempDir, runCli, writePolicyBundle } from '../testing/helpers.mjs';
|
|
6
7
|
|
|
7
8
|
function setupTempProject() {
|
|
8
9
|
const dir = createTempDir('periapsis-test-');
|
|
@@ -136,3 +137,11 @@ test('checker respects --dep-types filter', async () => {
|
|
|
136
137
|
});
|
|
137
138
|
assert.match(failOutput, /license-not-allowed/);
|
|
138
139
|
});
|
|
140
|
+
|
|
141
|
+
test('isDirectExecution resolves symlinked bin paths', () => {
|
|
142
|
+
const cwd = createTempDir('periapsis-bin-symlink-');
|
|
143
|
+
const symlinkPath = path.join(cwd, 'periapsis');
|
|
144
|
+
fs.symlinkSync(BIN, symlinkPath);
|
|
145
|
+
|
|
146
|
+
assert.equal(isDirectExecution(BIN, symlinkPath), true);
|
|
147
|
+
});
|