Skip to content

Commit

Permalink
Streamline build process
Browse files Browse the repository at this point in the history
- separate output files from the generating files (all generated files go in /build/out)
- call makensis from inside the build script instead of manually compiling the installer
  • Loading branch information
marcelklehr committed Nov 13, 2015
1 parent 2da9f3b commit 0e2bd74
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
15 changes: 4 additions & 11 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Building Nodist
# Building the Nodist installer

Moving forward as of 0.7.0 Nodist no longer installs like it had previously.

Now an installer is generated from the build process. This document is going
to overview the build process in the hope that it can then be scripted.
Now an installer is generated from the build process.

## Preparation

Expand All @@ -20,23 +19,17 @@ Before a build can be made the following software is needed.
* Extract ZIP File
* Copy `Plugin\AccessControl.dll` to `C:\Program Files x86\NSIS\Plugins\x86-ansi`
* Copy `Unicode\Plugin\AccessControl.dll` to `C:\Program Files x86\NSIS\Plugins\x86-unicode`
* Add C:\Program Files\NSIS to your PATH

## Build Process


First run the build script to prepare the installer for compilation.

```
$ cd <NODIST_DEV_FOLDER>
$ node build\build.js
``
Next compile the installer by opening NSIS and selecting the "Compile Scripts"
option. Point the compiler to `<NODIST_DEV_FOLDER>\build\Nodist.nsi` this will
start the compile process.
Provided the process is successful the installer will be at
`<NODIST_DEV_FOLDER>\build\NodistSetup.exe`
`<NODIST_DEV_FOLDER>\build\out\NodistSetup.exe`
Next, move the `NodistSetup.exe` to the final production name of
`NodistSetup-v<VERSION>.exe` for example `NodistSetup-v0.7.0.exe`
Expand Down
20 changes: 11 additions & 9 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ var npmLatestReleaseUrl = 'https://github.com/npm/npm/releases/latest';
var npmLatestUrl = 'https://codeload.github.com/npm/npm/zip/vVERSION';

//setup some folders
var tmpDir = path.resolve(path.join(__dirname,'tmp'));
var stagingDir = path.resolve(path.join(__dirname,'staging'));
var outDir = path.resolve(path.join(__dirname, 'out'))
var tmpDir = path.resolve(path.join(outDir, 'tmp'));
var stagingDir = path.resolve(path.join(outDir, 'staging'));
var stagingBin = path.join(stagingDir,'bin');
var stagingLib = path.join(stagingDir,'lib');
var stagingNpmDir = stagingBin + '/node_modules/npm';
Expand All @@ -91,13 +92,12 @@ console.log(' before going further we need to prep our staging folder');

//start by clearing the staging and tmp folders
P.all([
rimraf(stagingDir),
rimraf(tmpDir)
rimraf(outDir)
])
.then(function(){
return P.all([
fs.mkdirAsync(stagingDir),
fs.mkdirAsync(tmpDir)
mkdirp(stagingDir),
mkdirp(tmpDir)
]);
})
.then(function(){
Expand Down Expand Up @@ -226,14 +226,16 @@ P.all([
uninstallFolders.join('\n')
);
return fs.writeFileAsync(
path.resolve(nodistDir + '/build/Nodist.nsi'),
path.resolve(nodistDir + '/build/out/Nodist.nsi'),
nsiTemplate
);
})
.then(function() {
console.log('Run NSIS compiler')
return exec('makensis "' + nodistDir + '/build/out/Nodist.nsi"')
})
.then(function(){
console.log('NSI template created!');
console.log('Build complete!');
console.log('Just compile the Nodist.nsi file to complete the build');
process.exit(0);
})
.catch(function(err){
Expand Down

0 comments on commit 0e2bd74

Please sign in to comment.