vlt 0.0.0-5 → 0.0.0-7

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 (7) hide show
  1. package/package.json +6 -6
  2. package/postinstall.cjs +17 -8
  3. package/vlix +1 -25
  4. package/vlr +1 -25
  5. package/vlrx +1 -25
  6. package/vlt +1 -25
  7. package/vlx +1 -25
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vlt",
3
3
  "description": "The vlt CLI",
4
- "version": "0.0.0-5",
4
+ "version": "0.0.0-7",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -20,11 +20,11 @@
20
20
  "vlx": "./vlx"
21
21
  },
22
22
  "optionalDependencies": {
23
- "@vltpkg/cli-linux-x64": "0.0.0-5",
24
- "@vltpkg/cli-linux-arm64": "0.0.0-5",
25
- "@vltpkg/cli-darwin-x64": "0.0.0-5",
26
- "@vltpkg/cli-darwin-arm64": "0.0.0-5",
27
- "@vltpkg/cli-win32-x64": "0.0.0-5"
23
+ "@vltpkg/cli-linux-x64": "0.0.0-7",
24
+ "@vltpkg/cli-linux-arm64": "0.0.0-7",
25
+ "@vltpkg/cli-darwin-x64": "0.0.0-7",
26
+ "@vltpkg/cli-darwin-arm64": "0.0.0-7",
27
+ "@vltpkg/cli-win32-x64": "0.0.0-7"
28
28
  },
