Skip to content

Commit

Permalink
fix(create): fix commonjs import
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Jun 5, 2022
1 parent 536d1a5 commit be96c71
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/create/src/i18n.ts
@@ -1,4 +1,4 @@
import { prompt } from "inquirer";
import inquirer from "inquirer";

import { bin } from "./bin";

Expand Down Expand Up @@ -85,7 +85,7 @@ interface LanguageResult {
}

export const getLanguage = async (): Promise<LanguageResult> => {
const { language } = await prompt<{ language: Lang }>([
const { language } = await inquirer.prompt<{ language: Lang }>([
{
name: "language",
type: "list",
Expand Down
10 changes: 6 additions & 4 deletions packages/create/src/index.ts
@@ -1,17 +1,19 @@
#!/usr/bin/env node
import { cac } from "cac";
import { execaCommand, execaCommandSync } from "execa";
import { prompt } from "inquirer";
import inquirer from "inquirer";

import { bin } from "./bin";
import { getLanguage } from "./i18n";
import { createPackageJson } from "./packageJson";
import { getRegistry } from "./registry";
import { generateTemplate } from "./template";
// eslint-disable-next-line
// @ts-ignore
import pkg from "../package.json";

const cli = cac("vuepress-theme-hope");
// eslint-disable-next-line
const version = require("../package.json").version as string;
const version = pkg.version;

cli
.command("[dir]", "Generate a new vuepress-theme-hope project")
Expand Down Expand Up @@ -55,7 +57,7 @@ cli
* Open dev server
*/

const { choice } = await prompt<{ choice: boolean }>([
const { choice } = await inquirer.prompt<{ choice: boolean }>([
{
name: "choice",
type: "confirm",
Expand Down
4 changes: 2 additions & 2 deletions packages/create/src/packageJson.ts
@@ -1,5 +1,5 @@
import { existsSync, writeFileSync, readFileSync } from "fs";
import { prompt } from "inquirer";
import inquirer from "inquirer";
import { resolve } from "path";

import { checkForNextVersion } from "./checkVersion";
Expand Down Expand Up @@ -70,7 +70,7 @@ export const createPackageJson = async (
license: string;
}

const result = await prompt<PackageJsonAnswer>([
const result = await inquirer.prompt<PackageJsonAnswer>([
{
name: "name",
type: "input",
Expand Down
4 changes: 2 additions & 2 deletions packages/create/src/registry.ts
@@ -1,5 +1,5 @@
import { execaCommandSync } from "execa";
import { prompt } from "inquirer";
import inquirer from "inquirer";

import { bin } from "./bin";

Expand All @@ -18,7 +18,7 @@ export const getRegistry = async (lang: Lang): Promise<string> => {
const userRegistry = getUserRegistry();

if (lang === "简体中文") {
const { registry } = await prompt<RegistryAnswer>([
const { registry } = await inquirer.prompt<RegistryAnswer>([
{
name: "registry",
type: "list",
Expand Down
4 changes: 2 additions & 2 deletions packages/create/src/template.ts
@@ -1,5 +1,5 @@
import { existsSync, readFileSync, writeFileSync } from "fs";
import { prompt } from "inquirer";
import inquirer from "inquirer";
import { join, resolve } from "path";

import { bin } from "./bin";
Expand Down Expand Up @@ -89,7 +89,7 @@ export const generateTemplate = async (
lang: Lang,
message: CreateI18n
): Promise<void> => {
const { i18n, workflow } = await prompt<{
const { i18n, workflow } = await inquirer.prompt<{
i18n: boolean;
workflow: boolean;
}>([
Expand Down

0 comments on commit be96c71

Please sign in to comment.