Skip to content

Commit

Permalink
refactor(ts): import as type for all modules
Browse files Browse the repository at this point in the history
better ts processing
  • Loading branch information
hckhanh committed Dec 17, 2021
1 parent 2de0b0d commit f4a495c
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/actions/AddDependenciesAction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Packager } from "../packagers/Packager";
import type { Packager } from "../packagers/Packager";
import { Action } from "./Action";

export class AddDependenciesAction extends Action {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/CreateConfigsFileAction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Formatter } from "../formatters/Formatter";
import type { Formatter } from "../formatters/Formatter";
import { withCurrentDir, writeContentToFile } from "../process";
import { Action } from "./Action";

Expand Down
2 changes: 1 addition & 1 deletion src/actions/CreateYarn2ConfigsAction.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getChangesetBaseRefs, nonZeroInstalls, zeroInstalls } from "../configs";
import { removeFile, runCommand, withCurrentDir, writeContentToFile } from "../process";
import { InquirerConfigs } from "../types";
import type { InquirerConfigs } from "../types";
import { Action } from "./Action";

export class CreateYarn2ConfigsAction extends Action {
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/FormatterFactory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConfigsFileFormat } from "../types";
import type { ConfigsFileFormat } from "../types";
import { Formatter } from "./Formatter";
import { JsFormatter } from "./JsFormatter";
import { JsonFormatter } from "./JsonFormatter";
Expand Down
8 changes: 4 additions & 4 deletions src/generators/ESLintGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Action } from "../actions/Action";
import type { Action } from "../actions/Action";
import { AddDependenciesAction } from "../actions/AddDependenciesAction";
import { AddScriptsAction } from "../actions/AddScriptsAction";
import { CreateConfigsFileAction } from "../actions/CreateConfigsFileAction";
import { CreateFileAction } from "../actions/CreateFileAction";
import { eslintBaseConfigs, ignoreFiles } from "../configs";
import { Formatter } from "../formatters/Formatter";
import { Packager } from "../packagers/Packager";
import { InquirerConfigs } from "../types";
import type { Formatter } from "../formatters/Formatter";
import type { Packager } from "../packagers/Packager";
import type { InquirerConfigs } from "../types";
import { Generator } from "./Generator";

export class ESLintGenerator extends Generator {
Expand Down
8 changes: 4 additions & 4 deletions src/generators/FlowGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Action } from "../actions/Action";
import type { Action } from "../actions/Action";
import { AddDependenciesAction } from "../actions/AddDependenciesAction";
import { AddScriptsAction } from "../actions/AddScriptsAction";
import { CreateConfigsFileAction } from "../actions/CreateConfigsFileAction";
import { CreateFlowConfigsAction } from "../actions/CreateFlowConfigsAction";
import { flowConfigs } from "../configs";
import { Formatter } from "../formatters/Formatter";
import type { Formatter } from "../formatters/Formatter";
import { IniFormatter } from "../formatters/IniFormatter";
import { Packager } from "../packagers/Packager";
import { InquirerConfigs } from "../types";
import type { Packager } from "../packagers/Packager";
import type { InquirerConfigs } from "../types";
import { Generator } from "./Generator";

export class FlowGenerator extends Generator {
Expand Down
8 changes: 4 additions & 4 deletions src/generators/Generator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Action } from "../actions/Action";
import { Formatter } from "../formatters/Formatter";
import { Packager } from "../packagers/Packager";
import { InquirerConfigs } from "../types";
import type { Action } from "../actions/Action";
import type { Formatter } from "../formatters/Formatter";
import type { Packager } from "../packagers/Packager";
import type { InquirerConfigs } from "../types";

