spice-js 2.5.7 → 2.5.8

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.
@@ -11,11 +11,11 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
11
11
 
12
12
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
13
13
 
14
- var views = require('koa-views');
14
+ var views = require("koa-views");
15
15
 
16
16
  var path = require("path");
17
17
 
18
- var juice = require('juice');
18
+ var juice = require("juice");
19
19
 
20
20
  class Storage {
21
21
  constructor(args) {
@@ -47,7 +47,7 @@ class Storage {
47
47
  var driver = new _this.Driver(_this.driver_options);
48
48
  return yield driver.save({
49
49
  files,
50
- path
50
+ path: _this.driver_options.base_path ? _this.driver_options.base_path + "/" + path : path
51
51
  });
52
52
  })();
53
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spice-js",
3
- "version": "2.5.7",
3
+ "version": "2.5.8",
4
4
  "description": "spice",
5
5
  "main": "build/index.js",
6
6
  "repository": {
@@ -1,28 +1,30 @@
1
- var views = require('koa-views');
1
+ var views = require("koa-views");
2
2
  const path = require("path");
3
- const juice = require('juice');
4
- import _ from 'lodash';
5
-
3
+ const juice = require("juice");
4
+ import _ from "lodash";
6
5
 
7
6
  export default class Storage {
7
+ constructor(args = {}) {
8
+ this.driver_name = args.driver_name || spice.config.storage.default_driver;
9
+ this.driver_options = _.merge(
10
+ spice.config.storage.drivers[this.driver_name],
11
+ args.options
12
+ );
13
+ //console.log(this.driver_name, spice.config.storage.providers)
14
+ this.Driver = spice.config.storage.providers[this.driver_name];
15
+ }
8
16
 
9
- constructor(args = {}) {
10
- this.driver_name = args.driver_name || spice.config.storage.default_driver;
11
- this.driver_options = _.merge(spice.config.storage.drivers[this.driver_name], args.options);
12
- //console.log(this.driver_name, spice.config.storage.providers)
13
- this.Driver = spice.config.storage.providers[this.driver_name];
14
- }
15
-
16
-
17
- async save({files, path,
18
- options,
19
- }) {
20
- if (options) {
21
- this.driver_options = _.merge(this.driver_options, options);
22
- }
23
- //console.log(this.Driver);
24
- let driver = new this.Driver(this.driver_options);
25
-
26
- return await driver.save({files, path});
17
+ async save({ files, path, options }) {
18
+ if (options) {
19
+ this.driver_options = _.merge(this.driver_options, options);
27
20
  }
28
- }
21
+ //console.log(this.Driver);
22
+ let driver = new this.Driver(this.driver_options);
23
+ return await driver.save({
24
+ files,
25
+ path: this.driver_options.base_path
26
+ ? `${this.driver_options.base_path}/${path}`
27
+ : path,
28
+ });
29
+ }
30
+ }