@brainwav/diagram 1.0.0 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainwav/diagram",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Generate architecture diagrams from codebases",
5
5
  "main": "src/diagram.js",
6
6
  "bin": {
@@ -48,6 +48,7 @@
48
48
  "files": [
49
49
  "src/diagram.js",
50
50
  "src/video.js",
51
+ "src/utils/commands.js",
51
52
  "README.md",
52
53
  "LICENSE"
53
54
  ],
@@ -0,0 +1,51 @@
1
+ const os = require('os');
2
+ const path = require('path');
3
+
4
+ function getOpenCommand(url, platform = process.platform) {
5
+ if (platform === 'darwin') {
6
+ return { cmd: 'open', args: [url] };
7
+ }
8
+ if (platform === 'win32') {
9
+ return { cmd: 'explorer.exe', args: [url] };
10
+ }
11
+ return { cmd: 'xdg-open', args: [url] };
12
+ }
13
+
14
+ function getNpxCommandCandidates(platform = process.platform) {
15
+ if (platform === 'win32') {
16
+ return ['npx.cmd', 'npx'];
17
+ }
18
+ return ['npx'];
19
+ }
20
+
21
+ function getFfmpegCommandCandidates(platform = process.platform, homeDir = os.homedir()) {
22
+ const common = [
23
+ 'ffmpeg',
24
+ '/usr/bin/ffmpeg',
25
+ '/usr/local/bin/ffmpeg',
26
+ '/opt/homebrew/bin/ffmpeg',
27
+ '/opt/homebrew/opt/ffmpeg/bin/ffmpeg',
28
+ path.join(homeDir, '.local/share/mise/installs/ffmpeg/current/bin/ffmpeg'),
29
+ path.join(homeDir, '.local/share/mise/installs/ffmpeg/8.0.1/bin/ffmpeg')
30
+ ];
31
+
32
+ if (platform === 'win32') {
33
+ return [
34
+ 'ffmpeg.exe',
35
+ 'C:\\ffmpeg\\bin\\ffmpeg.exe',
36
+ 'C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe',
37
+ 'C:\\Program Files (x86)\\ffmpeg\\bin\\ffmpeg.exe',
38
+ path.join(homeDir, '.local/share/mise/installs/ffmpeg/current/bin/ffmpeg.exe'),
39
+ path.join(homeDir, '.local/share/mise/installs/ffmpeg/8.0.1/bin/ffmpeg.exe'),
40
+ ...common
41
+ ];
42
+ }
43
+
44
+ return common;
45
+ }
46
+
47
+ module.exports = {
48
+ getOpenCommand,
49
+ getNpxCommandCandidates,
50
+ getFfmpegCommandCandidates
51
+ };