Skip to content

Commit

Permalink
fix: remove "Warning: homepage"
Browse files Browse the repository at this point in the history
Because normalize-package-data in any case add this field
  • Loading branch information
develar committed Jul 28, 2016
1 parent a807b17 commit 0fd6a3e
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@
"lodash.template": "^4.3.0",
"mime": "^1.3.4",
"minimatch": "^3.0.2",
"normalize-package-data": "^2.3.5",
"path-sort": "^0.1.0",
"plist": "^1.2.0",
"pretty-ms": "^2.1.0",
"progress": "^1.1.8",
"progress-stream": "^1.2.0",
"rcedit": "^0.5.1",
"read-package-json": "^2.0.4",
"sanitize-filename": "^1.6.0",
"semver": "^5.3.0",
"signcode-tf": "~0.7.5",
Expand Down
3 changes: 2 additions & 1 deletion src/install-app-deps.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#! /usr/bin/env node

import { computeDefaultAppDirectory, installDependencies, getElectronVersion, readPackageJson, use } from "./util/util"
import { computeDefaultAppDirectory, installDependencies, getElectronVersion, use } from "./util/util"
import { printErrorAndExit } from "./util/promise"
import * as path from "path"
import { Promise as BluebirdPromise } from "bluebird"
import { DevMetadata } from "./metadata"
import yargs = require("yargs")
import { readPackageJson } from "./util/readPackageJson"

//noinspection JSUnusedLocalSymbols
const __awaiter = require("./util/awaiter")
Expand Down
16 changes: 6 additions & 10 deletions src/packager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from "path"
import {
computeDefaultAppDirectory, installDependencies, getElectronVersion, readPackageJson, use,
exec, isEmptyOrSpaces
computeDefaultAppDirectory, installDependencies, getElectronVersion, use,
exec, isEmptyOrSpaces, statOrNull
} from "./util/util"
import { all, executeFinally } from "./util/promise"
import { EventEmitter } from "events"
Expand All @@ -17,6 +17,7 @@ import { warn, log } from "./util/log"
import { AppInfo } from "./appInfo"
import MacPackager from "./macPackager"
import { createTargets } from "./targets/targetFactory"
import { readPackageJson } from "./util/readPackageJson"

//noinspection JSUnusedLocalSymbols
const __awaiter = require("./util/awaiter")
Expand Down Expand Up @@ -172,11 +173,8 @@ export class Packager implements BuildInfo {
throw new Error(util.format(errorMessages.buildInAppSpecified, appPackageFile, devAppPackageFile))
}

if (this.devMetadata.homepage != null) {
warn("homepage in the development package.json is deprecated, please move to the application package.json")
}
if (this.devMetadata.license != null) {
warn("license in the development package.json is deprecated, please move to the application package.json")
warn(`license in the development package.json (${devAppPackageFile}) is deprecated, please move to the application package.json`)
}
}

Expand Down Expand Up @@ -207,13 +205,13 @@ export class Packager implements BuildInfo {
}
}

private installAppDependencies(platform: Platform, arch: Arch): Promise<any> {
private async installAppDependencies(platform: Platform, arch: Arch): Promise<any> {
if (this.isTwoPackageJsonProjectLayoutUsed) {
if (this.devMetadata.build.npmRebuild === false) {
log("Skip app dependencies rebuild because npmRebuild is set to false")
}
else if (platform.nodeName === process.platform) {
return installDependencies(this.appDir, this.electronVersion, Arch[arch], "rebuild")
await installDependencies(this.appDir, this.electronVersion, Arch[arch], (await statOrNull(path.join(this.appDir, "node_modules"))) == null ? "install" : "rebuild")
}
else {
log("Skip app dependencies rebuild because platform is different")
Expand All @@ -222,8 +220,6 @@ export class Packager implements BuildInfo {
else {
log("Skip app dependencies rebuild because dev and app dependencies are not separated")
}

return BluebirdPromise.resolve()
}
}

Expand Down
32 changes: 32 additions & 0 deletions src/util/readPackageJson.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as path from "path"
import { readJson, readFile } from "fs-extra-p"

//noinspection JSUnusedLocalSymbols
const __awaiter = require("./awaiter")

const normalizeData = require("normalize-package-data")

export async function readPackageJson(file: string): Promise<any> {
const data = await readJson(file)
await authors(file, data)
normalizeData(data)
return data
}

async function authors(file: string, data: any) {
if (data.contributors != null) {
return
}

let authorData: string | null = null
try {
authorData = await readFile(path.resolve(path.dirname(file), "AUTHORS"), "utf8")
}
catch (ignored) {
return
}

data.contributors = authorData
.split(/\r?\n/g)
.map(it => it.replace(/^\s*#.*$/, "").trim())
}
7 changes: 2 additions & 5 deletions src/util/util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { execFile, spawn as _spawn, ChildProcess, SpawnOptions } from "child_process"
import { Promise as BluebirdPromise } from "bluebird"
import readPackageJsonAsync = require("read-package-json")
import * as os from "os"
import { homedir } from "os"
import * as path from "path"
import { readJson, stat, Stats, unlink } from "fs-extra-p"
import { yellow, red } from "chalk"
Expand All @@ -17,10 +16,8 @@ export const debug7z = debugFactory("electron-builder:7z")

const DEFAULT_APP_DIR_NAMES = ["app", "www"]

export const readPackageJson = BluebirdPromise.promisify(readPackageJsonAsync)

export function installDependencies(appDir: string, electronVersion: string, arch: string = process.arch, command: string = "install"): BluebirdPromise<any> {
const gypHome = path.join(os.homedir(), ".electron-gyp")
const gypHome = path.join(homedir(), ".electron-gyp")
return task(`${(command === "install" ? "Installing" : "Rebuilding")} app dependencies for arch ${arch} to ${appDir}`, spawnNpmProduction(command, appDir, Object.assign({}, process.env, {
npm_config_disturl: "https://atom.io/download/atom-shell",
npm_config_target: electronVersion,
Expand Down

0 comments on commit 0fd6a3e

Please sign in to comment.