Skip to content

Commit

Permalink
refactor: make const top level
Browse files Browse the repository at this point in the history
  • Loading branch information
lihbr committed May 27, 2021
1 parent 82dee62 commit d734832
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import latestVersion from "latest-version";
import semver from "semver";

import * as commands from "./commands";
import { logger, NAME, PACKAGE, ucFirst, VERSION } from "./lib";
import { NAME, PACKAGE, VERSION } from "./const";
import { logger, ucFirst } from "./lib";

const cli = cac(NAME);

Expand Down
3 changes: 2 additions & 1 deletion src/commands/default.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CAC } from "cac";
import exit from "exit";
import { logger, NAME } from "../lib";
import { NAME } from "../const";
import { logger } from "../lib";

export const _default = (cli: CAC, _: { [key: string]: never }): void => {
const command = cli.args.join(" ");
Expand Down
2 changes: 1 addition & 1 deletion src/commands/help.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chalk from "chalk";
import { PACKAGE, VERSION } from "../lib";
import { PACKAGE, VERSION } from "../const";

interface HelpSection {
title?: string;
Expand Down
5 changes: 2 additions & 3 deletions src/lib/const.ts → src/const.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import pkg from "../../package.json";
import pkg from "../package.json";

export const NAME = "dico";
export const PACKAGE = pkg.name;
export const DESCRIPTION = pkg.description;
export const VERSION = pkg.version;
export const RC_FILE = ".dicorc";
export const API_ENDPOINT = "http://localhost:3000/v1/cli";
// export const API_ENDPOINT = "https://api.dico.app/v1/cli";
export const API_ENDPOINT = "https://api.dico.app/v1/cli";
1 change: 0 additions & 1 deletion src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from "./const";
export * from "./logger";
export * from "./string";
2 changes: 1 addition & 1 deletion src/lib/logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import consola from "consola";
import { NAME } from "./const";
import { NAME } from "../const";

export const logger = consola.withScope(NAME);

0 comments on commit d734832

Please sign in to comment.