Skip to content

Commit

Permalink
chore(add-cmd): add typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvdutt committed Jul 4, 2018
1 parent 7f51c27 commit d730841
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 535 deletions.
768 changes: 256 additions & 512 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/add/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.js
2 changes: 2 additions & 0 deletions packages/add/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tsconfig.json
*.ts
23 changes: 0 additions & 23 deletions packages/add/index.js

This file was deleted.

23 changes: 23 additions & 0 deletions packages/add/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import defaultGenerator from "@webpack-cli/generators/add-generator";
import modifyConfigHelper from "@webpack-cli/utils/modify-config-helper";

/**
* Is called and returns a scaffolding instance, adding properties
*
* @param {String[]} args - array of arguments such as
* @returns {Function} modifyConfigHelper - A helper function that uses the action
* we're given on a generator
*
*/

export default function add(...args: string[]): Function {
const DEFAULT_WEBPACK_CONFIG_FILENAME: string = "webpack.config.js";

const filePaths: string[] = args.slice(3);
let configFile: string = DEFAULT_WEBPACK_CONFIG_FILENAME;
if (filePaths.length) {
configFile = filePaths[0];
}

return modifyConfigHelper("add", defaultGenerator, configFile);
}
16 changes: 16 additions & 0 deletions packages/add/package-lock.json

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

7 changes: 7 additions & 0 deletions packages/add/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,12 @@
"dependencies": {
"@webpack-cli/generators": "^0.0.8",
"@webpack-cli/utils": "^0.0.8"
},
"devDependencies": {
"@types/node": "^10.3.6",
"typescript": "^2.9.2"
},
"scripts": {
"build": "tsc"
}
}
3 changes: 3 additions & 0 deletions packages/add/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}

0 comments on commit d730841

Please sign in to comment.