Skip to content

Commit 2a8407c

Browse files
committed
Initial commit
Created with bitjson/typescript-starter@586cdb3
0 parents  commit 2a8407c

21 files changed

+443
-0
lines changed

.cspell.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"version": "0.1",
3+
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json",
4+
"language": "en",
5+
"words": [
6+
"bitjson",
7+
"bitauth",
8+
"cimg",
9+
"circleci",
10+
"codecov",
11+
"commitlint",
12+
"dependabot",
13+
"editorconfig",
14+
"esnext",
15+
"execa",
16+
"exponentiate",
17+
"globby",
18+
"libauth",
19+
"mkdir",
20+
"prettierignore",
21+
"sandboxed",
22+
"transpiled",
23+
"typedoc",
24+
"untracked"
25+
],
26+
"flagWords": [],
27+
"ignorePaths": [
28+
"package.json",
29+
"package-lock.json",
30+
"yarn.lock",
31+
"tsconfig.json",
32+
"node_modules/**"
33+
]
34+
}

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
max_line_length = 80
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
max_line_length = 0
15+
trim_trailing_whitespace = false

.eslintrc.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": { "project": "./tsconfig.json" },
5+
"env": { "es6": true },
6+
"ignorePatterns": ["node_modules", "build", "coverage"],
7+
"plugins": ["import", "eslint-comments", "functional"],
8+
"extends": [
9+
"eslint:recommended",
10+
"plugin:eslint-comments/recommended",
11+
"plugin:@typescript-eslint/recommended",
12+
"plugin:import/typescript",
13+
"plugin:functional/lite",
14+
"prettier",
15+
"prettier/@typescript-eslint"
16+
],
17+
"globals": { "BigInt": true, "console": true, "WebAssembly": true },
18+
"rules": {
19+
"@typescript-eslint/explicit-module-boundary-types": "off",
20+
"eslint-comments/disable-enable-pair": [
21+
"error",
22+
{ "allowWholeFile": true }
23+
],
24+
"eslint-comments/no-unused-disable": "error",
25+
"import/order": [
26+
"error",
27+
{ "newlines-between": "always", "alphabetize": { "order": "asc" } }
28+
],
29+
"sort-imports": [
30+
"error",
31+
{ "ignoreDeclarationSort": true, "ignoreCase": true }
32+
]
33+
}
34+
}

.github/CONTRIBUTING.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Example Contributing Guidelines
2+
3+
This is an example of GitHub's contributing guidelines file. Check out GitHub's [CONTRIBUTING.md help center article](https://help.github.com/articles/setting-guidelines-for-repository-contributors/) for more information.

.github/ISSUE_TEMPLATE.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- **I'm submitting a ...**
2+
[ ] bug report
3+
[ ] feature request
4+
[ ] question about the decisions made in the repository
5+
[ ] question about how to use this project
6+
7+
- **Summary**
8+
9+
- **Other information** (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

.github/PULL_REQUEST_TEMPLATE.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...)
2+
3+
- **What is the current behavior?** (You can also link to an open issue here)
4+
5+
- **What is the new behavior (if this is a feature change)?**
6+
7+
- **Other information**:

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.idea/*
2+
.nyc_output
3+
build
4+
node_modules
5+
test
6+
src/**.js
7+
coverage
8+
*.log
9+
package-lock.json

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# package.json is formatted by package managers, so we ignore it here
2+
package.json

.travis.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- '10'
5+
- '12'
6+
- '14'
7+
# keep the npm cache to speed up installs
8+
cache:
9+
directories:
10+
- '$HOME/.npm'
11+
after_success:
12+
- npm run cov:send
13+
- npm run cov:check

.vscode/extensions.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
5+
"eamodio.gitlens",
6+
"streetsidesoftware.code-spell-checker",
7+
]
8+
}

.vscode/launch.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
// To debug, make sure a *.spec.ts file is active in the editor, then run a configuration
5+
{
6+
"type": "node",
7+
"request": "launch",
8+
"name": "Debug Active Spec",
9+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/ava",
10+
"runtimeArgs": ["debug", "--break", "--serial", "${file}"],
11+
"port": 9229,
12+
"outputCapture": "std",
13+
"skipFiles": ["<node_internals>/**/*.js"],
14+
"preLaunchTask": "npm: build"
15+
// "smartStep": true
16+
},
17+
{
18+
// Use this one if you're already running `yarn watch`
19+
"type": "node",
20+
"request": "launch",
21+
"name": "Debug Active Spec (no build)",
22+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/ava",
23+
"runtimeArgs": ["debug", "--break", "--serial", "${file}"],
24+
"port": 9229,
25+
"outputCapture": "std",
26+
"skipFiles": ["<node_internals>/**/*.js"]
27+
// "smartStep": true
28+
}]
29+
}

