Skip to content

Commit

Permalink
chore(refactor): use all utils from the root file in generators
Browse files Browse the repository at this point in the history
use all utils from root file in generators
  • Loading branch information
anshumanv committed Jun 5, 2019
1 parent 1b49075 commit faabbfb
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/generators/__tests__/add-generator.test.ts
@@ -1,4 +1,4 @@
import { generatePluginName } from "../utils/plugins";
import { generatePluginName } from "../utils";

describe("generatePluginName", () => {
it("should return webpack Standard Plugin Name for Name : extract-text-webpack-plugin", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/generators/add-generator.ts
Expand Up @@ -10,10 +10,10 @@ import PROP_TYPES from "@webpack-cli/utils/prop-types";
import { AutoComplete, Confirm, Input, List } from "@webpack-cli/webpack-scaffold";

import { SchemaProperties, WebpackOptions } from "./types";
import entryQuestions from "./utils/entry";
import { generatePluginName } from "./utils/plugins";
import { entryQuestions, generatePluginName } from "./utils";
import * as webpackDevServerSchema from "webpack-dev-server/lib/options.json";
import * as webpackSchema from "./utils/optionsSchema.json";

const PROPS: string[] = Array.from(PROP_TYPES.keys());

/**
Expand Down
17 changes: 11 additions & 6 deletions packages/generators/init-generator.ts
Expand Up @@ -6,13 +6,18 @@ import * as path from "path";
import { getPackageManager } from "@webpack-cli/utils/package-manager";
import { Confirm, Input, List } from "@webpack-cli/webpack-scaffold";

import { getDefaultOptimization } from "./utils/webpackConfig";
import {
getDefaultOptimization,
LangType,
langQuestionHandler,
tooltip,
generatePluginName,
Loader,
StylingType,
styleQuestionHandler,
entryQuestions
} from "./utils";
import { WebpackOptions } from "./types";
import entryQuestions from "./utils/entry";
import langQuestionHandler, { LangType } from "./utils/languageSupport";
import styleQuestionHandler, { Loader, StylingType } from "./utils/styleSupport";
import tooltip from "./utils/tooltip";
import { generatePluginName } from "./utils/plugins";

/**
*
Expand Down
26 changes: 26 additions & 0 deletions packages/generators/utils/index.ts
@@ -0,0 +1,26 @@
import entryQuestions from './entry'
import langQuestionHandler, { LangType, getBabelLoader, getTypescriptLoader } from "./languageSupport";
import plugins , { replaceAt, generatePluginName } from './plugins'
import styleQuestionHandler, { StylingType, LoaderName, StyleRegex, Loader } from './styleSupport'
import tooltip from "./tooltip";
import validate from './validate'
import { getDefaultOptimization } from './webpackConfig';

export {
entryQuestions,
langQuestionHandler,
LangType,
getBabelLoader,
getTypescriptLoader,
plugins,
replaceAt,
generatePluginName,
styleQuestionHandler,
StylingType,
LoaderName,
StyleRegex,
Loader,
tooltip,
validate,
getDefaultOptimization
};

0 comments on commit faabbfb

Please sign in to comment.