@backtomyfuture/exchange-cli 0.1.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/bin/exchange-cli.js +52 -0
- package/install.js +29 -0
- package/package.json +30 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require('child_process');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const PLATFORM_PACKAGES = {
|
|
8
|
+
'darwin-arm64': '@backtomyfuture/exchange-cli-darwin-arm64',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
12
|
+
const ext = process.platform === 'win32' ? '.exe' : '';
|
|
13
|
+
|
|
14
|
+
function getBinaryPath() {
|
|
15
|
+
if (process.env.EXCHANGE_CLI_BINARY) {
|
|
16
|
+
return process.env.EXCHANGE_CLI_BINARY;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const pkg = PLATFORM_PACKAGES[platformKey];
|
|
20
|
+
if (!pkg) {
|
|
21
|
+
console.error(`exchange-cli: unsupported platform ${platformKey}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
return require.resolve(`${pkg}/bin/exchange-cli${ext}`);
|
|
27
|
+
} catch {
|
|
28
|
+
const modPath = path.join(
|
|
29
|
+
path.dirname(require.resolve(`${pkg}/package.json`)),
|
|
30
|
+
`bin/exchange-cli${ext}`
|
|
31
|
+
);
|
|
32
|
+
if (fs.existsSync(modPath)) {
|
|
33
|
+
return modPath;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.error(`exchange-cli: binary not found for ${platformKey}`);
|
|
38
|
+
console.error('Try: npm install --force @backtomyfuture/exchange-cli');
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
execFileSync(getBinaryPath(), process.argv.slice(2), {
|
|
44
|
+
stdio: 'inherit',
|
|
45
|
+
env: { ...process.env },
|
|
46
|
+
});
|
|
47
|
+
} catch (e) {
|
|
48
|
+
if (e && e.status != null) {
|
|
49
|
+
process.exit(e.status);
|
|
50
|
+
}
|
|
51
|
+
throw e;
|
|
52
|
+
}
|
package/install.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
const PLATFORM_PACKAGES = {
|
|
7
|
+
'darwin-arm64': '@backtomyfuture/exchange-cli-darwin-arm64',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
11
|
+
const pkg = PLATFORM_PACKAGES[platformKey];
|
|
12
|
+
|
|
13
|
+
if (!pkg) {
|
|
14
|
+
console.log(`exchange-cli: no binary for ${platformKey}, skipping`);
|
|
15
|
+
process.exit(0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const ext = process.platform === 'win32' ? '.exe' : '';
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
const binaryPath = require.resolve(`${pkg}/bin/exchange-cli${ext}`);
|
|
22
|
+
if (process.platform !== 'win32') {
|
|
23
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
24
|
+
console.log(`exchange-cli: set executable permission for ${platformKey}`);
|
|
25
|
+
}
|
|
26
|
+
} catch {
|
|
27
|
+
console.log(`exchange-cli: platform package ${pkg} not installed`);
|
|
28
|
+
console.log('To fix: npm install --force @backtomyfuture/exchange-cli');
|
|
29
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backtomyfuture/exchange-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Exchange Web Services CLI - email, calendar, tasks, contacts. Designed for AI agents.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"exchange-cli": "bin/exchange-cli.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node install.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
"install.js"
|
|
14
|
+
],
|
|
15
|
+
"optionalDependencies": {
|
|
16
|
+
"@backtomyfuture/exchange-cli-darwin-arm64": "0.1.0"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=14"
|
|
20
|
+
},
|
|
21
|
+
"keywords": ["exchange", "ews", "cli", "email", "ai-agent", "office365"],
|
|
22
|
+
"license": "Apache-2.0",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/canghe/exchange-cli"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
}
|
|
30
|
+
}
|