Skip to content

Commit

Permalink
feat(init): add typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvdutt committed Jun 21, 2018
1 parent 39a5123 commit 9699ba1
Show file tree
Hide file tree
Showing 12 changed files with 190 additions and 145 deletions.
77 changes: 42 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/generate-loader/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/generate-plugin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/init/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.js
2 changes: 2 additions & 0 deletions packages/init/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tsconfig.json
*.ts
16 changes: 7 additions & 9 deletions packages/init/index.js → packages/init/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
"use strict";

const npmPackagesExists = require("@webpack-cli/utils/npm-packages-exists");
const defaultGenerator = require("@webpack-cli/generators/init-generator");
const modifyConfigHelper = require("@webpack-cli/utils/modify-config-helper");
import defaultGenerator from "@webpack-cli/generators/init-generator";
import modifyConfigHelper from "@webpack-cli/utils/modify-config-helper";
import npmPackagesExists from "@webpack-cli/utils/npm-packages-exists";

/**
*
* First function to be called after running the init flag. This is a check,
* if we are running the init command with no arguments or if we got dependencies
*
* @param {Array} args - array of arguments such as
* @param {String[]} args - array of arguments such as
* packages included when running the init command
* @returns {Function} creator/npmPackagesExists - returns an installation of the package,
* followed up with a yeoman instance of that if there's packages. If not, it creates a defaultGenerator
*/

module.exports = function initializeInquirer(...args) {
const packages = args.slice(3);
export default function initializeInquirer(...args: string[]): Function {
const packages: string[] = args.slice(3);

if (packages.length === 0) {
return modifyConfigHelper("init", defaultGenerator);
}
return npmPackagesExists(packages);
};
}
94 changes: 0 additions & 94 deletions packages/init/init.js

This file was deleted.

Loading

0 comments on commit 9699ba1

Please sign in to comment.