Skip to content

Commit 197fc35

Browse files
committed
chore(core): WIP initialize plugins
1 parent 0850fd6 commit 197fc35

File tree

1 file changed

+17
-34
lines changed

1 file changed

+17
-34
lines changed

packages/core/src/lib/patternlab.js

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -136,27 +136,23 @@ module.exports = class PatternLab {
136136
*/
137137
//todo, move this to plugin_manager
138138
initializePlugins(patternlab) {
139-
if (!patternlab.config.plugins) {
140-
return;
141-
}
142-
143-
const plugin_manager = new pm(
144-
patternlab.config,
145-
path.resolve(__dirname, '../../patternlab-config.json')
146-
);
147-
const foundPlugins = findModules('plugin-');
148-
149-
if (foundPlugins && foundPlugins.length > 0) {
150-
for (let i = 0; i < foundPlugins.length; i++) {
151-
const pluginKey = foundPlugins[i];
152-
153-
logger.info(`Found plugin: ${pluginKey}`);
154-
logger.info(`Attempting to load and initialize plugin.`);
155-
156-
const plugin = plugin_manager.load_plugin(pluginKey);
157-
plugin(patternlab);
158-
}
159-
}
139+
// console.log('initialize plugins');
140+
// if (!patternlab.config.plugins) {
141+
// return;
142+
// }
143+
// const plugin_manager = new pm(
144+
// patternlab.config,
145+
// path.resolve(__dirname, '../../patternlab-config.json')
146+
// );
147+
// const nodeModulesPath = path.join(process.cwd(), 'node_modules');
148+
// const foundPlugins = findModules(nodeModulesPath, plugin_manager.is_plugin);
149+
// console.log(148, foundPlugins, patternlab.config.plugins);
150+
// foundPlugins.forEach(plugin => {
151+
// logger.info(`Found plugin: plugin-${plugin.name}`);
152+
// logger.info(`Attempting to load and initialize plugin.`);
153+
// const pluginModule = plugin_manager.load_plugin(plugin.modulePath);
154+
// pluginModule(patternlab);
155+
// });
160156
}
161157

162158
buildGlobalData(additionalData) {
@@ -311,19 +307,6 @@ module.exports = class PatternLab {
311307
}
312308
}
313309

314-
/**
315-
* Installs a given plugin. Assumes it has already been pulled down via npm
316-
* @param pluginName - the name of the plugin
317-
*/
318-
installPlugin(pluginName) {
319-
//get the config
320-
const configPath = path.resolve(process.cwd(), 'patternlab-config.json');
321-
const config = fs.readJSONSync(path.resolve(configPath), 'utf8');
322-
const plugin_manager = new pm(config, configPath);
323-
324-
plugin_manager.install_plugin(pluginName);
325-
}
326-
327310
/**
328311
* Given a path, load info from the folder to compile into a single config object.
329312
* @param dataFilesPath

0 commit comments

Comments
 (0)