Add types so the lage.config.js can be typed! (#148)

* bump deps and add types as output

* bump beachball

* Change files

* add more ignored stuff

* adding more to ignore

* lage main should expose types, but bin to use the cli.js instead

* let yarn figure out where to find lage

* okay use cli instead of index
This commit is contained in:
Kenneth Chau 2021-06-11 15:58:47 -07:00 коммит произвёл GitHub
Родитель 846b3f78f7
Коммит c8eded2255
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 87 добавлений и 72 удалений

Просмотреть файл

@ -1,2 +1,7 @@
src src
change change
scripts
decks
docs
tests
.github

Просмотреть файл

@ -1,3 +1,3 @@
#!/usr/bin/env node #!/usr/bin/env node
require("../lib/index.js"); require("../lib/cli.js");

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "bump deps and add types as output",
"packageName": "lage",
"email": "kchau@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -7,6 +7,7 @@
}, },
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts",
"bin": { "bin": {
"lage": "bin/lage.js" "lage": "bin/lage.js"
}, },
@ -29,9 +30,9 @@
"watchpack": "1.6.1" "watchpack": "1.6.1"
}, },
"dependencies": { "dependencies": {
"@microsoft/task-scheduler": "^2.7.0", "@microsoft/task-scheduler": "^2.7.1",
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
"backfill": "^6.1.5", "backfill": "^6.1.6",
"backfill-config": "^6.1.3", "backfill-config": "^6.1.3",
"backfill-logger": "^5.1.3", "backfill-logger": "^5.1.3",
"chalk": "^4.0.0", "chalk": "^4.0.0",
@ -41,7 +42,7 @@
"git-url-parse": "^11.1.2", "git-url-parse": "^11.1.2",
"npmlog": "^4.1.2", "npmlog": "^4.1.2",
"p-profiler": "^0.2.1", "p-profiler": "^0.2.1",
"workspace-tools": "^0.15.0", "workspace-tools": "^0.16.2",
"yargs-parser": "^18.1.3" "yargs-parser": "^18.1.3"
}, },
"devDependencies": { "devDependencies": {
@ -55,7 +56,7 @@
"@types/npmlog": "^4.1.2", "@types/npmlog": "^4.1.2",
"@types/p-queue": "^3.2.1", "@types/p-queue": "^3.2.1",
"@types/yargs-parser": "^15.0.0", "@types/yargs-parser": "^15.0.0",
"beachball": "^2.2.0", "beachball": "^2.6.1",
"gh-pages": "^2.2.0", "gh-pages": "^2.2.0",
"jasmine": "^3.5.0", "jasmine": "^3.5.0",
"renovate": "^23.42.2", "renovate": "^23.42.2",

41
src/cli.ts Normal file
Просмотреть файл

@ -0,0 +1,41 @@
import { getConfig } from "./config/getConfig";
import { init } from "./command/init";
import { run } from "./command/run";
import { showHelp } from "./showHelp";
import { logger } from "./logger";
import { info } from "./command/info";
import { initReporters } from "./logger/initReporters";
import { version } from "./command/version";
import { cache } from "./command/cache";
// Parse CLI args
const cwd = process.cwd();
try {
const config = getConfig(cwd);
const reporters = initReporters(config);
switch (config.command[0]) {
case "cache":
cache(cwd, config);
break;
case "init":
init(cwd);
break;
case "info":
info(cwd, config);
break;
case "version":
version();
break;
default:
logger.info(`Lage task runner - let's make it`);
run(cwd, config, reporters);
break;
}
} catch (e) {
showHelp(e.message);
}

Просмотреть файл

@ -1,41 +1 @@
import { getConfig } from "./config/getConfig"; export type { ConfigOptions } from "./types/ConfigOptions";
import { init } from "./command/init";
import { run } from "./command/run";
import { showHelp } from "./showHelp";
import { logger } from "./logger";
import { info } from "./command/info";
import { initReporters } from "./logger/initReporters";
import { version } from "./command/version";
import { cache } from "./command/cache";
// Parse CLI args
const cwd = process.cwd();
try {
const config = getConfig(cwd);
const reporters = initReporters(config);
switch (config.command[0]) {
case "cache":
cache(cwd, config);
break;
case "init":
init(cwd);
break;
case "info":
info(cwd, config);
break;
case "version":
version();
break;
default:
logger.info(`Lage task runner - let's make it`);
run(cwd, config, reporters);
break;
}
} catch (e) {
showHelp(e.message);
}

Просмотреть файл

@ -78,7 +78,7 @@ export class Monorepo {
} }
generateRepoFiles() { generateRepoFiles() {
const lagePath = path.join(this.nodeModulesPath, "lage/lib/index"); const lagePath = path.join(this.nodeModulesPath, "lage/lib/cli");
this.commitFiles({ this.commitFiles({
"package.json": { "package.json": {

Просмотреть файл

@ -6,6 +6,7 @@
"target": "ES2017", "target": "ES2017",
"module": "CommonJS", "module": "CommonJS",
"moduleResolution": "Node", "moduleResolution": "Node",
"declaration": true,
"lib": ["ES2017"], "lib": ["ES2017"],
"allowJs": true, "allowJs": true,
"outDir": "./lib", "outDir": "./lib",

Просмотреть файл

@ -975,7 +975,7 @@
markdown-it-front-matter "^0.2.1" markdown-it-front-matter "^0.2.1"
postcss "^7.0.32" postcss "^7.0.32"
"@microsoft/task-scheduler@^2.7.0": "@microsoft/task-scheduler@^2.7.1":
version "2.7.1" version "2.7.1"
resolved "https://registry.yarnpkg.com/@microsoft/task-scheduler/-/task-scheduler-2.7.1.tgz#de2ebe6edb7ed882511051301f0e6f81732d7564" resolved "https://registry.yarnpkg.com/@microsoft/task-scheduler/-/task-scheduler-2.7.1.tgz#de2ebe6edb7ed882511051301f0e6f81732d7564"
integrity sha512-xSmX7xgLTtf3LwVOW5HCEL4qrSWYCmPsVzpJ7PTBayN0KA9acScgsLYaDE6tE26N//DtDEW6mi4RteWU4XSrjA== integrity sha512-xSmX7xgLTtf3LwVOW5HCEL4qrSWYCmPsVzpJ7PTBayN0KA9acScgsLYaDE6tE26N//DtDEW6mi4RteWU4XSrjA==
@ -2263,15 +2263,17 @@ babel-plugin-dynamic-import-node@^2.3.0, babel-plugin-dynamic-import-node@^2.3.3
dependencies: dependencies:
object.assign "^4.1.0" object.assign "^4.1.0"
backfill-cache@^5.2.3: backfill-cache@^5.2.4:
version "5.2.3" version "5.2.4"
resolved "https://registry.yarnpkg.com/backfill-cache/-/backfill-cache-5.2.3.tgz#826d1089f47c2147d1ae2ccb857ce5ee5f38706e" resolved "https://registry.yarnpkg.com/backfill-cache/-/backfill-cache-5.2.4.tgz#4354933df98fc878aa38e137dcdcdbe78b5bdf38"
integrity sha512-r5up3vTTgwazit0rd0aBNc2invV6SvftchSB/HZ0rhvcITy/63PNCMiWUKc6exGmm9b6XANfD67/tIh+SfYujA== integrity sha512-5Kbm8lU1BbImlgVV53fgaxEhHnaKRjWe9KCy47e2VLP7Fy2ZYCiRLD9H7YBYTws1AfDn5QRA/y/3924j6/Cnzg==
dependencies: dependencies:
"@azure/storage-blob" "12.1.2" "@azure/storage-blob" "12.1.2"
"@rushstack/package-deps-hash" "^2.4.48"
backfill-config "^6.1.3" backfill-config "^6.1.3"
backfill-logger "^5.1.3" backfill-logger "^5.1.3"
execa "^4.0.0" execa "^4.0.0"
find-up "^5.0.0"
fs-extra "^8.1.0" fs-extra "^8.1.0"
globby "^11.0.0" globby "^11.0.0"
tar-fs "^2.1.0" tar-fs "^2.1.0"
@ -2315,13 +2317,13 @@ backfill-utils-dotenv@^5.1.1:
dotenv "^8.1.0" dotenv "^8.1.0"
find-up "^5.0.0" find-up "^5.0.0"
backfill@^6.1.5: backfill@^6.1.6:
version "6.1.5" version "6.1.6"
resolved "https://registry.yarnpkg.com/backfill/-/backfill-6.1.5.tgz#02e72fce0a667dfd2ab2360160efb53dca595919" resolved "https://registry.yarnpkg.com/backfill/-/backfill-6.1.6.tgz#52e2f8f80b1cd33b5bdb0f18202c11dcb54011e3"
integrity sha512-RT5Y8IzZqB0rdUgVViABZwl8ksi4S5g4bmQcsMKxtL/GHk4XZI+aducWPNXNj8Fn+5umVN/qkRw2XbylaTQXmQ== integrity sha512-JbYlY6OkWpLFDUdGuiR4vqab/3MCzy9Pi0olN6h2wZFOn87ZG3LjN2ot26CMEezIYTbC+UonjQm/wrU163CyVg==
dependencies: dependencies:
anymatch "^3.0.3" anymatch "^3.0.3"
backfill-cache "^5.2.3" backfill-cache "^5.2.4"
backfill-config "^6.1.3" backfill-config "^6.1.3"
backfill-hasher "^6.2.4" backfill-hasher "^6.2.4"
backfill-logger "^5.1.3" backfill-logger "^5.1.3"
@ -2377,10 +2379,10 @@ bcrypt-pbkdf@^1.0.0:
dependencies: dependencies:
tweetnacl "^0.14.3" tweetnacl "^0.14.3"
beachball@^2.2.0: beachball@^2.6.1:
version "2.2.0" version "2.6.1"
resolved "https://registry.yarnpkg.com/beachball/-/beachball-2.2.0.tgz#5b74cc1a01097a24a4f683f3608368b26f6a2174" resolved "https://registry.yarnpkg.com/beachball/-/beachball-2.6.1.tgz#0f48a08fbeb965a643c3b5c3c224d08c6d67ce84"
integrity sha512-2cell9HViD9navg+txbnOybmL7hbpdZBRcx930Gv/92ZyqAmIr7gHTsyZv90tzkeYvUh+xDZGbEBGddLF1QOUg== integrity sha512-+vUTrIPGpSUVHCl2WbNP9+cOG6UAFlm15Nbvu1onuob0DqqLvCF4nzPTR3ZFFsq+mkbS3NG4iIk8YiYSo+wiIQ==
dependencies: dependencies:
cosmiconfig "^6.0.0" cosmiconfig "^6.0.0"
execa "^4.0.3" execa "^4.0.3"
@ -2394,7 +2396,7 @@ beachball@^2.2.0:
semver "^6.1.1" semver "^6.1.1"
toposort "^2.0.2" toposort "^2.0.2"
uuid "^8.3.1" uuid "^8.3.1"
workspace-tools "^0.14.0" workspace-tools "^0.16.2"
yargs-parser "^20.2.4" yargs-parser "^20.2.4"
big.js@^3.1.3: big.js@^3.1.3:
@ -12153,10 +12155,10 @@ worker-farm@^1.7.0:
dependencies: dependencies:
errno "~0.1.7" errno "~0.1.7"
workspace-tools@^0.14.0: workspace-tools@^0.15.0:
version "0.14.1" version "0.15.0"
resolved "https://registry.yarnpkg.com/workspace-tools/-/workspace-tools-0.14.1.tgz#db65c5e01d93021520634a0f4501b95457a9a436" resolved "https://registry.yarnpkg.com/workspace-tools/-/workspace-tools-0.15.0.tgz#8710f6151b21ab4382a5230d752e8b822ea24d16"
integrity sha512-39eUegRij7gXmlxo9S/x8p1Bv5MDjCJmj/1ERwD8epQM5DM3kWZFJhpuq9m5kcL1qT6ny02GgRbIyr4whsX+kQ== integrity sha512-KYSEKdqRJC3moABdCho03nSK4H9oqb6KtvGusGi5giR5oV1LilCRqem7STLRsZlnTJVTATv4nHnnioB+wSleDA==
dependencies: dependencies:
"@pnpm/lockfile-file" "^3.0.7" "@pnpm/lockfile-file" "^3.0.7"
"@pnpm/logger" "^3.2.2" "@pnpm/logger" "^3.2.2"
@ -12170,13 +12172,11 @@ workspace-tools@^0.14.0:
multimatch "^4.0.0" multimatch "^4.0.0"
read-yaml-file "^2.0.0" read-yaml-file "^2.0.0"
workspace-tools@^0.15.0: workspace-tools@^0.16.2:
version "0.15.0" version "0.16.2"
resolved "https://registry.yarnpkg.com/workspace-tools/-/workspace-tools-0.15.0.tgz#8710f6151b21ab4382a5230d752e8b822ea24d16" resolved "https://registry.yarnpkg.com/workspace-tools/-/workspace-tools-0.16.2.tgz#b7355c811dcda648d12e92ceb89f8fccacca3901"
integrity sha512-KYSEKdqRJC3moABdCho03nSK4H9oqb6KtvGusGi5giR5oV1LilCRqem7STLRsZlnTJVTATv4nHnnioB+wSleDA== integrity sha512-Z/NHo4t39DUd50MdWiPfxICyVaCjWZc/xwZxE4a/n2nAQGgeYeg6GWBY1juULPi/BGSrjSVaDQfDCj/Y80033A==
dependencies: dependencies:
"@pnpm/lockfile-file" "^3.0.7"
"@pnpm/logger" "^3.2.2"
"@yarnpkg/lockfile" "^1.1.0" "@yarnpkg/lockfile" "^1.1.0"
find-up "^4.1.0" find-up "^4.1.0"
find-yarn-workspace-root "^1.2.1" find-yarn-workspace-root "^1.2.1"