Replace grunt-contrib-concat with tools/cat.js.

This commit is contained in:
ccd0 2016-04-10 01:13:18 -07:00
parent 949e0af514
commit 2e81bc99b5
5 changed files with 63 additions and 128 deletions

View File

@ -17,66 +17,46 @@ module.exports = (grunt) ->
BIN: ['node_modules', '.bin', ''].join(path.sep)
concat:
coffee:
src: [
'src/General/Config.coffee'
'src/General/Globals.coffee'
'src/General/$.coffee'
'src/classes/Callbacks.coffee'
'src/classes/Board.coffee'
'src/classes/Thread.coffee'
'src/classes/CatalogThread.coffee'
'src/classes/Post.coffee'
'src/classes/Clone.coffee'
'src/classes/DataBoard.coffee'
'src/classes/Notice.coffee'
'src/classes/RandomAccessList.coffee'
'src/classes/SimpleDict.coffee'
'src/classes/Set.coffee'
'src/classes/Connection.coffee'
'src/classes/Fetcher.coffee'
'src/General/Polyfill.coffee'
'src/General/Header.coffee'
'src/General/Index.coffee'
'src/General/Build.coffee'
'src/General/Get.coffee'
'src/General/UI.coffee'
'src/General/Notice.coffee'
'src/General/CrossOrigin.coffee'
'src/General/BuildTest.coffee'
'src/Filtering/*.coffee'
'src/Quotelinks/*.coffee'
'src/Posting/QR.coffee'
'src/Posting/Captcha.coffee'
'src/Posting/*.coffee'
'src/Images/*.coffee'
'src/Linkification/*.coffee'
'src/Menu/*.coffee'
'src/Monitoring/*.coffee'
'src/Archive/*.coffee'
'src/Miscellaneous/*.coffee'
'src/General/Settings.coffee'
'src/General/Main.coffee'
]
dest: 'tmp/script.coffee'
crx:
files:
'testbuilds/crx<%= pkg.channel %>/script.js': [
'tmp/botproc.js'
'tmp/LICENSE'
'tmp/usestrict.js'
'tmp/script-crx.js'
]
userscript:
files:
'testbuilds/<%= pkg.name %><%= pkg.channel %>.user.js': [
'tmp/botproc.js'
'testbuilds/<%= pkg.name %><%= pkg.channel %>.meta.js'
'tmp/LICENSE'
'tmp/usestrict.js'
'tmp/script-userscript.js'
]
sources: grunt.file.expand [
'src/General/Config.coffee'
'src/General/Globals.coffee'
'src/General/$.coffee'
'src/classes/Callbacks.coffee'
'src/classes/Board.coffee'
'src/classes/Thread.coffee'
'src/classes/CatalogThread.coffee'
'src/classes/Post.coffee'
'src/classes/Clone.coffee'
'src/classes/DataBoard.coffee'
'src/classes/Notice.coffee'
'src/classes/RandomAccessList.coffee'
'src/classes/SimpleDict.coffee'
'src/classes/Set.coffee'
'src/classes/Connection.coffee'
'src/classes/Fetcher.coffee'
'src/General/Polyfill.coffee'
'src/General/Header.coffee'
'src/General/Index.coffee'
'src/General/Build.coffee'
'src/General/Get.coffee'
'src/General/UI.coffee'
'src/General/Notice.coffee'
'src/General/CrossOrigin.coffee'
'src/General/BuildTest.coffee'
'src/Filtering/*.coffee'
'src/Quotelinks/*.coffee'
'src/Posting/QR.coffee'
'src/Posting/Captcha.coffee'
'src/Posting/*.coffee'
'src/Images/*.coffee'
'src/Linkification/*.coffee'
'src/Menu/*.coffee'
'src/Monitoring/*.coffee'
'src/Archive/*.coffee'
'src/Miscellaneous/*.coffee'
'src/General/Settings.coffee'
'src/General/Main.coffee'
]
copy:
crx:
@ -112,9 +92,7 @@ module.exports = (grunt) ->
general:
command: """
<%= BIN %>coffee tools/templates.coffee src/meta/jshint.json .jshintrc
<%= BIN %>coffee tools/templates.coffee src/meta/botproc.js tmp/botproc.js
<%= BIN %>coffee tools/templates.coffee LICENSE tmp/LICENSE
<%= BIN %>coffee tools/templates.coffee src/meta/usestrict.js tmp/usestrict.js
node tools/cat.js <%= sources.join(' ') %> tmp/script.coffee
""".split('\n').join('&&')
crx:
command: """
@ -123,10 +101,11 @@ module.exports = (grunt) ->
<%= BIN %>coffee --no-header -o tmp -c src/General/eventPage.coffee
<%= BIN %>jshint tmp/script-crx.js tmp/eventPage.js
""".split('\n').join('&&')
'crx-meta':
'crx-channel':
command: """
<%= BIN %>coffee tools/templates.coffee src/meta/updates.xml testbuilds/updates<%= pkg.channel %>.xml type=crx channel=<%= pkg.channel %>
<%= BIN %>coffee tools/templates.coffee src/meta/manifest.json testbuilds/crx<%= pkg.channel %>/manifest.json type=crx channel=<%= pkg.channel %>
node tools/cat.js src/meta/botproc.js LICENSE src/meta/usestrict.js tmp/script-crx.js testbuilds/crx<%= pkg.channel %>/script.js
""".split('\n').join('&&')
userscript:
command: """
@ -134,8 +113,11 @@ module.exports = (grunt) ->
<%= BIN %>coffee --no-header -c tmp/script-userscript.coffee
<%= BIN %>jshint tmp/script-userscript.js
""".split('\n').join('&&')
'userscript-meta':
command: '<%= BIN %>coffee tools/templates.coffee src/meta/metadata.js testbuilds/<%= pkg.name %><%= pkg.channel %>.meta.js type=userscript channel=<%= pkg.channel %>'
'userscript-channel':
command: """
<%= BIN %>coffee tools/templates.coffee src/meta/metadata.js testbuilds/<%= pkg.name %><%= pkg.channel %>.meta.js type=userscript channel=<%= pkg.channel %>
node tools/cat.js src/meta/botproc.js testbuilds/<%= pkg.name %><%= pkg.channel %>.meta.js LICENSE src/meta/usestrict.js tmp/script-userscript.js testbuilds/<%= pkg.name %><%= pkg.channel %>.user.js
""".split('\n').join('&&')
markdown:
command: 'node tools/markdown.js'
commit:
@ -229,13 +211,11 @@ module.exports = (grunt) ->
grunt.registerTask 'build', [
'shell:npm'
'shell:general'
'concat:coffee'
'concurrent:build'
]
grunt.registerTask 'build-crx-channel', [
'shell:crx-meta'
'concat:crx'
'shell:crx-channel'
'copy:crx'
'zip-crx'
]
@ -279,19 +259,14 @@ module.exports = (grunt) ->
'sign-channel:-noupdate'
]
grunt.registerTask 'build-userscript-channel', [
'shell:userscript-meta'
'concat:userscript'
]
grunt.registerTask 'build-userscript', [
'shell:userscript'
'set-channel'
'build-userscript-channel'
'shell:userscript-channel'
'set-channel:-beta'
'build-userscript-channel'
'shell:userscript-channel'
'set-channel:-noupdate'
'build-userscript-channel'
'shell:userscript-channel'
'copy:install'
]
@ -299,7 +274,6 @@ module.exports = (grunt) ->
'shell:npm'
'enable-tests'
'shell:general'
'concat:coffee'
'build-crx'
'build-userscript'
]

