vlt 0.0.0-0.1740089541607 → 0.0.0-10

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