Skip to content

Commit

Permalink
chore: fix remaining lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushmanchhabra committed Feb 3, 2024
1 parent 72f65e1 commit 334ae74
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 41 deletions.
28 changes: 15 additions & 13 deletions src/bld.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,24 @@ import util from "./util.js"

/**
* @typedef {object} BuildOptions
* @property {string | "latest" | "stable" | "lts"} [options.version = "latest"] Runtime version
* @property {"normal" | "sdk"} [options.flavor = "normal"] Build flavor
* @property {"linux" | "osx" | "win"} [options.platform] Target platform
* @property {"ia32" | "x64" | "arm64"} [options.arch] Target arch
* @property {string} [options.manifestUrl = "https://nwjs.io/versions"] Manifest URL
* @property {string} [options.srcDir = "./src"] Source directory
* @property {string} [options.cacheDir = "./cache"] Cache directory
* @property {string} [options.outDir = "./out"] Out directory
* @property {LinuxRc | WinRc | OsxRc} [options.app] Platform specific rc
* @property {boolean} [options.glob = true] File globbing
* @property {boolean | string | object} [options.managedManifest = false] Manage manifest
* @property {false | "gyp"} [options.nativeAddon = false] Rebuild native modules
* @property {false | "zip" | "tar" | "tgz"} [options.zip = false] Compress built artifacts
* @property {string | "latest" | "stable" | "lts"} [version = "latest"] Runtime version
* @property {"normal" | "sdk"} [flavor = "normal"] Build flavor
* @property {"linux" | "osx" | "win"} [platform] Target platform
* @property {"ia32" | "x64" | "arm64"} [arch] Target arch
* @property {string} [manifestUrl = "https://nwjs.io/versions"] Manifest URL
* @property {string} [srcDir = "./src"] Source directory
* @property {string} [cacheDir = "./cache"] Cache directory
* @property {string} [outDir = "./out"] Out directory
* @property {LinuxRc | WinRc | OsxRc} [app] Platform specific rc
* @property {boolean} [glob = true] File globbing
* @property {boolean | string | object} [managedManifest = false] Manage manifest
* @property {false | "gyp"} [nativeAddon = false] Rebuild native modules
* @property {false | "zip" | "tar" | "tgz"} [zip = false] Compress built artifacts
*/

/**
* Build NW.js application.
*
* @async
* @function
* @param {BuildOptions} options - Build options
Expand Down
32 changes: 17 additions & 15 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,37 @@ import util from "./util.js";

/**
* @typedef {object} Options Configuration options
* @property {"./" | string} [srcDir="./"] String of space separated glob patterns which correspond to NW app code
* @property {"get" | "run" | "build"} [mode="build"] Run or build application
* @property {"latest" | "stable" | string} [version="latest"] NW runtime version
* @property {"normal" | "sdk"} [flavor="normal"] NW runtime build flavor
* @property {"linux" | "osx" | "win"} platform NW supported platforms
* @property {"ia32" | "x64" | "arm64"} arch NW supported architectures
* @property {"get" | "run" | "build"} [mode="build"] Choose between get, run or build mode
* @property {"latest" | "stable" | string} [version="latest"] Runtime version
* @property {"normal" | "sdk"} [flavor="normal"] Runtime flavor
* @property {"linux" | "osx" | "win"} platform Host platform
* @property {"ia32" | "x64" | "arm64"} arch Host architecture
* @property {"https://dl.nwjs.io" | string} [downloadUrl="https://dl.nwjs.io"] Download server
* @property {"https://nwjs.io/versions" | string} [manifestUrl="https://nwjs.io/versions"] Versions manifest
* @property {"./cache" | string} [cacheDir="./cache"] Directory to cache NW binaries
* @property {"./" | string} [srcDir="./"] File paths to application code
* @property {"./out" | string} [outDir="./out"] Directory to store build artifacts
* @property {"./cache" | string} [cacheDir="./cache"] Directory to store NW binaries
* @property {"https://dl.nwjs.io" | string} [downloadUrl="https://dl.nwjs.io"] URI to download NW binaries from
* @property {"https://nwjs.io/versions" | string} [manifestUrl="https://nwjs.io/versions"] URI to download manifest from
* @property {boolean | string | object} [managedManifest = false] Managed manifest mode
* @property {false | "gyp"} [nodeAddon = false] Rebuild Node native addons
* @property {object} app Refer to Linux/Windows Specific Options under Getting Started in the docs
* @property {boolean} [cache=true] If true the existing cache is used. Otherwise it removes and redownloads it.
* @property {boolean | "zip" | "tar" | "tgz"} [zip=false] If true, "zip", "tar" or "tgz" the outDir directory is compressed.
* @property {boolean} [cli=false] If true the CLI is used to glob srcDir and parse other options
* @property {boolean} [ffmpeg=false] If true the chromium ffmpeg is replaced by community version
* @property {boolean} [glob=true] If true globbing is enabled
* @property {"error" | "warn" | "info" | "debug"} [logLevel="info"] Specified log level.
* @property {boolean} [glob=true] If true file globbing is enabled when parsing srcDir.
* @property {"error" | "warn" | "info" | "debug"} [logLevel="info"] Specify level of logging.
* @property {boolean | "zip" | "tar" | "tgz"} [zip=false] If true, "zip", "tar" or "tgz" the outDir directory is compressed.
* @property {boolean} [cli=false] If true the CLI is used to parse options. This option is used internally.
*/

