-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: accept multiple default app dirs
www checked in addition to app. Closes #344
- Loading branch information
1 parent
9b043d6
commit ea5f842
Showing
13 changed files
with
170 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
#! /usr/bin/env node | ||
|
||
import { DEFAULT_APP_DIR_NAME, installDependencies, commonArgs, getElectronVersion, readPackageJson } from "./util" | ||
import { computeDefaultAppDirectory, installDependencies, getElectronVersion, readPackageJson, use } from "./util" | ||
import { printErrorAndExit } from "./promise" | ||
import * as path from "path" | ||
import cla = require("command-line-args") | ||
import { Promise as BluebirdPromise } from "bluebird" | ||
import { DevMetadata } from "./metadata"; | ||
|
||
//noinspection JSUnusedLocalSymbols | ||
const __awaiter = require("./awaiter") | ||
|
||
const args = cla(commonArgs.concat({ | ||
name: "arch", | ||
type: String, | ||
})).parse() | ||
const args = cla([{name: "arch", type: String}, {name: "appDir", type: String}]).parse() | ||
|
||
const devPackageFile = path.join(process.cwd(), "package.json") | ||
const appDir = args.appDir || DEFAULT_APP_DIR_NAME | ||
const projectDir = process.cwd() | ||
const devPackageFile = path.join(projectDir, "package.json") | ||
|
||
readPackageJson(devPackageFile) | ||
.then(async (it) => installDependencies(path.join(process.cwd(), appDir), await getElectronVersion(it, devPackageFile), args.arch)) | ||
.catch(printErrorAndExit) | ||
async function main() { | ||
const devMetadata: DevMetadata = await readPackageJson(devPackageFile) | ||
const results: Array<string> = await BluebirdPromise.all([ | ||
computeDefaultAppDirectory(projectDir, use(devMetadata.directories, it => it.app) || args.appDir), | ||
getElectronVersion(devMetadata, devPackageFile) | ||
]) | ||
|
||
await installDependencies(results[0], results[1], args.arch) | ||
} | ||
|
||
try { | ||
main() | ||
} | ||
catch (e) { | ||
printErrorAndExit(e) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.