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 1, 2018
1 parent faeec57 commit fb98933
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 49 deletions.
12 changes: 6 additions & 6 deletions 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/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"
}
23 changes: 11 additions & 12 deletions packages/generators/package-lock.json

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

29 changes: 21 additions & 8 deletions packages/utils/package-lock.json

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

0 comments on commit fb98933

Please sign in to comment.