Преглед на файлове

refactor(project): some minor fixes

evshiron преди 8 години
родител
ревизия
d4690f64b2

+ 8 - 0
.gitignore

@@ -0,0 +1,8 @@
+.*
+*.log
+node_modules
+/packages/nsis-compat-updater/dist
+/packages/nsis-compat-tester/dist
+/assets/project/dist
+/caches
+/dist

+ 10 - 0
.npmignore

@@ -0,0 +1,10 @@
+.*
+*.log
+node_modules
+/packages
+/assets/project
+/caches
+/coverage
+/docs
+/src
+/test

+ 11 - 6
README.md

@@ -16,16 +16,17 @@ Although NW.js has much lesser popularity than Electron, and is really troubled
 
 * Building for Windows, macOS and Linux
   * Common: `zip`, `7z`
-  * Windows: `nsis`, `nsis7z`
+  * Windows: `nsis`, [`nsis7z`](./docs/FAQs.md)
   * macOS: TODO
   * Linux: TODO
 * Building for different platforms concurrently
-* Chrome App Support
 * Configurable executable fields and icons for Windows and macOS
-* Integration for `nwjs-ffmpeg-prebuilt`
-* Exclusion of useless files from `node_modules`
-* [Auto Updater](./packages/nsis-compat-tester/) inspired by `electron-updater`
+* Exclusion of loose files from `node_modules`
+* [Chrome App support](./docs/FAQs.md)
+* `nwjs-ffmpeg-prebuilt` integration
+* [Auto Updater](./packages/nsis-compat-tester/)
 * TODO Rebuilding native modules
+* TODO Code signing
 * Ideas appreciated :)
 
 ## Getting Started
@@ -88,7 +89,11 @@ Also [see all available options here](./docs/Options.md).
 * `nwjs-builder-phoenix` supports node.js 4.x and later versions only.
 * `nwjs-builder-phoenix` writes with TypeScript and benefits from strong typing and async/await functions.
 
-## Known Mirrors
+## Development
+
+To be done.
+
+## Available Mirrors
 
 If you have difficulties connecting to the official download source, you can specify a mirror via `--mirror` argument of both `build` and `run`, or by setting `NWJS_MIRROR` environment variable. Environment variables like `HTTP_PROXY`, `HTTPS_PROXY` and `ALL_PROXY` should be useful too.
 

+ 30 - 0
packages/nsis-compat-tester/README.md

@@ -0,0 +1,30 @@
+
+# nsis-compat-tester
+
+The test case for `nsis-compat-updater`.
+
+## Getting Started - Part Server
+
+Serve those `*.exe` and `versions.nsis.json` in a directory via HTTP/HTTPS servers, and let's name the URL to the directory `feed`.
+
+## Getting Started - Part App
+
+* Install `nsis-compat-updater` and save as a `dependency`:
+
+```
+npm install nsis-compat-updater --save
+```
+
+* Import and setup `nsis-compat-updater` by passing in `feed`, `version` and `arch`.
+* Combine `updater.checkForUpdates`, `updater.downloadUpdate` and `updater.quitAndInstall` to complete update logic.
+
+See also [nsis-compat-updater](../nsis-compat-updater/).
+
+## Test
+
+```bash
+npm install
+
+npm run dist
+npm run serve
+```

+ 1 - 1
packages/nsis-compat-tester/main.html

@@ -24,7 +24,7 @@ const updater = new NsisCompatUpdater('http://127.0.0.1:8080/versions.nsis.json'
 updater.checkForUpdates()
 .then((version) => {
 
-    document.write(`<p>Version: ${ version }</p>`);
+    document.write(`<p>Available Version: ${ version ? version.version : 'current' }</p>`);
 
     if(version && confirm(`New version of ${ version.version } is available, download now?`)) {
 

+ 1 - 1
packages/nsis-compat-tester/package.json

@@ -21,7 +21,7 @@
   "build": {
     "nwFlavor": "sdk",
     "targets": [
-      "nsis"
+      "nsis7z"
     ],
     "nsis": {
       "diffUpdaters": true

+ 4 - 0
packages/nsis-compat-updater/.npmignore

@@ -0,0 +1,4 @@
+.*
+*.log
+node_modules
+/src

+ 61 - 0
packages/nsis-compat-updater/README.md

@@ -0,0 +1,61 @@
+
+# nsis-compat-updater
+
+`nsis-compat-updater` is an auto updater implementation for NW.js, inspired by `electron-updater`.
+
+## API
+
+### Imports
+
+```javascript
+import { NsisCompatUpdater } from 'nsis-compat-updater';
+// Or
+// const { NsisCompatUpdater } = require('nsis-compat-updater');
+```
+
+### Types
+
+```typescript
+
+interface IInstaller {
+    arch: string;
+    path: string;
+    hash: string;
+    created: number;
+}
+
+interface IUpdater {
+    arch: string;
+    fromVersion: string;
+    path: string;
+    hash: string;
+    created: number;
+}
+
+interface IVersion {
+    version: string;
+    changelog: string;
+    source: string;
+    installers: IInstaller[];
+    updaters: IUpdater[];
+}
+
+```
+
+### `new NsisCompatUpdater(feed: string, version: string, arch: 'x86' | 'x64')`
+
+```javascript
+const updater = new NsisCompatUpdater(feed, version, arch);
+```
+
+### `updater.checkForUpdates(): Promise<IVersion | null>`
+
+Returns an instance of `IVersion` if new version is available, otherwise `null`.
+
+### `updater.downloadUpdate(version: string): Promise<string>`
+
+Returns the temporary path of the downloaded update.
+
+### `updater.quitAndInstall(path: string)`
+
+### ~~`updater.installWhenQuit(path: string)`~~