-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSakefile
60 lines (48 loc) · 1.58 KB
/
Sakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use 'sake-outdated'
use 'sake-publish'
use 'sake-version'
task 'clean', 'clean project', ->
exec 'rm -rf lib && rm -rf bin/handroll'
task 'bootstrap', 'Build bootstrapped version of handroll', ->
coffee = require '@zeekay/rollup-plugin-coffee'
nodeResolve = require '@zeekay/rollup-plugin-node-resolve'
json = require 'rollup-plugin-json'
rollup = require 'rollup'
pkg = require './package.json'
external = (Object.keys pkg.dependencies).concat Object.keys pkg.devDependencies
plugins = [
coffee()
json()
nodeResolve()
]
# CommonJS bootstrap lib
bundle = yield rollup.rollup
input: 'src/index.coffee'
acorn: allowReserved: true
external: external
plugins: plugins
yield bundle.write
file: 'lib/bootstrap.js'
format: 'cjs'
sourcemap: true
task 'build', 'build project', ['bootstrap'], ->
handroll = require './lib/bootstrap.js'
path = require 'path'
b = new handroll.Bundle external: true
yield b.write
entry: 'src/index.coffee'
formats: ['cjs', 'es']
inject:
exclude: 'node_modules/**',
'Object.assign': path.resolve 'node_modules/es-object-assign/lib/es-object-assign.mjs'
yield b.write
entry: 'src/cli.coffee'
format: 'cli'
executable: true
task 'watch', 'watch project and build on changes', ->
build = (filename) ->
console.log filename, 'modified, rebuilding'
invoke 'build' if not running 'build'
watch 'src/', build
watch 'node_modules/', build, watchSymlink: true
task 'test', 'test handroll', ['build']