Skip to content

Commit

Permalink
Changed build tool from Webpack to Rollup.
Browse files Browse the repository at this point in the history
  • Loading branch information
bugra9 committed Mar 27, 2022
1 parent b65b4c8 commit caf27a7
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 532 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
32 changes: 0 additions & 32 deletions .webpack.config.js

This file was deleted.

32 changes: 19 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,32 @@
"repository": "https://github.com/bugra9/gdal3.js.git",
"private": false,
"keywords": [
"gdal",
"ogr2ogr",
"gdal_translate",
"gdal_rasterize",
"gdalwarp",
"gdaltransform"
],
"gis",
"geospatial",
"gdal",
"ogr2ogr",
"gdal_translate",
"gdal_rasterize",
"gdalwarp",
"gdaltransform",
"webassembly",
"emscripten"
],
"files": [
"dist/package/gdal3WebAssembly.data",
"dist/package/gdal3WebAssembly.wasm"
],
"main": "dist/package/gdal3.js",
"scripts": {
"lint": "eslint .",
"build": "yarn run build-native && yarn run build-src-all && yarn run build-spec && yarn run build-gui && yarn run build-docs",
"build": "yarn run build-native && yarn run build-src && yarn run build-spec && yarn run build-gui && yarn run build-docs",
"test": "yarn run test-node && yarn run test-browser && yarn run test-coverage",
"dist": "rm -rf dist && mkdir -p dist/examples && cp -r build/app/* dist && cp -r build/package dist && cp -r build/docs dist && cp -r build/test dist && cp -r build/coverage dist && cp -r apps/example*browser* dist/examples",
"serve": "http-server dist",
"deploy": "push-dir --dir=dist --branch=gh-pages --cleanup",
"build-native": "make",
"build-src": "webpack --config .webpack.config.js src/index.js -o build/package/gdal3.js",
"build-src": "rollup --config rollup.config.js",
"build-src-dev": "webpack --config .webpack.config.js src/index.js -o build/package/gdal3.js --mode development",
"build-src-withcoverage": "NODE_ENV=coverage webpack --config .webpack.config.js src/index.js -o build/package/gdal3.coverage.js",
"build-src-all": "yarn run build-src && yarn run build-src-withcoverage",
"build-spec": "mkdir -p build/test/specs/ && cp src/**/**/*.spec.js build/test/specs/ && cp test/*.spec.js build/test/specs/ && cp test/browser.html build/test/index.html && cp -r test/data build/test/data",
"build-gui": "cd apps/app-gui && yarn install && yarn run build",
"build-docs": "jsdoc --configure .jsdoc.json --verbose && cp -r build/docs/gdal3.js/2.0.2/* build/docs",
Expand All @@ -44,6 +46,9 @@
"@babel/plugin-transform-runtime": "^7.16.7",
"@babel/preset-env": "^7.16.7",
"@babel/register": "^7.16.7",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.0.2",
"@rollup/plugin-node-resolve": "^13.1.3",
"@types/detect-node": "^2.0.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.3",
Expand Down Expand Up @@ -78,8 +83,9 @@
"nyc": "^15.1.0",
"puppeteer": "^13.0.1",
"push-dir": "^0.4.1",
"webpack": "^5.70.0",
"webpack-cli": "^4.9.2"
"rollup": "^2.70.1",
"rollup-plugin-istanbul": "^3.0.0",
"rollup-plugin-uglify": "^6.0.4"
},
"dependencies": {
"detect-node": "^2.1.0",
Expand Down
42 changes: 42 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { babel } from '@rollup/plugin-babel';
import istanbul from 'rollup-plugin-istanbul';
import { uglify } from "rollup-plugin-uglify";

export default [
{
plugins: [nodeResolve(), commonjs(), babel({ babelHelpers: 'bundled' }), uglify()],
input: 'src/index.js',
output: {
file: 'build/package/gdal3.js',
format: 'umd',
name: 'initGdalJs',
}
},
{
plugins: [nodeResolve(), commonjs()],
input: 'src/index.js',
output: {
file: 'build/package/gdal3.dev.js',
format: 'umd',
name: 'initGdalJs',
sourcemap: 'inline',
}
},
{
plugins: [
nodeResolve(),
commonjs(),
istanbul({
exclude: ['src/**/*.spec.js']
})
],
input: 'src/index.js',
output: {
file: 'build/package/gdal3.coverage.js',
format: 'umd',
name: 'initGdalJs',
}
},
];
Loading

0 comments on commit caf27a7

Please sign in to comment.