├── .nvmrc ├── .gitignore ├── .travis.yml ├── src ├── main.js ├── __snapshots__ │ └── main.test.js.snap └── main.test.js ├── dev └── index.html ├── .editorconfig ├── .yarnrc ├── .babelrc ├── rollup.config.js ├── LICENSE ├── package.json └── README.md /.nvmrc: -------------------------------------------------------------------------------- 1 | 12.22.1 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | npm-debug.log 4 | yarn-error.log 5 | package-lock.json 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | branches: 3 | only: 4 | - master 5 | cache: 6 | yarn: true 7 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | export default function rollupJestBoilerplate(string) { 2 | return { 3 | awesomeString: string, 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /dev/index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /src/__snapshots__/main.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`rollupJestBoilerplate rollupJestBoilerplate(string) 1`] = ` 4 | Object { 5 | "awesomeString": "cool", 6 | } 7 | `; 8 | -------------------------------------------------------------------------------- /.yarnrc: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | email vincent.voyer@gmail.com 6 | lastUpdateCheck 1557910378543 7 | username vvo 8 | yarn-path ".yarn/releases/yarn-1.16.0.js" 9 | -------------------------------------------------------------------------------- /src/main.test.js: -------------------------------------------------------------------------------- 1 | import rollupJestBoilerplate from './main.js'; 2 | 3 | describe('rollupJestBoilerplate', () => { 4 | it('rollupJestBoilerplate(string)', () => { 5 | expect(rollupJestBoilerplate('cool')).toMatchSnapshot(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["@babel/preset-env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": "ie >= 11" 7 | } 8 | }] 9 | ], 10 | "env": { 11 | "test": { 12 | "presets": [["@babel/preset-env"]] 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import resolve from 'rollup-plugin-node-resolve'; 2 | import commonjs from 'rollup-plugin-commonjs'; 3 | import pkg from './package.json'; 4 | import babel from 'rollup-plugin-babel'; 5 | 6 | export default [ 7 | // browser-friendly UMD build 8 | { 9 | input: 'src/main.js', 10 | output: { 11 | name: 'rollupJestBoilerplate', 12 | file: pkg.browser, 13 | format: 'umd', 14 | }, 15 | plugins: [ 16 | resolve(), 17 | commonjs(), 18 | babel({ 19 | exclude: 'node_modules/**', 20 | }), 21 | ], 22 | }, 23 | 24 | // CommonJS (for Node) and ES module (for bundlers) build. 25 | // (We could have three entries in the configuration array 26 | // instead of two, but it's quicker to generate multiple 27 | // builds from a single configuration where possible, using 28 | // an array for the `output` option, where we can specify 29 | // `file` and `format` for each target) 30 | { 31 | input: 'src/main.js', 32 | external: [], 33 | output: [ 34 | { file: pkg.main, format: 'cjs' }, 35 | { file: pkg.module, format: 'es' }, 36 | ], 37 | }, 38 | ]; 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018-present Someone 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. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rollup-jest-boilerplate", 3 | "version": "1.0.1", 4 | "main": "dist/rollup-jest-boilerplate.cjs.js", 5 | "module": "dist/rollup-jest-boilerplate.esm.js", 6 | "browser": "dist/rollup-jest-boilerplate.umd.js", 7 | "license": "MIT", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/algolia/rollup-jest-boilerplate" 11 | }, 12 | "devDependencies": { 13 | "@babel/core": "7.14.3", 14 | "@babel/preset-env": "7.14.4", 15 | "babel-core": "7.0.0-bridge.0", 16 | "babel-jest": "24.9.0", 17 | "concurrently": "4.1.2", 18 | "jest": "24.9.0", 19 | "rollup": "1.32.1", 20 | "rollup-plugin-babel": "4.4.0", 21 | "rollup-plugin-commonjs": "10.1.0", 22 | "rollup-plugin-node-resolve": "5.2.0", 23 | "serve": "11.3.2" 24 | }, 25 | "scripts": { 26 | "prepare": "yarn build", 27 | "build": "rollup -c", 28 | "build:watch": "rollup -c -w", 29 | "watch": "concurrently 'yarn build:watch' 'yarn serve -l tcp://127.0.0.1'", 30 | "test": "jest && yarn build" 31 | }, 32 | "renovate": { 33 | "extends": [ 34 | "config:js-lib" 35 | ], 36 | "automerge": true, 37 | "major": { 38 | "automerge": false 39 | }, 40 | "automergeType": "branch" 41 | }, 42 | "files": [ 43 | "dist" 44 | ] 45 | } 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 📚 rollup-jest-boilerplate 2 | 3 | > Full featured boilerplate for building JavaScript libraries the modern way. 4 | 5 | ## Features 6 | - 📜 [Rollup.js](https://rollupjs.org/guide/en) configuration providing compatibility with different module systems (CommonJS, ECMAScript, UMD for `