mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-23 10:38:55 +00:00
Merge branch 'expose-main' of https://github.com/zweicoder/nativefier into zweicoder-expose-main
# Conflicts: # src/cli.js
This commit is contained in:
commit
ffc5450e00
@ -9,7 +9,7 @@
|
|||||||
"native",
|
"native",
|
||||||
"wrapper"
|
"wrapper"
|
||||||
],
|
],
|
||||||
"main": "lib/buildApp.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev-up": "npm install && (cd app && npm install) && npm run build",
|
"dev-up": "npm install && (cd app && npm install) && npm run build",
|
||||||
"test": "gulp test",
|
"test": "gulp test",
|
||||||
|
@ -2,6 +2,7 @@ import fs from 'fs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
|
|
||||||
|
import optionsFactory from './options';
|
||||||
import packager from 'electron-packager';
|
import packager from 'electron-packager';
|
||||||
import tmp from 'tmp';
|
import tmp from 'tmp';
|
||||||
import ncp from 'ncp';
|
import ncp from 'ncp';
|
||||||
@ -31,10 +32,30 @@ function buildApp(options, callback) {
|
|||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
callback => {
|
callback => {
|
||||||
copyPlaceholderApp(options.dir, tmpPath, options.name, options.targetUrl, options.counter, options.width, options.height, options.showMenuBar, options.userAgent, callback);
|
optionsFactory(
|
||||||
|
options.appName,
|
||||||
|
options.targetUrl,
|
||||||
|
options.platform,
|
||||||
|
options.arch,
|
||||||
|
options.electronVersion,
|
||||||
|
options.outDir,
|
||||||
|
options.overwrite,
|
||||||
|
options.conceal,
|
||||||
|
options.icon,
|
||||||
|
options.counter,
|
||||||
|
options.width,
|
||||||
|
options.height,
|
||||||
|
options.showMenuBar,
|
||||||
|
options.userAgent,
|
||||||
|
options.honest,
|
||||||
|
callback);
|
||||||
},
|
},
|
||||||
|
(options, callback) => {
|
||||||
(tempDir, callback) => {
|
copyPlaceholderApp(options.dir, tmpPath, options.name, options.targetUrl, options.counter, options.width, options.height, options.showMenuBar, options.userAgent, (error, tempDirPath) => {
|
||||||
|
callback(error, tempDirPath, options);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
(tempDir, options, callback) => {
|
||||||
options.dir = tempDir;
|
options.dir = tempDir;
|
||||||
packager(options, callback);
|
packager(options, callback);
|
||||||
},
|
},
|
||||||
|
46
src/cli.js
46
src/cli.js
@ -2,47 +2,9 @@
|
|||||||
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import program from 'commander';
|
import program from 'commander';
|
||||||
import async from 'async';
|
|
||||||
|
|
||||||
import optionsFactory from './options';
|
|
||||||
import buildApp from './buildApp';
|
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.showMenuBar,
|
|
||||||
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)
|
||||||
@ -70,5 +32,11 @@ if (require.main === module) {
|
|||||||
program.help();
|
program.help();
|
||||||
}
|
}
|
||||||
|
|
||||||
main(program);
|
buildApp(program, (error, appPath) => {
|
||||||
|
if (error) {
|
||||||
|
console.error(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(`App built to ${appPath}`);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
3
src/index.js
Normal file
3
src/index.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import buildApp from './buildApp';
|
||||||
|
|
||||||
|
export default buildApp;
|
Loading…
Reference in New Issue
Block a user