44 lines
1.5 KiB
Bash
44 lines
1.5 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
node --input-type=module <<'NODE'
|
||
|
|
import fs from 'node:fs';
|
||
|
|
|
||
|
|
const readJson = (path) => JSON.parse(fs.readFileSync(path, 'utf8'));
|
||
|
|
|
||
|
|
const checks = {
|
||
|
|
packageVersion: readJson('/app/package.json').version,
|
||
|
|
hasCli: fs.existsSync('/app/cli.js'),
|
||
|
|
hasIndex: fs.existsSync('/app/dist_ts/index.js'),
|
||
|
|
hasWebBundle: fs.existsSync('/app/dist_serve/bundle.js'),
|
||
|
|
hasWebIndex: fs.existsSync('/app/dist_serve/index.html'),
|
||
|
|
hasArgon2: fs.existsSync('/app/node_modules/argon2/package.json'),
|
||
|
|
hasOtplib: fs.existsSync('/app/node_modules/otplib/package.json'),
|
||
|
|
hasSimpleWebAuthnServer: fs.existsSync('/app/node_modules/@simplewebauthn/server/package.json'),
|
||
|
|
hasSimpleWebAuthnBrowser: fs.existsSync('/app/node_modules/@simplewebauthn/browser/package.json'),
|
||
|
|
};
|
||
|
|
|
||
|
|
await import('/app/dist_ts/index.js');
|
||
|
|
await import('argon2');
|
||
|
|
await import('otplib');
|
||
|
|
await import('@simplewebauthn/server');
|
||
|
|
|
||
|
|
if (checks.packageVersion !== '1.21.1') {
|
||
|
|
throw new Error(`Unexpected idp.global package version ${checks.packageVersion}`);
|
||
|
|
}
|
||
|
|
if (!checks.hasCli) {
|
||
|
|
throw new Error('Missing cli.js');
|
||
|
|
}
|
||
|
|
if (!checks.hasIndex) {
|
||
|
|
throw new Error('Missing dist_ts/index.js');
|
||
|
|
}
|
||
|
|
if (!checks.hasWebBundle || !checks.hasWebIndex) {
|
||
|
|
throw new Error('Missing dist_serve web assets');
|
||
|
|
}
|
||
|
|
if (!checks.hasArgon2 || !checks.hasOtplib || !checks.hasSimpleWebAuthnServer || !checks.hasSimpleWebAuthnBrowser) {
|
||
|
|
throw new Error('Missing MFA/passkey runtime dependencies');
|
||
|
|
}
|
||
|
|
|
||
|
|
console.log(JSON.stringify(checks));
|
||
|
|
NODE
|