UNPKG

@directus/extensions-sdk

Version:

A toolkit to develop extensions to extend Directus

27 lines (26 loc) 823 B
import path from 'path'; import fse from 'fs-extra'; import {} from 'ora'; const checkLicense = { name: 'license', handler: async (spinner, reports) => { spinner.text = 'Check for license'; const packagePath = path.resolve('package.json'); const { license } = await fse.readJson(packagePath); if (!license) { const message = 'No license defined'; reports.push({ level: 'error', message: `${checkLicense.name}: ${message}`, }); throw new Error(message); } const message = 'Valid license'; reports.push({ level: 'info', message: `${checkLicense.name}: ${message}`, }); return (spinner.text = message); }, }; export default checkLicense;