@c6fc/spellcraft 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +11 -2
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "name": "@c6fc/spellcraft",
10
10
  "description": "Extensible JSonnet CLI platform",
11
- "version": "0.0.10",
11
+ "version": "0.0.11",
12
12
  "main": "src/index.js",
13
13
  "directories": {
14
14
  "lib": "lib"
package/src/index.js CHANGED
@@ -294,11 +294,20 @@ exports.SpellFrame = class SpellFrame {
294
294
  }
295
295
 
296
296
  async importSpellCraftModuleFromNpm(npmPackage, name = false) {
297
- if (!fs.existsSync(this.getModulePackagePath(npmPackage))) {
297
+
298
+ let packagePath;
299
+
300
+ try {
301
+ packagePath = fs.existsSync(this.getModulePackagePath(npmPackage));
302
+ } catch (e) {
303
+ packagePath = false;
304
+ }
305
+
306
+ if (!packagePath) {
298
307
  console.log(`[*] Attempting to install ${npmPackage.blue}...`);
299
308
 
300
309
  const install = spawnSync(`npm`, ['install', '--save', npmPackage], {
301
- cwd: baseDir,
310
+ cwd: this.currentPackagePath,
302
311
  stdio: 'inherit'
303
312
  });
304
313