Skip to content

Commit ba794d9

Browse files
committed
updated to rollup build process
support ESM, Node and Browser
1 parent d525da3 commit ba794d9

14 files changed

+3649
-590
lines changed

.eslintrc.json renamed to .eslintrc.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1-
{
1+
module.exports = {
22
"env": {
3+
"browser": true,
34
"es6": true,
4-
"node": true,
5-
"mocha": true
5+
"node": true
66
},
7+
"extends": "eslint:recommended",
78
"globals": {
8-
"riot": true
9+
"Atomics": "readonly",
10+
"SharedArrayBuffer": "readonly"
911
},
1012
"parserOptions": {
11-
"ecmaVersion": 2015
13+
"ecmaVersion": 2018,
14+
"sourceType": "module"
1215
},
13-
"extends": "eslint:recommended",
1416
"rules": {
15-
"indent": [
16-
"error",
17-
4
17+
"no-console": [
18+
"warn"
1819
],
19-
"linebreak-style": [
20+
"indent": [
2021
"error",
21-
"unix"
22+
4,
23+
{"SwitchCase": 1}
2224
],
2325
"quotes": [
2426
"error",
25-
"single"
27+
"double"
2628
],
2729
"semi": [
2830
"error",

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ Commit messages should includes GitHub number reference and a imperative easy to
6060

6161
## Coding style
6262

63-
If it is supported in all major browers without transpiling, then please use those JavaScript language features in your code, with one caveat -- readablity is king.
63+
If it is supported in all major browers without transpiling, then please use those JavaScript language features in your code, with one caveat -- readablity is king.
6464

6565
Currently all ES5 and ES6/ES2015 are available.
6666

67-
This project is linted agaist [ESLint](https://eslint.org/) and the [`.eslintrc.json`](.eslintrc.json) is dead-simple, and all you need to followed.
67+
This project is linted agaist [ESLint](https://eslint.org/) and the [`.eslintrc.js`](.eslintrc.js) is dead-simple, and all you need to followed.
6868

6969
Thank you for reading this.
7070

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2018
1+
Copyright (c) 2020 Geoff Doty
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of
44
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
Brainspace is limited these days, so start with this nice boilerplate, so you do not have to remember all the things you forgot last week.
88

99
**Features**
10-
- No Build Process
11-
- Template for browsers and NodeJS library
12-
- ESLint w/ ES6 Support
13-
- More..less..not sure, why dont you take a look
10+
- Build / Minify Your Library
11+
- Rollup for browser and NodeJS library distribution
12+
- ESLint w/ ES6/2018 Support
13+
- Includes [Tape]() for quickly writing tests
1414

1515
## Quick Start
1616

@@ -19,6 +19,7 @@ Brainspace is limited these days, so start with this nice boilerplate, so you do
1919
git clone https://github.com/n2geoff/js-lib.git
2020

2121
2. do a find-replace on `n2geoff/js-lib`, to your user name/repo
22+
3. Update [LICENSE](LICENSE), README & [CONTRIBUTING](CONTRIBUTING.md) as needed
2223
3. update the [package.js](package.json)
2324
4. start writing your [library](src/index.js)
2425

@@ -28,7 +29,7 @@ Please open [an issue](https://github.com/n2geoff/js-lib/issues/new) for support
2829

2930
## Contributing
3031

31-
Anyone is welcome to contribute, however, if you decide to get involved, please take a moment to review the [guidelines](CONTRIBUTING.md), there minimalistic;)
32+
Anyone is welcome to contribute, however, if you decide to get involved, please take a moment to review the [guidelines](CONTRIBUTING.md), they're minimalistic;)
3233

3334
## License
3435

dist/bundle.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var index = {};
2+
3+
export default index;

dist/bundle.min.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
var index={};export default index;

dist/bundle.umd.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(function (global, factory) {
2+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3+
typeof define === 'function' && define.amd ? define('umd', factory) :
4+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.umd = factory());
5+
}(this, (function () { 'use strict';
6+
7+
var index = {};
8+
9+
return index;
10+
11+
})));

dist/bundle.umd.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

gulpfile.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const gulp = require("gulp");
2+
const minify = require("gulp-minify");
3+
const strip = require("gulp-strip-comments");
4+
const rollup = require("gulp-rollup-2").rollup;
5+
6+
gulp.task("default", function build() {
7+
return gulp.src("./src/*.js")
8+
.pipe(rollup({
9+
output: [
10+
{
11+
file: "bundle.js",
12+
name: "es",
13+
format: "es"
14+
},
15+
{
16+
file: "bundle.umd.js",
17+
name: "umd",
18+
format: "umd"
19+
},
20+
]
21+
}))
22+
.pipe(strip({safe: true}))
23+
.pipe(minify({ext: {min: ".min.js"}}))
24+
.pipe(gulp.dest("dist"))
25+
});

0 commit comments

Comments
 (0)