/**
* Main module exported
* Main module exported.
*
* @async
* @function
*
* @param {Options} options Options
* @return {Promise<void>}
*/
async function nwbuild (options) {
async function nwbuild(options) {
let built;
let releaseInfo = {};
let manifest = {};
Expand Down
18 changes: 9 additions & 9 deletions src/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import util from "./util.js";

/**
* @typedef {object} RunOptions
* @property {string | "latest" | "stable" | "lts"} [options.version = "latest"] Runtime version
* @property {"normal" | "sdk"} [options.flavor = "normal"] Build flavor
* @property {"linux" | "osx" | "win"} [options.platform] Target platform
* @property {"ia32" | "x64" | "arm64"} [options.arch] Target arch
* @property {string} [options.srcDir = "./src"] Source directory
* @property {string} [options.cacheDir = "./cache"] Cache directory
* @property {boolean} [options.glob = false] If true, throw error
* @property {string[]} [options.argv = []] CLI arguments
* @property {string | "latest" | "stable" | "lts"} [version = "latest"] Runtime version
* @property {"normal" | "sdk"} [flavor = "normal"] Build flavor
* @property {"linux" | "osx" | "win"} [platform] Target platform
* @property {"ia32" | "x64" | "arm64"} [arch] Target arch
* @property {string} [srcDir = "./src"] Source directory
* @property {string} [cacheDir = "./cache"] Cache directory
* @property {boolean} [glob = false] If true, throw error
* @property {string[]} [argv = []] CLI arguments
*/

/**
* Run NW.js application
* Run NW.js application.
*
* @async
* @function
Expand Down
11 changes: 7 additions & 4 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as GlobModule from "glob";
import semver from "semver";

/**
* Get manifest (array of NW release metadata) from URL
* Get manifest (array of NW release metadata) from URL.
*
* @param {string} manifestUrl Url to manifest
* @return {Promise<object | undefined>} - Manifest object
Expand Down Expand Up @@ -39,7 +39,7 @@ function getManifest(manifestUrl) {
}

/**
* Get version specific release metadata
* Get version specific release metadata.
*
* @param {string} version NW version
* @param {string} platform NW platform
Expand Down Expand Up @@ -105,7 +105,7 @@ const EXE_NAME = {
};

/**
* Glob files
* Glob files.
*
* @async
* @function
Expand Down Expand Up @@ -134,6 +134,8 @@ async function globFiles({
}

/**
* Get Node manifest.
*
* @async
* @function
* @param {object} options - node manifest options
Expand Down Expand Up @@ -272,7 +274,7 @@ export const parse = async (options, pkg) => {
};

/**
* Validate options
* Validate options.
*
* @param {import("../index.js").Options} options Options
* @param {object} releaseInfo Version specific NW release info
Expand Down Expand Up @@ -415,6 +417,7 @@ async function getPath(type, options) {
}

/**
* Check if file exists at specified path.
*
* @param {string} filePath - File path to check existence of
* @return {Promise<boolean>} `true` if exists, otherwise `false`
Expand Down

0 comments on commit 334ae74

Please sign in to comment.