-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from jonataswalker/update-deps
Rewrite (almost) the project
- Loading branch information
Showing
49 changed files
with
13,328 additions
and
7,568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
extends: ['jwalker'], | ||
rules: { | ||
'no-console': 1 | ||
}, | ||
globals: { | ||
Geocoder: true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
const { writeFileSync, readFileSync } = require('fs'); | ||
const boxen = require('boxen'); | ||
const chalk = require('chalk'); | ||
const gzip = require('gzip-size'); | ||
const bytes = require('bytes'); | ||
const sass = require('node-sass'); | ||
const jsonImporter = require('node-sass-json-importer'); | ||
const autoprefixer = require('autoprefixer'); | ||
const postcss = require('postcss'); | ||
const postcssReport = require('postcss-reporter'); | ||
const cssnano = require('cssnano'); | ||
const pkg = require('../package.json'); | ||
|
||
var banner = readFileSync('./build/banner.js', 'utf-8') | ||
.replace('${name}', pkg.name) | ||
.replace('${description}', pkg.description) | ||
.replace('${homepage}', pkg.homepage) | ||
.replace('${version}', pkg.version) | ||
.replace('${time}', new Date()); | ||
|
||
|
||
sass.render({ | ||
file: './src/sass/main.scss', | ||
importer: jsonImporter | ||
}, (err, result) => { | ||
if (err) throw err.message; | ||
|
||
const prefixer = postcss([ | ||
autoprefixer({ browsers: ['> 5%'] }), | ||
postcssReport({ clearMessages: true }) | ||
]); | ||
prefixer.process(result.css).then(res => { | ||
res.warnings().forEach((warn) => { | ||
console.warn(warn.toString()); | ||
}); | ||
|
||
writeFileSync('./dist/ol-geocoder.css', banner + res.css); | ||
|
||
cssnano.process(res.css).then(min => { | ||
writeFileSync('./dist/ol-geocoder.min.css', banner + min.css); | ||
|
||
const cssSize = bytes(Buffer.byteLength(res.css)); | ||
const cssMinSize = bytes(Buffer.byteLength(min.css)); | ||
const cssGzip = bytes(gzip.sync(res.css)); | ||
const cssMinGzip = bytes(gzip.sync(min.css)); | ||
|
||
// eslint-disable-next-line no-console | ||
console.log(boxen([ | ||
chalk.green.bold('CSS: '), | ||
chalk.yellow.bold(cssSize), ', ', | ||
chalk.green.bold('Gzipped: '), | ||
chalk.yellow.bold(cssGzip), '\n', | ||
chalk.green.bold('Minified: '), | ||
chalk.yellow.bold(cssMinSize), ', ', | ||
chalk.green.bold('Gzipped: '), | ||
chalk.yellow.bold(cssMinGzip), '\n', | ||
chalk.green.bold('Now: '), | ||
chalk.yellow.bold(new Date()) | ||
].join(''), { padding: 1 })); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { readFileSync } from 'fs'; | ||
import { minify } from 'uglify-es'; | ||
import nodeResolve from 'rollup-plugin-node-resolve'; | ||
import json from 'rollup-plugin-json'; | ||
import buble from 'rollup-plugin-buble'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import eslint from 'rollup-plugin-eslint'; | ||
import includePaths from 'rollup-plugin-includepaths'; | ||
import bundleSize from 'rollup-plugin-filesize'; | ||
import uglify from 'rollup-plugin-uglify'; | ||
|
||
const pkg = JSON.parse(readFileSync('./package.json', 'utf-8')); | ||
const external = Object.keys(pkg.dependencies); | ||
|
||
const globals = { | ||
openlayers: 'ol', | ||
}; | ||
|
||
const lintOpts = { | ||
// extensions: ['js'], | ||
exclude: ['**/*.json'], | ||
cache: true, | ||
throwOnError: true | ||
}; | ||
|
||
const includePathOptions = { | ||
paths: ['', './src'] | ||
}; | ||
|
||
const banner = readFileSync('./build/banner.js', 'utf-8') | ||
.replace('${name}', pkg.name) | ||
.replace('${description}', pkg.description) | ||
.replace('${homepage}', pkg.homepage) | ||
.replace('${version}', pkg.version) | ||
.replace('${time}', new Date()); | ||
|
||
export default [ | ||
{ | ||
external, | ||
banner, | ||
globals, | ||
input: './src/base.js', | ||
output: { | ||
file: './dist/ol-geocoder.js', | ||
format: 'umd', | ||
name: 'Geocoder', | ||
}, | ||
plugins: [ | ||
includePaths(includePathOptions), | ||
eslint(lintOpts), | ||
bundleSize(), | ||
nodeResolve(), | ||
commonjs(), | ||
json({ exclude: 'node_modules/**' }), | ||
buble({ target: { ie: 11 } }), | ||
uglify({ output: { comments: /^!/ } }, minify) | ||
], | ||
}, | ||
{ | ||
external, | ||
banner, | ||
globals, | ||
input: './src/base.js', | ||
output: { | ||
file: './dist/ol-geocoder-debug.js', | ||
format: 'umd', | ||
name: 'Geocoder', | ||
}, | ||
plugins: [ | ||
includePaths(includePathOptions), | ||
eslint(lintOpts), | ||
bundleSize(), | ||
nodeResolve(), | ||
commonjs(), | ||
json({ exclude: 'node_modules/**' }), | ||
buble({ target: { ie: 11 } }) | ||
], | ||
} | ||
]; |
Oops, something went wrong.