-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improve Monorepo package detection by using @rnx-kit/tools-wor…
…kspaces for node_modules search, use stricli instead of commander to improve type safety for CLI, cursor improved my README.md
- Loading branch information
Showing
21 changed files
with
177 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { buildApplication, buildCommand } from "@stricli/core"; | ||
import { description, name, version } from "../../package.json"; | ||
|
||
const command = buildCommand({ | ||
loader: async () => import("./impl"), | ||
parameters: { | ||
flags: { | ||
debug: { | ||
kind: "boolean", | ||
brief: "output debugging info", | ||
default: false, | ||
}, | ||
}, | ||
}, | ||
docs: { | ||
brief: description, | ||
}, | ||
}); | ||
|
||
export const app = buildApplication(command, { | ||
name, | ||
versionInfo: { | ||
currentVersion: version, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env node | ||
import { proposeCompletions } from "@stricli/core"; | ||
import { app } from "../app"; | ||
import { buildContext } from "../context"; | ||
|
||
const inputs = process.argv.slice(3); | ||
// biome-ignore lint/complexity/useLiteralKeys: <explanation> | ||
if (process.env["COMP_LINE"]?.endsWith(" ")) { | ||
inputs.push(""); | ||
} | ||
await proposeCompletions(app, inputs, buildContext(process)); | ||
try { | ||
for (const { completion } of await proposeCompletions(app, inputs, buildContext(process))) { | ||
process.stdout.write(`${completion}\n`); | ||
} | ||
} catch { | ||
// ignore | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env node | ||
import { run } from "@stricli/core"; | ||
import { app } from "../app"; | ||
import { buildContext } from "../context"; | ||
|
||
await run(app, process.argv.slice(2), buildContext(process)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import fs from "node:fs"; | ||
import os from "node:os"; | ||
import path from "node:path"; | ||
import type { StricliAutoCompleteContext } from "@stricli/auto-complete"; | ||
import type { CommandContext } from "@stricli/core"; | ||
|
||
export interface LocalContext extends CommandContext, StricliAutoCompleteContext { | ||
readonly process: NodeJS.Process; | ||
} | ||
|
||
export function buildContext(process: NodeJS.Process): LocalContext { | ||
return { | ||
process, | ||
os, | ||
fs, | ||
path, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { listConfigPlugins } from "../listConfigPlugins"; | ||
import type { LocalContext } from "./context"; | ||
|
||
export interface CommandFlags { | ||
readonly debug: boolean; | ||
} | ||
|
||
export default async function (this: LocalContext, flags: CommandFlags): Promise<void> { | ||
listConfigPlugins(flags); | ||
} |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/detectionHelpers.ts → src/configPlugin/detectionHelpers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { findWorkspacePackagesSync, findWorkspaceRootSync } from "@rnx-kit/tools-workspaces"; | ||
|
||
export const nodeModulesFolders = [findWorkspaceRootSync(), ...findWorkspacePackagesSync()] | ||
.filter(Boolean) | ||
.map((path) => `${path}/node_modules`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import "@total-typescript/ts-reset"; | ||
|
||
declare namespace NodeJS { | ||
interface ProcessEnv { | ||
COMP_LINE: string | undefined; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
import { defineConfig } from "tsup"; | ||
|
||
export default defineConfig({ | ||
entry: ["src/bin.ts"], | ||
entry: ["src/cli/bin/cli.ts", "src/cli/bin/bash-complete.ts"], | ||
format: ["esm"], | ||
dts: false, | ||
define: { | ||
__VERSION__: JSON.stringify(process.env.npm_package_version), | ||
}, | ||
outDir: "dist", | ||
clean: true, | ||
}); |