node-make: 又一个 Makefile 的 JS 版本

1,748 阅读1分钟

It's neither Jake nor Runfile, it's just Makefile and JavaScript.

Installation

npm install -g node-make

Example

makefile.js

@import:
  import fs from 'fs'
  import marked from 'marked'

log:
  log('hi')
  log('feel weird?')
  for (let i of [1, 2, 3]) {
    console.log(i)
  }

md:
  const data = fs.readFileSync('hello.md', 'utf8')
  console.log(marked(data))

publish:
  exec('npm run build')
  exec('npm test')
  exec('npm publish')
  // a short-hand for exec()
  > echo 'starting with > works too!'

// external task file:
clean: ./tasks/clean.mk.js

// emit a task in a task
emit:
  // callback is optional
  emit('log', callback)

// async/await feature
read@async:
  const data = await promiseFn()

command line

License

MIT © EGOIST