@dmytro-yemelianov/raps-cli 4.3.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 +54 -0
- package/package.json +45 -0
- package/scripts/postinstall.js +67 -0
- package/src/index.js +111 -0
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @dmytro-yemelianov/raps-cli
|
|
2
|
+
|
|
3
|
+
RAPS (rapeseed) - Rust CLI for Autodesk Platform Services
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @dmytro-yemelianov/raps-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or run without installing:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @dmytro-yemelianov/raps-cli --version
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Test authentication
|
|
21
|
+
raps auth test
|
|
22
|
+
|
|
23
|
+
# List buckets
|
|
24
|
+
raps bucket list
|
|
25
|
+
|
|
26
|
+
# Upload a file
|
|
27
|
+
raps object upload my-bucket model.rvt
|
|
28
|
+
|
|
29
|
+
# Translate to SVF2
|
|
30
|
+
raps translate start urn:... --format svf2
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Documentation
|
|
34
|
+
|
|
35
|
+
Full documentation available at [rapscli.xyz](https://rapscli.xyz)
|
|
36
|
+
|
|
37
|
+
## Alternative Installation Methods
|
|
38
|
+
|
|
39
|
+
- **pip**: `pip install raps`
|
|
40
|
+
- **Homebrew**: `brew install dmytro-yemelianov/raps/raps`
|
|
41
|
+
- **Scoop**: `scoop install raps`
|
|
42
|
+
- **Shell script**: `curl -fsSL https://raw.githubusercontent.com/dmytro-yemelianov/raps/main/install.sh | bash`
|
|
43
|
+
|
|
44
|
+
## Supported Platforms
|
|
45
|
+
|
|
46
|
+
- Windows x64
|
|
47
|
+
- macOS x64 (Intel)
|
|
48
|
+
- macOS ARM64 (Apple Silicon)
|
|
49
|
+
- Linux x64
|
|
50
|
+
- Linux ARM64
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
Apache-2.0
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dmytro-yemelianov/raps-cli",
|
|
3
|
+
"version": "4.3.0",
|
|
4
|
+
"description": "RAPS (rapeseed) - Rust CLI for Autodesk Platform Services",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"autodesk",
|
|
7
|
+
"aps",
|
|
8
|
+
"forge",
|
|
9
|
+
"cad",
|
|
10
|
+
"bim",
|
|
11
|
+
"cli",
|
|
12
|
+
"rust"
|
|
13
|
+
],
|
|
14
|
+
"author": "Dmytro Yemelianov",
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/dmytro-yemelianov/raps.git"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://rapscli.xyz",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/dmytro-yemelianov/raps/issues"
|
|
23
|
+
},
|
|
24
|
+
"bin": {
|
|
25
|
+
"raps": "src/index.js"
|
|
26
|
+
},
|
|
27
|
+
"main": "src/index.js",
|
|
28
|
+
"files": [
|
|
29
|
+
"src",
|
|
30
|
+
"scripts"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"postinstall": "node scripts/postinstall.js"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=14"
|
|
37
|
+
},
|
|
38
|
+
"optionalDependencies": {
|
|
39
|
+
"@dmytro-yemelianov/raps-cli-win32-x64": "4.3.0",
|
|
40
|
+
"@dmytro-yemelianov/raps-cli-win32-x64": "4.3.0",
|
|
41
|
+
"@dmytro-yemelianov/raps-cli-win32-x64": "4.3.0",
|
|
42
|
+
"@dmytro-yemelianov/raps-cli-win32-x64": "4.3.0",
|
|
43
|
+
"@dmytro-yemelianov/raps-cli-win32-x64": "4.3.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* RAPS CLI - Post-install verification script
|
|
5
|
+
*
|
|
6
|
+
* Verifies that the platform-specific binary was installed correctly.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const { execSync } = require('child_process');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
// Platform to package mapping
|
|
13
|
+
const PLATFORMS = {
|
|
14
|
+
'win32-x64': '@dmytro-yemelianov/raps-cli-win32-x64',
|
|
15
|
+
'darwin-x64': '@dmytro-yemelianov/raps-cli-darwin-x64',
|
|
16
|
+
'darwin-arm64': '@dmytro-yemelianov/raps-cli-darwin-arm64',
|
|
17
|
+
'linux-x64': '@dmytro-yemelianov/raps-cli-linux-x64',
|
|
18
|
+
'linux-arm64': '@dmytro-yemelianov/raps-cli-linux-arm64',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function getPlatformKey() {
|
|
22
|
+
const platform = process.platform;
|
|
23
|
+
const arch = process.arch;
|
|
24
|
+
const archMap = { 'x64': 'x64', 'arm64': 'arm64' };
|
|
25
|
+
const mappedArch = archMap[arch];
|
|
26
|
+
return mappedArch ? `${platform}-${mappedArch}` : null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function main() {
|
|
30
|
+
const platformKey = getPlatformKey();
|
|
31
|
+
const packageName = PLATFORMS[platformKey];
|
|
32
|
+
|
|
33
|
+
if (!packageName) {
|
|
34
|
+
console.warn(`Warning: RAPS does not support your platform (${process.platform}-${process.arch})`);
|
|
35
|
+
console.warn('The CLI may not work correctly.');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
// Try to require the platform package
|
|
41
|
+
const platformModule = require(packageName);
|
|
42
|
+
const binaryPath = platformModule.binaryPath;
|
|
43
|
+
|
|
44
|
+
if (!binaryPath) {
|
|
45
|
+
console.warn('Warning: Platform package found but binary path not exported.');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Try to run --version to verify binary works
|
|
50
|
+
try {
|
|
51
|
+
const version = execSync(`"${binaryPath}" --version`, {
|
|
52
|
+
encoding: 'utf-8',
|
|
53
|
+
timeout: 5000,
|
|
54
|
+
}).trim();
|
|
55
|
+
console.log(`RAPS installed successfully: ${version}`);
|
|
56
|
+
} catch (e) {
|
|
57
|
+
console.warn('Warning: Binary found but failed to execute.');
|
|
58
|
+
console.warn('You may need to install additional dependencies for your platform.');
|
|
59
|
+
}
|
|
60
|
+
} catch (e) {
|
|
61
|
+
// Optional dependency not installed - this is normal for unsupported platforms
|
|
62
|
+
console.warn(`Note: Platform binary for ${platformKey} not available.`);
|
|
63
|
+
console.warn('This is expected if npm skipped optional dependencies.');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
main();
|
package/src/index.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* RAPS CLI - Platform-specific binary executor
|
|
5
|
+
*
|
|
6
|
+
* This script detects the current platform and executes the appropriate
|
|
7
|
+
* pre-compiled RAPS binary, passing through all command-line arguments.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const { spawn } = require('child_process');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
|
|
14
|
+
// Platform to package mapping
|
|
15
|
+
const PLATFORMS = {
|
|
16
|
+
'win32-x64': '@dmytro-yemelianov/raps-cli-win32-x64',
|
|
17
|
+
'darwin-x64': '@dmytro-yemelianov/raps-cli-darwin-x64',
|
|
18
|
+
'darwin-arm64': '@dmytro-yemelianov/raps-cli-darwin-arm64',
|
|
19
|
+
'linux-x64': '@dmytro-yemelianov/raps-cli-linux-x64',
|
|
20
|
+
'linux-arm64': '@dmytro-yemelianov/raps-cli-linux-arm64',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Get current platform identifier
|
|
24
|
+
function getPlatformKey() {
|
|
25
|
+
const platform = process.platform;
|
|
26
|
+
const arch = process.arch;
|
|
27
|
+
|
|
28
|
+
// Map Node.js arch names to our naming convention
|
|
29
|
+
const archMap = {
|
|
30
|
+
'x64': 'x64',
|
|
31
|
+
'arm64': 'arm64',
|
|
32
|
+
'ia32': 'x86',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const mappedArch = archMap[arch];
|
|
36
|
+
if (!mappedArch) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return `${platform}-${mappedArch}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Find the binary path for the current platform
|
|
44
|
+
function getBinaryPath() {
|
|
45
|
+
const platformKey = getPlatformKey();
|
|
46
|
+
|
|
47
|
+
if (!platformKey) {
|
|
48
|
+
console.error(`Error: Unsupported architecture: ${process.arch}`);
|
|
49
|
+
console.error('Supported architectures: x64, arm64');
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const packageName = PLATFORMS[platformKey];
|
|
54
|
+
|
|
55
|
+
if (!packageName) {
|
|
56
|
+
console.error(`Error: Unsupported platform: ${platformKey}`);
|
|
57
|
+
console.error(`Supported platforms: ${Object.keys(PLATFORMS).join(', ')}`);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Try to find the platform package
|
|
62
|
+
let packagePath;
|
|
63
|
+
try {
|
|
64
|
+
packagePath = require.resolve(packageName);
|
|
65
|
+
} catch (e) {
|
|
66
|
+
console.error(`Error: Platform package not installed: ${packageName}`);
|
|
67
|
+
console.error('');
|
|
68
|
+
console.error('This usually means your platform is not supported or the');
|
|
69
|
+
console.error('optional dependency failed to install.');
|
|
70
|
+
console.error('');
|
|
71
|
+
console.error('Try reinstalling with:');
|
|
72
|
+
console.error(' npm install -g @dmytro-yemelianov/raps-cli');
|
|
73
|
+
console.error('');
|
|
74
|
+
console.error('Or install RAPS directly:');
|
|
75
|
+
console.error(' curl -fsSL https://raw.githubusercontent.com/dmytro-yemelianov/raps/main/install.sh | bash');
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// The platform package exports the binary path
|
|
80
|
+
const platformModule = require(packageName);
|
|
81
|
+
const binaryPath = platformModule.binaryPath;
|
|
82
|
+
|
|
83
|
+
if (!binaryPath || !fs.existsSync(binaryPath)) {
|
|
84
|
+
console.error(`Error: Binary not found at expected path: ${binaryPath}`);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return binaryPath;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Execute the binary with all arguments
|
|
92
|
+
function main() {
|
|
93
|
+
const binaryPath = getBinaryPath();
|
|
94
|
+
const args = process.argv.slice(2);
|
|
95
|
+
|
|
96
|
+
const child = spawn(binaryPath, args, {
|
|
97
|
+
stdio: 'inherit',
|
|
98
|
+
shell: false,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
child.on('error', (err) => {
|
|
102
|
+
console.error(`Error executing RAPS: ${err.message}`);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
child.on('close', (code) => {
|
|
107
|
+
process.exit(code || 0);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
main();
|