Create 3rd party libraries with node instead of Python.

This commit is contained in:
Sebastian Kupke 2019-03-22 14:26:44 +01:00
parent b164de08a5
commit 8c43840572
11 changed files with 27026 additions and 16225 deletions

View File

@ -10,24 +10,16 @@ and some dependencies locally
`npm i`
Be sure that Python 3 is installed on your system (for building the 3rd party library).
## Build
To build the two iwmlib files type
`npm run build`
The files will be generated in the dist folder (iwmlib.js and iwmlib.pixi.js). If you want to watch the files for a continuously build type
The files will be generated in the dist folder (iwmlib.js and iwmlib.pixi.js). If you want to watch the files for a continuously build type
`npm run watch`
To build the 3rd party library type
`npm run 3rdparty`
To create the minified version of the 3rd party library type
`npm run minify`

32027
dist/iwmlib.3rdparty.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

10945
dist/iwmlib.3rdparty.preload.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/iwmlib.3rdparty.preload.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,45 @@
const {src, dest, parallel} = require('gulp');
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
const concat = require('gulp-concat');
function minify() {
function vendors() {
return src([
'dist/iwmlib.3rdparty.js'
'./lib/3rdparty/jquery.js',
'./lib/3rdparty/optimal-select.js',
'./lib/3rdparty/hammer.js',
'./lib/3rdparty/hammer.propagating.js',
'./lib/3rdparty/d3/d3.js',
'./lib/3rdparty/d3/d3-selection-multi.js',
'./lib/3rdparty/highlight/**/*.js',
'./lib/3rdparty/pixi/pixi.js',
'./lib/3rdparty/pixi/lib/crn_decomp.js',
'./lib/3rdparty/pixi/pixi-compressed-textures.js',
'./lib/3rdparty/pixi/pixi-filters.js',
'./lib/3rdparty/pixi/pixi-particles.js',
'./lib/3rdparty/pixi/pixi-projection.js',
'./lib/3rdparty/greensock/src/uncompressed/**/*.js',
'./lib/3rdparty/convertPointFromPageToNode.js',
], {sourcemaps: false})
.pipe(concat('iwmlib.3rdparty.js'))
.pipe(dest('dist', {sourcemaps: false}))
.pipe(rename({extname: '.min.js'}))
.pipe(uglify())
.pipe(dest('dist'))
.pipe(dest('dist', {sourcemaps: false}))
}
exports.default = parallel(minify);
function preload() {
return src([
'./lib/3rdparty/highlight/**/*.js',
'./lib/3rdparty/greensock/src/uncompressed/plugins/*.js',
'./lib/3rdparty/greensock/src/uncompressed/TweenLite.js',
'./lib/3rdparty/convertPointFromPageToNode.js',
], {sourcemaps: false})
.pipe(concat('iwmlib.3rdparty.preload.js'))
.pipe(dest('dist', {sourcemaps: false}))
.pipe(rename({extname: '.min.js'}))
.pipe(uglify())
.pipe(dest('dist', {sourcemaps: false}))
}
exports.default = parallel(vendors, preload);

View File

@ -1,45 +0,0 @@
/*
* Import often used libraries.
*/
import './jquery.js'
import './optimal-select.js'
import './hammer.js'
import './d3/d3.v4.js'
import './d3/d3.v4.selection-multi.js'
import './highlight/highlight.pack.js'
import './pixi/pixi.js'
import './pixi/pixi-filters.js'
import './pixi/pixi-particles.js'
import './pixi/pixi-compressed-textures.js'
import './greensock/src/uncompressed/jquery.gsap.js'
import './greensock/src/uncompressed/TweenLite.js'
import './greensock/src/uncompressed/TweenMax.js'
import './greensock/src/uncompressed/TimelineLite.js'
import './greensock/src/uncompressed/TimelineMax.js'
import './greensock/src/uncompressed/easing/CustomBounce.js'
import './greensock/src/uncompressed/easing/CustomEase.js'
import './greensock/src/uncompressed/easing/CustomWiggle.js'
import './greensock/src/uncompressed/easing/EasePack.js'
import './greensock/src/uncompressed/plugins/AttrPlugin.js'
import './greensock/src/uncompressed/plugins/BezierPlugin.js'
import './greensock/src/uncompressed/plugins/ColorPropsPlugin.js'
import './greensock/src/uncompressed/plugins/CSSPlugin.js'
import './greensock/src/uncompressed/plugins/CSSRulePlugin.js'
import './greensock/src/uncompressed/plugins/DirectionalRotationPlugin.js'
import './greensock/src/uncompressed/plugins/DrawSVGPlugin.js'
import './greensock/src/uncompressed/plugins/EaselPlugin.js'
import './greensock/src/uncompressed/plugins/EndArrayPlugin.js'
import './greensock/src/uncompressed/plugins/ModifiersPlugin.js'
import './greensock/src/uncompressed/plugins/MorphSVGPlugin.js'
import './greensock/src/uncompressed/plugins/Physics2DPlugin.js'
import './greensock/src/uncompressed/plugins/PhysicsPropsPlugin.js'
import './greensock/src/uncompressed/plugins/PixiPlugin.js'
import './greensock/src/uncompressed/plugins/RaphaelPlugin.js'
import './greensock/src/uncompressed/plugins/RoundPropsPlugin.js'
import './greensock/src/uncompressed/plugins/ScrambleTextPlugin.js'
import './greensock/src/uncompressed/plugins/ScrollToPlugin.js'
import './greensock/src/uncompressed/plugins/TEMPLATE_Plugin.js'
import './greensock/src/uncompressed/plugins/TextPlugin.js'
import './greensock/src/uncompressed/plugins/ThrowPropsPlugin.js'
import './greensock/src/uncompressed/utils/Draggable.js'
import './greensock/src/uncompressed/utils/SplitText.js'

View File

@ -1,82 +0,0 @@
#!/usr/bin/env python
"""
Module docstring.
"""
import sys, os, optparse
items = (
"./lib/3rdparty/jquery.js",
"./lib/3rdparty/optimal-select.js",
"./lib/3rdparty/hammer.js",
"./lib/3rdparty/hammer.propagating.js",
"./lib/3rdparty/d3/d3.js",
"./lib/3rdparty/d3/d3-selection-multi.js",
"./lib/3rdparty/highlight",
"./lib/3rdparty/pixi/pixi.js",
"./lib/3rdparty/pixi/lib/crn_decomp.js",
"./lib/3rdparty/pixi/pixi-compressed-textures.js",
"./lib/3rdparty/pixi/pixi-filters.js",
"./lib/3rdparty/pixi/pixi-particles.js",
"./lib/3rdparty/pixi/pixi-projection.js",
"./lib/3rdparty/greensock/src/uncompressed",
"./lib/3rdparty/greensock/src/uncompressed/easing",
"./lib/3rdparty/greensock/src/uncompressed/plugins",
"./lib/3rdparty/greensock/src/uncompressed/utils",
"./lib/3rdparty/convertPointFromPageToNode.js"
)
def process_command_line(argv):
"""
Return a 2-tuple: (settings object, args list).
`argv` is a list of arguments, or `None` for ``sys.argv[1:]``.
"""
if argv is None:
argv = sys.argv[1:]
# initialize the parser object:
parser = optparse.OptionParser(
formatter=optparse.TitledHelpFormatter(width=78),
add_help_option=None)
# define options here:
parser.add_option( # customized description; put --help last
'-h', '--help', action='help',
help='Show this help message and exit.')
settings, args = parser.parse_args(argv)
# check number of arguments, verify values, etc.:
if args:
parser.error('program takes no command-line arguments; '
'"%s" ignored.' % (args,))
# further process settings & args if necessary
return settings, args
def main(argv=None):
settings, args = process_command_line(argv)
run(settings, args)
return 0 # success
def run(settings, args):
with open("./dist/iwmlib.3rdparty.js", 'w') as outfile:
for item in items:
if item.endswith(".js"):
appendFile(outfile, item)
else:
for filename in os.listdir(item):
if filename.endswith(".js"):
appendFile(outfile, os.path.join(item, filename))
def appendFile(outfile, filename):
with open(filename) as infile:
outfile.write("\n")
outfile.write(infile.read())
print("File appended: " + infile.name)
if __name__ == '__main__':
status = main()
sys.exit(status)

View File

@ -1,68 +0,0 @@
#!/usr/bin/env python
"""
Module docstring.
"""
import sys, os, optparse
items = (
"highlight",
"greensock/src/uncompressed/plugins",
"greensock/src/uncompressed/TweenLite.js",
"convertPointFromPageToNode.js"
)
def process_command_line(argv):
"""
Return a 2-tuple: (settings object, args list).
`argv` is a list of arguments, or `None` for ``sys.argv[1:]``.
"""
if argv is None:
argv = sys.argv[1:]
# initialize the parser object:
parser = optparse.OptionParser(
formatter=optparse.TitledHelpFormatter(width=78),
add_help_option=None)
# define options here:
parser.add_option( # customized description; put --help last
'-h', '--help', action='help',
help='Show this help message and exit.')
settings, args = parser.parse_args(argv)
# check number of arguments, verify values, etc.:
if args:
parser.error('program takes no command-line arguments; '
'"%s" ignored.' % (args,))
# further process settings & args if necessary
return settings, args
def main(argv=None):
settings, args = process_command_line(argv)
run(settings, args)
return 0 # success
def run(settings, args):
with open("preload.js", 'w') as outfile:
for item in items:
if item.endswith(".js"):
appendFile(outfile, item)
else:
for filename in os.listdir(item):
if filename.endswith(".js"):
appendFile(outfile, os.path.join(item, filename))
def appendFile(outfile, filename):
with open(filename) as infile:
outfile.write("\n")
outfile.write(infile.read())
print("File appended: " + infile.name)
if __name__ == '__main__':
status = main()
sys.exit(status)

28
package-lock.json generated
View File

@ -526,6 +526,23 @@
"typedarray": "^0.0.6"
}
},
"concat-with-sourcemaps": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz",
"integrity": "sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==",
"dev": true,
"requires": {
"source-map": "^0.6.1"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
},
"convert-source-map": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz",
@ -1735,6 +1752,17 @@
}
}
},
"gulp-concat": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/gulp-concat/-/gulp-concat-2.6.1.tgz",
"integrity": "sha1-Yz0WyV2IUEYorQJmVmPO5aR5M1M=",
"dev": true,
"requires": {
"concat-with-sourcemaps": "^1.0.0",
"through2": "^2.0.0",
"vinyl": "^2.0.0"
}
},
"gulp-rename": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.4.0.tgz",

View File

@ -10,8 +10,7 @@
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup --config ./rollup.config.js",
"watch": "rollup --watch --config ./rollup.config.js",
"3rdparty": "python3 ./lib/3rdparty/create_all_js.py",
"minify": "gulp"
"3rdparty": "gulp"
},
"repository": {
"type": "git",
@ -21,6 +20,7 @@
"license": "LGPL-3.0-or-later",
"devDependencies": {
"gulp": "^4.0.0",
"gulp-concat": "^2.6.1",
"gulp-rename": "^1.4.0",
"gulp-uglify": "^3.0.2"
}