.vscode/settings.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"cSpell.userWords": [], // only use words from .cspell.json
3+
"cSpell.enabled": true,
4+
"editor.formatOnSave": true,
5+
"typescript.tsdk": "node_modules/typescript/lib",
6+
"typescript.enablePromptUseWorkspaceTsdk": true
7+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Maronato
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

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# plausible-analytics
2+
3+
Unofficial frontend library to interact with Plausible Analytics

package.json

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
"name": "plausible-analytics",
3+
"version": "1.0.0",
4+
"description": "Unofficial frontend library to interact with Plausible Analytics",
5+
"main": "build/main/index.js",
6+
"typings": "build/main/index.d.ts",
7+
"module": "build/module/index.js",
8+
"repository": "https://github.com/Maronato/plausible-analytics",
9+
"license": "MIT",
10+
"keywords": [],
11+
"scripts": {
12+
"build": "run-p build:*",
13+
"build:main": "tsc -p tsconfig.json",
14+
"build:module": "tsc -p tsconfig.module.json",
15+
"fix": "run-s fix:*",
16+
"fix:prettier": "prettier \"src/**/*.ts\" --write",
17+
"fix:lint": "eslint src --ext .ts --fix",
18+
"test": "run-s build test:*",
19+
"test:lint": "eslint src --ext .ts",
20+
"test:prettier": "prettier \"src/**/*.ts\" --list-different",
21+
"test:spelling": "cspell \"{README.md,.github/*.md,src/**/*.ts}\"",
22+
"test:unit": "nyc --silent ava",
23+
"check-cli": "run-s test diff-integration-tests check-integration-tests",
24+
"check-integration-tests": "run-s check-integration-test:*",
25+
"diff-integration-tests": "mkdir -p diff && rm -rf diff/test && cp -r test diff/test && rm -rf diff/test/test-*/.git && cd diff && git init --quiet && git add -A && git commit --quiet --no-verify --allow-empty -m 'WIP' && echo '\\n\\nCommitted most recent integration test output in the \"diff\" directory. Review the changes with \"cd diff && git diff HEAD\" or your preferred git diff viewer.'",
26+
"watch:build": "tsc -p tsconfig.json -w",
27+
"watch:test": "nyc --silent ava --watch",
28+
"cov": "run-s build test:unit cov:html cov:lcov && open-cli coverage/index.html",
29+
"cov:html": "nyc report --reporter=html",
30+
"cov:lcov": "nyc report --reporter=lcov",
31+
"cov:send": "run-s cov:lcov && codecov",
32+
"cov:check": "nyc report && nyc check-coverage --lines 100 --functions 100 --branches 100",
33+
"doc": "run-s doc:html && open-cli build/docs/index.html",
34+
"doc:html": "typedoc src/ --exclude **/*.spec.ts --target ES6 --mode file --out build/docs",
35+
"doc:json": "typedoc src/ --exclude **/*.spec.ts --target ES6 --mode file --json build/docs/typedoc.json",
36+
"doc:publish": "gh-pages -m \"[ci skip] Updates\" -d build/docs",
37+
"version": "standard-version",
38+
"reset-hard": "git clean -dfx && git reset --hard && yarn",
39+
"prepare-release": "run-s reset-hard test cov:check doc:html version doc:publish"
40+
},
41+
"engines": {
42+
"node": ">=10"
43+
},
44+
"dependencies": {},
45+
"devDependencies": {
46+
"@ava/typescript": "^1.1.1",
47+
"@istanbuljs/nyc-config-typescript": "^1.0.1",
48+
"@typescript-eslint/eslint-plugin": "^4.0.1",
49+
"@typescript-eslint/parser": "^4.0.1",
50+
"ava": "^3.12.1",
51+
"codecov": "^3.5.0",
52+
"cspell": "^4.1.0",
53+
"cz-conventional-changelog": "^3.3.0",
54+
"eslint": "^7.8.0",
55+
"eslint-config-prettier": "^6.11.0",
56+
"eslint-plugin-eslint-comments": "^3.2.0",
57+
"eslint-plugin-functional": "^3.0.2",
58+
"eslint-plugin-import": "^2.22.0",
59+
"gh-pages": "^3.1.0",
60+
"npm-run-all": "^4.1.5",
61+
"nyc": "^15.1.0",
62+
"open-cli": "^6.0.1",
63+
"prettier": "^2.1.1",
64+
"standard-version": "^9.0.0",
65+
"ts-node": "^9.0.0",
66+
"typedoc": "^0.19.0",
67+
"typescript": "^4.0.2"
68+
},
69+
"files": [
70+
"build/main",
71+
"build/module",
72+
"!**/*.spec.*",
73+
"!**/*.json",
74+
"CHANGELOG.md",
75+
"LICENSE",
76+
"README.md"
77+
],
78+
"ava": {
79+
"failFast": true,
80+
"timeout": "60s",
81+
"typescript": {
82+
"rewritePaths": {
83+
"src/": "build/main/"
84+
}
85+
},
86+
"files": [
87+
"!build/module/**"
88+
]
89+
},
90+
"config": {
91+
"commitizen": {
92+
"path": "cz-conventional-changelog"
93+
}
94+
},
95+
"prettier": {
96+
"singleQuote": true
97+
},
98+
"nyc": {
99+
"extends": "@istanbuljs/nyc-config-typescript",
100+
"exclude": [
101+
"**/*.spec.js"
102+
]
103+
}
104+
}

