Skip to content

Commit c8eded2

Browse files
authored
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
1 parent 846b3f7 commit c8eded2

File tree

9 files changed

+87
-72
lines changed

9 files changed

+87
-72
lines changed

.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
src
22
change
3+
scripts
4+
decks
5+
docs
6+
tests
7+
.github

bin/lage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env node
22

3-
require("../lib/index.js");
3+
require("../lib/cli.js");
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "minor",
3+
"comment": "bump deps and add types as output",
4+
"packageName": "lage",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
},
88
"license": "MIT",
99
"main": "lib/index.js",
10+
"types": "lib/index.d.ts",
1011
"bin": {
1112
"lage": "bin/lage.js"
1213
},
@@ -29,9 +30,9 @@
2930
"watchpack": "1.6.1"
3031
},
3132
"dependencies": {
32-
"@microsoft/task-scheduler": "^2.7.0",
33+
"@microsoft/task-scheduler": "^2.7.1",
3334
"abort-controller": "^3.0.0",
34-
"backfill": "^6.1.5",
35+
"backfill": "^6.1.6",
3536
"backfill-config": "^6.1.3",
3637
"backfill-logger": "^5.1.3",
3738
"chalk": "^4.0.0",
@@ -41,7 +42,7 @@
4142
"git-url-parse": "^11.1.2",
4243
"npmlog": "^4.1.2",
4344
"p-profiler": "^0.2.1",
44-
"workspace-tools": "^0.15.0",
45+
"workspace-tools": "^0.16.2",
4546
"yargs-parser": "^18.1.3"
4647
},
4748
"devDependencies": {
@@ -55,7 +56,7 @@
5556
"@types/npmlog": "^4.1.2",
5657
"@types/p-queue": "^3.2.1",
5758
"@types/yargs-parser": "^15.0.0",
58-
"beachball": "^2.2.0",
59+
"beachball": "^2.6.1",
5960
"gh-pages": "^2.2.0",
6061
"jasmine": "^3.5.0",
6162
"renovate": "^23.42.2",

src/cli.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { getConfig } from "./config/getConfig";
2+
import { init } from "./command/init";
3+
import { run } from "./command/run";
4+
import { showHelp } from "./showHelp";
5+
import { logger } from "./logger";
6+
import { info } from "./command/info";
7+
import { initReporters } from "./logger/initReporters";
8+
import { version } from "./command/version";
9+
import { cache } from "./command/cache";
10+
11+
// Parse CLI args
12+
const cwd = process.cwd();
13+
try {
14+
const config = getConfig(cwd);
15+
const reporters = initReporters(config);
16+
17+
switch (config.command[0]) {
18+
case "cache":
19+
cache(cwd, config);
20+
break;
21+
22+
case "init":
23+
init(cwd);
24+
break;
25+
26+
case "info":
27+
info(cwd, config);
28+
break;
29+
30+
case "version":
31+
version();
32+
break;
33+
34+
default:
35+
logger.info(`Lage task runner - let's make it`);
36+
run(cwd, config, reporters);
37+
break;
38+
}
39+
} catch (e) {
40+
showHelp(e.message);
41+
}

src/index.ts

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1 @@
1-
import { getConfig } from "./config/getConfig";
2-
import { init } from "./command/init";
3-
import { run } from "./command/run";
4-
import { showHelp } from "./showHelp";
5-
import { logger } from "./logger";
6-
import { info } from "./command/info";
7-
import { initReporters } from "./logger/initReporters";
8-
import { version } from "./command/version";
9-
import { cache } from "./command/cache";
10-
11-
// Parse CLI args
12-
const cwd = process.cwd();
13-
try {
14-
const config = getConfig(cwd);
15-
const reporters = initReporters(config);
16-
17-
switch (config.command[0]) {
18-
case "cache":
19-
cache(cwd, config);
20-
break;
21-
22-
case "init":
23-
init(cwd);
24-
break;
25-
26-
case "info":
27-
info(cwd, config);
28-
break;
29-
30-
case "version":
31-
version();
32-
break;
33-
34-
default:
35-
logger.info(`Lage task runner - let's make it`);
36-
run(cwd, config, reporters);
37-
break;
38-
}
39-
} catch (e) {
40-
showHelp(e.message);
41-
}
1+
export type { ConfigOptions } from "./types/ConfigOptions";

tests/mock/monorepo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class Monorepo {
7878
}
7979

8080
generateRepoFiles() {
81-
const lagePath = path.join(this.nodeModulesPath, "lage/lib/index");
81+
const lagePath = path.join(this.nodeModulesPath, "lage/lib/cli");
8282

8383
this.commitFiles({
8484
"package.json": {

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"target": "ES2017",
77
"module": "CommonJS",
88
"moduleResolution": "Node",
9+
"declaration": true,
910
"lib": ["ES2017"],
1011
"allowJs": true,
1112
"outDir": "./lib",

yarn.lock

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@
975975
markdown-it-front-matter "^0.2.1"
976976
postcss "^7.0.32"
977977

978-
"@microsoft/task-scheduler@^2.7.0":
978+
"@microsoft/task-scheduler@^2.7.1":
979979
version "2.7.1"
980980
resolved "https://registry.yarnpkg.com/@microsoft/task-scheduler/-/task-scheduler-2.7.1.tgz#de2ebe6edb7ed882511051301f0e6f81732d7564"
981981
integrity sha512-xSmX7xgLTtf3LwVOW5HCEL4qrSWYCmPsVzpJ7PTBayN0KA9acScgsLYaDE6tE26N//DtDEW6mi4RteWU4XSrjA==
@@ -2263,15 +2263,17 @@ babel-plugin-dynamic-import-node@^2.3.0, babel-plugin-dynamic-import-node@^2.3.3
22632263
dependencies:
22642264
object.assign "^4.1.0"
22652265

2266-
backfill-cache@^5.2.3:
2267-
version "5.2.3"
2268-
resolved "https://registry.yarnpkg.com/backfill-cache/-/backfill-cache-5.2.3.tgz#826d1089f47c2147d1ae2ccb857ce5ee5f38706e"
2269-
integrity sha512-r5up3vTTgwazit0rd0aBNc2invV6SvftchSB/HZ0rhvcITy/63PNCMiWUKc6exGmm9b6XANfD67/tIh+SfYujA==
2266+
backfill-cache@^5.2.4:
2267+
version "5.2.4"
2268+
resolved "https://registry.yarnpkg.com/backfill-cache/-/backfill-cache-5.2.4.tgz#4354933df98fc878aa38e137dcdcdbe78b5bdf38"
2269+
integrity sha512-5Kbm8lU1BbImlgVV53fgaxEhHnaKRjWe9KCy47e2VLP7Fy2ZYCiRLD9H7YBYTws1AfDn5QRA/y/3924j6/Cnzg==
22702270
dependencies:
22712271
"@azure/storage-blob" "12.1.2"
2272+
"@rushstack/package-deps-hash" "^2.4.48"
22722273
backfill-config "^6.1.3"
22732274
backfill-logger "^5.1.3"
22742275
execa "^4.0.0"
2276+
find-up "^5.0.0"
22752277
fs-extra "^8.1.0"
22762278
globby "^11.0.0"
22772279
tar-fs "^2.1.0"
@@ -2315,13 +2317,13 @@ backfill-utils-dotenv@^5.1.1:
23152317
dotenv "^8.1.0"
23162318
find-up "^5.0.0"
23172319

2318-
backfill@^6.1.5:
2319-
version "6.1.5"
2320-
resolved "https://registry.yarnpkg.com/backfill/-/backfill-6.1.5.tgz#02e72fce0a667dfd2ab2360160efb53dca595919"
2321-
integrity sha512-RT5Y8IzZqB0rdUgVViABZwl8ksi4S5g4bmQcsMKxtL/GHk4XZI+aducWPNXNj8Fn+5umVN/qkRw2XbylaTQXmQ==
2320+
backfill@^6.1.6:
2321+
version "6.1.6"
2322+
resolved "https://registry.yarnpkg.com/backfill/-/backfill-6.1.6.tgz#52e2f8f80b1cd33b5bdb0f18202c11dcb54011e3"
2323+
integrity sha512-JbYlY6OkWpLFDUdGuiR4vqab/3MCzy9Pi0olN6h2wZFOn87ZG3LjN2ot26CMEezIYTbC+UonjQm/wrU163CyVg==
23222324
dependencies:
23232325
anymatch "^3.0.3"
2324-
backfill-cache "^5.2.3"
2326+
backfill-cache "^5.2.4"
23252327
backfill-config "^6.1.3"
23262328
backfill-hasher "^6.2.4"
23272329
backfill-logger "^5.1.3"
@@ -2377,10 +2379,10 @@ bcrypt-pbkdf@^1.0.0:
23772379
dependencies:
23782380
tweetnacl "^0.14.3"
23792381

2380-
beachball@^2.2.0:
2381-
version "2.2.0"
2382-
resolved "https://registry.yarnpkg.com/beachball/-/beachball-2.2.0.tgz#5b74cc1a01097a24a4f683f3608368b26f6a2174"
2383-
integrity sha512-2cell9HViD9navg+txbnOybmL7hbpdZBRcx930Gv/92ZyqAmIr7gHTsyZv90tzkeYvUh+xDZGbEBGddLF1QOUg==
2382+
beachball@^2.6.1:
2383+
version "2.6.1"
2384+
resolved "https://registry.yarnpkg.com/beachball/-/beachball-2.6.1.tgz#0f48a08fbeb965a643c3b5c3c224d08c6d67ce84"
2385+
integrity sha512-+vUTrIPGpSUVHCl2WbNP9+cOG6UAFlm15Nbvu1onuob0DqqLvCF4nzPTR3ZFFsq+mkbS3NG4iIk8YiYSo+wiIQ==
23842386
dependencies:
23852387
cosmiconfig "^6.0.0"
23862388
execa "^4.0.3"
@@ -2394,7 +2396,7 @@ beachball@^2.2.0:
23942396
semver "^6.1.1"
23952397
toposort "^2.0.2"
23962398
uuid "^8.3.1"
2397-
workspace-tools "^0.14.0"
2399+
workspace-tools "^0.16.2"
23982400
yargs-parser "^20.2.4"
23992401

24002402
big.js@^3.1.3:
@@ -12153,10 +12155,10 @@ worker-farm@^1.7.0:
1215312155
dependencies:
1215412156
errno "~0.1.7"
1215512157

12156-
workspace-tools@^0.14.0:
12157-
version "0.14.1"
12158-
resolved "https://registry.yarnpkg.com/workspace-tools/-/workspace-tools-0.14.1.tgz#db65c5e01d93021520634a0f4501b95457a9a436"
12159-
integrity sha512-39eUegRij7gXmlxo9S/x8p1Bv5MDjCJmj/1ERwD8epQM5DM3kWZFJhpuq9m5kcL1qT6ny02GgRbIyr4whsX+kQ==
12158+
workspace-tools@^0.15.0:
12159+
version "0.15.0"
12160+
resolved "https://registry.yarnpkg.com/workspace-tools/-/workspace-tools-0.15.0.tgz#8710f6151b21ab4382a5230d752e8b822ea24d16"
12161+
integrity sha512-KYSEKdqRJC3moABdCho03nSK4H9oqb6KtvGusGi5giR5oV1LilCRqem7STLRsZlnTJVTATv4nHnnioB+wSleDA==
1216012162
dependencies:
1216112163
"@pnpm/lockfile-file" "^3.0.7"
1216212164
"@pnpm/logger" "^3.2.2"
@@ -12170,13 +12172,11 @@ workspace-tools@^0.14.0:
1217012172
multimatch "^4.0.0"
1217112173
read-yaml-file "^2.0.0"
1217212174

12173-
workspace-tools@^0.15.0:
12174-
version "0.15.0"
12175-
resolved "https://registry.yarnpkg.com/workspace-tools/-/workspace-tools-0.15.0.tgz#8710f6151b21ab4382a5230d752e8b822ea24d16"
12176-
integrity sha512-KYSEKdqRJC3moABdCho03nSK4H9oqb6KtvGusGi5giR5oV1LilCRqem7STLRsZlnTJVTATv4nHnnioB+wSleDA==
12175+
workspace-tools@^0.16.2:
12176+
version "0.16.2"
12177+
resolved "https://registry.yarnpkg.com/workspace-tools/-/workspace-tools-0.16.2.tgz#b7355c811dcda648d12e92ceb89f8fccacca3901"
12178+
integrity sha512-Z/NHo4t39DUd50MdWiPfxICyVaCjWZc/xwZxE4a/n2nAQGgeYeg6GWBY1juULPi/BGSrjSVaDQfDCj/Y80033A==
1217712179
dependencies:
12178-
"@pnpm/lockfile-file" "^3.0.7"
12179-
"@pnpm/logger" "^3.2.2"
1218012180
"@yarnpkg/lockfile" "^1.1.0"
1218112181
find-up "^4.1.0"
1218212182
find-yarn-workspace-root "^1.2.1"

0 commit comments

Comments
 (0)