Browse Source

Create 3rd party libraries with node instead of Python.

obersalzberg
Sebastian Kupke 3 years ago
parent
commit
8c43840572
11 changed files with 37478 additions and 26677 deletions
  1. +1
    -9
      README.md
  2. +26465
    -26466
      dist/iwmlib.3rdparty.js
  3. +1
    -1
      dist/iwmlib.3rdparty.min.js
  4. +10945
    -0
      dist/iwmlib.3rdparty.preload.js
  5. +1
    -0
      dist/iwmlib.3rdparty.preload.min.js
  6. +35
    -4
      gulpfile.js
  7. +0
    -45
      lib/3rdparty/3rdparty.js
  8. +0
    -82
      lib/3rdparty/create_all_js.py
  9. +0
    -68
      lib/3rdparty/create_preload_js.py
  10. +28
    -0
      package-lock.json
  11. +2
    -2
      package.json

+ 1
- 9
README.md 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`

+ 26465
- 26466
dist/iwmlib.3rdparty.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/iwmlib.3rdparty.min.js
File diff suppressed because it is too large
View File


+ 10945
- 0
dist/iwmlib.3rdparty.preload.js
File diff suppressed because it is too large
View File


+ 1
- 0
dist/iwmlib.3rdparty.preload.min.js
File diff suppressed because it is too large
View File


+ 35
- 4
gulpfile.js 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);

+ 0
- 45
lib/3rdparty/3rdparty.js 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'

+ 0
- 82
lib/3rdparty/create_all_js.py 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)

+ 0
- 68
lib/3rdparty/create_preload_js.py 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
- 0
package-lock.json 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",


+ 2
- 2
package.json 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"
}


Loading…
Cancel
Save