Skip to content

Commit 7843565

Browse files
greenkeeper[bot]jescalan
authored andcommitted
Update spike-core to the latest version 🚀 (#23)
* chore(package): update spike-core to version 2.0.0 * fix paginated locals for new version of reshape-standard
1 parent 6fe6f71 commit 7843565

File tree

4 files changed

+178
-179
lines changed

4 files changed

+178
-179
lines changed

‎README.md‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@ Install with: `npm install spike-collections -S`
2222
Add to your spike project as such:
2323

2424
```js
25+
const Collections = require('spike-collections')
26+
const htmlStandards = require('reshape-standard')
27+
2528
const locals = {}
26-
const collections = new Collections({
27-
addDataTo: locals
28-
})
29+
const collections = new Collections({ addDataTo: locals })
2930

3031
module.exports = {
3132
// your config here...
32-
reshape: (ctx) => {
33-
return htmlStandards({ webpack: ctx, locals: collections.locals(ctx, locals) })
34-
},
33+
reshape: htmlStandards({
34+
locals: (ctx) => collections.locals(ctx, locals)
35+
}),
3536
plugins: [collections]
3637
}
3738
```

‎lib/index.js‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,17 +236,20 @@ class SpikeCollections {
236236
// Go through each of the pagination pages and write it out
237237
return keys.map(this._pagination, (pages, _) => {
238238
return keys.map(pages, (opts, p) => {
239-
const reshapeOpts = loader.parseOptions.call(opts.loaderContext, this.util.getSpikeOptions().reshape, {})
239+
const reshapeOpts = loader.parseOptions.call(opts.loaderContext, this.util.getSpikeOptions().reshape, { locals: opts.locals })
240+
// add locals to reshape opts in case of early eval code
241+
Object.assign(reshapeOpts, { locals: opts.locals })
240242
return reshape(reshapeOpts)
241243
.process(tpl)
242-
.then(((locals, res) => {
244+
.then((res) => {
243245
const outPath = this.util.getOutputPath(p)
244-
const src = res.output(locals)
246+
// also run options here if in template mode
247+
const src = res.output(opts.locals)
245248
compilation.assets[outPath.relative] = {
246249
source: () => src,
247250
size: () => src.length
248251
}
249-
}).bind(null, opts.locals)) // getting around the async loop issue
252+
})
250253
})
251254
})
252255
}).done(() => { done() }, done)

‎package.json‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
},
99
"bugs": "https://github.com/static-dev/spike-collections/issues",
1010
"devDependencies": {
11-
"ava": "^0.19.1",
11+
"ava": "^0.20.0",
1212
"coveralls": "^2.13.1",
13-
"nyc": "^11.0.2",
14-
"reshape-standard": "^1.2.0",
13+
"nyc": "^11.0.3",
14+
"reshape-standard": "^2.0.0",
1515
"rimraf": "^2.6.1",
1616
"snazzy": "^7.0.0",
1717
"source-loader": "^0.2.0",
18-
"spike-core": "^1.3.1",
18+
"spike-core": "^2.0.0",
1919
"standard": "^10.0.2",
20-
"webpack": "^2.5.1"
20+
"webpack": "^3.0.0"
2121
},
2222
"engines": {
2323
"node": ">= 6"

0 commit comments

Comments
 (0)