-
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.
Merge pull request #3 from Arylo/release/1.1.2
Release to 1.1.2
- Loading branch information
Showing
10 changed files
with
116 additions
and
33 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,20 @@ | ||
# 1.1.2 | ||
|
||
## Add | ||
|
||
- A Example for Custom Config Module in Typescript Project | ||
- Changelog File | ||
|
||
## Update | ||
|
||
- Update `.d.ts` File, it is more standardized. | ||
|
||
## Remove | ||
|
||
- Eslint Check | ||
|
||
# 1.1.1 | ||
|
||
## Update | ||
|
||
- Update `.d.ts` File |
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,44 @@ | ||
export interface AnyObject { | ||
[prop: string]: any | ||
} | ||
|
||
export class Config<T extends AnyObject> { | ||
/** | ||
* Get Debug Status | ||
*/ | ||
public getDebug(): boolean; | ||
/** | ||
* Set Debug Status | ||
* @param bool status | ||
*/ | ||
public setDebug(bool: boolean): boolean; | ||
|
||
public on(event: string, cb: any): void; | ||
public once(event: string, cb: any): void; | ||
|
||
/** | ||
* Display Stored Data | ||
*/ | ||
public getConfig(): T; | ||
/** | ||
* Store Data | ||
* @param obj data | ||
*/ | ||
public setConfig(obj: T): boolean; | ||
|
||
public clearConfigCwd(): boolean; | ||
public getConfigCwd(): boolean; | ||
public setConfigCwd(cwd: string): boolean; | ||
|
||
public clearConfigPath(): boolean; | ||
public clearCustomConfigPath(): boolean; | ||
public getConfigPath(): string; | ||
public getCustomConfigPath(): string; | ||
public setConfigPath(filepath: string): boolean; | ||
public setCustomConfigPath(filepath: string): boolean; | ||
|
||
public clear(): boolean; | ||
public reload(): boolean; | ||
|
||
[prop: string]: any; | ||
} |
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 @@ | ||
import config = require('config'); | ||
|
||
const test = config.test; | ||
const bar = config.bar; |
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 @@ | ||
{ | ||
"name": "custom_config_module", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"keywords": [ | ||
"y-config", | ||
"example" | ||
], | ||
"author": "AryloYeung <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"y-config": "file:../../" | ||
} | ||
} |
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,6 @@ | ||
import { AnyObject } from 'y-config/dts'; | ||
|
||
export interface NewObject extends AnyObject { | ||
test: string; | ||
bar: 'foo'; | ||
} |
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,7 @@ | ||
import { NewObject } from './test.d'; | ||
import config = require('y-config'); | ||
|
||
config.test = 'test'; | ||
config.bar = 'foo'; | ||
|
||
export = <NewObject>config.getConfig(); |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "commonjs", | ||
"strict": true, | ||
/* Add Start */ | ||
"baseUrl": ".", | ||
"paths": { | ||
"config": ["test.ts"] | ||
} | ||
/* Add End */ | ||
} | ||
} |
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,31 +1,7 @@ | ||
interface AnyObject { | ||
[prop: string]: any | ||
} | ||
import { Config, AnyObject } from './dts.d'; | ||
|
||
declare module "y-config" { | ||
function getDebug(): boolean; | ||
function setDebug(bool: boolean): boolean; | ||
|
||
function on(event: string, cb: any): void; | ||
function once(event: string, cb: any): void; | ||
|
||
function getConfig(): AnyObject; | ||
function setConfig(obj: any): boolean; | ||
|
||
function clearConfigCwd(): boolean; | ||
function getConfigCwd(): boolean; | ||
function setConfigCwd(cwd: string): boolean; | ||
|
||
function clearConfigPath(): boolean; | ||
function clearCustomConfigPath(): boolean; | ||
function getConfigPath(): string; | ||
function getCustomConfigPath(): string; | ||
function setConfigPath(filepath: string): boolean; | ||
function setCustomConfigPath(filepath: string): boolean; | ||
|
||
function clear(): boolean; | ||
function reload(): boolean; | ||
export = new Config(); | ||
} | ||
|
||
declare let config: "y-config"; | ||
export = config; | ||
export = new Config(); |
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 @@ | ||
{ | ||
"name": "y-config", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Create public configuration for the project", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"scripts": { | ||
"pretest": "npm run lint", | ||
"test": "mocha -r should -R list", | ||
"lint": "eslint ./", | ||
"prepublish": "npm run test" | ||
}, | ||
"repository": { | ||
|
@@ -22,7 +20,9 @@ | |
"node-config", | ||
"env", | ||
"environment", | ||
"common" | ||
"common", | ||
"typescript", | ||
"coffeescript" | ||
], | ||
"author": "AryloYeung <[email protected]>", | ||
"license": "MIT", | ||
|
@@ -36,7 +36,6 @@ | |
"lodash": "^4.17.4" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^3.18.0", | ||
"mocha": "^3.2.0", | ||
"should": "^11.2.1" | ||
} | ||
|