src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './lib/number';

src/lib/number.spec.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import test from 'ava';
2+
3+
import { double, power } from './number';
4+
5+
test('double', (t) => {
6+
t.is(double(2), 4);
7+
});
8+
9+
test('power', (t) => {
10+
t.is(power(2, 4), 16);
11+
});

src/lib/number.ts

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* Multiplies a value by 2. (Also a full example of TypeDoc's functionality.)
3+
*
4+
* ### Example (es module)
5+
* ```js
6+
* import { double } from 'typescript-starter'
7+
* console.log(double(4))
8+
* // => 8
9+
* ```
10+
*
11+
* ### Example (commonjs)
12+
* ```js
13+
* var double = require('typescript-starter').double;
14+
* console.log(double(4))
15+
* // => 8
16+
* ```
17+
*
18+
* @param value - Comment describing the `value` parameter.
19+
* @returns Comment describing the return type.
20+
* @anotherNote Some other value.
21+
*/
22+
export const double = (value: number) => {
23+
return value * 2;
24+
};
25+
26+
/**
27+
* Raise the value of the first parameter to the power of the second using the
28+
* es7 exponentiation operator (`**`).
29+
*
30+
* ### Example (es module)
31+
* ```js
32+
* import { power } from 'typescript-starter'
33+
* console.log(power(2,3))
34+
* // => 8
35+
* ```
36+
*
37+
* ### Example (commonjs)
38+
* ```js
39+
* var power = require('typescript-starter').power;
40+
* console.log(power(2,3))
41+
* // => 8
42+
* ```
43+
* @param base - the base to exponentiate
44+
* @param exponent - the power to which to raise the base
45+
*/
46+
export const power = (base: number, exponent: number) => {
47+
/**
48+
* This es7 exponentiation operator is transpiled by TypeScript
49+
*/
50+
return base ** exponent;
51+
};

0 commit comments

Comments
 (0)