Skip to content

Commit

Permalink
refactor(top-level): rewrite top level to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric committed Jun 13, 2019
1 parent 9075844 commit 810d9b5
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 1,381 deletions.
1 change: 1 addition & 0 deletions @commitlint/top-level/index.d.ts
@@ -0,0 +1 @@
export * from './lib';
1 change: 1 addition & 0 deletions @commitlint/top-level/index.js
@@ -0,0 +1 @@
module.exports = require('./lib');
10 changes: 6 additions & 4 deletions @commitlint/top-level/package.json
Expand Up @@ -7,11 +7,11 @@
"lib/"
],
"scripts": {
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
"build": "tsc",
"deps": "dep-check",
"pkg": "pkg-check",
"start": "yarn watch",
"watch": "babel src --out-dir lib --watch --source-maps"
"watch": "tsc -w"
},
"babel": {
"presets": [
Expand Down Expand Up @@ -42,12 +42,14 @@
"license": "MIT",
"devDependencies": {
"@commitlint/utils": "^8.0.0",
"@types/node": "^12.0.4",
"babel-cli": "6.26.0",
"babel-preset-commitlint": "^8.0.0",
"babel-register": "6.26.0",
"cross-env": "5.1.1"
"cross-env": "5.1.1",
"typescript": "^3.5.1"
},
"dependencies": {
"find-up": "^2.1.0"
"find-up": "^4.0.0"
}
}
17 changes: 17 additions & 0 deletions @commitlint/top-level/src/index.ts
@@ -0,0 +1,17 @@
import path from 'path';
import up from 'find-up';

export default toplevel;

/**
* Find the next git root
*/
async function toplevel(cwd: string) {
const found = await up('.git', { cwd, type: 'directory' });

if (typeof found !== 'string') {
return found;
}

return path.join(found, '..');
}
22 changes: 22 additions & 0 deletions @commitlint/top-level/tsconfig.json
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"lib": [
"dom",
"es2015"
],
"rootDir": "src",
"outDir": "lib",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": [
"./src"
],
"exclude": [
"./src/**/*.test.ts"
]
}

0 comments on commit 810d9b5

Please sign in to comment.