Skip to content

Commit 1dae3ed

Browse files
committed
first version, almost there!
1 parent 24b568d commit 1dae3ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+8373
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
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

.github/CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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+
10+
11+
* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

.github/PULL_REQUEST_TEMPLATE.md

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

.gitignore

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

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "deps/ckb-js-toolkit-contrib"]
2+
path = deps/ckb-js-toolkit-contrib
3+
url = https://github.com/xxuejie/ckb-js-toolkit-contrib.git

.npmignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
src
2+
test
3+
tsconfig.json
4+
tsconfig.module.json
5+
tslint.json
6+
.travis.yml
7+
.github
8+
.prettierignore
9+
.vscode
10+
build/docs
11+
**/*.spec.*
12+
coverage
13+
.nyc_output
14+
*.log

.prettierignore

Lines changed: 2 additions & 0 deletions
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

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

.vscode/debug-ts.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
'use strict';
2+
const meow = require('meow');
3+
const path = require('path');
4+
5+
const tsFile = getTSFile();
6+
const jsFile = TS2JS(tsFile);
7+
8+
replaceCLIArg(tsFile, jsFile);
9+
10+
// Ava debugger
11+
require('ava/profile');
12+
13+
/**
14+
* get ts file path from CLI args
15+
*
16+
* @return string path
17+
*/
18+
function getTSFile() {
19+
const cli = meow();
20+
return cli.input[0];
21+
}
22+
23+
/**
24+
* get associated compiled js file path
25+
*
26+
* @param tsFile path
27+
* @return string path
28+
*/
29+
function TS2JS(tsFile) {
30+
const srcFolder = path.join(__dirname, '..', 'src');
31+
const distFolder = path.join(__dirname, '..', 'build', 'main');
32+
33+
const tsPathObj = path.parse(tsFile);
34+
35+
return path.format({
36+
dir: tsPathObj.dir.replace(srcFolder, distFolder),
37+
ext: '.js',
38+
name: tsPathObj.name,
39+
root: tsPathObj.root
40+
});
41+
}
42+
43+
/**
44+
* replace a value in CLI args
45+
*
46+
* @param search value to search
47+
* @param replace value to replace
48+
* @return void
49+
*/
50+
function replaceCLIArg(search, replace) {
51+
process.argv[process.argv.indexOf(search)] = replace;
52+
}

0 commit comments

Comments
 (0)