Skip to content
Permalink
Browse files

initial commit

  • Loading branch information...
wangshijun
wangshijun committed Jul 15, 2018
0 parents commit 5570fd9d444695ff2495ed522d2c04b972c120b6
Showing with 6,412 additions and 0 deletions.
  1. +9 −0 .editorconfig
  2. +1 −0 .gitattributes
  3. +6 −0 .gitignore
  4. +1 −0 .remarkignore
  5. +5 −0 .travis.yml
  6. +21 −0 LICENSE
  7. +64 −0 README.md
  8. +16 −0 index.js
  9. +114 −0 package.json
  10. +10 −0 test/helpers/index.js
  11. +26 −0 test/test.js
  12. +6,139 −0 yarn.lock
@@ -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
@@ -0,0 +1 @@
* text=auto
@@ -0,0 +1,6 @@
.DS_Store
*.log
.idea
node_modules
coverage
.nyc_output
@@ -0,0 +1 @@
test/snapshots/**/*.md
@@ -0,0 +1,5 @@
language: node_js
node_js:
- '8'
after_success:
npm run coverage
21 LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 wangshijun <wangshijun2010@gmail.com>

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.
@@ -0,0 +1,64 @@
# mixin-node-sdk

[![build status](https://img.shields.io/travis/wangshijun/mixin-node-sdk.svg)](https://travis-ci.org/wangshijun/mixin-node-sdk)
[![code coverage](https://img.shields.io/codecov/c/github/wangshijun/mixin-node-sdk.svg)](https://codecov.io/gh/wangshijun/mixin-node-sdk)
[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)
[![license](https://img.shields.io/github/license/wangshijun/mixin-node-sdk.svg)](LICENSE)

> Node.js SDK for Mixin Network

## Table of Contents

* [Install](#install)
* [Usage](#usage)
* [Contributors](#contributors)
* [License](#license)


## Install

[npm][]:

```sh
npm install mixin-node-sdk
```

[yarn][]:

```sh
yarn add mixin-node-sdk
```


## Usage

```js
const MixinNodeSdk = require('mixin-node-sdk');
const mixinNodeSdk = new MixinNodeSdk();
console.log(mixinNodeSdk.renderName());
// script
```


## Contributors

| Name |
| -------------- |
| **wangshijun** |


## License

[MIT](LICENSE) © wangshijun


##

[npm]: https://www.npmjs.com/

[yarn]: https://yarnpkg.com/
@@ -0,0 +1,16 @@
const autoBind = require('auto-bind');

class Script {
constructor(config) {
config = Object.assign({}, config);
this._name = config.name || 'script';

autoBind(this);
}

renderName() {
return this._name;
}
}

module.exports = Script;
@@ -0,0 +1,114 @@
{
"name": "mixin-node-sdk",
"description": "Node.js SDK for Mixin Network",
"version": "0.1.0",
"author": "wangshijun <wangshijun2010@gmail.com> ()",
"bugs": {
"url": "https://github.com/wangshijun/mixin-node-sdk/issues",
"email": "wangshijun2010@gmail.com"
},
"contributors": [
"wangshijun <wangshijun2010@gmail.com> ()"
],
"dependencies": {},
"ava": {
"failFast": true,
"verbose": true
},
"devDependencies": {
"auto-bind": "^1.1.0",
"ava": "^0.22.0",
"codecov": "^2.3.0",
"cross-env": "^5.0.5",
"eslint": "^4.5.0",
"eslint-config-prettier": "latest",
"eslint-plugin-prettier": "latest",
"husky": "^0.14.3",
"lint-staged": "^4.0.4",
"nyc": "^11.1.0",
"prettier": "^1.6.1",
"remark-cli": "^4.0.0",
"remark-preset-github": "^0.0.6",
"xo": "latest"
},
"engines": {
"node": ">=8.3"
},
"homepage": "https://github.com/wangshijun/mixin-node-sdk",
"keywords": [
"mixin",
"blockchain",
"lass",
"node.js",
"crypto"
],
"license": "MIT",
"lint-staged": {
"*.{js,jsx,mjs,ts,tsx,css,less,scss,json,graphql}": [
"prettier --write --single-quote --trailing-comma none",
"git add"
],
"*.md": [
"remark . -qfo",
"git add"
]
},
"main": "index.js",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100,
"reporter": [
"lcov",
"html",
"text"
]
},
"remarkConfig": {
"plugins": [
"preset-github"
]
},
"repository": {
"type": "git",
"url": "https://github.com/wangshijun/mixin-node-sdk"
},
"xo": {
"extends": "prettier",
"plugins": [
"prettier"
],
"parserOptions": {
"sourceType": "script"
},
"rules": {
"prettier/prettier": [
"error",
{
"singleQuote": true,
"bracketSpacing": true,
"trailingComma": "none"
}
],
"max-len": [
"error",
{
"code": 80,
"ignoreUrls": true
}
],
"capitalized-comments": "off",
"camelcase": "off",
"no-warning-comments": "off"
},
"space": true
},
"scripts": {
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"lint": "xo && remark . -qfo",
"precommit": "lint-staged && npm test",
"test": "npm run lint && npm run test-coverage",
"test-coverage": "cross-env NODE_ENV=test nyc ava"
}
}
@@ -0,0 +1,10 @@
const Script = require('../..');

function beforeEach(t) {
const script = new Script({});
Object.assign(t.context, { script });
}

function afterEach() {}

module.exports = { beforeEach, afterEach };
@@ -0,0 +1,26 @@
const test = require('ava');

const Script = require('..');
const { beforeEach, afterEach } = require('./helpers');

test.beforeEach(beforeEach);
test.afterEach(afterEach);

test('returns itself', t => {
t.true(t.context.script instanceof Script);
});

test('sets a config object', t => {
const script = new Script(false);
t.true(script instanceof Script);
});

test('renders name', t => {
const { script } = t.context;
t.is(script.renderName(), 'script');
});

test('sets a default name', t => {
const { script } = t.context;
t.is(script._name, 'script');
});

0 comments on commit 5570fd9

Please sign in to comment.
You can’t perform that action at this time.