diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..a261f29 --- /dev/null +++ b/debian/clean @@ -0,0 +1 @@ +dist/* diff --git a/debian/control b/debian/control index a4f9a49..5520fd4 100644 --- a/debian/control +++ b/debian/control @@ -7,10 +7,8 @@ debhelper (>= 11~) , nodejs , node-tape - , webpack - , node-babel-loader - , node-babel-plugin-add-module-exports - , node-babel-preset-es2015 + , rollup + , uglifyjs.terser , node-d3-path (>= 1) , node-d3-polygon Standards-Version: 4.3.0 diff --git a/debian/install b/debian/install index ab084c1..8ab5571 100644 --- a/debian/install +++ b/debian/install @@ -1,2 +1,3 @@ package.json usr/lib/nodejs/d3-shape/ -build usr/lib/nodejs/d3-shape/ +dist usr/lib/nodejs/d3-shape/ +src usr/lib/nodejs/d3-shape/ diff --git a/debian/patches/remove-unsupported-syntax.patch b/debian/patches/remove-unsupported-syntax.patch new file mode 100644 index 0000000..bf1b359 --- /dev/null +++ b/debian/patches/remove-unsupported-syntax.patch @@ -0,0 +1,32 @@ +This syntax is not supported in packaged rollup/node yet. +Minified file is generated by uglifyjs.terser command line. + +--- a/rollup.config.js ++++ b/rollup.config.js +@@ -1,4 +1,3 @@ +-import {terser} from "rollup-plugin-terser"; + import * as meta from "./package.json"; + + const config = { +@@ -17,20 +16,5 @@ + }; + + export default [ +- config, +- { +- ...config, +- output: { +- ...config.output, +- file: `dist/${meta.name}.min.js` +- }, +- plugins: [ +- ...config.plugins, +- terser({ +- output: { +- preamble: config.output.banner +- } +- }) +- ] +- } ++ config + ]; diff --git a/debian/patches/reproducible_build.diff b/debian/patches/reproducible_build.diff new file mode 100644 index 0000000..289e06d --- /dev/null +++ b/debian/patches/reproducible_build.diff @@ -0,0 +1,15 @@ +Description: Make the build reproducible +Author: Chris Lamb +Last-Update: 2019-06-20 + +--- a/rollup.config.js ++++ b/rollup.config.js +@@ -9,7 +9,7 @@ + format: "umd", + indent: false, + extend: true, +- banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`, ++ banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date(process.env.SOURCE_DATE_EPOCH ? (process.env.SOURCE_DATE_EPOCH * 1000) : new Date().getTime())).getFullYear()} ${meta.author.name}`, + globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"}))) + }, + plugins: [] diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..ba4f208 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +remove-unsupported-syntax.patch +reproducible_build.diff diff --git a/debian/rules b/debian/rules index d71790f..beb5308 100755 --- a/debian/rules +++ b/debian/rules @@ -8,13 +8,8 @@ dh $@ override_dh_auto_build: - webpack --config debian/webpack.config.js \ - --output-library=d3 \ - index.js build/d3-shape.js + rollup -c + uglifyjs.terser dist/d3-shape.js -o dist/d3-shape.min.js override_dh_auto_test: tape 'test/**/*.js' - -override_dh_auto_clean: - rm -rf build - dh_auto_clean diff --git a/debian/webpack.config.js b/debian/webpack.config.js deleted file mode 100644 index f9cb59f..0000000 --- a/debian/webpack.config.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; -var path = require('path'); -var config = { - target: 'web', - resolve: { - modules: ['/usr/lib/nodejs', '.'], - }, - resolveLoader: { - modules: ['/usr/lib/nodejs'], - }, - output: { - libraryTarget: 'umd' - }, - module: { rules: [ {test: /\.js$/, loader: 'babel-loader', options: { presets: [ 'es2015' ], plugins: ['add-module-exports'] } }] } -} -module.exports = config;