Skip to content

Commit 929e809

Browse files
committed
Preparing for verison bump.
Upgraded compile process. Support individually setting opacity. Pulled out comment class type for future compatibility with bold fonts.
1 parent 89630d4 commit 929e809

File tree

9 files changed

+775
-931
lines changed

9 files changed

+775
-931
lines changed

Gruntfile.coffee

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ module.exports = (grunt) ->
1212
'src/css/fontalias.css'
1313
]
1414

15+
SRC_CORE_CMP = [
16+
'Comment'
17+
'CommentSpaceAllocator'
18+
]
19+
1520
SRC_CORE = [
1621
'src/Array.js'
1722
'src/core/CommentSpaceAllocator.js'
@@ -32,16 +37,38 @@ module.exports = (grunt) ->
3237
'src/parsers/BilibiliFormat.js'
3338
]
3439

35-
# Dynamically generate the ts targets
36-
kagerou_config = { }
40+
# !! Below are compile settings
41+
# Dynamically generate the core ts targets
42+
CMP_CORE_TS = { }
43+
CMP_CORE_NAME = [ ]
44+
for target in SRC_CORE_CMP
45+
CMP_CORE_NAME.push ("typescript:" + target)
46+
CMP_CORE_TS[target] =
47+
options:
48+
target: 'es5'
49+
basePath: 'src/core'
50+
src: "src/core/" + target + ".ts"
51+
dest: "src/core/" + target + ".js"
52+
53+
# Dynamically generate the kagerou ts targets
54+
CMP_KAGEROU_TS = { }
55+
CMP_KAGEROU_NAME = [ ]
3756
for target,src of SRC_SCRIPTING_KAGEROU
38-
kagerou_config['kagerou_engine_' + target] =
57+
CMP_KAGEROU_NAME.push ('typescript:kagerou_engine_' + target)
58+
CMP_KAGEROU_TS['kagerou_engine_' + target] =
3959
options:
4060
target: 'es5'
4161
basePath: src.split('/')[0..-1].join('/')
4262
src: src
4363
dest: 'build/scripting/api/' + src.split('/').pop().split('.')[0] + '.js'
4464

65+
# Append Typescript Tasks
66+
ts_config = {}
67+
for key,value of CMP_CORE_TS
68+
ts_config[key] = value
69+
for key,value of CMP_KAGEROU_TS
70+
ts_config[key] = value
71+
4572
# Core concatenated with libraries
4673
# Actual concat ordering does not/should not matter
4774
SRC_CORELIB = SRC_CORE.concat(SRC_PARSER)
@@ -55,7 +82,7 @@ module.exports = (grunt) ->
5582
# core_only : builds CCL without parsers
5683
# all : builds CCL with everything
5784
concat:
58-
scripting:
85+
scripting_host:
5986
files:
6087
'build/scripting/Host.js': ['src/scripting/Host.js','src/scripting/Unpacker.js']
6188
core_only:
@@ -68,11 +95,11 @@ module.exports = (grunt) ->
6895
'build/CommentCoreLibrary.js': SRC_CORELIB
6996

7097
# Compile TypeScript
71-
typescript: kagerou_config
98+
typescript: ts_config
7299

73100
# Copy
74101
copy:
75-
scripting:
102+
scripting_sandbox:
76103
files:[
77104
{expand: true, cwd:'src/scripting/api/', src: ['*.js'], dest:'build/scripting/api/'},
78105
{expand: true, cwd:'src/scripting/', src: ['OOAPI.js','Worker.js'], dest:'build/scripting/'}
@@ -110,10 +137,14 @@ module.exports = (grunt) ->
110137
# Run concat, autoprefixer, cssmin and uglify
111138
tasks: ['build']
112139
)
113-
140+
141+
# Register special compiles
142+
grunt.registerTask 'compile-ts-kagerou', CMP_KAGEROU_NAME
143+
grunt.registerTask 'compile-ts-core', CMP_CORE_NAME
144+
114145
# Register our tasks
115-
grunt.registerTask 'build-scripting', ['clean:scripting','concat:scripting', 'copy:scripting', 'typescript']
116-
grunt.registerTask 'build-core', ['concat:core_only', 'autoprefixer', 'cssmin', 'uglify:core_only']
117-
grunt.registerTask 'build', ['concat:all', 'autoprefixer', 'cssmin', 'uglify:all']
146+
grunt.registerTask 'build-scripting', ['clean:scripting','concat:scripting_host', 'compile-ts-kagerou', 'copy:scripting_sandbox']
147+
grunt.registerTask 'build-core', ['compile-ts-core', 'concat:core_only', 'autoprefixer', 'cssmin', 'uglify:core_only']
148+
grunt.registerTask 'build', ['compile-ts-core', 'concat:all', 'autoprefixer', 'cssmin', 'uglify:all']
118149
grunt.registerTask 'default', ['clean', 'build', 'build-scripting', 'watch']
119150

0 commit comments

Comments
 (0)