Skip to content

Commit faabbfb

Browse files
committedJun 5, 2019
chore(refactor): use all utils from the root file in generators
use all utils from root file in generators
1 parent 1b49075 commit faabbfb

File tree

4 files changed

+40
-9
lines changed

4 files changed

+40
-9
lines changed
 

‎packages/generators/__tests__/add-generator.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { generatePluginName } from "../utils/plugins";
1+
import { generatePluginName } from "../utils";
22

33
describe("generatePluginName", () => {
44
it("should return webpack Standard Plugin Name for Name : extract-text-webpack-plugin", () => {

‎packages/generators/add-generator.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import PROP_TYPES from "@webpack-cli/utils/prop-types";
1010
import { AutoComplete, Confirm, Input, List } from "@webpack-cli/webpack-scaffold";
1111

1212
import { SchemaProperties, WebpackOptions } from "./types";
13-
import entryQuestions from "./utils/entry";
14-
import { generatePluginName } from "./utils/plugins";
13+
import { entryQuestions, generatePluginName } from "./utils";
1514
import * as webpackDevServerSchema from "webpack-dev-server/lib/options.json";
1615
import * as webpackSchema from "./utils/optionsSchema.json";
16+
1717
const PROPS: string[] = Array.from(PROP_TYPES.keys());
1818

1919
/**

‎packages/generators/init-generator.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@ import * as path from "path";
66
import { getPackageManager } from "@webpack-cli/utils/package-manager";
77
import { Confirm, Input, List } from "@webpack-cli/webpack-scaffold";
88

9-
import { getDefaultOptimization } from "./utils/webpackConfig";
9+
import {
10+
getDefaultOptimization,
11+
LangType,
12+
langQuestionHandler,
13+
tooltip,
14+
generatePluginName,
15+
Loader,
16+
StylingType,
17+
styleQuestionHandler,
18+
entryQuestions
19+
} from "./utils";
1020
import { WebpackOptions } from "./types";
11-
import entryQuestions from "./utils/entry";
12-
import langQuestionHandler, { LangType } from "./utils/languageSupport";
13-
import styleQuestionHandler, { Loader, StylingType } from "./utils/styleSupport";
14-
import tooltip from "./utils/tooltip";
15-
import { generatePluginName } from "./utils/plugins";
1621

1722
/**
1823
*

‎packages/generators/utils/index.ts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import entryQuestions from './entry'
2+
import langQuestionHandler, { LangType, getBabelLoader, getTypescriptLoader } from "./languageSupport";
3+
import plugins , { replaceAt, generatePluginName } from './plugins'
4+
import styleQuestionHandler, { StylingType, LoaderName, StyleRegex, Loader } from './styleSupport'
5+
import tooltip from "./tooltip";
6+
import validate from './validate'
7+
import { getDefaultOptimization } from './webpackConfig';
8+
9+
export {
10+
entryQuestions,
11+
langQuestionHandler,
12+
LangType,
13+
getBabelLoader,
14+
getTypescriptLoader,
15+
plugins,
16+
replaceAt,
17+
generatePluginName,
18+
styleQuestionHandler,
19+
StylingType,
20+
LoaderName,
21+
StyleRegex,
22+
Loader,
23+
tooltip,
24+
validate,
25+
getDefaultOptimization
26+
};

0 commit comments

Comments
 (0)
Please sign in to comment.