29
29
  "scripts": {
30
30
  "postinstall": "node postinstall.cjs"
package/postinstall.cjs CHANGED
@@ -7,11 +7,18 @@ const fs = require('fs')
7
7
  const execMode = 0o777 & ~process.umask()
8
8
  const platform = os.platform()
9
9
  const arch = os.arch()
10
+ const isWindows = platform === 'win32'
10
11
  const rootPackage = __dirname
11
- const bins = Object.values(
12
- require(join(rootPackage, 'package.json')).bin,
12
+ const pkg = JSON.parse(
13
+ fs.readFileSync(join(rootPackage, 'package.json'), 'utf8'),
13
14
  )
14
15
 
16
+ const unlinkSyncSafe = file => {
17
+ try {
18
+ fs.unlinkSync(file)
19
+ } catch {}
20
+ }
21
+
15
22
  const platformPkg = (() => {
16
23
  try {
17
24
  return dirname(
@@ -34,9 +41,7 @@ const atomicCopySync = (source, target) => {
34
41
  fs.renameSync(tmp, target)
35
42
  fs.chmodSync(target, execMode)
36
43
  } catch (err) {
37
- try {
38
- fs.unlinkSync(tmp)
39
- } catch {}
44
+ unlinkSyncSafe(tmp)
40
45
  throw new Error(`Could not copy platform bin`, {
41
46
  cause: {
42
47
  source,
@@ -48,9 +53,13 @@ const atomicCopySync = (source, target) => {
48
53
  }
49
54
  }
50
55
 
51
- for (const binPath of bins) {
56
+ for (const binPath of Object.values(pkg.bin)) {
57
+ const platformBinPath = `${binPath}${isWindows ? '.exe' : ''}`
52
58
  atomicCopySync(
53
- join(platformPkg, binPath + `${os === 'win32' ? '.exe' : ''}`),
54
- join(rootPackage, binPath),
59
+ join(platformPkg, platformBinPath),
60
+ join(rootPackage, platformBinPath),
55
61
  )
62
+ if (platformBinPath !== binPath) {
63
+ unlinkSyncSafe(join(rootPackage, binPath))
64
+ }
56
65
  }
package/vlix CHANGED
@@ -1,25 +1 @@
1
- #!/usr/bin/env node
2
-
3
- import { readFileSync } from 'fs'
4
- import { resolve } from 'path'
5
- import os from 'os'
6
-
7
- const validPlatforms = Object.keys(
8
- JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf8'))
9
- .optionalDependencies,
10
- ).map(name => name.replace('@vltpkg/cli-', ''))
11
-
12
- const currentPlatform = `${os.platform()}-${os.arch()}`
13
-
14
- console.error(
15
- validPlatforms.includes(currentPlatform) ?
16
- `This is a supported platform but the matching binary was not found.
17
- This could be due to --no-optional or --ignore-scripts being used when installing.
18
- Try again without either of those flags.
19
- Otherwise check for error logs from the postinstall script.`
20
- : `The current platform is not supported by this package.`,
21
- )
22
- console.error(`Valid platforms: ${JSON.stringify(validPlatforms)}`)
23
- console.error(`Current platform: ${JSON.stringify(currentPlatform)}`)
24
-
25
- process.exit(1)
1
+ "If this file exists, the postinstall script failed to run."
package/vlr CHANGED
@@ -1,25 +1 @@
1
- #!/usr/bin/env node
2
-
3
- import { readFileSync } from 'fs'
4
- import { resolve } from 'path'
5
- import os from 'os'
6
-
7
- const validPlatforms = Object.keys(
8
- JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf8'))
9
- .optionalDependencies,
10
- ).map(name => name.replace('@vltpkg/cli-', ''))
11
-
12
- const currentPlatform = `${os.platform()}-${os.arch()}`
13
-
14
- console.error(
15
- validPlatforms.includes(currentPlatform) ?
16
- `This is a supported platform but the matching binary was not found.
17
- This could be due to --no-optional or --ignore-scripts being used when installing.
18
- Try again without either of those flags.
19
- Otherwise check for error logs from the postinstall script.`
20
- : `The current platform is not supported by this package.`,
21
- )
22
- console.error(`Valid platforms: ${JSON.stringify(validPlatforms)}`)
23
- console.error(`Current platform: ${JSON.stringify(currentPlatform)}`)
24
-
25
- process.exit(1)
1
+ "If this file exists, the postinstall script failed to run."
package/vlrx CHANGED
@@ -1,25 +1 @@
1
- #!/usr/bin/env node
2
-
3
- import { readFileSync } from 'fs'
4
- import { resolve } from 'path'
5
- import os from 'os'
6
-
7
- const validPlatforms = Object.keys(
8
- JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf8'))
9
- .optionalDependencies,
10
- ).map(name => name.replace('@vltpkg/cli-', ''))
11
-
12
- const currentPlatform = `${os.platform()}-${os.arch()}`
13
-
14
- console.error(
15
- validPlatforms.includes(currentPlatform) ?
16
- `This is a supported platform but the matching binary was not found.
17
- This could be due to --no-optional or --ignore-scripts being used when installing.
18
- Try again without either of those flags.
19
- Otherwise check for error logs from the postinstall script.`
20
- : `The current platform is not supported by this package.`,
21
- )
22
- console.error(`Valid platforms: ${JSON.stringify(validPlatforms)}`)
23
- console.error(`Current platform: ${JSON.stringify(currentPlatform)}`)
24
-
25
- process.exit(1)
1
+ "If this file exists, the postinstall script failed to run."
package/vlt CHANGED
@@ -1,25 +1 @@
1
- #!/usr/bin/env node
2
-
3
- import { readFileSync } from 'fs'
4
- import { resolve } from 'path'
5
- import os from 'os'
6
-
7
- const validPlatforms = Object.keys(
8
- JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf8'))
9
- .optionalDependencies,
10
- ).map(name => name.replace('@vltpkg/cli-', ''))
11
-
12
- const currentPlatform = `${os.platform()}-${os.arch()}`
13
-
14
- console.error(
15
- validPlatforms.includes(currentPlatform) ?
16
- `This is a supported platform but the matching binary was not found.
17
- This could be due to --no-optional or --ignore-scripts being used when installing.
18
- Try again without either of those flags.
19
- Otherwise check for error logs from the postinstall script.`
20
- : `The current platform is not supported by this package.`,
21
- )
22
- console.error(`Valid platforms: ${JSON.stringify(validPlatforms)}`)
23
- console.error(`Current platform: ${JSON.stringify(currentPlatform)}`)
24
-
25
- process.exit(1)
1
+ "If this file exists, the postinstall script failed to run."
package/vlx CHANGED
@@ -1,25 +1 @@
1
- #!/usr/bin/env node
2
-
3
- import { readFileSync } from 'fs'
4
- import { resolve } from 'path'
5
- import os from 'os'
6
-
7
- const validPlatforms = Object.keys(
8
- JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf8'))
9
- .optionalDependencies,
10
- ).map(name => name.replace('@vltpkg/cli-', ''))
11
-
12
- const currentPlatform = `${os.platform()}-${os.arch()}`
13
-
14
- console.error(
15
- validPlatforms.includes(currentPlatform) ?
16
- `This is a supported platform but the matching binary was not found.
17
- This could be due to --no-optional or --ignore-scripts being used when installing.
18
- Try again without either of those flags.
19
- Otherwise check for error logs from the postinstall script.`
20
- : `The current platform is not supported by this package.`,
21
- )
22
- console.error(`Valid platforms: ${JSON.stringify(validPlatforms)}`)
23
- console.error(`Current platform: ${JSON.stringify(currentPlatform)}`)
24
-
25
- process.exit(1)
1
+ "If this file exists, the postinstall script failed to run."