2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-10 15:21:03 +00:00

Expose main instead of buildApp

This commit is contained in:
zweicoder 2016-01-23 23:10:44 +08:00
parent b7433dfc3b
commit 9c19c144e7
4 changed files with 41 additions and 41 deletions

1
index.js Normal file
View File

@ -0,0 +1 @@
module.exports = require('lib/main.js');

View File

@ -9,7 +9,7 @@
"native", "native",
"wrapper" "wrapper"
], ],
"main": "lib/buildApp.js", "main": "./index.js",
"scripts": { "scripts": {
"dev-up": "npm install && (cd app && npm install)", "dev-up": "npm install && (cd app && npm install)",
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",

View File

@ -2,48 +2,9 @@
import path from 'path'; import path from 'path';
import program from 'commander'; import program from 'commander';
import async from 'async'; import main from './main'
import optionsFactory from './options';
import buildApp from './buildApp';
const packageJson = require(path.join('..', 'package')); const packageJson = require(path.join('..', 'package'));
function main(program) {
async.waterfall([
callback => {
optionsFactory(
program.appName,
program.targetUrl,
program.platform,
program.arch,
program.electronVersion,
program.outDir,
program.overwrite,
program.conceal,
program.icon,
program.counter,
program.width,
program.height,
program.userAgent,
program.honest,
callback);
},
(options, callback) => {
buildApp(options, callback);
}
], (error, appPath) => {
if (error) {
console.error(error);
return;
}
console.log(`App built to ${appPath}`);
});
}
if (require.main === module) { if (require.main === module) {
program program
.version(packageJson.version) .version(packageJson.version)

38
src/main.js Normal file
View File

@ -0,0 +1,38 @@
import optionsFactory from './options';
import buildApp from './buildApp';
import async from 'async';
export default function main(program) {
async.waterfall([
callback => {
optionsFactory(
program.appName,
program.targetUrl,
program.platform,
program.arch,
program.electronVersion,
program.outDir,
program.overwrite,
program.conceal,
program.icon,
program.counter,
program.width,
program.height,
program.userAgent,
program.honest,
callback);
},
(options, callback) => {
buildApp(options, callback);
}
], (error, appPath) => {
if (error) {
console.error(error);
return;
}
console.log(`App built to ${appPath}`);
});
}