@todesktop/cli 1.6.2 → 1.7.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -102,6 +102,14 @@ To release that build (i.e. publish new downloads and an auto-update), run:
102
102
  todesktop release
103
103
  ```
104
104
 
105
+ ### Step 6: Run smoke test
106
+
107
+ To test whether that build works fine and can be successfully updated, run:
108
+
109
+ ```sh
110
+ todesktop smoke-test
111
+ ```
112
+
105
113
  See the next section for more information on the available commands.
106
114
 
107
115
  ## CLI Commands
@@ -140,6 +148,10 @@ We also support:
140
148
  - Append `--config=<path.to.another.todesktop.json>` to use a different configuration file.
141
149
  - Append `--exit` to disable dynamic pagination and exit the process once the build data has been displayed.
142
150
  - `todesktop logout`. Logs you out.
151
+ - `todesktop smoke-test` Check whether the build works and can be successfully updated.
152
+ - Use `todesktop smoke-test <id>` to test a specific build by ID.
153
+ - `todesktop smoke-test --latest` will test the latest build.
154
+ - Append `--config=<path.to.another.todesktop.json>` to use a different configuration file.
143
155
  - `todesktop whoami`. Prints the email of the account you're signed into.
144
156
  - `todesktop --help`. Shows the help documentation.
145
157
  - `todesktop --version`. Shows the current version of the CLI.
@@ -727,6 +739,31 @@ Default: The root [`icon`](#icon---string) is used.
727
739
 
728
740
  The path to your application's Windows desktop icon. It must be an ICO, ICNS, or PNG.
729
741
 
742
+ #### `windows.nsisCustomBinary` - (optional) object
743
+
744
+ Example:
745
+
746
+ ```json
747
+ {
748
+ "debugLogging": true,
749
+ "url": "https://download.todesktop.com/nsis/nsis-3.06.1-log.7z",
750
+ "checksum": "pB4LJ5s+bIjK6X+IrY4oyq1knpI1YNcykawJR1+ax9XqDULohiS6J7/Imin22rBBX6uoEDY2gvsaCcvqKkWAtA=="
751
+ }
752
+ ```
753
+
754
+ Default: `undefined`.
755
+
756
+ Allows you to provide your own makensis, such as one with support for debug logging via LogSet and LogText. (Logging also requires option debugLogging = true). It's not recommended to use it for production build.
757
+
758
+ Example of NSIS script which enables install logging:
759
+
760
+ ```nsis
761
+ !macro customInit
762
+ SetOutPath $INSTDIR
763
+ LogSet on
764
+ !macroend
765
+ ```
766
+
730
767
  #### `windows.nsisInclude` - (optional) string
731
768
 
732
769
  Example: `build/installer.nsh`.
@@ -826,7 +863,7 @@ module.exports = async ({ appOutDir, packager }) => {
826
863
 
827
864
  ## FAQs
828
865
 
829
- ### One of my dependencies is a private package. How do I safely using it with ToDesktop CLI
866
+ ### One of my dependencies is a private package. How do I safely use it with ToDesktop CLI
830
867
 
831
868
  ToDesktop CLI is similar to Continuous Integration service so you can use the guide from here: https://docs.npmjs.com/using-private-packages-in-a-ci-cd-workflow/
832
869
 
@@ -881,8 +918,62 @@ ToDesktop CLI supports the concept of a staging version of your app. This is use
881
918
 
882
919
  Now you can run `npm run todesktop-build` to build the production app. Or you can run `npm run todesktop-staging-build` to build the staging app.
883
920
 
921
+ ### I want ToDesktop to compile my typescript/react/whatever on ToDesktop Servers
922
+
923
+ No problem, this can be achieved with a [`postInstall`](https://docs.npmjs.com/cli/v9/using-npm/scripts) script in combination with ToDesktop's `TODESKTOP_CI` and `TODESKTOP_INITIAL_INSTALL_PHASE` environment variables.
924
+
925
+ | Name | Description |
926
+ | --------------------------------- | ------------------------------------------------------------------------------------- |
927
+ | `TODESKTOP_CI` | Set to `true` when running on ToDesktop build servers |
928
+ | `TODESKTOP_INITIAL_INSTALL_PHASE` | Set to `true` when running the first npm/yarn/pnpm install on ToDesktop build servers |
929
+
930
+ First, let's create a file called `todesktop-postinstall.js` or something similar in the root of your app (alongside `pkckage.json`). This file is going to run a script to compile typescript after your dependencies have been installed. It could look something like this
931
+
932
+ ```js
933
+ const { exec } = require("child_process");
934
+ const { promisify } = require("util");
935
+ const execAsync = promisify(exec);
936
+
937
+ async function postInstall() {
938
+ const firstInstallOnToDesktopServers =
939
+ process.env.TODESKTOP_CI && process.env.TODESKTOP_INITIAL_INSTALL_PHASE;
940
+
941
+ if (firstInstallOnToDesktopServers) {
942
+ console.log("➔ Building typescript on ToDesktop servers");
943
+ await execAsync("npm run build", {
944
+ stdio: "inherit",
945
+ });
946
+ } else {
947
+ console.log("➔ Not on ToDesktop servers... Do nothing.");
948
+ }
949
+ }
950
+
951
+ postInstall();
952
+ ```
953
+
954
+ Next, add the following to your `package.json`:
955
+
956
+ ```js
957
+ {
958
+ // ...
959
+ "scripts": {
960
+ // This is our existing typescript build script
961
+ "build": "tsc -p .",
962
+
963
+ // Our new postinstall script will run the script above when on ToDesktop servers
964
+ "postinstall": "node todesktop-postinstall.js"
965
+ }
966
+ }
967
+ ```
968
+
969
+ Now, when we build your app on ToDesktop servers, it will also run your custom `build` script after all dependencies have been installed.
970
+
884
971
  ## Changelog
885
972
 
973
+ ### v1.6.3
974
+
975
+ - Add support for specifying custom `windows.nsisCustomBinary` in config
976
+
886
977
  ### v1.6.2
887
978
 
888
979
  - Add support for specifying custom `nodeVersion` in config