-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
example(transform-typescript): add example.
- Loading branch information
1 parent
2994ca2
commit e98a687
Showing
8 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-typescript" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# Created by https://www.gitignore.io/api/node | ||
# Edit at https://www.gitignore.io/?templates=node | ||
|
||
lib | ||
package-lock.json | ||
__snapshots__ | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# 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 (https://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 | ||
.env.test | ||
|
||
# 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/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# End of https://www.gitignore.io/api/node | ||
|
||
.DS_Store | ||
.cache | ||
.vscode | ||
.idea | ||
.env | ||
|
||
*.bak | ||
*.tem | ||
*.temp | ||
#.swp | ||
*.*~ | ||
~*.* | ||
|
||
# IDEA | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Transform Typescript Example | ||
--- | ||
|
||
Feature: Just delete the typescript type. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "@template/transform-typescript", | ||
"private": true, | ||
"version": "2.2.1", | ||
"description": "Transform Typescript Example.", | ||
"scripts": { | ||
"start": "node lib/index.js", | ||
"watch": "npm run watch:ts", | ||
"watch:ts": "tsbb watch --babel-option=none & npm run build:types -- --watch", | ||
"build": "npm run build:ts && npm run build:types", | ||
"build:ts": "tsbb build --babel-option=none", | ||
"build:types": "tsbb types", | ||
"test": "tsbb test", | ||
"coverage": "tsbb test --coverage" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/jaywcjlove/tsbb/tree/master/example/transform-typescript" | ||
}, | ||
"jest": {}, | ||
"keywords": [], | ||
"license": "MIT", | ||
"devDependencies": { | ||
"tsbb": "2.2.1" | ||
}, | ||
"author": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { sum } from './utils/sum'; | ||
|
||
class Test { | ||
constructor() {} | ||
count() { | ||
return 10; | ||
} | ||
} | ||
|
||
async function testHandle() { | ||
console.log('>>>'); | ||
} | ||
|
||
(() => { | ||
const { sum } = require('./utils/sum'); | ||
const data = { a: 1 }; | ||
const result = { ...data }; | ||
console.log('>>>', sum(1, result.a)); | ||
})(); | ||
|
||
export default async () => { | ||
const test = new Test(); | ||
await testHandle(); | ||
return sum(1, test.count()); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* 这里是注释 | ||
* @param a | ||
* @param b | ||
*/ | ||
export function abs(a: number, b: number) { | ||
return a + b; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function sum(a: number, b: number) { | ||
return a + b; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"esModuleInterop": true, | ||
"declaration": true, | ||
"target": "ES2017", | ||
"noImplicitAny": true, | ||
"resolveJsonModule": true, | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"outDir": "lib", | ||
"baseUrl": "." | ||
}, | ||
"include": ["src/**/*"] | ||
} |