Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: static-dev/spike
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.2.0
Choose a base ref
...
head repository: static-dev/spike
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 10 commits
  • 14 files changed
  • 2 contributors

Commits on Aug 23, 2017

  1. fix template list

    jescalan committed Aug 23, 2017
    Copy the full SHA
    eb96d05 View commit details
  2. fix list test

    jescalan committed Aug 23, 2017
    Copy the full SHA
    8a55228 View commit details
  3. convert to prettier linting

    jescalan committed Aug 23, 2017
    Copy the full SHA
    489a791 View commit details

Commits on Oct 5, 2017

  1. deps

    jescalan committed Oct 5, 2017
    Copy the full SHA
    74e26f4 View commit details
  2. v2.2.1

    jescalan committed Oct 5, 2017
    Copy the full SHA
    3191263 View commit details

Commits on Jun 19, 2018

  1. update deps

    Jeff Escalante committed Jun 19, 2018
    Copy the full SHA
    92a44f0 View commit details
  2. v2.2.2

    Jeff Escalante committed Jun 19, 2018
    Copy the full SHA
    ec5c15a View commit details

Commits on Jul 27, 2018

  1. update dependencies

    Jeff Escalante committed Jul 27, 2018
    Copy the full SHA
    a9cfaff View commit details
  2. v2.3.0

    Jeff Escalante committed Jul 27, 2018
    Copy the full SHA
    b22fc23 View commit details

Commits on Feb 7, 2019

  1. maintenance badge

    Jeff Escalante committed Feb 7, 2019
    Copy the full SHA
    3030b2d View commit details
Showing with 1,603 additions and 1,448 deletions.
  1. +1 −1 lib/clean.js
  2. +1 −1 lib/compile.js
  3. +32 −19 lib/index.js
  4. +15 −10 lib/new.js
  5. +1 −1 lib/template/add.js
  6. +1 −1 lib/template/default.js
  7. +6 −2 lib/template/list.js
  8. +1 −1 lib/template/remove.js
  9. +1 −1 lib/template/reset.js
  10. +6 −2 lib/watch.js
  11. +13 −14 package.json
  12. +4 −0 readme.md
  13. +37 −37 test/index.js
  14. +1,484 −1,358 yarn.lock
