From ae632d609bc1ab187e80a9487429186f8a63da73 Mon Sep 17 00:00:00 2001 From: Aldwin Vlasblom Date: Thu, 17 Oct 2019 20:21:32 +0200 Subject: [PATCH] Add project boilerplate --- .config | 6 ++++ .editorconfig | 9 +++++ .eslintrc.json | 12 +++++++ .github/PULL_REQUEST_TEMPLATE/initial-pr.md | 28 +++++++++++++++ .gitignore | 3 ++ .npmrc | 1 + .travis.yml | 7 ++++ CONTRIBUTING.md | 18 ++++++++++ LICENSE | 20 +++++++++++ README.md | 5 ++- index.js | 1 + package.json | 38 +++++++++++++++++++++ rollup.config.js | 9 +++++ scripts/prepublish | 16 +++++++++ scripts/test | 13 +++++++ test/index.js | 1 + 16 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 .config create mode 100644 .editorconfig create mode 100644 .eslintrc.json create mode 100644 .github/PULL_REQUEST_TEMPLATE/initial-pr.md create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 .travis.yml create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 index.js create mode 100644 package.json create mode 100644 rollup.config.js create mode 100755 scripts/prepublish create mode 100755 scripts/test create mode 100644 test/index.js diff --git a/.config b/.config new file mode 100644 index 0000000..8e5c04b --- /dev/null +++ b/.config @@ -0,0 +1,6 @@ +author-name = Aldwin Vlasblom +repo-owner = fluture-js +repo-name = fluture-project +source-files = index.js +module-type = esm +opening-delimiter = ```js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c6c8b36 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..e41ae7e --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,12 @@ +{ + "root": true, + "extends": ["./node_modules/sanctuary-style/eslint-es3.json"], + "parserOptions": {"sourceType": "module"}, + "env": {"node": true, "es6": true}, + "overrides": [ + { + "files": ["README.md"], + "rules": {"no-undef": ["off"]} + } + ] +} diff --git a/.github/PULL_REQUEST_TEMPLATE/initial-pr.md b/.github/PULL_REQUEST_TEMPLATE/initial-pr.md new file mode 100644 index 0000000..93f32a9 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/initial-pr.md @@ -0,0 +1,28 @@ +--- +name: Initial pull request +about: When you've just generated this repository and you want to get to work. +--- + +# Everything + +This pull request adds everything the project needs to be at its first release. + +# TODO + +- [ ] Name the project: + - Change `repo-name` in `.config` and ensure the tests pass. + - Change the header of the documentation in `index.js`. + - Change the module name in `rollup.config.js`. + +- [ ] Describe the project: + - Change `description` in `package.json` + - Update the GitHub repo description. + - Add the description to the documentation in `index.js`. + +- [ ] If this is a node-only module, remove browser support: + - Change `umd` to `cjs` in `rollup.config.js` and remove `output.name`. + - Change `eslint-es3` to `eslint-es6` in `.eslintrc.json`. + +- [ ] Remove the `initial-pr.md` pull-request template. + +- [ ] Write the code. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c1ae26 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/coverage/ +/index.cjs +/node_modules/ diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..429810f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "12" +after_success: npm run codecov +branches: + only: + - master diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..c4b0342 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,18 @@ +# Contribution Guideline + +## Making a contribution + +1. Fork the repo if you do not have write access +1. Clone the remote (fork) from GitHub +1. Create a branch named `/` +1. Make one or more atomic commits +1. Make sure the tests pass locally +1. Create a pull-request on GitHub + +## Publishing a new version + +1. Make sure you have write access to the module on npm +1. Make sure you have write access to the master branch on GitHub +1. Checkout `master` and make sure it's up to date with the remote +1. Run `npm run release `, where `` can be any of: 'major', + 'minor', 'patch', 'premajor', 'preminor', 'prepatch', or 'prerelease'. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..56bb7cd --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) +Copyright (c) 2019 Aldwin Vlasblom + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 5e97a66..551d225 100644 --- a/README.md +++ b/README.md @@ -1 +1,4 @@ -# Fluture Project +# Under Construction + +This project is still under construction. If all went well, you should be +able to learn about it in the [initial pull request](./pull/1). diff --git a/index.js b/index.js new file mode 100644 index 0000000..7a7ae40 --- /dev/null +++ b/index.js @@ -0,0 +1 @@ +//. # Fluture Project diff --git a/package.json b/package.json new file mode 100644 index 0000000..6318cc4 --- /dev/null +++ b/package.json @@ -0,0 +1,38 @@ +{ + "name": "fluture-project", + "version": "0.0.0", + "description": "Hopefully something related to Fluture", + "type": "module", + "main": "index.cjs", + "module": "index.js", + "scripts": { + "build": "rollup -c rollup.config.js", + "codecov": "codecov", + "doctest": "sanctuary-doctest", + "lint": "sanctuary-lint", + "release": "sanctuary-release", + "test": "npm run lint && sanctuary-test && npm run doctest" + }, + "repository": { + "type": "git", + "url": "git://github.com/fluture-js/fluture-project.git" + }, + "files": [ + "/index.cjs", + "/index.js", + "/LICENSE", + "/package.json", + "/README.md" + ], + "author": "Aldwin Vlasblom (https://github.com/Avaq)", + "license": "MIT", + "dependencies": {}, + "peerDependencies": {}, + "devDependencies": { + "c8": "^5.0.4", + "codecov": "^3.2.0", + "oletus": "^2.0.0", + "rollup": "^1.21.4", + "sanctuary-scripts": "^3.1.1" + } +} diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..261cd8e --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,9 @@ +export default { + input: 'index.js', + output: { + format: 'umd', + file: 'index.cjs', + name: 'flutureProject', + interop: false + } +}; diff --git a/scripts/prepublish b/scripts/prepublish new file mode 100755 index 0000000..8c19848 --- /dev/null +++ b/scripts/prepublish @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -eufo pipefail + +echo "Publishing as $(npm whoami)." + +if ! npm outdated --long; then + read -rp "Continue? [y/N] " choice + if [[ "${choice-n}" != 'y' ]]; then + echo 'Package distribution aborted.' + exit 2 + fi +fi + +npm run build + +sanctuary-prepublish "$@" diff --git a/scripts/test b/scripts/test new file mode 100755 index 0000000..b1de5a7 --- /dev/null +++ b/scripts/test @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -eufo pipefail + +# shellcheck source=/dev/null +source "${BASH_SOURCE%/*}/../node_modules/sanctuary-scripts/functions" + +branches="$(get min-branch-coverage)" + +c8 --check-coverage \ + --branches "$branches" \ + node --experimental-modules \ + --no-warnings \ + ./node_modules/.bin/oletus diff --git a/test/index.js b/test/index.js new file mode 100644 index 0000000..c89a925 --- /dev/null +++ b/test/index.js @@ -0,0 +1 @@ +import '../index.js';