@gasket/plugin-metadata
Advanced tools
Comparing version 7.0.0-next.57 to 7.0.0-next.58
@@ -6,2 +6,3 @@ const path = require('path'); | ||
const isGasketPlugin = /(gasket-plugin)|(@gasket\/plugin-)/; | ||
let _metadata; | ||
@@ -32,42 +33,46 @@ function getAppInfo(gasket) { | ||
async function getMetadata(gasket) { | ||
const app = getAppInfo(gasket); | ||
const plugins = []; | ||
const presets = []; | ||
const modules = {}; | ||
if (!_metadata) { | ||
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 (isPreset) | ||
presets.push(pluginData); | ||
else | ||
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')); | ||
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), '..')) | ||
}; | ||
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), '..')) | ||
}; | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
return { app, plugins, modules: Object.values(modules), presets }; | ||
_metadata = { app, plugins, modules: Object.values(modules), presets }; | ||
} | ||
return _metadata; | ||
} | ||
@@ -74,0 +79,0 @@ |
{ | ||
"name": "@gasket/plugin-metadata", | ||
"version": "7.0.0-next.57", | ||
"version": "7.0.0-next.58", | ||
"description": "Adds metadata to gasket lifecycles", | ||
@@ -42,3 +42,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@gasket/core": "7.0.0-next.57" | ||
"@gasket/core": "7.0.0-next.58" | ||
}, | ||
@@ -70,3 +70,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "40e38b3d5102a08bd022bda3f9a8ddbd261e4dc9" | ||
"gitHead": "800032d942a80eec38ae3cf80e738e73e411db7f" | ||
} |
17903
289
+ Added@gasket/core@7.0.0-next.58(transitive)
- Removed@gasket/core@7.0.0-next.57(transitive)
Updated@gasket/core@7.0.0-next.58