Skip to content
Permalink
Browse files

fix: make the version lookup more resilient to install strategy

  • Loading branch information
MarshallOfSound committed May 23, 2019
1 parent 49bf7a1 commit 068c2f81a50b6ca85c209ab6a18ed91f7e0b3d73
@@ -2,14 +2,15 @@ import { api } from '@electron-forge/core';

import fs from 'fs-extra';
import program from 'commander';
import path from 'path';

import './util/terminate';
import workingDir from './util/working-dir';

(async () => {
let dir = process.cwd();
program
.version((await fs.readJson('../package.json')).version)
.version((await fs.readJson(path.resolve(__dirname, '../package.json'))).version)
.arguments('[name]')
.action((name) => { dir = workingDir(dir, name, false); })
.parse(process.argv);
@@ -2,14 +2,15 @@ import { api, InitOptions } from '@electron-forge/core';

import fs from 'fs-extra';
import program from 'commander';
import path from 'path';

import './util/terminate';
import workingDir from './util/working-dir';

(async () => {
let dir = process.cwd();
program
.version((await fs.readJson('../package.json')).version)
.version((await fs.readJson(path.resolve(__dirname, '../package.json'))).version)
.arguments('[name]')
.option('-t, --template [name]', 'Name of the forge template to use')
.option('-c, --copy-ci-files', 'Whether to copy the templated CI files (defaults to false)', false)
@@ -3,14 +3,15 @@ import { api, InstallAsset } from '@electron-forge/core';
import fs from 'fs-extra';
import inquirer from 'inquirer';
import program from 'commander';
import path from 'path';

import './util/terminate';

(async () => {
let repo!: string;

program
.version((await fs.readJson('../package.json')).version)
.version((await fs.readJson(path.resolve(__dirname, '../package.json'))).version)
.arguments('[repository]')
.option('--prerelease', 'Fetch prerelease versions')
.action((repository) => { repo = repository; })
@@ -2,14 +2,15 @@ import { api } from '@electron-forge/core';

import fs from 'fs-extra';
import program from 'commander';
import path from 'path';

import './util/terminate';
import workingDir from './util/working-dir';

(async () => {
let dir = process.cwd();
program
.version((await fs.readJson('../package.json')).version)
.version((await fs.readJson(path.resolve(__dirname, '../package.json'))).version)
.arguments('[cwd]')
.action((cwd) => { dir = workingDir(dir, cwd); })
.parse(process.argv);
@@ -2,6 +2,7 @@ import { api, MakeOptions } from '@electron-forge/core';

import fs from 'fs-extra';
import program from 'commander';
import path from 'path';

import './util/terminate';
import workingDir from './util/working-dir';
@@ -10,7 +11,7 @@ import workingDir from './util/working-dir';
export async function getMakeOptions() {
let dir = process.cwd();
program
.version((await fs.readJson('../package.json')).version)
.version((await fs.readJson(path.resolve(__dirname, '../package.json'))).version)
.arguments('[cwd]')
.option('--skip-package', 'Assume the app is already packaged')
.option('-a, --arch [arch]', 'Target architecture')
@@ -2,14 +2,15 @@ import { api, PackageOptions } from '@electron-forge/core';

import fs from 'fs-extra';
import program from 'commander';
import path from 'path';

import './util/terminate';
import workingDir from './util/working-dir';

(async () => {
let dir: string = process.cwd();
program
.version((await fs.readJson('../package.json')).version)
.version((await fs.readJson(path.resolve(__dirname, '../package.json'))).version)
.arguments('[cwd]')
.option('-a, --arch [arch]', 'Target architecture')
.option('-p, --platform [platform]', 'Target build platform')
@@ -2,6 +2,7 @@ import { api, PublishOptions } from '@electron-forge/core';

import fs from 'fs-extra';
import program from 'commander';
import path from 'path';

import './util/terminate';
import workingDir from './util/working-dir';
@@ -10,7 +11,7 @@ import { getMakeOptions } from './electron-forge-make';
(async () => {
let dir = process.cwd();
program
.version((await fs.readJson('../package.json')).version)
.version((await fs.readJson(path.resolve(__dirname, '../package.json'))).version)
.arguments('[cwd]')
.option('--target [target[,target...]]', 'The comma-separated deployment targets, defaults to "github"')
.option('--dry-run', 'Triggers a publish dry run which saves state and doesn\'t upload anything')
@@ -3,6 +3,7 @@ import { api, StartOptions } from '@electron-forge/core';
import { ChildProcess } from 'child_process';
import fs from 'fs-extra';
import program from 'commander';
import path from 'path';

import './util/terminate';
import workingDir from './util/working-dir';
@@ -19,7 +20,7 @@ import workingDir from './util/working-dir';

let dir = process.cwd();
program
.version((await fs.readJson('../package.json')).version)
.version((await fs.readJson(path.resolve(__dirname, '../package.json'))).version)
.arguments('[cwd]')
.option('-p, --app-path <path>', 'Override the path to the Electron app to launch (defaults to \'.\')')
.option('-l, --enable-logging', 'Enable advanced logging. This will log internal Electron things')

0 comments on commit 068c2f8

Please sign in to comment.
You can’t perform that action at this time.