Skip to content

Commit

Permalink
pass extraFileSpecs
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Mar 26, 2016
1 parent 762cbc0 commit 8f76c91
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 40 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electron-winstaller",
"version": "2.0.5",
"name": "electron-winstaller-fixed",
"version": "2.0.6-beta.4",
"description": "Module to generate Windows installers for Electron apps",
"main": "./lib/index.js",
"license": "MIT",
Expand All @@ -19,7 +19,6 @@
"debug": "^2.2.0",
"fs-extra": "^0.26.7",
"fs-jetpack": "^0.7.3",
"lodash.template": "^4.2.2",
"temp": "^0.8.3"
},
"devDependencies": {
Expand Down
40 changes: 28 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import template from 'lodash.template';
import spawn from './spawn-promise';
import asar from 'asar';
import path from 'path';
Expand Down Expand Up @@ -117,21 +116,38 @@ export async function createWindowsInstaller(options) {
}
}

metadata.owners = metadata.owners || metadata.authors;
metadata.version = convertVersion(metadata.version);
metadata.copyright = metadata.copyright ||
const copyright = metadata.copyright ||
`Copyright © ${new Date().getFullYear()} ${metadata.authors || metadata.owners}`;

let templateData = await jetpack.readAsync(path.join(__dirname, '..', 'template.nuspec'));
if (path.sep === '/') {
templateData = templateData.replace(/\\/g, '/');
}
const nuspecContent = template(templateData)(metadata);

const nuspecContent = `<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>${metadata.name}</id>
<title>${metadata.title}</title>
<version>${convertVersion(metadata.version)}</version>
<authors>${metadata.authors || metadata.owners}</authors>
<owners>${metadata.owners || metadata.authors}</owners>
<iconUrl>${metadata.iconUrl}</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>${metadata}</description>
<copyright>${copyright}</copyright>
</metadata>
<files>
<file src="locales${path.sep}**" target="lib\\net45\\locales" />
<file src="resources${path.sep}**" target="lib\\net45\\resources" />
<file src="*.bin" target="lib\\net45" />
<file src="*.dll" target="lib\\net45" />
<file src="*.pak" target="lib\\net45" />
<file src="Update.exe" target="lib\\net45\\squirrel.exe" />
<file src="icudtl.dat" target="lib\\net45\\icudtl.dat" />
<file src="LICENSE" target="lib\\net45\\LICENSE" />
<file src="${metadata.exe}" target="lib\\net45\\${metadata.exe}" />${metadata.extraFileSpecs || ''}
</files>
</package>`;
d(`Created NuSpec file:\n${nuspecContent}`);

let nugetOutput = await createTempDir('si-');
let targetNuspecPath = path.join(nugetOutput, metadata.name + '.nuspec');
const nugetOutput = await createTempDir('si-');
const targetNuspecPath = path.join(nugetOutput, metadata.name + '.nuspec');
await jetpack.writeAsync(targetNuspecPath, nuspecContent);

let cmd = path.join(vendorPath, 'nuget.exe');
Expand Down
25 changes: 0 additions & 25 deletions template.nuspec

This file was deleted.

0 comments on commit 8f76c91

Please sign in to comment.