2 changes: 1 addition & 1 deletion lib/clean.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function (Spike, args) {
module.exports = function(Spike, args) {
const project = new Spike({ root: args.path })
process.nextTick(() => project.clean())
return project
2 changes: 1 addition & 1 deletion lib/compile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function (Spike, args) {
module.exports = function(Spike, args) {
const project = new Spike({ root: args.path, env: args.env })
process.nextTick(() => project.compile())
return project
51 changes: 32 additions & 19 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ let Spike
* @extends EventEmitter
*/
module.exports = class CLI extends EventEmitter {
constructor () {
constructor() {
super()

this.parser = new ArgumentParser({
@@ -41,13 +41,22 @@ module.exports = class CLI extends EventEmitter {
* @param {Array|String} args - a string or array representing a command
* @return {CLI} returns itself, which is an event emitter
*/
run (args) {
if (typeof args === 'string') { args = args.split(' ') }
run(args) {
if (typeof args === 'string') {
args = args.split(' ')
}
args = this.parser.parseArgs(args)

// argparse uses `null` which doesn't get along with joi, so we remove
// null values here
args = reduce(args, (m, v, k) => { if (v) m[k] = v; return m }, {})
args = reduce(
args,
(m, v, k) => {
if (v) m[k] = v
return m
},
{}
)

// try to load up a local spike instance first
let spikePath = args.path && path.join(args.path, 'node_modules/spike-core')
@@ -57,7 +66,9 @@ module.exports = class CLI extends EventEmitter {
spikePath = 'spike-core'
}

if (!Spike) { Spike = require(spikePath) }
if (!Spike) {
Spike = require(spikePath)
}

// set up analytics
const uid = Spike.globalConfig().id // mocked in tests
@@ -80,7 +91,7 @@ module.exports = class CLI extends EventEmitter {
emitter.on('info', this.emit.bind(this, 'info'))

// instance-method-specific
emitter.on('compile', (res) => {
emitter.on('compile', res => {
analytics.event({ ec: 'core', ea: 'compile' }).send()
this.emit('compile', res)
})
@@ -89,7 +100,7 @@ module.exports = class CLI extends EventEmitter {
return this
}

addCompile () {
addCompile() {
const s = this.sub.addParser('compile', {
help: 'Compile a spike project'
})
@@ -101,15 +112,16 @@ module.exports = class CLI extends EventEmitter {
})

s.addArgument(['--env', '-e'], {
help: 'Name of the environment you\'d like to use'
help: "Name of the environment you'd like to use"
})

s.setDefaults({ fn: 'compile' })
}

addWatch () {
addWatch() {
const s = this.sub.addParser('watch', {
help: 'Watch a spike project and compile any time there are changes to a file'
help:
'Watch a spike project and compile any time there are changes to a file'
})

s.addArgument(['path'], {
@@ -124,13 +136,13 @@ module.exports = class CLI extends EventEmitter {
})

s.addArgument(['--env', '-e'], {
help: 'Name of the environment you\'d like to use'
help: "Name of the environment you'd like to use"
})

s.setDefaults({ fn: 'watch' })
}

addClean () {
addClean() {
const s = this.sub.addParser('clean', {
help: 'Removes the output directory of a spike project'
})
@@ -144,7 +156,7 @@ module.exports = class CLI extends EventEmitter {
s.setDefaults({ fn: 'clean' })
}

addNew () {
addNew() {
const s = this.sub.addParser('new', {
help: 'Creates a new spike project from a template'
})
@@ -159,13 +171,14 @@ module.exports = class CLI extends EventEmitter {

s.addArgument(['--overrides', '-o'], {
type: keyVal,
help: "Pass information directly to the template without answering questions. Accepts a quoted comma-separated key-value list, like 'a: b, c: d'"
help:
"Pass information directly to the template without answering questions. Accepts a quoted comma-separated key-value list, like 'a: b, c: d'"
})

s.setDefaults({ fn: 'new' })
}

addTemplate () {
addTemplate() {
const main = this.sub.addParser('template', {
aliases: ['tpl'],
help: 'Manage spike project templates'
@@ -185,7 +198,7 @@ module.exports = class CLI extends EventEmitter {
})

s.addArgument(['src'], {
help: 'Url that can be git-clone\'d to download the template'
help: "Url that can be git-clone'd to download the template"
})

s.setDefaults({ fn: 'template/add' })
@@ -237,10 +250,10 @@ module.exports = class CLI extends EventEmitter {
* and outputs a javascript object.
* @param {String} str - input string
* @return {Object} javascript object output
*/
function keyVal (str) {
*/
function keyVal(str) {
return str.split(',').reduce((m, i) => {
const s = i.split(':').map((i) => i.trim())
const s = i.split(':').map(i => i.trim())
m[s[0]] = s[1]
return m
}, {})
25 changes: 15 additions & 10 deletions lib/new.js
Original file line number Diff line number Diff line change
@@ -2,20 +2,25 @@ const path = require('path')
const EventEmitter = require('events').EventEmitter
const inquirer = require('inquirer')

module.exports = function (Spike, args) {
module.exports = function(Spike, args) {
const emitter = new EventEmitter()

emitter.on('done', (project) => {
emitter.emit('success', `project created at ${path.resolve(project.config.context)}`)
emitter.on('done', project => {
emitter.emit(
'success',
`project created at ${path.resolve(project.config.context)}`
)
})

process.nextTick(() => Spike.new({
root: args.path,
emitter: emitter,
locals: args.overrides,
template: args.template,
inquirer: inquirer.prompt.bind(inquirer)
}))
process.nextTick(() =>
Spike.new({
root: args.path,
emitter: emitter,
locals: args.overrides,
template: args.template,
inquirer: inquirer.prompt.bind(inquirer)
})
)

return emitter
}
2 changes: 1 addition & 1 deletion lib/template/add.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const EventEmitter = require('events')

module.exports = function (Spike, args) {
module.exports = function(Spike, args) {
const emitter = new EventEmitter()
process.nextTick(() => {
Spike.template.add(Object.assign(args, { emitter: emitter }))
2 changes: 1 addition & 1 deletion lib/template/default.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const EventEmitter = require('events')

module.exports = function (Spike, args) {
module.exports = function(Spike, args) {
const emitter = new EventEmitter()
process.nextTick(() => {
Spike.template.default(Object.assign(args, { emitter: emitter }))
8 changes: 6 additions & 2 deletions lib/template/list.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
const EventEmitter = require('events')

module.exports = function (Spike, args) {
module.exports = function(Spike, args) {
const emitter = new EventEmitter()
const e2 = new EventEmitter()
process.nextTick(() => {
emitter.on('success', res => {
e2.emit('success', 'Your Templates:\n- ' + Object.keys(res).join('\n- '))
})
Spike.template.list(Object.assign(args, { emitter: emitter }))
})
return emitter
return e2
}
2 changes: 1 addition & 1 deletion lib/template/remove.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const EventEmitter = require('events')

module.exports = function (Spike, args) {
module.exports = function(Spike, args) {
const emitter = new EventEmitter()
process.nextTick(() => {
Spike.template.remove(Object.assign(args, { emitter: emitter }))
2 changes: 1 addition & 1 deletion lib/template/reset.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const EventEmitter = require('events')

module.exports = function (Spike, args) {
module.exports = function(Spike, args) {
const emitter = new EventEmitter()
process.nextTick(() => {
Spike.template.reset()
8 changes: 6 additions & 2 deletions lib/watch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module.exports = function (Spike, args) {
const project = new Spike({ root: args.path, env: args.env, server: { port: args.port } })
module.exports = function(Spike, args) {
const project = new Spike({
root: args.path,
env: args.env,
server: { port: args.port }
})
process.nextTick(() => project.watch())
return project
}
27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "spike",
"description": "an opinionated static build tool, powered by webpack",
"version": "2.2.0",
"version": "2.3.0",
"author": "Jeff Escalante",
"ava": {
"verbose": "true",
@@ -12,20 +12,20 @@
},
"bugs": "https://github.com/static-dev/spike/issues",
"dependencies": {
"argparse": "^1.0.9",
"chalk": "^2.0.0",
"argparse": "^1.0.10",
"chalk": "^2.4.1",
"inquirer": "^3.2.1",
"lodash.reduce": "^4.6.0",
"spike-core": "^2.2.0",
"universal-analytics": "^0.4.13"
"spike-core": "^2.3.0",
"universal-analytics": "^0.4.17"
},
"devDependencies": {
"ava": "^0.21.0",
"coveralls": "^2.13.1",
"nyc": "^11.0.3",
"rewire": "^2.5.1",
"snazzy": "^7.0.0",
"standard": "^10.0.2"
"ava": "^0.25.0",
"coveralls": "^3.0.2",
"husky": "^0.14.3",
"nyc": "^12.0.2",
"prettier": "^1.13.7",
"rewire": "^2.5.1"
},
"engines": {
"node": ">=6.0.0",
@@ -43,9 +43,8 @@
"scripts": {
"coverage": "nyc --reporter=html ava && open coverage/index.html",
"coveralls": "nyc --reporter=lcov ava && cat ./coverage/lcov.info | coveralls",
"lint": "standard --verbose | snazzy",
"precommit": "npm run lint -s",
"pretest": "npm run lint -s",
"lint": "prettier --no-semi --single-quote --write '**/*.js'",
"precommit": "npm run lint",
"test": "ava "
}
}
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@

A modern static build tool, powered by [webpack](http://webpack.github.io)

[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)

> Note: This project is currently unmaintained. If you are interested in taking over maintenance, please reach out!
## What is Spike?

[We](https://github.com/carrot) [:heart:](http://giphy.com/gifs/steve-carell-cute-the-office-Yb8ebQV8Ua2Y0/tile) [static](https://www.smashingmagazine.com/2015/11/modern-static-website-generators-next-big-thing/).
Loading