@todesktop/cli 0.28.2 → 1.1.1
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 +95 -0
- package/build/commands/build.js +4740 -115
- package/build/commands/build.js.map +1 -1
- package/build/commands/builds.js +4224 -109
- package/build/commands/builds.js.map +1 -1
- package/build/commands/logout.js +2511 -57
- package/build/commands/logout.js.map +1 -1
- package/build/commands/release.js +3606 -89
- package/build/commands/release.js.map +1 -1
- package/build/commands/whoami.js +2511 -57
- package/build/commands/whoami.js.map +1 -1
- package/build/commands.json +22 -22
- package/package.json +13 -10
package/README.md
CHANGED
|
@@ -11,7 +11,9 @@ For more information, visit the project [landing page](https://www.todesktop.com
|
|
|
11
11
|
- [CLI commands](#cli-commands)
|
|
12
12
|
- [Automating your builds (CI)](#automating-your-builds-ci)
|
|
13
13
|
- [Project configuration (todesktop.json)](#project-configuration-todesktopjson)
|
|
14
|
+
- [Build lifecycle hooks (package.json scripts)](#build-lifecycle-hooks-packagejson-scripts)
|
|
14
15
|
- [App package.json requirements](#packagejson-requirements)
|
|
16
|
+
- [Changelog](#changelog)
|
|
15
17
|
|
|
16
18
|
## Installation
|
|
17
19
|
|
|
@@ -647,6 +649,86 @@ Default: The root [`icon`](#icon---string) is used.
|
|
|
647
649
|
|
|
648
650
|
The path to your application's Windows desktop icon. It must be an ICO, ICNS, or PNG.
|
|
649
651
|
|
|
652
|
+
## Build lifecycle hooks (package.json scripts)
|
|
653
|
+
|
|
654
|
+
Sometimes you want to do something before or during the build process. For example, you might want to run a script before the build starts, or you might want to run a script after the files have been packaged. Our lifecycle hooks provide a way to do this.
|
|
655
|
+
|
|
656
|
+
To specify a script, add a `scripts` property to your `package.json` file. The key is the name of the script (prefixed by `todesktop:`), and the value is the path to the script.
|
|
657
|
+
|
|
658
|
+
```json
|
|
659
|
+
{
|
|
660
|
+
"scripts": {
|
|
661
|
+
"todesktop:beforeInstall": "./scripts/beforeInstall.js",
|
|
662
|
+
"todesktop:afterPack": "./scripts/afterPack.js"
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
When writing your script, you can follow this template:
|
|
668
|
+
|
|
669
|
+
```js
|
|
670
|
+
module.exports = async ({ pkgJsonPath, pkgJson, appDir, hookName }) => {
|
|
671
|
+
/**
|
|
672
|
+
* pkgJsonPath - string - path to the package.json file
|
|
673
|
+
* pkgJson - object - the parsed package.json file
|
|
674
|
+
* appDir - string - the path to the app directory
|
|
675
|
+
* hookName - string - the name of the hook ("todesktop:beforeInstall" or "todesktop:afterPack")
|
|
676
|
+
*/
|
|
677
|
+
};
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
### `todesktop:beforeInstall` - (optional) path to script
|
|
681
|
+
|
|
682
|
+
Example: `./scripts/beforeInstall.js`.
|
|
683
|
+
|
|
684
|
+
The path to a script that will be run before the build starts.
|
|
685
|
+
|
|
686
|
+
Example script:
|
|
687
|
+
|
|
688
|
+
```js
|
|
689
|
+
const { writeFile } = require("fs/promises");
|
|
690
|
+
|
|
691
|
+
// Delete `internal` dependency from package.json
|
|
692
|
+
module.exports = async ({ pkgJsonPath, pkgJson, appDir, hookName }) => {
|
|
693
|
+
delete pkgJson.dependencies["internal"];
|
|
694
|
+
await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
695
|
+
};
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
### `todesktop:afterPack` - (optional) path to script
|
|
699
|
+
|
|
700
|
+
Example: `./scripts/afterPack.js`.
|
|
701
|
+
|
|
702
|
+
The path to a script that will be run after the app has been packed (but _before_ it has been transformed into a distributable installer format and signed).
|
|
703
|
+
|
|
704
|
+
The `afterPack` function also has the following arguments added to it's signature:
|
|
705
|
+
|
|
706
|
+
- appPkgName - string - the name of the app package
|
|
707
|
+
- appId - string - the app id
|
|
708
|
+
- shouldCodeSign - boolean - whether the app will be code signed or not
|
|
709
|
+
- outDir - string - the path to the output directory
|
|
710
|
+
- appOutDir - string - the path to the app output directory
|
|
711
|
+
- arch - string - the architecture of the app
|
|
712
|
+
- packager - object - the packager object
|
|
713
|
+
|
|
714
|
+
Example script:
|
|
715
|
+
|
|
716
|
+
```js
|
|
717
|
+
const { writeFile } = require("fs/promises");
|
|
718
|
+
|
|
719
|
+
// Add a copyright file inside of the app directory on Mac only
|
|
720
|
+
module.exports = async ({ appOutDir, packager }) => {
|
|
721
|
+
if (os.platform() === "darwin") {
|
|
722
|
+
const appName = packager.appInfo.productFilename;
|
|
723
|
+
const appPath = path.join(`${appOutDir}`, `${APP_NAME}.app`);
|
|
724
|
+
await writeFile(
|
|
725
|
+
path.join(appPath, "copyright.txt"),
|
|
726
|
+
`Copyright © ${new Date().getFullYear()} ${APP_NAME}`
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
```
|
|
731
|
+
|
|
650
732
|
## App package.json requirements
|
|
651
733
|
|
|
652
734
|
- Electron must be in your `devDependencies` and it must be a fixed version. I.e. it doesn't start with `^` or `~`.
|
|
@@ -674,3 +756,16 @@ To summarize:
|
|
|
674
756
|
```
|
|
675
757
|
|
|
676
758
|
Note: **Do not put a token in this file**. You are specifying a literal value of `${NPM_TOKEN}`. NPM will replace the value for you. 5. Add `.npmrc` to your `appFiles` array `[".npmrc"]` in `todesktop.json`.
|
|
759
|
+
|
|
760
|
+
## Changelog
|
|
761
|
+
|
|
762
|
+
### v1.1.0
|
|
763
|
+
|
|
764
|
+
- Add support for `beforeInstall` and `afterPack` hooks.
|
|
765
|
+
|
|
766
|
+
### v1.0.0
|
|
767
|
+
|
|
768
|
+
- Feature: Support multiple concurrent builds
|
|
769
|
+
- Enhancement: Switched to presigned uploads (removes AWS dependency)
|
|
770
|
+
- Fix: Fixed package resolution for Ink
|
|
771
|
+
- Add PNPM support
|