Skip to content

Commit

Permalink
fix: update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Jun 30, 2019
1 parent 941da90 commit 7553ae7
Showing 1 changed file with 17 additions and 25 deletions.
42 changes: 17 additions & 25 deletions packages/serve/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,6 @@ import * as path from "path";

import { processPromise } from "@webpack-cli/utils/resolve-packages";

/**
*
* Installs WDS using NPM with --save --dev etc
*
* @param {Object} cmd - arg to spawn with
* @returns {Void}
*/

/**
*
* Installs WDS using Yarn with add etc
*
* @param {Object} cmd - arg to spawn with
* @returns {Void}
*/

interface Commands {
dependency: string[];
devDependency: string[];
Expand All @@ -45,16 +29,24 @@ const pmConfig: PackageManagerConfig = {
}
};

/**
*
* Installs WDS using the respective package manager with add etc
*
* @param {String} pm - package manager to be used
* @param {String} cmd - arg to spawn with
* @returns {Function} spawn - installs WDS
*
* The dependency installation commands for the
* respective package manager is available as
* nested objects within pmConfig
*
* We gonna extract the root installation command
* and rest of the flags from pmConfig object
* by means of array destructuring
*/

const spawnWithArg = (pm: string, cmd: string): SpawnSyncReturns<Buffer> => {
/*
* The dependency installation commands for the
* respective package manager is available as
* nested objects within pmConfig
*
* We gonna extract the root installation command
* and rest of the flags from pmConfig object
* by means of array destructuring
*/
const [installCmd, ...flags] = pmConfig[pm][cmd];
const options: string[] = [installCmd, "webpack-dev-server", ...flags];
return spawn.sync(pm, options, { stdio: "inherit" });
Expand Down

0 comments on commit 7553ae7

Please sign in to comment.