Skip to content

Commit

Permalink
Convert to ES6. (#5)
Browse files Browse the repository at this point in the history
* Convert to ES6.

* Upgrade node version.

* Bump version.
  • Loading branch information
schneidmaster committed Jul 12, 2017
1 parent d047856 commit 52b64cb
Show file tree
Hide file tree
Showing 40 changed files with 330 additions and 267 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
29 changes: 29 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module"
},
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
actual-output
coverage
/coverage
/lib
/node_modules
1 change: 0 additions & 1 deletion .jshintignore

This file was deleted.

4 changes: 0 additions & 4 deletions .npmignore

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ Add to your webpack config -- see below for examples. The plugin signature is:
### webpack.config.js

```js
var SitemapPlugin = require('sitemap-webpack-plugin');
import SitemapPlugin from 'sitemap-webpack-plugin';

/* basic paths -- directly compatible with static-site-generator-webpack-plugin */
var paths = [
const paths = [
'/foo/',
'/bar/'
];

/* object paths -- more fine-grained but not directly compatible with static-site-generator-webpack-plugin */
/* object paths must have a `path` attribute -- others are optional, and fall back to global config (if any) */
var paths = [
const paths = [
{
path: '/foo/',
lastMod: '2015-01-04',
Expand All @@ -49,9 +49,9 @@ var paths = [
];

/* you can also convert object paths back into static-site-generator-webpack-plugin compatible paths */
var staticSiteGeneratorCompatiblePaths = paths.map(function(path) { return path.path });
const staticSiteGeneratorCompatiblePaths = paths.map(function(path) { return path.path });

module.exports = {
export default {

/* snip */

Expand Down
4 changes: 4 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
machine:
node:
version: 8.1.4

test:
override:
- npm test
Expand Down
8 changes: 0 additions & 8 deletions date.js

This file was deleted.

129 changes: 0 additions & 129 deletions index.js

This file was deleted.

26 changes: 17 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"name": "sitemap-webpack-plugin",
"version": "0.3.0",
"version": "0.4.0",
"description": "Webpack plugin to generate a sitemap.",
"main": "index.js",
"main": "lib/index.js",
"scripts": {
"test": "istanbul cover _mocha test -- --timeout 20000",
"build": "babel src --out-dir lib",
"prepublish": "npm run build",
"test": "istanbul cover _mocha -- --compilers js:babel-core/register",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
"lint": "jshint ./**/*.js"
},
"jshintConfig": {
"expr": true
"lint": "eslint src/*.js 'test/**/*.js'"
},
"repository": {
"type": "git",
Expand All @@ -26,14 +25,23 @@
"bugs": {
"url": "https://github.com/schneidmaster/sitemap-webpack-plugin/issues"
},
"files": [
"lib/",
"src/",
"LICENSE.txt",
"package.json",
"README.md"
],
"homepage": "https://github.com/schneidmaster/sitemap-webpack-plugin#readme",
"devDependencies": {
"async": "^2.1.4",
"babel-cli": "^6.24.1",
"babel-preset-es2015": "^6.24.1",
"chai": "^3.5.0",
"coveralls": "^2.11.15",
"eslint": "^4.2.0",
"glob": "^7.1.1",
"istanbul": "^0.4.5",
"jshint": "^2.9.4",
"istanbul": "^1.0.0-alpha.2",
"mocha": "^3.2.0",
"rimraf": "^2.5.4",
"timecop": "git+https://github.com/jamesarosen/Timecop.js.git",
Expand Down
7 changes: 7 additions & 0 deletions src/date.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default () => {
const dateOptions = { day: '2-digit', month: '2-digit', year: 'numeric' };
const date = new Date().toLocaleDateString([], dateOptions).split('/');
const year = date.splice(-1)[0];
date.splice(0, 0, year);
return date.join('-');
};
Loading

0 comments on commit 52b64cb

Please sign in to comment.