Commit 4ec25867 authored by Romain Casati's avatar Romain Casati
Browse files

Using gulp to build the kernel bundle (single js file).

parent 665261d5
__pycache__/
geckodriver.log
test_report.xml
\ No newline at end of file
test_report.xml
node_modules/
package-lock.json
......@@ -6,14 +6,9 @@ BASTHON_JS = src/basthon-py/build/basthon.js
BASTHON_MODULE = src/basthon-py/basthon
BASTHON_VFS_DEST = /lib/python3.8/site-packages/basthon/
MINIFIED=src/basthon-js/basthon_base.min.js src/basthon-js/basthon_python.min.js src/basthon-js/basthon_goodies.min.js
SOURCEMAPS=$(patsubst %.min.js,%.min.js.map,$(MINIFIED))
minify: $(MINIFIED)
# this is a workaround for the buggy sources= parameter in map file
# produced by uglifyjs.terser
%.min.js: %.js
cd $(dir $<) && uglifyjs.terser $(notdir $<) --source-map url=$(notdir $@).map --compress --mangle --output $(notdir $@) && cd -
minify:
npm install --save-dev
./node_modules/gulp/bin/gulp.js all
extern/emscripten:
git clone --depth 1 https://github.com/emscripten-core/emsdk.git
......@@ -47,7 +42,7 @@ publish:
clean:
cd setup/ && make clean
rm -rf $(MINIFIED) $(SOURCEMAPS) $(BASTHON_DATA) $(BASTHON_JS) tests/build/
rm -rf src/basthon-js/*.min.js src/basthon-js/*.min.js.map $(BASTHON_DATA) $(BASTHON_JS) tests/build/
install:
pip3 install --force-reinstall setup/dist/basthon-kernel-*.tar.gz
......
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
const kernels = ['python'];
function gulp_task_kernel(kernel_name) {
return gulp.task(kernel_name, function() {
return gulp.src(['src/basthon-js/basthon_base.js',
`src/basthon-js/basthon_${kernel_name}.js`,
'src/basthon-js/basthon_goodies.js'])
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify())
.pipe(concat(`basthon-${kernel_name}.min.js`))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('src/basthon-js/'));
});
}
kernels.forEach((k) => gulp_task_kernel(k));
gulp.task('all', gulp.parallel(...kernels));
{
"name": "basthon-kernel",
"version": "0.30.0",
"dependencies": {
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-sourcemaps": "^3.0.0",
"gulp-uglify": "^3.0.2"
}
}
......@@ -2,7 +2,7 @@ FROM python:3.8.2-slim-buster
RUN echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list \
&& apt-get update && apt-get install -y --no-install-recommends \
make git patch llvm nodejs chromium-driver firefox-esr wget tar xz-utils bzip2 uglifyjs.terser \
make git patch llvm nodejs chromium-driver firefox-esr wget tar xz-utils bzip2 uglifyjs.terser npm \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 --no-cache-dir install \
......
......@@ -21,9 +21,7 @@
window.logs.push(message);
};
</script>
<script src="basthon_base.min.js"></script>
<script src="basthon_python.min.js"></script>
<script src="basthon_goodies.min.js"></script>
<script src="basthon-python.min.js"></script>
</head>
<body>
<script>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment