@todesktop/cli 1.6.2-2 → 1.6.3

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
@@ -727,6 +727,31 @@ Default: The root [`icon`](#icon---string) is used.
727
727
 
728
728
  The path to your application's Windows desktop icon. It must be an ICO, ICNS, or PNG.
729
729
 
730
+ #### `windows.nsisCustomBinary` - (optional) object
731
+
732
+ Example:
733
+
734
+ ```json
735
+ {
736
+ "debugLogging": true,
737
+ "url": "https://download.todesktop.com/nsis/nsis-3.06.1-log.7z",
738
+ "checksum": "pB4LJ5s+bIjK6X+IrY4oyq1knpI1YNcykawJR1+ax9XqDULohiS6J7/Imin22rBBX6uoEDY2gvsaCcvqKkWAtA=="
739
+ }
740
+ ```
741
+
742
+ Default: `undefined`.
743
+
744
+ 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.
745
+
746
+ Example of NSIS script which enables install logging:
747
+
748
+ ```nsis
749
+ !macro customInit
750
+ SetOutPath $INSTDIR
751
+ LogSet on
752
+ !macroend
753
+ ```
754
+
730
755
  #### `windows.nsisInclude` - (optional) string
731
756
 
732
757
  Example: `build/installer.nsh`.
@@ -826,7 +851,7 @@ module.exports = async ({ appOutDir, packager }) => {
826
851
 
827
852
  ## FAQs
828
853
 
829
- ### One of my dependencies is a private package. How do I safely using it with ToDesktop CLI
854
+ ### One of my dependencies is a private package. How do I safely use it with ToDesktop CLI
830
855
 
831
856
  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
857
 
@@ -881,8 +906,74 @@ ToDesktop CLI supports the concept of a staging version of your app. This is use
881
906
 
882
907
  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
908
 
909
+ ### I want ToDesktop to compile my typescript/react/whatever on ToDesktop Servers
910
+
911
+ 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.
912
+
913
+ | Name | Description |
914
+ | --------------------------------- | ------------------------------------------------------------------------------------- |
915
+ | `TODESKTOP_CI` | Set to `true` when running on ToDesktop build servers |
916
+ | `TODESKTOP_INITIAL_INSTALL_PHASE` | Set to `true` when running the first npm/yarn/pnpm install on ToDesktop build servers |
917
+
918
+ 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
919
+
920
+ ```js
921
+ const { exec } = require("child_process");
922
+ const { promisify } = require("util");
923
+ const execAsync = promisify(exec);
924
+
925
+ async function postInstall() {
926
+ const firstInstallOnToDesktopServers =
927
+ process.env.TODESKTOP_CI && process.env.TODESKTOP_INITIAL_INSTALL_PHASE;
928
+
929
+ if (firstInstallOnToDesktopServers) {
930
+ console.log("➔ Building typescript on ToDesktop servers");
931
+ await execAsync("npm run build", {
932
+ stdio: "inherit",
933
+ });
934
+ } else {
935
+ console.log("➔ Not on ToDesktop servers... Do nothing.");
936
+ }
937
+ }
938
+
939
+ postInstall();
940
+ ```
941
+
942
+ Next, add the following to your `package.json`:
943
+
944
+ ```js
945
+ {
946
+ // ...
947
+ "scripts": {
948
+ // This is our existing typescript build script
949
+ "build": "tsc -p .",
950
+
951
+ // Our new postinstall script will run the script above when on ToDesktop servers
952
+ "postinstall": "node todesktop-postinstall.js"
953
+ }
954
+ }
955
+ ```
956
+
957
+ Now, when we build your app on ToDesktop servers, it will also run your custom `build` script after all dependencies have been installed.
958
+
884
959
  ## Changelog
885
960
 
961
+ ### v1.6.3
962
+
963
+ - Add support for specifying custom `windows.nsisCustomBinary` in config
964
+
965
+ ### v1.6.2
966
+
967
+ - Add support for specifying custom `nodeVersion` in config
968
+
969
+ ### v1.6.1
970
+
971
+ - Add support for specifying `windows.nsisInclude` in config
972
+
973
+ ### v1.6.0
974
+
975
+ - Codebase refactored and converted to typescript
976
+
886
977
  ### v1.5.1
887
978
 
888
979
  - Add support for `--exit` flag for `todesktop builds`.
package/dist/cli.js CHANGED
@@ -1720,6 +1720,15 @@ var full_default = (context) => {
1720
1720
  type: "object",
1721
1721
  properties: {
1722
1722
  icon: getIconSchema(["ico"]),
1723
+ nsisCustomBinary: {
1724
+ type: "object",
1725
+ properties: {
1726
+ checksum: { type: "string" },
1727
+ debugLogging: { type: "boolean" },
1728
+ url: { type: "string" },
1729
+ version: { type: "string" }
1730
+ }
1731
+ },
1723
1732
  nsisInclude: {
1724
1733
  type: "string",
1725
1734
  file: {
@@ -4192,7 +4201,7 @@ var package_default = {
4192
4201
  access: "public"
4193
4202
  },
4194
4203
  name: "@todesktop/cli",
4195
- version: "1.6.2-1",
4204
+ version: "1.6.2",
4196
4205
  license: "MIT",
4197
4206
  author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
4198
4207
  homepage: "https://todesktop.com/cli",