@ast-grep/cli 0.4.0 → 0.5.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/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # @ast-grep/cli
2
2
 
3
- See https://github.com/ast-grep/ast-grep
3
+ Please see https://github.com/ast-grep/ast-grep
package/ast-grep ADDED
@@ -0,0 +1,2 @@
1
+ This file is required so that dumb npm creates the ast-grep binary.
2
+ N.B. pnpm does not have this issue.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ast-grep/cli",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -10,6 +10,7 @@
10
10
  },
11
11
  "files": [
12
12
  "sg",
13
+ "ast-grep",
13
14
  "postinstall.js"
14
15
  ],
15
16
  "dependencies": {
@@ -19,12 +20,13 @@
19
20
  "postinstall": "node postinstall.js"
20
21
  },
21
22
  "optionalDependencies": {
22
- "@ast-grep/cli-darwin-x64": "0.4.0",
23
- "@ast-grep/cli-linux-x64-gnu": "0.4.0",
24
- "@ast-grep/cli-win32-x64-msvc": "0.4.0",
25
- "@ast-grep/cli-darwin-arm64": "0.4.0"
23
+ "@ast-grep/cli-darwin-x64": "0.5.0",
24
+ "@ast-grep/cli-linux-x64-gnu": "0.5.0",
25
+ "@ast-grep/cli-win32-x64-msvc": "0.5.0",
26
+ "@ast-grep/cli-darwin-arm64": "0.5.0"
26
27
  },
27
28
  "bin": {
28
- "sg": "sg"
29
+ "sg": "sg",
30
+ "ast-grep": "ast-grep"
29
31
  }
30
32
  }
package/postinstall.js CHANGED
@@ -16,6 +16,7 @@ if (process.platform === 'linux') {
16
16
  }
17
17
 
18
18
  let binary = process.platform === 'win32' ? 'sg.exe' : 'sg';
19
+ let alternative = process.platform === 'win32' ? 'ast-grep.exe' : 'ast-grep';
19
20
 
20
21
  let pkgPath;
21
22
  try {
@@ -29,9 +30,11 @@ try {
29
30
 
30
31
  try {
31
32
  fs.linkSync(path.join(pkgPath, binary), path.join(__dirname, binary));
33
+ fs.linkSync(path.join(pkgPath, binary), path.join(__dirname, alternative));
32
34
  } catch (err) {
33
35
  try {
34
36
  fs.copyFileSync(path.join(pkgPath, binary), path.join(__dirname, binary));
37
+ fs.copyFileSync(path.join(pkgPath, binary), path.join(__dirname, alternative));
35
38
  } catch (err) {
36
39
  console.error('Failed to move @ast-grep/cli binary into place.');
37
40
  process.exit(1);