├── .dependabot └── config.yml ├── .eslintrc.js ├── .gitignore ├── README.md ├── jest.config.js ├── package.json ├── prettier.config.js ├── src ├── index.ts ├── math.test.ts └── math.ts └── tsconfig.json /.dependabot/config.yml: -------------------------------------------------------------------------------- 1 | version: 1 2 | update_configs: 3 | - package_manager: "javascript" 4 | directory: "/" 5 | update_schedule: "daily" 6 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = require('@spotify/web-scripts/config/eslintrc.js'); 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | # web-scripts paths 64 | types 65 | esm 66 | cjs -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # web-scripts-template 2 | 3 | A [GitHub Template Repository](https://help.github.com/en/articles/creating-a-repository-from-a-template) to create an NPM library which uses [@spotify/web-scripts](https://github.com/spotify/web-scripts) for build, test, lint, auto-format, and release. 4 | 5 | ## Usage 6 | 7 | Click the green "Use this template" button to create a new library from this template. 8 | 9 | Once you have your project, run `yarn` to install the dependencies. Try out scripts such as `yarn build`, `yarn lint`, and `yarn test`. 10 | 11 | ## ONCE YOU HAVE CREATED YOUR REPO 12 | 13 | - [ ] replace every `@@CHANGE THIS@@` in package.json 14 | - [ ] remove `private: true` if you plan to publish the library to NPM 15 | - [ ] use `yarn commit` when committing to this repo (uses commitizen) 16 | - [ ] set a `license` in your package.json and create a `LICENSE` file 17 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('@spotify/web-scripts/config/jest.config.js'); 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@@CHANGE THIS@@", 3 | "description": "@@CHANGE THIS@@", 4 | "author": "@@CHANGE THIS@@", 5 | "repository": "@@CHANGE THIS@@", 6 | "version": "1.0.0", 7 | "private": true, 8 | "main": "cjs/index.js", 9 | "module": "esm/index.js", 10 | "types": "types", 11 | "scripts": { 12 | "lint": "web-scripts lint", 13 | "test": "web-scripts test", 14 | "build": "web-scripts build", 15 | "commit": "web-scripts commit", 16 | "release": "web-scripts release", 17 | "prepare": "web-scripts audit" 18 | }, 19 | "husky": { 20 | "hooks": { 21 | "commit-msg": "web-scripts commitmsg", 22 | "pre-commit": "web-scripts precommit" 23 | } 24 | }, 25 | "devDependencies": { 26 | "@spotify/web-scripts": "^6.0.0", 27 | "husky": "^4.0.0" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('@spotify/web-scripts/config/prettier.config.js'); 2 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export { sum } from './math'; 2 | -------------------------------------------------------------------------------- /src/math.test.ts: -------------------------------------------------------------------------------- 1 | import { sum } from './math'; 2 | 3 | describe('math', () => { 4 | describe('sum', () => { 5 | it('sums 2 numbers', () => { 6 | expect(sum(1, 1)).toBe(2); 7 | }); 8 | 9 | it('sums n numbers', () => { 10 | expect(sum(1, 2, 3, 4)).toBe(10); 11 | }); 12 | 13 | it('returns a number if it is provided by itself', () => { 14 | expect(sum(10)).toBe(10); 15 | }); 16 | 17 | it('returns 0 if no numbers are provided', () => { 18 | expect(sum()).toBe(0); 19 | }); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /src/math.ts: -------------------------------------------------------------------------------- 1 | export function sum(...numbers: number[]): number { 2 | return numbers.reduce((total, val) => total + val, 0); 3 | } 4 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@spotify/web-scripts/config/tsconfig.json", 3 | "include": ["src"] 4 | } 5 | --------------------------------------------------------------------------------