Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel Camomot committed Oct 12, 2018
0 parents commit 9fef301
Show file tree
Hide file tree
Showing 18 changed files with 409 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Example Contributing Guidelines

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.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* **I'm submitting a ...**
[ ] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project

* **Summary**



* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
* **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...)



* **What is the current behavior?** (You can also link to an open issue here)



* **What is the new behavior (if this is a feature change)?**



* **Other information**:
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
build
test
src/**.js
.idea/*

coverage
.nyc_output
*.log

yarn.lock
14 changes: 14 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
src
test
tsconfig.json
tsconfig.module.json
tslint.json
.travis.yml
.github
.prettierignore
.vscode
build/docs
**/*.spec.*
coverage
.nyc_output
*.log
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# package.json is formatted by package managers, so we ignore it here
package.json
51 changes: 51 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Project",
// we test in `build` to make cleanup fast and easy
"cwd": "${workspaceFolder}/build",
// Replace this with your project root. If there are multiple, you can
// automatically run the currently visible file with: "program": ${file}"
"program": "${workspaceFolder}/src/cli/cli.ts",
// "args": ["--no-install"],
"outFiles": ["${workspaceFolder}/build/main/**/*.js"],
"skipFiles": [
"<node_internals>/**/*.js",
"${workspaceFolder}/node_modules/**/*.js"
],
"preLaunchTask": "npm: build",
"stopOnEntry": true,
"smartStep": true,
"runtimeArgs": ["--nolazy"],
"env": {
"TYPESCRIPT_STARTER_REPO_URL": "${workspaceFolder}"
},
"console": "externalTerminal"
},
{
/// Usage: set appropriate breakpoints in a *.spec.ts file, then open the
// respective *.spec.js file to run this task. Once a breakpoint is hit,
// the debugger will open the source *.spec.ts file for debugging.
"type": "node",
"request": "launch",
"name": "Debug Visible Compiled Spec",
"program": "${workspaceFolder}/node_modules/ava/profile.js",
"args": [
"${file}"
// TODO: VSCode's launch.json variable substitution
// (https://code.visualstudio.com/docs/editor/variables-reference)
// doesn't quite allow us to go from:
// `./src/path/to/file.ts` to `./build/main/path/to/file.js`
// so the user has to navigate to the compiled file manually. (Close:)
// "${workspaceFolder}/build/main/lib/${fileBasenameNoExtension}.js"
],
"skipFiles": ["<node_internals>/**/*.js"],
// Consider using `npm run watch` or `yarn watch` for faster debugging
// "preLaunchTask": "npm: build",
// "smartStep": true,
"runtimeArgs": ["--nolazy"]
}]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
// "typescript.implementationsCodeLens.enabled": true
// "typescript.referencesCodeLens.enabled": true
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Nathaniel Camomot

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

