Init project

This commit is contained in:
morrigan 2019-10-30 15:02:03 +01:00
parent b08ea40075
commit 8fb80913f3
10 changed files with 3429 additions and 0 deletions

27
.editorconfig Normal file
View File

@ -0,0 +1,27 @@
# top-most EditorConfig file
root = true
# All files
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
# JS files
[*.js]
indent_style = space
indent_size = 2
# TS files
[*.ts]
indent_style = space
indent_size = 2
# JSON files
[*.json]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false

20
.eslintrc Normal file
View File

@ -0,0 +1,20 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"env": {
"mocha": true
},
"plugins": ["@typescript-eslint"],
"extends": ["plugin:@typescript-eslint/recommended"],
"rules": {
"new-parens": "error",
"no-caller": "error",
"no-bitwise": "off",
"@typescript-eslint/indent": ["error", 2],
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-explicit-any": "off",
"no-console": "warn"
}
}

14
.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
node_modules/
.idea
.env
.nyc_output
lib
dist
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

4
babel-register.js Normal file
View File

@ -0,0 +1,4 @@
require('@babel/register')({
extensions: ['.ts'],
ignore: ['node_modules'],
})

39
package.json Normal file
View File

@ -0,0 +1,39 @@
{
"name": "js-libp2p-noise",
"version": "1.0.0",
"main": "index.js",
"repository": "git@github.com:NodeFactoryIo/js-libp2p-noise.git",
"author": "NodeFactory <info@nodefactory.io>",
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib",
"build": "babel src -x .ts -d lib --source-maps",
"check-types": "tsc --incremental --noEmit",
"lint": "eslint --ext .ts src/",
"pretest": "yarn check-types",
"test": "mocha -r ./babel-register.js \"test/**/*.test.ts\""
},
"devDependencies": {
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"@babel/preset-typescript": "^7.6.0",
"@babel/register": "^7.6.2",
"@types/chai": "^4.2.4",
"@types/mocha": "^5.2.7",
"@typescript-eslint/eslint-plugin": "^2.6.0",
"@typescript-eslint/parser": "^2.6.0",
"chai": "^4.2.0",
"eslint": "^6.6.0",
"mocha": "^6.2.2",
"typescript": "^3.6.4"
},
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-typescript"
],
"plugins": [
]
}
}

3
src/encrypt.ts Normal file
View File

@ -0,0 +1,3 @@
export function encrypt() {
return "Encrypt world";
}

8
src/index.ts Normal file
View File

@ -0,0 +1,8 @@
import { encrypt } from './encrypt';
const tag = '/noise/1.0.0';
export {
tag,
encrypt,
}

9
test/index.test.ts Normal file
View File

@ -0,0 +1,9 @@
import { expect } from "chai";
import { tag, encrypt} from "../src";
describe("Index", () => {
it("should expose right tag and encrypt function", () => {
expect(tag).to.equal('/noise/1.0.0');
expect(typeof(encrypt)).to.equal('function');
})
});

14
tsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"typeRoots": [
"./node_modules/@types"
]
},
"exclude": [
"node_modules"
]
}

3291
yarn.lock Normal file

File diff suppressed because it is too large Load Diff