UNPKG

geoip_from_cities

Version:

Find the lattitude and longitude from a locally cached cities.json as opposed to google geoip which has limits of 2500 requests per day.

67 lines (63 loc) 1.58 kB
import commonjs from 'rollup-plugin-commonjs'; import uglify from 'rollup-plugin-uglify'; import resolve from 'rollup-plugin-node-resolve'; import license from 'rollup-plugin-license'; const commitHash = require('child_process') .execSync('git rev-parse --short HEAD', { encoding: 'utf-8' }) .trim(); const bundleConfig = { input: 'src/index.js', output: { format: 'iife', name: 'geoip_from_cities', sourcemap: true, }, context: 'window', plugins: [ resolve({ jsnext: true, main: true, browser: true, }), commonjs(), license({ sourcemap: true, banner: `/*! geoip_from_cities <%= pkg.version %> (${commitHash}) | https://gitlab.com/rioadvancement/geoip_from_cities */`, }), ], }; export default [ { input: 'src/index.js', output: { file: 'dist/index.js', format: 'cjs', exports: 'named', interop: false, }, external: ['ramda', 'cities.json'], plugins: [ resolve({ jsnext: true, main: true, browser: true, }), commonjs(), ], }, Object.assign({}, bundleConfig, { output: Object.assign({}, bundleConfig.output, { file: 'build/bundle.js', }), }), Object.assign({}, bundleConfig, { output: Object.assign({}, bundleConfig.output, { file: 'build/bundle.min.js', }), // Uglify has to be at the end of compilation, BUT before the license banner plugins: bundleConfig.plugins .slice(0, -1) .concat(uglify()) .concat(bundleConfig.plugins.slice(-1)), }), ];