-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* switch to jsdoc * convert package to esm and files to cjs * fix linting * fix cli * update contributing section
- Loading branch information
1 parent
3237575
commit 34bea75
Showing
36 changed files
with
290 additions
and
647 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,6 @@ yarn.lock | |
package-lock.json | ||
|
||
npm-debug.log | ||
.pnpm-debug.lo | ||
.pnpm-debug.log | ||
yarn-debug.log* | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/usr/bin/env node | ||
const NwBuilder = require("../lib/index.cjs"); | ||
const path = require("path"); | ||
const { detectCurrentPlatform } = require("../dist/index.cjs"); | ||
|
||
const currentPlatform = detectCurrentPlatform(process); | ||
|
||
const argv = require("yargs") | ||
.command("$0 <path>") | ||
.usage("Usage:\n $0 [options] [path] [-- <args>]") | ||
|
||
.alias("p", "platforms") | ||
.default("p", currentPlatform) | ||
.describe( | ||
"p", | ||
"Platforms to build, comma-sperated, can be: \n win32, win64, osx32, osx64, linux32, linux64 or \nwin, osx, linux", | ||
) | ||
|
||
.version(false) | ||
.alias("v", "version") | ||
.default("v", "latest") | ||
.describe("v", "The NW.js version, eg. 0.8.4") | ||
|
||
.alias("r", "run") | ||
.default("r", false) | ||
.describe("r", "Runs NW.js for the current platform") | ||
.boolean("r") | ||
|
||
.alias("o", "buildDir") | ||
.default("o", "./build") | ||
.describe("o", "The build folder") | ||
|
||
.alias("f", "forceDownload") | ||
.default("f", false) | ||
.describe("f", "Force download of NW.js") | ||
.boolean("f") | ||
|
||
.alias("n", "name") | ||
.describe("n", "The Name of your NW.js app.") | ||
|
||
.describe("cacheDir", "The cache folder") | ||
|
||
.default("quiet", false) | ||
.describe("quiet", "Disables logging") | ||
.boolean("quiet") | ||
|
||
.describe( | ||
" <args>", | ||
"Pass custom arguments to the NW.js instance \n(-r, --run mode only)", | ||
) | ||
|
||
// Howto Help | ||
.help("h") | ||
.alias("h", "help") | ||
|
||
.wrap(100).argv; | ||
|
||
const options = { | ||
appName: argv.name, | ||
files: path.resolve(process.cwd(), argv.path) + "/**/*", | ||
flavor: argv.flavor || "sdk", | ||
platforms: argv.platforms ? argv.platforms.split(",") : [currentPlatform], | ||
currentPlatform: currentPlatform, | ||
version: argv.version, | ||
macIcns: argv.macIcns || false, | ||
winIco: argv.winIco || false, | ||
cacheDir: argv.cacheDir | ||
? path.resolve(process.cwd(), argv.cacheDir) | ||
: path.resolve(__dirname, "..", "cache"), | ||
buildDir: path.resolve(process.cwd(), argv.buildDir), | ||
forceDownload: argv.forceDownload, | ||
// get all argv arguments after -- | ||
argv: process.argv.slice( | ||
process.argv.findIndex(function firstDash(el) { | ||
return el === "--"; | ||
}) + 1, | ||
), | ||
}; | ||
|
||
// Initialize Builder | ||
const nw = new NwBuilder(options); | ||
|
||
// Logging | ||
if (!(argv.quiet || argv.quite)) { | ||
nw.on("log", console.log); | ||
} | ||
|
||
// Build or Run the app | ||
const np = argv.r ? nw.run() : nw.build(); | ||
np.then(function () { | ||
process.exit(0); | ||
}).catch(function (error) { | ||
if (error) { | ||
console.error(error); | ||
process.exit(1); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var d=Object.create;var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var s=(r,t)=>{for(var e in t)a(r,e,{get:t[e],enumerable:!0})},u=(r,t,e,f)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of p(t))!S.call(r,n)&&n!==e&&a(r,n,{get:()=>t[n],enumerable:!(f=h(t,n))||f.enumerable});return r};var l=(r,t,e)=>(e=r!=null?d(I(r)):{},u(t||!r||!r.__esModule?a(e,"default",{value:r,enumerable:!0}):e,r)),C=r=>u(a({},"__esModule",{value:!0}),r);var O={};s(O,{Platform:()=>o,checkCache:()=>c,detectCurrentPlatform:()=>i});module.exports=C(O);var x={NIX_32:"linux32",NIX_64:"linux64",OSX_32:"osx32",OSX_64:"osx64",WIN_32:"win32",WIN_64:"win64"};Object.freeze(x);var o=x;var m=l(require("fs"),1),_=l(require("path"),1),N=(r,t)=>{let e=!1;if(t.length===1&&t[0]==="*")return m.default.existsSync(r)&&m.default.readdirSync(r).length>=2;for(let f of t){if(e)return!1;m.default.existsSync(_.default.join(r,f))||(e=!0)}return!e},c=N;var X=r=>{switch(r.platform){case"darwin":return r.arch==="x64"?o.OSX_64:o.OSX_32;case"win32":return r.arch==="x64"||r.env.PROCESSOR_ARCHITEW6432?o.WIN_64:o.WIN_32;case"linux":return r.arch==="x64"?o.NIX_64:o.NIX_32;default:return}},i=X;0&&(module.exports={Platform,checkCache,detectCurrentPlatform}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.