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 4, 2019
1 parent c102d2f commit 41da5f4
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 33 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: 'file' });

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"
]
}
134 changes: 105 additions & 29 deletions yarn.lock
Expand Up @@ -1088,6 +1088,11 @@
version "12.0.2"
resolved "https://registry.npmjs.org/@types/node/-/node-12.0.2.tgz#3452a24edf9fea138b48fad4a0a028a683da1e40"

"@types/node@^12.0.4":
version "12.0.4"
resolved "https://registry.npmjs.org/@types/node/-/node-12.0.4.tgz#46832183115c904410c275e34cf9403992999c32"
integrity sha512-j8YL2C0fXq7IONwl/Ud5Kt0PeXw22zGERt+HSSnwbKOJVsAGkEz3sFCYwaF9IOuoG1HOtE0vKCj6sXF7Q0+Vaw==

"@types/normalize-package-data@^2.4.0":
version "2.4.0"
resolved "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"
Expand Down Expand Up @@ -2438,7 +2443,16 @@ brace-expansion@^1.1.7:
balanced-match "^1.0.0"
concat-map "0.0.1"

braces@2.3.1, braces@^1.8.2, braces@^2.3.0:
braces@^1.8.2:
version "1.8.5"
resolved "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7"
integrity sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=
dependencies:
expand-range "^1.8.1"
preserve "^0.2.0"
repeat-element "^1.1.2"

braces@^2.3.0:
version "2.3.1"
resolved "https://registry.npmjs.org/braces/-/braces-2.3.1.tgz#7086c913b4e5a08dbe37ac0ee6a2500c4ba691bb"
dependencies:
Expand Down Expand Up @@ -3450,9 +3464,15 @@ deep-equal@^1.0.0:
version "1.0.1"
resolved "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5"

deep-extend@0.5.1, deep-extend@^0.6.0, deep-extend@~0.4.0:
version "0.5.1"
resolved "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz#b894a9dd90d3023fbf1c55a394fb858eb2066f1f"
deep-extend@^0.6.0:
version "0.6.0"
resolved "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==

deep-extend@~0.4.0:
version "0.4.2"
resolved "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f"
integrity sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=

deep-is@~0.1.3:
version "0.1.3"
Expand Down Expand Up @@ -3899,6 +3919,13 @@ expand-brackets@^2.1.4:
snapdragon "^0.8.1"
to-regex "^3.0.1"

expand-range@^1.8.1:
version "1.8.2"
resolved "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337"
integrity sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=
dependencies:
fill-range "^2.1.0"

expand-tilde@^2.0.0, expand-tilde@^2.0.2:
version "2.0.2"
resolved "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502"
Expand Down Expand Up @@ -4061,6 +4088,17 @@ fill-keys@^1.0.2:
is-object "~1.0.1"
merge-descriptors "~1.0.0"

fill-range@^2.1.0:
version "2.2.4"
resolved "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565"
integrity sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==
dependencies:
is-number "^2.1.0"
isobject "^2.0.0"
randomatic "^3.0.0"
repeat-element "^1.1.2"
repeat-string "^1.5.2"

fill-range@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7"
Expand Down Expand Up @@ -4136,6 +4174,13 @@ find-up@^3.0.0:
dependencies:
locate-path "^3.0.0"

find-up@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/find-up/-/find-up-4.0.0.tgz#c367f8024de92efb75f2d4906536d24682065c3a"
integrity sha512-zoH7ZWPkRdgwYCDVoQTzqjG8JSPANhtvLhh4KVUHyKnaUJJrNeFmWIkTcNuJmR3GLMEmGYEf2S2bjgx26JTF+Q==
dependencies:
locate-path "^5.0.0"

findup-sync@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz#17b108f9ee512dfb7a5c7f3c8b27ea9e1a9c08d1"
Expand Down Expand Up @@ -4710,9 +4755,10 @@ hawk@3.1.3, hawk@~3.1.3:
hoek "2.x.x"
sntp "1.x.x"

hoek@2.x.x, hoek@5.0.3:
version "5.0.3"
resolved "https://registry.npmjs.org/hoek/-/hoek-5.0.3.tgz#b71d40d943d0a95da01956b547f83c4a5b4a34ac"
hoek@2.x.x:
version "2.16.3"
resolved "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed"
integrity sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=

home-or-tmp@^2.0.0:
version "2.0.0"
Expand Down Expand Up @@ -5225,6 +5271,13 @@ is-npm@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4"

is-number@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f"
integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=
dependencies:
kind-of "^3.0.2"

is-number@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195"
Expand Down Expand Up @@ -5811,7 +5864,7 @@ js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"

js-yaml@>=3.13.0, js-yaml@^3.10.0, js-yaml@^3.13.0, js-yaml@^3.8.2, js-yaml@^3.9.0:
js-yaml@^3.10.0, js-yaml@^3.13.0, js-yaml@^3.8.2, js-yaml@^3.9.0:
version "3.13.1"
resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
dependencies:
Expand Down Expand Up @@ -6170,6 +6223,13 @@ locate-path@^3.0.0:
p-locate "^3.0.0"
path-exists "^3.0.0"

locate-path@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==
dependencies:
p-locate "^4.1.0"

