@daz4126/swifty 4.1.0 → 4.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daz4126/swifty",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "main": "./src/index.js",
5
5
  "type": "module",
6
6
  "exports": {
package/src/build.js CHANGED
@@ -1,3 +1,4 @@
1
+ import fs from "fs";
1
2
  import { argv } from "process";
2
3
  import path from "path";
3
4
  import { fileURLToPath } from "url";
@@ -106,7 +107,7 @@ export { prepareOutputDirectory };
106
107
 
107
108
  // Run the build when invoked directly (e.g. `npm run build`, `npm start`),
108
109
  // not when imported as a module (e.g. by cli.js).
109
- if (argv[1] && fileURLToPath(import.meta.url) === argv[1]) {
110
+ if (argv[1] && fileURLToPath(import.meta.url) === fs.realpathSync(argv[1])) {
110
111
  build().catch((error) => {
111
112
  console.error("Build failed:", error);
112
113
  process.exit(1);
package/src/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { execFileSync, spawnSync } from "child_process";
4
+ import fs from "fs";
4
5
  import { fileURLToPath } from "url";
5
6
 
6
7
  const args = process.argv.slice(2);
@@ -138,7 +139,10 @@ async function main() {
138
139
  }
139
140
  }
140
141
 
141
- if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
142
+ if (
143
+ process.argv[1] &&
144
+ fileURLToPath(import.meta.url) === fs.realpathSync(process.argv[1])
145
+ ) {
142
146
  main().catch((error) => {
143
147
  console.error(`Swifty failed: ${error.message}`);
144
148
  process.exitCode = 1;