@ast-grep/create-lang 0.0.0-prerelease → 0.0.0-prerelease-1

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/index.js CHANGED
@@ -61,7 +61,11 @@ function askConfiguration() {
61
61
  message: 'Include gitignore and npm publish files?',
62
62
  initial: true,
63
63
  }
64
- ]);
64
+ ], {
65
+ onCancel: () => {
66
+ process.exit(1);
67
+ }
68
+ });
65
69
  }
66
70
  function copyTemplate(targetDir, includeDotFiles) {
67
71
  const templateDir = node_path_1.default.join(__dirname, 'template');
@@ -97,13 +101,15 @@ async function renameFiles(dir, answer) {
97
101
  }
98
102
  }
99
103
  }
100
- function installTreeSitterPackage(answer) {
104
+ function installTreeSitterPackage(cwd, answer) {
101
105
  console.log('Installing tree-sitter package...');
102
- (0, node_child_process_1.execSync)(`pnpm install ${answer.treeSitterPackage} --save-dev --save-exact`);
106
+ (0, node_child_process_1.execSync)(`pnpm install ${answer.treeSitterPackage} --save-dev --save-exact`, {
107
+ cwd,
108
+ });
103
109
  console.log('Copying source code...');
104
- (0, node_child_process_1.execSync)('pnpm run source');
110
+ (0, node_child_process_1.execSync)('pnpm run source', { cwd });
105
111
  console.log('Compiling');
106
- (0, node_child_process_1.execSync)('pnpm run build');
112
+ (0, node_child_process_1.execSync)('pnpm run build', { cwd });
107
113
  }
108
114
  async function main() {
109
115
  let cwd = process.cwd();
@@ -114,6 +120,6 @@ async function main() {
114
120
  const config = await askConfiguration();
115
121
  await copyTemplate(cwd, config.includeDotFiles);
116
122
  await renameFiles(cwd, config);
117
- installTreeSitterPackage(config);
123
+ installTreeSitterPackage(cwd, config);
118
124
  }
119
125
  main();
package/index.ts CHANGED
@@ -62,7 +62,11 @@ function askConfiguration() {
62
62
  message: 'Include gitignore and npm publish files?',
63
63
  initial: true,
64
64
  }
65
- ])
65
+ ], {
66
+ onCancel: () => {
67
+ process.exit(1)
68
+ }
69
+ })
66
70
  }
67
71
 
68
72
  type Answers = Awaited<ReturnType<typeof askConfiguration>>
@@ -101,13 +105,15 @@ async function renameFiles(dir: string, answer: Answers) {
101
105
  }
102
106
  }
103
107
  }
104
- function installTreeSitterPackage(answer: Answers) {
108
+ function installTreeSitterPackage(cwd: string, answer: Answers) {
105
109
  console.log('Installing tree-sitter package...')
106
- execSync(`pnpm install ${answer.treeSitterPackage} --save-dev --save-exact`)
110
+ execSync(`pnpm install ${answer.treeSitterPackage} --save-dev --save-exact`, {
111
+ cwd,
112
+ })
107
113
  console.log('Copying source code...')
108
- execSync('pnpm run source')
114
+ execSync('pnpm run source', { cwd })
109
115
  console.log('Compiling')
110
- execSync('pnpm run build')
116
+ execSync('pnpm run build', { cwd })
111
117
  }
112
118
 
113
119
  async function main() {
@@ -119,8 +125,7 @@ async function main() {
119
125
  const config = await askConfiguration()
120
126
  await copyTemplate(cwd, config.includeDotFiles)
121
127
  await renameFiles(cwd, config)
122
- installTreeSitterPackage(config)
128
+ installTreeSitterPackage(cwd, config)
123
129
  }
124
130
 
125
131
  main()
126
-
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@ast-grep/create-lang",
3
- "version": "0.0.0-prerelease",
3
+ "version": "0.0.0-prerelease-1",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "main": "index.js",
7
- "keywords": [],
7
+ "keywords": [
8
+ "ast-grep"
9
+ ],
8
10
  "author": "",
9
11
  "license": "ISC",
10
12
  "bin": {
@@ -18,7 +18,7 @@
18
18
  "src",
19
19
  "prebuilds"
20
20
  ],
21
- "keywords": [],
21
+ "keywords": ["ast-grep"],
22
22
  "author": "",
23
23
  "license": "ISC",
24
24
  "dependencies": {