diff --git a/types/app-root-dir/app-root-dir-tests.ts b/types/app-root-dir/app-root-dir-tests.ts new file mode 100644 index 0000000000..bff8969927 --- /dev/null +++ b/types/app-root-dir/app-root-dir-tests.ts @@ -0,0 +1,6 @@ +import * as rootDir from 'app-root-dir'; + +let appRootPath: string; + +rootDir.set('__dirname'); +appRootPath = rootDir.get(); diff --git a/types/app-root-dir/index.d.ts b/types/app-root-dir/index.d.ts new file mode 100644 index 0000000000..8b0bf5bc6a --- /dev/null +++ b/types/app-root-dir/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for app-root-dir 0.1 +// Project: https://github.com/philidem/node-app-root-dir +// Definitions by: shaochenyang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface AppRootDir { + // Get the application's root directory + get(): string; + /** + * Set the application's root directory + * this will set a global so that no matter + * how many instances of app-root-dir module are installed, + * they will all return the same directory + */ + set(dirname: string): void; +} + +declare const AppRootDir: AppRootDir; + +export = AppRootDir; diff --git a/types/app-root-dir/tsconfig.json b/types/app-root-dir/tsconfig.json new file mode 100644 index 0000000000..f378c094db --- /dev/null +++ b/types/app-root-dir/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "app-root-dir-tests.ts" + ] +} diff --git a/types/app-root-dir/tslint.json b/types/app-root-dir/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/app-root-dir/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}