Skip to content

Commit

Permalink
feat: the template 🔌
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayakkulkarni committed May 10, 2020
1 parent 9d825b8 commit 5b3d8c5
Show file tree
Hide file tree
Showing 24 changed files with 471 additions and 0 deletions.
1 change: 1 addition & 0 deletions template/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> .25% and not ie <= 11
20 changes: 20 additions & 0 deletions template/.dependabot/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

version: 1
update_configs:
# Keep package.json (& lockfiles) up to date as soon as
# new versions are published to the npm registry
- package_manager: "javascript"
directory: "/"
update_schedule: "live"
# Apply default reviewer and label to created
# pull requests
default_reviewers:
- "<%= username %>"
default_assignees:
- "<%= username %>"
default_labels:
- "dependencies"
commit_message:
prefix: "fix"
prefix_development: "chore"
include_scope: true
13 changes: 13 additions & 0 deletions template/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
27 changes: 27 additions & 0 deletions template/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
root: true,
env: {
browser: true,
es6: true,
node: true
},
parserOptions: {
parser: 'babel-eslint'
},
extends: [
'plugin:vue/recommended',
'plugin:prettier/recommended',
'prettier',
'prettier/vue'
],
// required to lint *.vue files
plugins: [
'vue',
'prettier'
],
// add your custom rules here
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
}
}
2 changes: 2 additions & 0 deletions template/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
5 changes: 5 additions & 0 deletions template/.github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Always validate the PR title AND all the commits
titleAndCommits: true
# Allows use of Merge commits (eg on github: "Merge branch 'master' into feature/ride-unicorns")
# this is only relevant when using commitsOnly: true (or titleAndCommits: true)
allowMergeCommits: true
21 changes: 21 additions & 0 deletions template/.github/workflows/shipjs-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Ship js trigger
on:
push:
branches:
- master
jobs:
build:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: master
- uses: actions/setup-node@v1
- run: npm install
- run: npm run test
- run: npm run release:trigger
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }}
12 changes: 12 additions & 0 deletions template/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"semi": true,
"arrowParens": "always",
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"tabWidth": 2,
"useTabs": false,
"vueIndentScriptAndStyle": true
}
21 changes: 21 additions & 0 deletions template/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2020-current <%= username %>

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.
7 changes: 7 additions & 0 deletions template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# <%= name %>

> <%= description %>
## License

MIT &copy; <%= username %>
72 changes: 72 additions & 0 deletions template/_package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"name": "<%= name %>",
"version": "1.0.0",
"description": "<%= description %>",
"repository": {
"url": "git+https://github.com/<%= username %>/<%= name %>",
"type": "git"
},
"author": {
"name": "<%= username %>",
"email": "<%= email %>",
"url": "<%= website %>"
},
"license": "MIT",
"files": [
"dist"
],
"scripts": {
"test": "npm run test:unit && npm run test:e2e",
"test:unit": "cross-env TEST=unit ava --config unit-tests.config.cjs",
"test:e2e": "cross-env TEST=e2e ava --config e2e-tests.config.cjs",
"test:snapshot": "cross-env TEST=unit ava --update-snapshots",
"build": "npm run bundle && npm run bundle:min",
"bundle": "rollup -c build/rollup.config.js",
"bundle:min": "rollup -c build/rollup.min.config.js",
"lint": "eslint 'src/**/*.{js,vue}'",
"lintfix": "eslint --fix 'src/**/*.{js,vue}'",
"release:prepare": "shipjs prepare",
"release:trigger": "shipjs trigger"
},
"dependencies": {
"@vue/composition-api": "^0.5.0"
},
"devDependencies": {
"@ava/babel": "^1.0.1",
"@babel/core": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@rollup/plugin-commonjs": "^11.1.0",
"@vue/test-utils": "^1.0.0-beta.33",
"ava": "^3.8.1",
"babel-eslint": "^10.1.0",
"babel-plugin-module-resolver": "^4.0.0",
"browser-env": "^3.3.0",
"cross-env": "^7.0.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-vue": "^2.0.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^6.2.2",
"husky": "^4.2.5",
"jsdom-global": "^3.0.2",
"nyc": "^15.0.1",
"prettier": "^2.0.5",
"require-extension-hooks": "^0.3.3",
"require-extension-hooks-babel": "^1.0.0",
"require-extension-hooks-vue": "^3.0.0",
"rollup": "^2.7.6",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-vue": "^5.1.6",
"shipjs": "^0.18.3",
"tap-spec": "^5.0.0",
"vue": "^2.6.11",
"vue-template-compiler": "^2.6.11"
},
"bugs": {
"url": "https://github.com/<%= username %>/<%= name %>/issues"
},
"homepage": "https://github.com/<%= username %>/<%= name %>#readme"
}
9 changes: 9 additions & 0 deletions template/ava.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
require: ['./test/helpers/ava.setup.js'],
ignoredByWatcher: ['!**/*.{js,vue}'],
snapshotDir: './test/snapshot',
babel: true,
tap: true,
verbose: true,
color: true,
};
20 changes: 20 additions & 0 deletions template/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
presets: ['@babel/preset-env'],
env: {
test: {
plugins: [
[
'module-resolver',
{
root: ['./'],
alias: {
'@': './',
'~': './',
},
},
],
],
ignore: ['ava.config.cjs'],
},
},
};
63 changes: 63 additions & 0 deletions template/build/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import babel from 'rollup-plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import vue from 'rollup-plugin-vue';

export default [
// ESM build to be used with webpack/rollup.
{
input: 'src/index.js',
output: {
format: 'esm',
name: '<%= name %>',
file: 'dist/<%= name %>.esm.js',
},
plugins: [
babel({
exclude: 'node_modules/**',
runtimeHelpers: true,
}),
commonjs(),
vue(),
],
external: ['@vue/composition-api'],
},
// CommonJS build
{
input: 'src/index.js',
output: {
format: 'cjs',
name: '<%= name %>',
file: 'dist/<%= name %>.cjs.js',
},
plugins: [
babel({
exclude: 'node_modules/**',
runtimeHelpers: true,
}),
commonjs(),
vue(),
],
external: ['@vue/composition-api'],
},
// UMD build.
{
input: 'src/index.js',
output: {
format: 'umd',
name: '<%= name %>',
file: 'dist/<%= name %>.js',
globals: {
'@vue/composition-api': 'vueCompositionApi',
},
},
plugins: [
babel({
exclude: 'node_modules/**',
runtimeHelpers: true,
}),
commonjs(),
vue(),
],
external: ['@vue/composition-api'],
},
];
26 changes: 26 additions & 0 deletions template/build/rollup.min.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import babel from 'rollup-plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
import vue from 'rollup-plugin-vue';

export default {
input: 'src/index.js',
output: {
format: 'umd',
name: '<%= name %>',
file: 'dist/<%= name %>.min.js',
globals: {
'@vue/composition-api': 'vueCompositionApi',
},
},
plugins: [
babel({
exclude: 'node_modules/**',
runtimeHelpers: true,
}),
commonjs(),
terser(),
vue(),
],
external: ['@vue/composition-api'],
};
3 changes: 3 additions & 0 deletions template/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
6 changes: 6 additions & 0 deletions template/e2e.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const baseConfig = require('./ava.config.cjs');

module.exports = {
...baseConfig,
files: ['./test/e2e/**/*'],
};
1 change: 1 addition & 0 deletions template/env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NPM_AUTH_TOKEN=
Loading

0 comments on commit 5b3d8c5

Please sign in to comment.