-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCakefile
32 lines (25 loc) · 1.43 KB
/
Cakefile
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
child_process = require 'child_process'
{ marked } = require 'marked'
{ gfmHeadingId } = require 'marked-gfm-heading-id'
fs = require 'fs'
marked.use gfmHeadingId()
task 'compile', 'Compiles index.html', ->
invoke 'update'
changelog = fs.readFileSync('./node_modules/@coffeelint/cli/CHANGELOG.md').toString()
template = fs.readFileSync('./scripts/template.html').toString()
template = template.replace '{{{changelog}}}', marked.parse changelog
template = template.replace '{{{rules}}}', require './scripts/rules.coffee'
fs.writeFileSync './index.html', template
task 'update', 'Update coffeelint.js and coffeescript.js and jquery.js', ->
child_process.execSync "npm install @coffeelint/cli@#{process.COFFEELINT_VERSION ? 'latest'}"
coffeelintPackage = require './node_modules/@coffeelint/cli/package.json'
coffeescriptVersion = coffeelintPackage.dependencies.coffeescript
child_process.execSync "npm install coffeescript@#{coffeescriptVersion}"
child_process.execSync 'npm install jquery'
coffeelintFile = './node_modules/@coffeelint/cli/lib/coffeelint.js'
coffeescriptFile =
'./node_modules/coffeescript/lib/coffeescript-browser-compiler-legacy/coffeescript.js'
jqueryFile = './node_modules/jquery/dist/jquery.min.js'
fs.copyFileSync coffeelintFile, './js/coffeelint.js'
fs.copyFileSync coffeescriptFile, './js/coffeescript.js'
fs.copyFileSync jqueryFile, './js/jquery.min.js'