Ensure pnpm dlx isn't used
This commit is contained in:
@ -3,11 +3,14 @@
|
|||||||
import { termost } from "termost";
|
import { termost } from "termost";
|
||||||
import { readThisNpmPackageVersion } from "./tools/readThisNpmPackageVersion";
|
import { readThisNpmPackageVersion } from "./tools/readThisNpmPackageVersion";
|
||||||
import * as child_process from "child_process";
|
import * as child_process from "child_process";
|
||||||
|
import { assertNoPnpmDlx } from "./tools/assertNoPnpmDlx";
|
||||||
|
|
||||||
export type CliCommandOptions = {
|
export type CliCommandOptions = {
|
||||||
projectDirPath: string | undefined;
|
projectDirPath: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
assertNoPnpmDlx();
|
||||||
|
|
||||||
const program = termost<CliCommandOptions>(
|
const program = termost<CliCommandOptions>(
|
||||||
{
|
{
|
||||||
name: "keycloakify",
|
name: "keycloakify",
|
||||||
|
15
src/bin/tools/assertNoPnpmDlx.ts
Normal file
15
src/bin/tools/assertNoPnpmDlx.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { sep as pathSep } from "path";
|
||||||
|
import chalk from "chalk";
|
||||||
|
|
||||||
|
export function assertNoPnpmDlx() {
|
||||||
|
if (__dirname.includes(`${pathSep}pnpm${pathSep}dlx${pathSep}`)) {
|
||||||
|
console.log(
|
||||||
|
[
|
||||||
|
chalk.red("Please don't use `pnpm dlx keycloakify`"),
|
||||||
|
"\nUse `npx keycloakify` or `pnpm exec keycloakify` instead since you want to use the keycloakify",
|
||||||
|
"version that is installed in your project and not the latest version on NPM."
|
||||||
|
].join(" ")
|
||||||
|
);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user