@gasket/plugin-metadata
Advanced tools
Comparing version 7.0.0-next.54 to 7.0.0-next.55
@@ -22,2 +22,3 @@ const path = require('path'); | ||
} catch (err) { | ||
// eslint-disable-next-line no-console | ||
console.error(`Error loading app metadata: ${err.message}`); | ||
@@ -29,48 +30,48 @@ } | ||
/** @type {import('@gasket/core').HookHandler<'actions'>} */ | ||
module.exports = function actions(gasket) { | ||
return { | ||
getMetadata: async function getMetadata() { | ||
const app = getAppInfo(gasket); | ||
const plugins = []; | ||
const presets = []; | ||
const modules = {}; | ||
/** @type {import('@gasket/core').ActionHandler<'getMetadata'>} */ | ||
async function getMetadata(gasket) { | ||
const app = getAppInfo(gasket); | ||
const plugins = []; | ||
const presets = []; | ||
const modules = {}; | ||
await gasket.execApply('metadata', async (data, handler) => { | ||
const isPreset = isGasketPreset.test(data.name); | ||
const isPlugin = isGasketPlugin.test(data.name); | ||
const isGasketPackage = isPlugin || isPreset; | ||
await gasket.execApply('metadata', async (data, handler) => { | ||
const isPreset = isGasketPreset.test(data.name); | ||
const isPlugin = isGasketPlugin.test(data.name); | ||
const isGasketPackage = isPlugin || isPreset; | ||
if (!isGasketPackage) { | ||
const pluginData = await handler(data); | ||
pluginData.path = path.join(app.path, 'plugins'); | ||
plugins.push(pluginData); | ||
} else { | ||
const pluginData = await handler(data); | ||
pluginData.path = path.dirname(path.join(require.resolve(pluginData.name), '..')); | ||
const { dependencies, devDependencies } = require(path.join(pluginData.path, 'package.json')); | ||
if (!isGasketPackage) { | ||
const pluginData = await handler(data); | ||
pluginData.path = path.join(app.path, 'plugins'); | ||
plugins.push(pluginData); | ||
} else { | ||
const pluginData = await handler(data); | ||
pluginData.path = path.dirname(path.join(require.resolve(pluginData.name), '..')); | ||
const { dependencies, devDependencies } = require(path.join(pluginData.path, 'package.json')); | ||
if (isPreset) | ||
presets.push(pluginData); | ||
else | ||
plugins.push(pluginData); | ||
if (isPreset) | ||
presets.push(pluginData); | ||
else | ||
plugins.push(pluginData); | ||
for (const name of Object.keys({ ...dependencies, ...devDependencies })) { | ||
const isModule = isGasketModule.test(name); | ||
if (!isModule) continue; | ||
const mod = require(path.join(name, 'package.json')); | ||
modules[name] = { | ||
name: mod.name, | ||
version: mod.version, | ||
description: mod.description, | ||
link: 'README.md', | ||
path: path.dirname(path.join(require.resolve(name), '..')) | ||
}; | ||
} | ||
} | ||
}); | ||
for (const name of Object.keys({ ...dependencies, ...devDependencies })) { | ||
const isModule = isGasketModule.test(name); | ||
if (!isModule) continue; | ||
const mod = require(path.join(name, 'package.json')); | ||
modules[name] = { | ||
name: mod.name, | ||
version: mod.version, | ||
description: mod.description, | ||
link: 'README.md', | ||
path: path.dirname(path.join(require.resolve(name), '..')) | ||
}; | ||
} | ||
} | ||
}); | ||
return { app, plugins, modules: Object.values(modules), presets }; | ||
} | ||
}; | ||
return { app, plugins, modules: Object.values(modules), presets }; | ||
} | ||
module.exports = { | ||
getMetadata | ||
}; |
@@ -11,5 +11,5 @@ const create = require('./create'); | ||
description, | ||
actions, | ||
hooks: { | ||
create, | ||
actions, | ||
webpackConfig, | ||
@@ -16,0 +16,0 @@ metadata(gasket, meta) { |
{ | ||
"name": "@gasket/plugin-metadata", | ||
"version": "7.0.0-next.54", | ||
"version": "7.0.0-next.55", | ||
"description": "Adds metadata to gasket lifecycles", | ||
@@ -14,4 +14,4 @@ "main": "lib/index.js", | ||
"test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict' jest", | ||
"test:watch": "jest --watch", | ||
"test:coverage": "jest --coverage", | ||
"test:watch": "npm run test -- --watch", | ||
"test:coverage": "npm run test -- --coverage", | ||
"posttest": "npm run lint && npm run typecheck", | ||
@@ -43,3 +43,3 @@ "typecheck": "tsc", | ||
"dependencies": { | ||
"@gasket/core": "7.0.0-next.54" | ||
"@gasket/core": "7.0.0-next.55" | ||
}, | ||
@@ -71,3 +71,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "d2348e6988730b1a27097d587f75c629552799cb" | ||
"gitHead": "84a2654cf25651972e1bfbb0a54cb9f330ecb3ad" | ||
} |
17768
+ Added@gasket/core@7.0.0-next.55(transitive)
- Removed@gasket/core@7.0.0-next.54(transitive)
Updated@gasket/core@7.0.0-next.55