@vibecuting/component-project-helper 0.1.14 → 0.1.15

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": "@vibecuting/component-project-helper",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "main": "./src/index.ts",
@@ -97,8 +97,16 @@ export async function runComponentProjectPostinstall(projectRoot = resolveCompon
97
97
  )
98
98
  }
99
99
 
100
- const isDirectRun = process.argv[1] && path.resolve(process.argv[1]) === path.resolve(new URL(import.meta.url).pathname)
100
+ async function isDirectRun() {
101
+ if (!process.argv[1]) {
102
+ return false
103
+ }
104
+
105
+ const entryPath = await fs.realpath(process.argv[1])
106
+ const currentPath = await fs.realpath(new URL(import.meta.url).pathname)
107
+ return entryPath === currentPath
108
+ }
101
109
 
102
- if (isDirectRun) {
110
+ if (await isDirectRun()) {
103
111
  await runComponentProjectPostinstall()
104
112
  }
@@ -1,5 +1,5 @@
1
1
  import fs from 'node:fs/promises'
2
- import path from 'node:path'
2
+ import { fileURLToPath } from 'node:url'
3
3
 
4
4
  import { resolveComponentProjectGeneratedManifestPath } from './runtime-root.mjs'
5
5
  import { ComponentProjectGeneratedManifestSchema } from './schemas.mjs'
@@ -30,8 +30,16 @@ export async function runComponentProjectPreuninstall(
30
30
  await removeComponentProjectSkillsScript(projectRoot)
31
31
  }
32
32
 
33
- const isDirectRun = process.argv[1] && path.resolve(process.argv[1]) === path.resolve(new URL(import.meta.url).pathname)
33
+ async function isDirectRun() {
34
+ if (!process.argv[1]) {
35
+ return false
36
+ }
37
+
38
+ const entryPath = await fs.realpath(process.argv[1])
39
+ const currentPath = await fs.realpath(fileURLToPath(import.meta.url))
40
+ return entryPath === currentPath
41
+ }
34
42
 
35
- if (isDirectRun) {
43
+ if (await isDirectRun()) {
36
44
  await runComponentProjectPreuninstall()
37
45
  }
@@ -105,10 +105,23 @@ export async function runComponentProjectPostinstall(
105
105
  )
106
106
  }
107
107
 
108
+ async function isDirectRun(): Promise<boolean> {
109
+ if (!process.argv[1]) {
110
+ return false
111
+ }
112
+
113
+ const [entryPath, currentPath] = await Promise.all([
114
+ fs.realpath(process.argv[1]),
115
+ fs.realpath(fileURLToPath(import.meta.url)),
116
+ ])
117
+
118
+ return entryPath === currentPath
119
+ }
120
+
108
121
  async function main(): Promise<void> {
109
122
  await runComponentProjectPostinstall()
110
123
  }
111
124
 
112
- if (process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
125
+ if (await isDirectRun()) {
113
126
  await main()
114
127
  }
@@ -1,5 +1,4 @@
1
1
  import fs from 'node:fs/promises'
2
- import path from 'node:path'
3
2
  import { fileURLToPath } from 'node:url'
4
3
 
5
4
  import { ComponentProjectGeneratedManifestSchema } from '../schemas'
@@ -37,6 +36,19 @@ async function main(): Promise<void> {
37
36
  await runComponentProjectPreuninstall()
38
37
  }
39
38
 
40
- if (process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
39
+ async function isDirectRun(): Promise<boolean> {
40
+ if (!process.argv[1]) {
41
+ return false
42
+ }
43
+
44
+ const [entryPath, currentPath] = await Promise.all([
45
+ fs.realpath(process.argv[1]),
46
+ fs.realpath(fileURLToPath(import.meta.url)),
47
+ ])
48
+
49
+ return entryPath === currentPath
50
+ }
51
+
52
+ if (await isDirectRun()) {
41
53
  await main()
42
54
  }