Skip to content

Commit

Permalink
change to ts-v0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangwen9229 committed Sep 19, 2019
1 parent 7a7aa77 commit 95c07d6
Show file tree
Hide file tree
Showing 71 changed files with 8,807 additions and 23,241 deletions.
23 changes: 0 additions & 23 deletions .babelrc

This file was deleted.

48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# https://circleci.com/docs/2.0/language-javascript/
version: 2
jobs:
'node-10':
docker:
- image: circleci/node:10
working_directory: ~/typescript-starter
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: npm test
- run: npm run cov:send
- run: npm run cov:check
'node-latest':
docker:
- image: circleci/node:latest
working_directory: ~/typescript-starter
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: npm test
- run: npm run cov:send
- run: npm run cov:check

workflows:
version: 2
build:
jobs:
- 'node-10'
- 'node-latest'
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

32 changes: 0 additions & 32 deletions .eslintrc.js

This file was deleted.

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**:
28 changes: 10 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
.DS_Store
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
node_modules
build
test
src/**.js
.idea/*

# dist/*.js
# dist/*.js.map
coverage
.nyc_output
*.log

dist/test.js
package-lock.json

tmpfiles/
log/*
15 changes: 15 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
src
test
tsconfig.json
tsconfig.module.json
tslint.json
.travis.yml
.github
.prettierignore
.vscode
build/docs
**/*.spec.*
coverage
.nyc_output
*.log
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
15 changes: 11 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
sudo: false
language: node_js
node_js: stable
script: npm run test
notifications:
email: false
node_js:
- '10'
- '12'
# keep the npm cache to speed up installs
cache:
directories:
- '$HOME/.npm'
after_success:
- npm run cov:send
- npm run cov:check
52 changes: 52 additions & 0 deletions .vscode/debug-ts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
'use strict';
const meow = require('meow');
const path = require('path');

const tsFile = getTSFile();
const jsFile = TS2JS(tsFile);

replaceCLIArg(tsFile, jsFile);

// Ava debugger
require('ava/profile');

/**
* get ts file path from CLI args
*
* @return string path
*/
function getTSFile() {
const cli = meow();
return cli.input[0];
}

/**
* get associated compiled js file path
*
* @param tsFile path
* @return string path
*/
function TS2JS(tsFile) {
const srcFolder = path.join(__dirname, '..', 'src');
const distFolder = path.join(__dirname, '..', 'build', 'main');

const tsPathObj = path.parse(tsFile);

return path.format({
dir: tsPathObj.dir.replace(srcFolder, distFolder),
ext: '.js',
name: tsPathObj.name,
root: tsPathObj.root
});
}

/**
* replace a value in CLI args
*
* @param search value to search
* @param replace value to replace
* @return void
*/
function replaceCLIArg(search, replace) {
process.argv[process.argv.indexOf(search)] = replace;
}
39 changes: 39 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"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"
},
{
"type": "node",
"request": "launch",
"name": "Debug Spec",
"program": "${workspaceRoot}/.vscode/debug-ts.js",
"args": ["${file}"],
"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
}
Loading

0 comments on commit 95c07d6

Please sign in to comment.