From f269878d8e6cb150a6cf4225e56c776d4f23e88d Mon Sep 17 00:00:00 2001 From: Pavel Sapachev Date: Fri, 22 Jun 2018 15:17:07 +0300 Subject: [PATCH 1/2] Added option for prettify package.json --- docs/Options.md | 3 ++- src/lib/Builder.ts | 2 +- src/lib/config/BuildConfig.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/Options.md b/docs/Options.md index 21c84cb..2b6dfa2 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -17,7 +17,8 @@ files | string[] | Glob patterns for included files. Exclude `${ output }` autom excludes | string[] | Glob patterns for excluded files. Defaults to `[]`. appId | string | App identity URI. Defaults to `io.github.nwjs.${ name }`. ffmpegIntegration | boolean | Whether to integrate `iteufel/nwjs-ffmpeg-prebuilt`. If `true`, you can NOT use symbols in `nwVersion`. Defaults to `false`. -strippedProperties | string[] | Properties to be stripped from `package.json`. Defaults to `[ 'scripts', 'devDependencies', 'build' ]`. +prettyPropertiesSpace | string or number | Prettify properties in `package.json`. A number is setups count of spaces, else - specifiied tab symbol. Defaults to `0`. + ## build.win <- [WinConfig](../src/lib/config/WinConfig.ts) diff --git a/src/lib/Builder.ts b/src/lib/Builder.ts index 99787b0..fa62f32 100644 --- a/src/lib/Builder.ts +++ b/src/lib/Builder.ts @@ -172,7 +172,7 @@ export class Builder { } } - await writeFile(path, JSON.stringify(json)); + await writeFile(path, JSON.stringify(json, null, config.prettyPropertiesSpace)); } diff --git a/src/lib/config/BuildConfig.ts b/src/lib/config/BuildConfig.ts index 181b2cc..9e1471f 100644 --- a/src/lib/config/BuildConfig.ts +++ b/src/lib/config/BuildConfig.ts @@ -26,6 +26,7 @@ export class BuildConfig { public appId: string = undefined; public ffmpegIntegration: boolean = false; public strippedProperties: string[] = [ 'scripts', 'devDependencies', 'build' ]; + public prettyPropertiesSpace: string | number = 0; constructor(pkg: any = {}) { From a3a9f3996aa36d661181f7995cababb57c75d92c Mon Sep 17 00:00:00 2001 From: Pavel Sapachev Date: Fri, 22 Jun 2018 15:19:14 +0300 Subject: [PATCH 2/2] revert of lost line --- docs/Options.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Options.md b/docs/Options.md index 2b6dfa2..eb83bd9 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -17,6 +17,7 @@ files | string[] | Glob patterns for included files. Exclude `${ output }` autom excludes | string[] | Glob patterns for excluded files. Defaults to `[]`. appId | string | App identity URI. Defaults to `io.github.nwjs.${ name }`. ffmpegIntegration | boolean | Whether to integrate `iteufel/nwjs-ffmpeg-prebuilt`. If `true`, you can NOT use symbols in `nwVersion`. Defaults to `false`. +strippedProperties | string[] | Properties to be stripped from `package.json`. Defaults to `[ 'scripts', 'devDependencies', 'build' ]`. prettyPropertiesSpace | string or number | Prettify properties in `package.json`. A number is setups count of spaces, else - specifiied tab symbol. Defaults to `0`.