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

View File

@ -30,4 +30,4 @@ AntiAutoplay =
for object in $$ 'object[data*="youtube"][data*="autoplay=1"]', root for object in $$ 'object[data*="youtube"][data*="autoplay=1"]', root
object.data = object.data.replace(/\?autoplay=1&?/, '?').replace('&autoplay=1', '') object.data = object.data.replace(/\?autoplay=1&?/, '?').replace('&autoplay=1', '')
$.addClass object, 'autoplay-removed' $.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);