48
npm-shrinkwrap.json generated
View File

@ -1255,54 +1255,6 @@
}
}
},
"grunt-contrib-concat": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/grunt-contrib-concat/-/grunt-contrib-concat-1.0.0.tgz",
"dependencies": {
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"dependencies": {
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz"
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz"
},
"has-ansi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
"dependencies": {
"ansi-regex": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz"
}
}
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"dependencies": {
"ansi-regex": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz"
}
}
},
"supports-color": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz"
}
}
},
"source-map": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.3.tgz"
}
}
},
"grunt-contrib-copy": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-1.0.0.tgz",

View File

@ -54,7 +54,6 @@
"grunt": "^1.0.1",
"grunt-concurrent": "^2.3.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-concat": "^1.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-shell": "^1.2.1",
"jshint": "^2.9.1",

View File

@ -30,4 +30,4 @@ AntiAutoplay =
for object in $$ 'object[data*="youtube"][data*="autoplay=1"]', root
object.data = object.data.replace(/\?autoplay=1&?/, '?').replace('&autoplay=1', '')
$.addClass object, 'autoplay-removed'
return
return

10
tools/cat.js Normal file
View File

@ -0,0 +1,10 @@
var fs = require('fs');
var path = require('path');
var text = process.argv.slice(2, -1).map(x => fs.readFileSync(x, 'utf8')).join('\n');
text = text.replace(/\r\n/g, '\n');
var outName = process.argv[process.argv.length - 1];
var dir = path.dirname(outName);
if (!fs.existsSync(dir)) fs.mkdirSync(dir);
fs.writeFileSync(outName, text);