mirror of
https://github.com/Kong/insomnia.git
synced 2026-10-07 13:33:27 -04:00
* sort and remove a few * autofix 1 * remove useless undefined * fix types * number seperators * native coercion * utf8 * explicit number * dom node dataset * explicit unused catch * array find * fix types * prefer negative index * from code point * fix error layout * prefer ternary * explicit length * useless case * named functions * utf8 * import style * default parameters * no instance of * clone * use regex test * single call * prettier * fix types * Revert "use regex test" This reverts commit 8fb9e991fffa9e3a51ff75cdc29dad331ed2fb66.
29 lines
773 B
TypeScript
29 lines
773 B
TypeScript
import { bundlePlugins } from '../config/config.json';
|
|
|
|
const isModuleInstalled = (moduleName: string) => {
|
|
try {
|
|
require.resolve(moduleName);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
export const verifyBundlePlugins = () => {
|
|
const executeInGithubActions = process.env.GITHUB_ACTIONS === 'true';
|
|
if (executeInGithubActions) {
|
|
console.log('[NPM Install] Verifying bundle plugins...');
|
|
const missingBundlePlugin = bundlePlugins.find(p => !isModuleInstalled(p.name));
|
|
if (missingBundlePlugin) {
|
|
// execute in Github Actions
|
|
console.error(
|
|
'[npm install] ERROR:',
|
|
`Required bundle plugin module ${missingBundlePlugin.name} is not installed.`,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
};
|
|
|
|
verifyBundlePlugins();
|