Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,20 @@ jobs:
with:
target: ${{ matrix.os == 'ubuntu-latest' && 'x86_64-unknown-linux-gnu' || matrix.os == 'windows-latest' && 'x86_64-pc-windows-msvc' || 'aarch64-apple-darwin' }}

- name: Check TypeScript types
if: ${{ matrix.os == 'ubuntu-latest' }}
run: pnpm tsgo

- name: Build CLI
run: |
pnpm build
pnpm bootstrap-cli:ci
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "$USERPROFILE\.vite-plus\bin" >> $GITHUB_PATH
else
echo "$HOME/.vite-plus/bin" >> $GITHUB_PATH
fi

- name: Check TypeScript types
if: ${{ matrix.os == 'ubuntu-latest' }}
run: pnpm tsgo

- name: Verify CLI installation
run: |
which vp
Expand Down
2 changes: 1 addition & 1 deletion packages/global/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
"picocolors": "catalog:"
},
"devDependencies": {
"@clack/prompts": "catalog:",
"@napi-rs/cli": "catalog:",
"@nkzw/safe-word-list": "catalog:",
"@oxc-node/core": "catalog:",
"@types/cross-spawn": "catalog:",
"@types/semver": "catalog:",
"@types/validate-npm-package-name": "catalog:",
"@voidzero-dev/vite-plus-prompts": "workspace:*",
"@voidzero-dev/vite-plus-tools": "workspace:",
"detect-indent": "catalog:",
"detect-newline": "catalog:",
Expand Down
4 changes: 2 additions & 2 deletions packages/global/src/create/bin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'node:path';
import { styleText } from 'node:util';

import * as prompts from '@clack/prompts';
import * as prompts from '@voidzero-dev/vite-plus-prompts';
import mri from 'mri';

import {
Expand Down Expand Up @@ -325,7 +325,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
message: 'Where should the new package be added to the monorepo:',
placeholder: 'e.g., packages/',
validate: (value) => {
return formatTargetDir(value).error;
return value ? formatTargetDir(value).error : 'Target directory is required';
},
});

Expand Down
10 changes: 5 additions & 5 deletions packages/global/src/create/prompts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'node:fs';
import path from 'node:path';

import * as prompts from '@clack/prompts';
import * as prompts from '@voidzero-dev/vite-plus-prompts';
import validateNpmPackageName from 'validate-npm-package-name';

import { accent } from '../utils/terminal.js';
Expand All @@ -20,15 +20,15 @@ export async function promptPackageNameAndTargetDir(
placeholder: defaultPackageName,
defaultValue: defaultPackageName,
validate: (value) => {
if (value.length === 0) {
if (value != null && value.length === 0) {
return;
}

const result = validateNpmPackageName(value);
if (result.validForNewPackages) {
const result = value ? validateNpmPackageName(value) : null;
if (result?.validForNewPackages) {
return;
}
return result.errors?.[0] ?? result.warnings?.[0] ?? 'Invalid package name';
return result?.errors?.[0] ?? result?.warnings?.[0] ?? 'Invalid package name';
},
});
if (prompts.isCancel(selected)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/global/src/create/templates/generator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'node:fs';
import path from 'node:path';

import * as prompts from '@clack/prompts';
import * as prompts from '@voidzero-dev/vite-plus-prompts';

import type { WorkspaceInfo } from '../../types/index.js';
import { editJsonFile } from '../../utils/json.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/global/src/create/templates/monorepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'node:assert';
import fs from 'node:fs';
import path from 'node:path';

import * as prompts from '@clack/prompts';
import * as prompts from '@voidzero-dev/vite-plus-prompts';
import spawn from 'cross-spawn';

import { rewriteMonorepoProject } from '../../migration/migrator.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/global/src/create/templates/remote.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as prompts from '@clack/prompts';
import * as prompts from '@voidzero-dev/vite-plus-prompts';
import colors from 'picocolors';

import type { WorkspaceInfo } from '../../types/index.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/global/src/local/bin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join } from 'node:path';
import { pathToFileURL } from 'node:url';

import * as prompts from '@clack/prompts';
import * as prompts from '@voidzero-dev/vite-plus-prompts';

import { detectWorkspace as detectWorkspaceBinding } from '../../binding/index.js';
import { runCommand } from '../utils/command.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/global/src/migration/bin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'node:path';
import { styleText } from 'node:util';

import * as prompts from '@clack/prompts';
import * as prompts from '@voidzero-dev/vite-plus-prompts';
import mri from 'mri';
import colors from 'picocolors';
import semver from 'semver';
Expand Down
2 changes: 1 addition & 1 deletion packages/global/src/migration/migrator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'node:fs';
import path from 'node:path';

import * as prompts from '@clack/prompts';
import * as prompts from '@voidzero-dev/vite-plus-prompts';
import semver from 'semver';
import { Scalar, YAMLMap, YAMLSeq } from 'yaml';

Expand Down
2 changes: 1 addition & 1 deletion packages/global/src/utils/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'node:fs';
import fsPromises from 'node:fs/promises';
import path from 'node:path';

import * as prompts from '@clack/prompts';
import * as prompts from '@voidzero-dev/vite-plus-prompts';

import { pkgRoot } from './path.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/global/src/utils/prompts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as prompts from '@clack/prompts';
import * as prompts from '@voidzero-dev/vite-plus-prompts';

import { downloadPackageManager as downloadPackageManagerBinding } from '../../binding/index.js';
import { PackageManager } from '../types/index.js';
Expand Down
13 changes: 13 additions & 0 deletions packages/prompts/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Forked from https://github.com/bombshell-dev/clack

Original License:

MIT License

Copyright (c) Nate Moore

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 changes: 28 additions & 0 deletions packages/prompts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@voidzero-dev/vite-plus-prompts",
"version": "0.0.0",
"files": [
"dist"
],
"type": "module",
"main": "./dist/index.mjs",
"types": "./dist/index.d.mts",
"exports": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"scripts": {
"build": "tsdown"
},
"dependencies": {
"@clack/core": "^1.0.0",
"picocolors": "^1.0.0",
"sisteransi": "^1.0.5"
},
"devDependencies": {
"fast-string-width": "^1.1.0",
"fast-wrap-ansi": "^0.1.3",
"is-unicode-supported": "^1.3.0",
"tsdown": "catalog:"
}
}
Loading
Loading