Skip to content

Commit 8ac907d

Browse files
committed
1.0.0
0 parents  commit 8ac907d

18 files changed

+8243
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
.vscode

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: node_js
2+
node_js:
3+
- node
4+
install:
5+
- npm install
6+
script:
7+
- npm run test

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Francisco Hodge
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<div align="center">
2+
<img align="center" width="180" src="https://franciscohodge.com/project-pages/js-library-boilerplate/images/JSLB2Basic.png" />
3+
<h2>Javascript Library Boilerplate Basic</h2>
4+
<blockquote>Minimal Library Starter Kit for your Javascript projects</blockquote>
5+
<a href="https://travis-ci.org/hodgef/js-library-boilerplate-basic"><img src="https://travis-ci.org/hodgef/js-library-boilerplate-basic.svg?branch=master" /></a> <img src="https://img.shields.io/david/hodgef/js-library-boilerplate-basic.svg" /> <a href="https://david-dm.org/hodgef/js-library-boilerplate-basic?type=dev"><img src="https://img.shields.io/david/dev/hodgef/js-library-boilerplate-basic.svg" /></a> <img src="https://api.dependabot.com/badges/status?host=github&repo=hodgef/js-library-boilerplate-basic" />
6+
7+
</div>
8+
9+
### For a more complete boilerplate, check out [js-library-boilerplate](https://github.com/hodgef/js-library-boilerplate).
10+
11+
## ⭐️ Features
12+
13+
- Webpack 4
14+
- Babel 7
15+
- UMD exports, so your library works everywhere.
16+
- Jest unit testing
17+
- Daily [dependabot](https://dependabot.com) dependency updates
18+
19+
## 📦 Getting Started
20+
21+
```
22+
git clone https://github.com/hodgef/js-library-boilerplate-basic.git myLibrary
23+
npm install
24+
```
25+
26+
## 💎 Customization
27+
28+
> Before shipping, make sure to:
29+
1. Edit `LICENSE` file
30+
2. Edit `package.json` information (These will be used to generate the headers for your built files)
31+
3. Edit `library: "MyLibrary"` with your library's export name in `./webpack.config.js`
32+
33+
## 🚀 Deployment
34+
1. `npm publish`
35+
2. Your users can include your library as usual
36+
37+
### npm
38+
```
39+
import MyLibrary from 'my-library';
40+
let libraryInstance = new MyLibrary();
41+
...
42+
```
43+
44+
### self-host/cdn
45+
```
46+
<script src="build/index.js"></script>
47+
48+
let MyLibrary = window.MyLibrary.default;
49+
let libraryInstance = new MyLibrary();
50+
...
51+
```
52+
53+
> **Note:** In this minimal version, images and css files are included in the js bundle. If you want them as separate files, you can use [js-library-boilerplate](https://github.com/hodgef/js-library-boilerplate) or edit the Webpack config accordingly.
54+
55+
## ✅ Libraries built with this boilerplate
56+
57+
> Made a library using this starter kit? Share it here by [submitting a pull request](https://github.com/hodgef/js-library-boilerplate-basic/pulls)!

babel.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
presets: [
3+
["@babel/env"],
4+
["minify", {
5+
"keepFnName": true
6+
}]
7+
],
8+
plugins: [
9+
["@babel/plugin-proposal-class-properties"]
10+
]
11+
};

build/index.js

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/index.html

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<title>Demo</title>
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<link rel="stylesheet" type="text/css" media="screen" href="main.css">
9+
</head>
10+
<body>
11+
<noscript>
12+
You need to enable JavaScript to run this app.
13+
</noscript>
14+
<div id="root">
15+
<h1>Hello World!</h1>
16+
</div>
17+
18+
<script src="../build/index.js"></script>
19+
<script src="main.js"></script>
20+
</body>
21+
</html>

demo/main.css

Whitespace-only changes.

demo/main.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let MyLibrary = window.MyLibrary.default;
2+
let myLibraryInstance = new MyLibrary();
3+
4+
console.log("myLibraryInstance", myLibraryInstance);
5+
6+
myLibraryInstance.myMethod();

0 commit comments

Comments
 (0)