export abstract class Generator {
actions: Action[];
Expand Down
8 changes: 4 additions & 4 deletions src/generators/GeneratorFactory.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Formatter } from "../formatters/Formatter";
import { Packager } from "../packagers/Packager";
import { GeneratorType, InquirerConfigs } from "../types";
import type { Formatter } from "../formatters/Formatter";
import type { Packager } from "../packagers/Packager";
import type { GeneratorType, InquirerConfigs } from "../types";
import { ESLintGenerator } from "./ESLintGenerator";
import { FlowGenerator } from "./FlowGenerator";
import { Generator } from "./Generator";
import type { Generator } from "./Generator";
import { PostGenerator } from "./PostGenerator";
import { PrettierGenerator } from "./PrettierGenerator";
import { Yarn2Generator } from "./Yarn2Generator";
Expand Down
8 changes: 4 additions & 4 deletions src/generators/PostGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Action } from "../actions/Action";
import type { Action } from "../actions/Action";
import { CreateFileAction } from "../actions/CreateFileAction";
import { postIgnoreFiles } from "../configs";
import { Formatter } from "../formatters/Formatter";
import { Packager } from "../packagers/Packager";
import { InquirerConfigs } from "../types";
import type { Formatter } from "../formatters/Formatter";
import type { Packager } from "../packagers/Packager";
import type { InquirerConfigs } from "../types";
import { Generator } from "./Generator";

export class PostGenerator extends Generator {
Expand Down
8 changes: 4 additions & 4 deletions src/generators/PrettierGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Action } from "../actions/Action";
import type { Action } from "../actions/Action";
import { AddDependenciesAction } from "../actions/AddDependenciesAction";
import { AddScriptsAction } from "../actions/AddScriptsAction";
import { CreateConfigsFileAction } from "../actions/CreateConfigsFileAction";
import { CreateFileAction } from "../actions/CreateFileAction";
import { ignoreFiles, prettierConfigs, prettierGitAttributeConfigs } from "../configs";
import { Formatter } from "../formatters/Formatter";
import { Packager } from "../packagers/Packager";
import { InquirerConfigs } from "../types";
import type { Formatter } from "../formatters/Formatter";
import type { Packager } from "../packagers/Packager";
import type { InquirerConfigs } from "../types";
import { Generator } from "./Generator";

export class PrettierGenerator extends Generator {
Expand Down
6 changes: 3 additions & 3 deletions src/generators/Yarn2Generator.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Action } from "../actions/Action";
import type { Action } from "../actions/Action";
import { CreateFileAction } from "../actions/CreateFileAction";
import { CreateYarn2ConfigsAction } from "../actions/CreateYarn2ConfigsAction";
import { ignoreYarn2 } from "../configs";
import { Formatter } from "../formatters/Formatter";
import { InquirerConfigs } from "../types";
import type { Formatter } from "../formatters/Formatter";
import type { InquirerConfigs } from "../types";
import { Generator } from "./Generator";

export class Yarn2Generator extends Generator {
Expand Down
4 changes: 2 additions & 2 deletions src/packagers/PackagerFactory.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { detectYarnVersion } from "../checker";
import { PackagerType } from "../types";
import type { PackagerType } from "../types";
import { NpmPackager } from "./NpmPackager";
import { Packager } from "./Packager";
import type { Packager } from "./Packager";
import { Yarn2Packager } from "./Yarn2Packager";
import { YarnPackager } from "./YarnPackager";

Expand Down
4 changes: 2 additions & 2 deletions src/process.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChildProcessWithoutNullStreams } from "child_process";
import type { ChildProcessWithoutNullStreams } from "child_process";
import { spawn } from "cross-spawn";
import { readdir, readFile, rm, stat, writeFile } from "fs/promises";
import { Stats } from "node:fs";
import type { Stats } from "node:fs";
import { join } from "path";

export const currentDir = process.cwd();
Expand Down
2 changes: 1 addition & 1 deletion src/questions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { prompt } from "inquirer";
import { GeneratorType, InquirerConfigs } from "./types";
import type { GeneratorType, InquirerConfigs } from "./types";

export async function collectAnswers(): Promise<InquirerConfigs> {
const answers = await prompt<InquirerConfigs>([
Expand Down

0 comments on commit f4a495c

Please sign in to comment.