Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
new version of starcoin js sdk
  • Loading branch information
nanne007 committed Dec 23, 2020
0 parents commit c638db6
Show file tree
Hide file tree
Showing 51 changed files with 6,538 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,84 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check {{ '/2.0/language-javascript/' | docs_url }} for more details
#
version: 2

defaults: &defaults
docker:
- image: circleci/node:12

jobs:
install:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
- run: yarn --frozen-lockfile
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "yarn.lock" }}
- persist_to_workspace:
root: ~/project
paths: .

test:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/project
- run:
name: Run tests
command: yarn test


lint:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/project
- run:
name: Run lint
command: yarn lint

deploy:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/project/.npmrc
- run:
name: Publish package
command: |
mkdir ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
git config --global user.email ""
git config --global user.name "caojiafeng"
git branch --set-upstream-to master
npx release-it
workflows:
version: 2
test-deploy:
jobs:
- install
- test:
requires:
- install
- lint:
requires:
- install
- deploy:
requires:
- lint
- test
filters:
branches:
only: master
11 changes: 11 additions & 0 deletions .editorconfig
@@ -0,0 +1,11 @@
root = true

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

[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .eslintignore
@@ -0,0 +1,3 @@
dist/
coverage/
.eslintrc.js
52 changes: 52 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,52 @@
module.exports = {
plugins: [
"@typescript-eslint",
"jest",
"promise",
"unicorn",
],
extends: [
"airbnb-typescript/base",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:promise/recommended",
"plugin:unicorn/recommended",
"prettier",
"prettier/react",
"prettier/@typescript-eslint",
],
parserOptions: {
project: "tsconfig.json"
},
env: {
node: true,
jest: true,
},
rules: {
// Too restrictive, writing ugly code to defend against a very unlikely scenario: https://eslint.org/docs/rules/no-prototype-builtins
"no-prototype-builtins": "off",
// https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html
"import/prefer-default-export": "off",
"import/no-default-export": "error",
// Too restrictive: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
"react/destructuring-assignment": "off",
// No jsx extension: https://github.com/facebook/create-react-app/issues/87#issuecomment-234627904
"react/jsx-filename-extension": "off",
// Use function hoisting to improve code readability
"no-use-before-define": [
"error",
{ functions: false, classes: true, variables: true },
],
// Makes no sense to allow type inferrence for expression parameters, but require typing the response
"@typescript-eslint/explicit-function-return-type": [
"error",
{ allowExpressions: true, allowTypedFunctionExpressions: true },
],
"@typescript-eslint/no-use-before-define": [
"error",
{ functions: false, classes: true, variables: true, typedefs: true },
],
// Common abbreviations are known and readable
"unicorn/prevent-abbreviations": "off",
},
}
85 changes: 85 additions & 0 deletions .gitignore
@@ -0,0 +1,85 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# Test and coverage results
test_results

# Microbundle
.rts2_cache_*

src/**/*.js

# Compiled JavaScript files
dist/
coverage/
10 changes: 10 additions & 0 deletions .release-it.json
@@ -0,0 +1,10 @@
{
"git": {
"commitMessage": "[ci skip] release v${version}",
"requireCleanWorkingDir": false
},
"hooks": {
"after:bump": "npm run build",
"after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
}
}
13 changes: 13 additions & 0 deletions LICENSE
@@ -0,0 +1,13 @@
Copyright 2020 annali007

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
1 change: 1 addition & 0 deletions README.md
@@ -0,0 +1 @@
# my project
1 change: 1 addition & 0 deletions index.ts
@@ -0,0 +1 @@
export * from './src';
85 changes: 85 additions & 0 deletions package.json
@@ -0,0 +1,85 @@
{
"name": "starcoin",
"version": "1.0.0",
"description": "starcoin js sdk",
"author": "lerencao",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/starcoinorg/starcoin.js"
},
"homepage": "https://github.com/starcoinorg/starcoin.js#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/starcoinorg/starcoin.js"
},
"keywords": [],
"source": "index.ts",
"main": "dist/starcoin.js",
"module": "dist/starcoin.module.js",
"files": [
"dist",
"LICENSE",
"readme.md"
],
"dependencies": {
"@ethersproject/basex": "^5.0.4",
"@ethersproject/bignumber": "^5.0",
"@ethersproject/bytes": "^5.0.6",
"@ethersproject/hash": "^5.0.6",
"@ethersproject/keccak256": "^5.0.5",
"@ethersproject/logger": "^5.0.6",
"@ethersproject/networks": "^5.0.4",
"@ethersproject/properties": "^5.0.4",
"@ethersproject/sha2": "^5.0.4",
"@ethersproject/transactions": "^5.0.6",
"@ethersproject/web": "^5.0.9",
"@open-rpc/client-js": "^1.6.0",
"@types/node": "^14.11.2",
"int64-buffer": "^0.99",
"leb": "^0.3.0"
},
"devDependencies": {
"cz-conventional-changelog": "^3.3.0",
"@types/jest": "^26.0.14",
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@typescript-eslint/parser": "^4.1.1",
"eslint": "^7.9.0",
"eslint-config-airbnb-typescript": "^10.0.0",
"eslint-config-prettier": "^6.10.1",
"eslint-formatter-pretty": "^4.0.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jest": "^24.0.2",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-unicorn": "^22.0.0",
"jest": "^26.4.2",
"microbundle": "^0.12.0",
"prettier": "^2.0.4",
"ts-jest": "^26.3.0",
"typescript": "^4.0.3"
},
"scripts": {
"build": "microbundle -o dist/ --sourcemap false --compress false -f modern,es,cjs",
"dev": "microbundle watch -o dist/ --sourcemap false --compress false -f modern,es,cjs",
"test": "jest --coverage",
"lint": "eslint --ext .js,.jsx,.ts,.tsx ."
},
"jest": {
"testEnvironment": "node",
"testPathIgnorePatterns": [
"node_modules",
"dist",
"coverage"
],
"transform": {
"^.+\\.ts?$": "ts-jest"
}
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"prettier": {
"singleQuote": true
}
}

0 comments on commit c638db6

Please sign in to comment.