lodash._reinterpolate@~3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
Expand Down Expand Up @@ -6239,10 +6299,15 @@ lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"

lodash@4.17.11, lodash@^3.3.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.1:
lodash@4.17.11, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.1:
version "4.17.11"
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"

lodash@^3.3.1:
version "3.10.1"
resolved "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
integrity sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=

log-symbols@^1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18"
Expand Down Expand Up @@ -6378,10 +6443,15 @@ map-visit@^1.0.0:
dependencies:
object-visit "^1.0.0"

marked@0.3.9, marked@^0.3.6, marked@^0.5.1:
marked@^0.3.6:
version "0.3.9"
resolved "https://registry.npmjs.org/marked/-/marked-0.3.9.tgz#54ce6a57e720c3ac6098374ec625fcbcc97ff290"

marked@^0.5.1:
version "0.5.2"
resolved "https://registry.npmjs.org/marked/-/marked-0.5.2.tgz#3efdb27b1fd0ecec4f5aba362bddcd18120e5ba9"
integrity sha512-fdZvBa7/vSQIZCi4uuwo2N3q+7jJURpMVCcbaX0S1Mg65WZ5ilXvC67MviJAsdjqqgD+CEq4RKo5AYGgINkVAA==

matcher@^0.1.1:
version "0.1.2"
resolved "https://registry.npmjs.org/matcher/-/matcher-0.1.2.tgz#ef20cbde64c24c50cc61af5b83ee0b1b8ff00101"
Expand Down Expand Up @@ -6672,7 +6742,7 @@ module-not-found-error@^1.0.0:
version "1.0.1"
resolved "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz#cf8b4ff4f29640674d6cdd02b0e3bc523c2bbdc0"

moment@2.19.3, moment@^2.18.1:
moment@^2.18.1:
version "2.19.3"
resolved "https://registry.npmjs.org/moment/-/moment-2.19.3.tgz#bdb99d270d6d7fda78cc0fbace855e27fe7da69f"

Expand Down Expand Up @@ -7272,6 +7342,13 @@ p-limit@^2.0.0:
dependencies:
p-try "^2.0.0"

p-limit@^2.2.0:
version "2.2.0"
resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2"
integrity sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==
dependencies:
p-try "^2.0.0"

p-locate@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43"
Expand All @@ -7284,6 +7361,13 @@ p-locate@^3.0.0:
dependencies:
p-limit "^2.0.0"

p-locate@^4.1.0:
version "4.1.0"
resolved "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==
dependencies:
p-limit "^2.2.0"

p-map-series@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/p-map-series/-/p-map-series-1.0.0.tgz#bf98fe575705658a9e1351befb85ae4c1f07bdca"
Expand Down Expand Up @@ -7634,6 +7718,11 @@ prepend-http@^1.0.1:
version "1.0.4"
resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"

preserve@^0.2.0:
version "0.2.0"
resolved "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=

prettier@1.17.1:
version "1.17.1"
resolved "https://registry.npmjs.org/prettier/-/prettier-1.17.1.tgz#ed64b4e93e370cb8a25b9ef7fef3e4fd1c0995db"
Expand Down Expand Up @@ -7801,9 +7890,10 @@ quick-lru@^1.0.0:
version "1.1.0"
resolved "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8"

randomatic@3:
randomatic@^3.0.0:
version "3.1.1"
resolved "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed"
integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==
dependencies:
is-number "^4.0.0"
kind-of "^6.0.0"
Expand Down Expand Up @@ -8113,7 +8203,7 @@ repeat-element@^1.1.2:
version "1.1.2"
resolved "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a"

repeat-string@^1.6.1:
repeat-string@^1.5.2, repeat-string@^1.6.1:
version "1.6.1"
resolved "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637"

Expand Down Expand Up @@ -8756,20 +8846,6 @@ sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"

sshpk@1.14.1:
version "1.14.1"
resolved "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz#130f5975eddad963f1d56f92b9ac6c51fa9f83eb"
dependencies:
asn1 "~0.2.3"
assert-plus "^1.0.0"
dashdash "^1.12.0"
getpass "^0.1.1"
optionalDependencies:
bcrypt-pbkdf "^1.0.0"
ecc-jsbn "~0.1.1"
jsbn "~0.1.0"
tweetnacl "~0.14.0"

sshpk@^1.7.0:
version "1.16.1"
resolved "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877"
Expand Down Expand Up @@ -8902,7 +8978,7 @@ stringify-object@^3.2.2:
is-obj "^1.0.1"
is-regexp "^1.0.0"

stringstream@0.0.6, stringstream@~0.0.4:
stringstream@~0.0.4:
version "0.0.6"
resolved "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz#7880225b0d4ad10e30927d167a1d6f2fd3b33a72"

Expand Down Expand Up @@ -9342,7 +9418,7 @@ typescript@3.4.5:
version "3.4.5"
resolved "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99"

typescript@3.5.1, typescript@^3.4.5:
typescript@3.5.1, typescript@^3.4.5, typescript@^3.5.1:
version "3.5.1"
resolved "https://registry.npmjs.org/typescript/-/typescript-3.5.1.tgz#ba72a6a600b2158139c5dd8850f700e231464202"

Expand Down

0 comments on commit 41da5f4

Please sign in to comment.