Skip to content

Commit

Permalink
fix: use workaround to re-export chalk
Browse files Browse the repository at this point in the history
  • Loading branch information
mkvlrn committed Sep 5, 2024
1 parent 8e3acbc commit 0d0f347
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 29 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"type": "module",
"bin": {
"mkvlrn-ts-new": "dist/main.js"
"mkvlrn-newts": "dist/main.js"
},
"engines": {
"node": ">=20"
Expand All @@ -27,7 +27,7 @@
"scripts": {
"test": "vitest --run",
"test:cov": "rm -rf coverage && vitest run --coverage",
"dev": "node --import tsx src/index.ts",
"dev": "node --import tsx src/main.ts",
"lint": "eslint --fix src tests",
"format": "prettier --write src tests",
"build": "rm -rf dist && node --import tsx esbuild.config.ts",
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @mkvlrn/ts-new
# @mkvlrn/newts

This is a _very_ _VERY_ **VERY** opinionated CLI tool for the setup of a TypeScript project in pure Node.js, NestJS, Vite (for a React SPA), and Next.js, with a focus on code quality and consistency.
This is a _very_ _VERY_ **VERY** opinionated CLI tool and set of templatesfor the setup of a TypeScript project in pure Node.js, NestJS, Vite (for a React SPA), and Next.js, with a focus on code quality and consistency.

It attempts to provide a minimalistic setup with modern tools and practices without bloat - but bloat means different things to different people, so your mileage may vary.

Expand All @@ -12,7 +12,7 @@ It attempts to provide a minimalistic setup with modern tools and practices with

## usage

Usage is as follows: `npx --yes @mkvlrn/ts-new@latest`. The CLI is interactive.
Usage is as follows: `npx --yes @mkvlrn/newts@latest`. The CLI is interactive.

The `--yes` flag is used to skip the npx confirmation prompt, and the `@latest` tag is used to ensure you are always getting the latest version of the tool.

Expand Down
2 changes: 2 additions & 0 deletions src/lib/misc/chalk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// TODO: remove this when chalk mantainers decide to do esm the right way
export { default as chalk } from "chalk";
4 changes: 1 addition & 3 deletions src/lib/prompts/confirmation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { select } from "@inquirer/prompts";
// TODO: remove this when chalk mantainers decide to do esm the right way
// eslint-disable-next-line import/default
import chalk from "chalk";
import { chalk } from "~/lib/misc/chalk.js";
import type { PackageManager } from "~/types.js";

export function promptConfirmation(
Expand Down
4 changes: 1 addition & 3 deletions src/lib/prompts/git-init.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { select } from "@inquirer/prompts";
// TODO: remove this when chalk mantainers decide to do esm the right way
// eslint-disable-next-line import/default
import chalk from "chalk";
import { chalk } from "~/lib/misc/chalk.js";

export async function promptGitInit() {
return select({
Expand Down
4 changes: 1 addition & 3 deletions src/lib/prompts/install-packages.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { select } from "@inquirer/prompts";
// TODO: remove this when chalk mantainers decide to do esm the right way
// eslint-disable-next-line import/default
import chalk from "chalk";
import { chalk } from "~/lib/misc/chalk.js";

export function promptInstallPackages() {
return select({
Expand Down
4 changes: 1 addition & 3 deletions src/lib/prompts/package-manager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { select } from "@inquirer/prompts";
// TODO: remove this when chalk mantainers decide to do esm the right way
// eslint-disable-next-line import/default
import chalk from "chalk";
import { chalk } from "~/lib/misc/chalk.js";
import type { PackageManager } from "~/types.js";

export function promptPackageManager(availablePackageManagers: PackageManager[]) {
Expand Down
4 changes: 1 addition & 3 deletions src/lib/prompts/project-name.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { access } from "node:fs/promises";
import { input } from "@inquirer/prompts";
// TODO: remove this when chalk mantainers decide to do esm the right way
// eslint-disable-next-line import/default
import chalk from "chalk";
import { chalk } from "~/lib/misc/chalk.js";

export async function promptProjectName() {
return input({
Expand Down
4 changes: 1 addition & 3 deletions src/lib/prompts/project-type.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { select } from "@inquirer/prompts";
// TODO: remove this when chalk mantainers decide to do esm the right way
// eslint-disable-next-line import/default
import chalk from "chalk";
import { chalk } from "~/lib/misc/chalk.js";
import type { GithubRepoResponse } from "~/types.js";

export function promptProjectType(templateList: GithubRepoResponse[]) {
Expand Down
4 changes: 1 addition & 3 deletions src/lib/system/say-goodbye.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// TODO: remove this when chalk mantainers decide to do esm the right way
// eslint-disable-next-line import/default
import chalk from "chalk";
import { chalk } from "~/lib/misc/chalk.js";

export function sayGoodbye(projectPath: string | false | null = null): void {
if (projectPath === null) {
Expand Down
4 changes: 1 addition & 3 deletions src/lib/system/say-hello.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { readFile } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
// TODO: remove this when chalk mantainers decide to do esm the right way
// eslint-disable-next-line import/default
import chalk from "chalk";
import { chalk } from "~/lib/misc/chalk.js";

export async function sayHello(): Promise<void> {
const packageDirectory = path.resolve(
Expand Down

0 comments on commit 0d0f347

Please sign in to comment.