@realtimex/pp-cli 2.0.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 ADDED
@@ -0,0 +1,8 @@
1
+ # @realtimex/pp-cli
2
+
3
+ Install the RealtimeX Printing Press CLI.
4
+
5
+ ```bash
6
+ npm install -g @realtimex/pp-cli
7
+ realtimex-pp-cli --version
8
+ ```
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require('child_process');
3
+ const path = require('path');
4
+ const fs = require('fs');
5
+
6
+ const packageName = '@realtimex/pp-cli-' + process.platform + '-' + process.arch;
7
+ const binaryName = process.platform === 'win32' ? 'realtimex-pp-cli.exe' : 'realtimex-pp-cli';
8
+
9
+ let binaryPath;
10
+ try {
11
+ binaryPath = path.join(path.dirname(require.resolve(packageName + '/package.json')), 'bin', binaryName);
12
+ } catch (error) {
13
+ const localPackagePath = path.resolve(__dirname, '..', '..', 'packages', process.platform + '-' + process.arch, 'package.json');
14
+ if (fs.existsSync(localPackagePath)) {
15
+ binaryPath = path.join(path.dirname(localPackagePath), 'bin', binaryName);
16
+ } else {
17
+ console.error('Unsupported platform for @realtimex/pp-cli: ' + process.platform + '/' + process.arch);
18
+ console.error('Expected optional package: ' + packageName);
19
+ process.exit(1);
20
+ }
21
+ }
22
+
23
+ const result = spawnSync(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
24
+ if (result.error) {
25
+ console.error(result.error.message);
26
+ process.exit(1);
27
+ }
28
+ process.exit(result.status == null ? 1 : result.status);
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@realtimex/pp-cli",
3
+ "version": "2.0.3",
4
+ "description": "RealtimeX Printing Press CLI",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "realtimex-pp-cli": "./bin/realtimex-pp-cli.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "README.md"
12
+ ],
13
+ "optionalDependencies": {
14
+ "@realtimex/pp-cli-darwin-x64": "2.0.3",
15
+ "@realtimex/pp-cli-darwin-arm64": "2.0.3",
16
+ "@realtimex/pp-cli-linux-x64": "2.0.3",
17
+ "@realtimex/pp-cli-linux-arm64": "2.0.3",
18
+ "@realtimex/pp-cli-win32-x64": "2.0.3",
19
+ "@realtimex/pp-cli-win32-arm64": "2.0.3"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ }
24
+ }