simple-peer p2p secure signalling through firebase
93 changes: 93 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"name": "firepeer",
"version": "1.0.0",
"description": "simple-peer p2p secure signalling through firebase",
"main": "build/main/index.js",
"typings": "build/main/index.d.ts",
"module": "build/module/index.js",
"repository": "https://github.com/YOUR_GITHUB_USER_NAME/firepeer",
"license": "MIT",
"keywords": [],
"scripts": {
"info": "npm-scripts-info",
"build": "run-s clean && run-p build:*",
"build:main": "tsc -p tsconfig.json",
"build:module": "tsc -p tsconfig.module.json",
"fix": "run-s fix:*",
"fix:prettier": "prettier \"src/**/*.ts\" --write",
"fix:tslint": "tslint --fix --project .",
"test": "run-s build test:*",
"test:lint": "tslint --project . && prettier \"src/**/*.ts\" --list-different",
"test:unit": "nyc --silent ava",
"watch": "run-s clean build:main && run-p \"build:main -- -w\" \"test:unit -- --watch\"",
"cov": "run-s build test:unit cov:html && opn coverage/index.html",
"cov:html": "nyc report --reporter=html",
"cov:send": "nyc report --reporter=lcov > coverage.lcov && codecov",
"cov:check": "nyc report && nyc check-coverage --lines 100 --functions 100 --branches 100",
"doc": "run-s doc:html && opn build/docs/index.html",
"doc:html": "typedoc src/ --target ES6 --mode file --out build/docs",
"doc:json": "typedoc src/ --target ES6 --mode file --json build/docs/typedoc.json",
"doc:publish": "gh-pages -m \"[ci skip] Updates\" -d build/docs",
"version": "standard-version",
"reset": "git clean -dfx && git reset --hard && npm i",
"clean": "trash build test",
"all": "run-s reset test cov:check doc:html",
"prepare-release": "run-s all version doc:publish"
},
"scripts-info": {
"info": "Display information about the package scripts",
"build": "Clean and rebuild the project",
"fix": "Try to automatically fix any linting problems",
"test": "Lint and unit test the project",
"watch": "Watch and rebuild the project on save, then rerun relevant tests",
"cov": "Rebuild, run tests, then create and open the coverage report",
"doc": "Generate HTML API documentation and open it in a browser",
"doc:json": "Generate API documentation in typedoc JSON format",
"version": "Bump package.json version, update CHANGELOG.md, tag release",
"reset": "Delete all untracked files and reset the repo to the last commit",
"prepare-release": "One-step: clean, build, test, publish docs, and prep a release"
},
"engines": {
"node": ">=8.9"
},
"dependencies": {},
"devDependencies": {
"ava": "1.0.0-beta.7",
"codecov": "^3.1.0",
"cz-conventional-changelog": "^2.1.0",
"gh-pages": "^2.0.0",
"npm-run-all": "^4.1.3",
"nyc": "^13.0.1",
"opn-cli": "^3.1.0",
"prettier": "^1.14.3",
"standard-version": "^4.4.0",
"trash-cli": "^1.4.0",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
"tslint-immutable": "^4.7.0",
"typedoc": "^0.12.0",
"typescript": "^3.0.3"
},
"ava": {
"failFast": true,
"files": [
"build/main/**/*.spec.js"
],
"sources": [
"build/main/**/*.js"
]
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"prettier": {
"singleQuote": true
},
"nyc": {
"exclude": [
"**/*.spec.js"
]
}
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/number';
11 changes: 11 additions & 0 deletions src/lib/number.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// tslint:disable:no-expression-statement
import test from 'ava';
import { double, power } from './number';

test('double', t => {
t.is(double(2), 4);
});

test('power', t => {
t.is(power(2, 4), 16);
});
46 changes: 46 additions & 0 deletions src/lib/number.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Multiplies a value by 2. (Also a full example of Typedoc's functionality.)
*
* ### Example (es module)
* ```js
* import { double } from 'typescript-starter'
* console.log(double(4))
* // => 8
* ```
*
* ### Example (commonjs)
* ```js
* var double = require('typescript-starter').double;
* console.log(double(4))
* // => 8
* ```
*
* @param value Comment describing the `value` parameter.
* @returns Comment describing the return type.
* @anotherNote Some other value.
*/
export function double(value: number): number {
return value * 2;
}

/**
* Raise the value of the first parameter to the power of the second using the es7 `**` operator.
*
* ### Example (es module)
* ```js
* import { power } from 'typescript-starter'
* console.log(power(2,3))
* // => 8
* ```
*
* ### Example (commonjs)
* ```js
* var power = require('typescript-starter').power;
* console.log(power(2,3))
* // => 8
* ```
*/
export function power(base: number, exponent: number): number {
// This is a proposed es7 operator, which should be transpiled by Typescript
return base ** exponent;
}
34 changes: 34 additions & 0 deletions src/types/example.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* If you import a dependency which does not include its own type definitions,
* TypeScript will try to find a definition for it by following the `typeRoots`
* compiler option in tsconfig.json. For this project, we've configured it to
* fall back to this folder if nothing is found in node_modules/@types.
*
* Often, you can install the DefinitelyTyped
* (https://github.com/DefinitelyTyped/DefinitelyTyped) type definition for the
* dependency in question. However, if no one has yet contributed definitions
* for the package, you may want to declare your own. (If you're using the
* `noImplicitAny` compiler options, you'll be required to declare it.)
*
* This is an example type definition for the `sha.js` package, used in hash.ts.
*
* (This definition was primarily extracted from:
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v8/index.d.ts
*/
declare module 'sha.js' {
export default function shaJs(algorithm: string): Hash;

type Utf8AsciiLatin1Encoding = 'utf8' | 'ascii' | 'latin1';
type HexBase64Latin1Encoding = 'latin1' | 'hex' | 'base64';

export interface Hash extends NodeJS.ReadWriteStream {
// tslint:disable:no-method-signature
update(
data: string | Buffer | DataView,
inputEncoding?: Utf8AsciiLatin1Encoding
): Hash;
digest(): Buffer;
digest(encoding: HexBase64Latin1Encoding): string;
// tslint:enable:no-method-signature
}
}
45 changes: 45 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"compilerOptions": {
"target": "es2017",
"outDir": "build/main",
"rootDir": "src",
"moduleResolution": "node",
"module": "commonjs",
"declaration": true,
"inlineSourceMap": true,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,

"strict": true /* Enable all strict type-checking options. */,

/* Strict Type-Checking Options */
// "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
// "strictNullChecks": true /* Enable strict null checks. */,
// "strictFunctionTypes": true /* Enable strict checking of function types. */,
// "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
// "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
// "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,

/* Additional Checks */
"noUnusedLocals": true /* Report errors on unused locals. */,
"noUnusedParameters": true /* Report errors on unused parameters. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,

/* Debugging Options */
"traceResolution": false /* Report module resolution log messages. */,
"listEmittedFiles": false /* Print names of generated files part of the compilation. */,
"listFiles": false /* Print names of files part of the compilation. */,
"pretty": true /* Stylize errors and messages using color and context. */,

/* Experimental Options */
// "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
// "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,

"lib": ["es2017"],
"types": [],
"typeRoots": ["node_modules/@types", "src/types"]
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules/**"],
"compileOnSave": false
}
11 changes: 11 additions & 0 deletions tsconfig.module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"target": "esnext",
"outDir": "build/module",
"module": "esnext"
},
"exclude": [
"node_modules/**"
]
}
Loading

0 comments on commit 9fef301

Please sign in to comment.