actionsprofiler 1.0.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.
Files changed (2) hide show
  1. package/bin.js +51 -0
  2. package/package.json +22 -0
package/bin.js ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ const { execFileSync } = require("child_process");
3
+ const path = require("path");
4
+ const fs = require("fs");
5
+
6
+ const PLATFORMS = {
7
+ "darwin-arm64": "actions-profiler-darwin-arm64",
8
+ "darwin-x64": "actions-profiler-darwin-x64",
9
+ "linux-x64": "actions-profiler-linux-x64",
10
+ "linux-arm64": "actions-profiler-linux-arm64",
11
+ "win32-x64": "actions-profiler-win32-x64",
12
+ };
13
+
14
+ const platformKey = `${process.platform}-${process.arch}`;
15
+ const pkgName = PLATFORMS[platformKey];
16
+
17
+ if (!pkgName) {
18
+ console.error(`Unsupported platform: ${platformKey}`);
19
+ console.error(`Supported platforms: ${Object.keys(PLATFORMS).join(", ")}`);
20
+ process.exit(1);
21
+ }
22
+
23
+ const ext = process.platform === "win32" ? ".exe" : "";
24
+ const binName = `actions-profiler${ext}`;
25
+
26
+ let binPath;
27
+
28
+ // First, try local development path (sibling directory)
29
+ const localPath = path.join(__dirname, "..", pkgName, "bin", binName);
30
+ if (fs.existsSync(localPath)) {
31
+ binPath = localPath;
32
+ } else {
33
+ // Fall back to npm installed package
34
+ try {
35
+ const pkgPath = require.resolve(`@abergs/${pkgName}/package.json`);
36
+ binPath = path.join(path.dirname(pkgPath), "bin", binName);
37
+ } catch (e) {
38
+ console.error(`Failed to find binary package: @abergs/${pkgName}`);
39
+ console.error(`Make sure the package is installed correctly.`);
40
+ process.exit(1);
41
+ }
42
+ }
43
+
44
+ try {
45
+ execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
46
+ } catch (e) {
47
+ if (e.status !== undefined) {
48
+ process.exit(e.status);
49
+ }
50
+ throw e;
51
+ }
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "actionsprofiler",
3
+ "version": "1.0.0",
4
+ "description": "CLI tool to analyze GitHub Actions workflow timing",
5
+ "bin": {
6
+ "actionsprofiler": "bin.js"
7
+ },
8
+ "optionalDependencies": {
9
+ "@abergs/actions-profiler-darwin-arm64": "1.0.0",
10
+ "@abergs/actions-profiler-darwin-x64": "1.0.0",
11
+ "@abergs/actions-profiler-linux-x64": "1.0.0",
12
+ "@abergs/actions-profiler-linux-arm64": "1.0.0",
13
+ "@abergs/actions-profiler-win32-x64": "1.0.0"
14
+ },
15
+ "keywords": ["github", "actions", "profiler", "workflow", "timing"],
16
+ "author": "Anders Åberg",
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/abergs/actionprofiler"
21
+ }
22
+ }