-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
340 additions
and
97 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 |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
"plusplus", | ||
"postbuild", | ||
"prebuild", | ||
"rimraf", | ||
"rollup", | ||
"sourcemap", | ||
"styl", | ||
|
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
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
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
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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
{ | ||
"extends": "../../tsconfig.settings", | ||
"extends": "../../tsconfig", | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "lib", | ||
"declarationDir": "lib/types", | ||
"target": "es2015", | ||
"module": "es2015" | ||
"module": "commonjs" | ||
}, | ||
"include": [ | ||
"src" | ||
"src", | ||
"script", | ||
"test" | ||
] | ||
} |
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,13 @@ | ||
{ | ||
"extends": "../../tsconfig.settings", | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "lib", | ||
"declarationDir": "lib/types", | ||
"target": "es2015", | ||
"module": "es2015" | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
} |
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
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
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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
{ | ||
"extends": "../../tsconfig.settings", | ||
"extends": "../../tsconfig", | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "lib", | ||
"declarationDir": "lib/types", | ||
"target": "es2015", | ||
"module": "es2015" | ||
"module": "commonjs" | ||
}, | ||
"include": [ | ||
"src" | ||
"src", | ||
"script", | ||
"test" | ||
] | ||
} |
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,13 @@ | ||
{ | ||
"extends": "../../tsconfig.settings", | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "lib", | ||
"declarationDir": "lib/types", | ||
"target": "es2015", | ||
"module": "es2015" | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
} |
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
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
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,41 @@ | ||
/** | ||
* 转换成布尔值 | ||
* - 若 @value 为 null/undefined,返回 undefined | ||
* - 若 @value 为 string,则只有 true/false 才是有效值,其它值视为 undefined | ||
* - 否则,返回 Boolean(@value) | ||
* @param value | ||
*/ | ||
export function convertToBoolean(value?: string | boolean | any): boolean | undefined { | ||
if (value == null) return undefined | ||
if (typeof value === 'string') { | ||
switch (value.toLowerCase()) { | ||
case 'false': return false | ||
case 'true': return true | ||
} | ||
return undefined | ||
} | ||
return Boolean(value) | ||
} | ||
|
||
|
||
/** | ||
* 当 value 为 null/undefined 时,返回 @defaultValue | ||
* 否则返回 @value | ||
* @param defaultValue | ||
* @param value | ||
*/ | ||
export function cover<T>(defaultValue: T, value: T | null | undefined): T { | ||
if (value == null) return defaultValue | ||
return value | ||
} | ||
|
||
|
||
/** | ||
* 先将 @value 转成布尔值,然后调用 cover 函数 | ||
* @param defaultValue | ||
* @param value | ||
*/ | ||
export function coverBoolean(defaultValue: boolean, value?: any): boolean { | ||
const v = convertToBoolean(value) | ||
return cover<boolean>(defaultValue, v) | ||
} |
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 |
---|---|---|
@@ -1,12 +1,11 @@ | ||
{ | ||
"extends": "../../tsconfig.settings", | ||
"extends": "../../tsconfig", | ||
"compilerOptions": { | ||
"outDir": "lib", | ||
"rootDir": ".", | ||
"target": "es5", | ||
"module": "CommonJS", | ||
"module": "commonjs" | ||
}, | ||
"include": [ | ||
"src" | ||
"src", | ||
"script", | ||
"test" | ||
] | ||
} |
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,14 @@ | ||
{ | ||
"extends": "../../tsconfig.settings", | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "lib", | ||
"target": "es2015", | ||
"module": "commonjs", | ||
"sourceMap": false, | ||
"declarationMap": false | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
} |
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
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
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 @@ | ||
console.log('Hello, world!') |
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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
{ | ||
"extends": "../../tsconfig.settings", | ||
"extends": "{{{tsconfigExtends}}}", | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "lib", | ||
"declarationDir": "lib/types", | ||
"target": "es2015", | ||
"module": "es2015" | ||
"module": "commonjs" | ||
}, | ||
"include": [ | ||
"src" | ||
"src", | ||
"script", | ||
"test" | ||
] | ||
} |
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
13 changes: 13 additions & 0 deletions
13
packages/template-ts-package/boilerplate/tsconfig.src.json.hbs
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,13 @@ | ||
{ | ||
"extends": "{{{tsconfigSrcExtends}}}", | ||
"compilerOptions": { | ||
"rootDir": ".", | ||
"outDir": "lib", | ||
"declarationDir": "lib/types", | ||
"target": "es2015", | ||
"module": "es2015" | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
} |
Oops, something went wrong.