MCPcopy Create free account
hub / github.com/adaptlearning/adapt_framework / load

Method load

grunt/helpers/plugins/Plugin.js:42–70  ·  view source on GitHub ↗

@returns {Plugin}

()

Source from the content-addressed store, hash-verified

40
41 /** @returns {Plugin} */
42 load() {
43 const pathDerivedName = this.sourcePath.split('/').filter(Boolean).pop();
44 const files = globs.sync(this.packageJSONLocations);
45 const firstFile = files[0];
46 if (firstFile) {
47 // use the first package definition found (this will be bower.json / package.json)
48 this.packageJSONFile = new JSONFile({
49 path: firstFile
50 });
51 } else {
52 // no json found, make some up (this will usually be the core)
53 this.packageJSONFile = new JSONFile({
54 path: null,
55 data: {
56 name: pathDerivedName
57 }
58 });
59 }
60 this.packageJSONFile.load();
61 const packageName = (this.packageJSONFile.firstFileItem.item.name);
62 if (packageName !== pathDerivedName) {
63 // assume path name is also plugin name, this shouldn't be necessary
64 this.warn(`Plugin folder name ${pathDerivedName} does not match package name ${packageName}.`);
65 }
66 if (this.requiredFramework && !this.isFrameworkCompatible) {
67 this.warn(`Required framework version (${this.requiredFramework}) for plugin ${packageName} not satisfied by current framework version (${this.framework.version}).`);
68 }
69 return this;
70 }
71
72 /**
73 * Informs the Schemas API from where to fetch the schemas defined in this

Callers 1

loadMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected