Skip to content

Commit c77524a

Browse files
fix: fix command usage
1 parent bb181f4 commit c77524a

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

packages/toml/nursery.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const assert = require('node:assert')
55
setup({
66
dirname: __dirname,
77
name: 'toml',
8+
treeSitterPackage: '@tree-sitter-grammars/tree-sitter-toml',
89
languageRegistration: toml,
910
testRunner: (parse) => {
1011
const sg = parse('name = "Tom"')

packages/toml/postinstall.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { postinstall } = require('@ast-grep/setup-lang')
22
postinstall({
3-
directory: __dirname,
3+
dirname: __dirname,
44
treeSitterPackage: '@tree-sitter-grammars/tree-sitter-toml',
55
})

scripts/setup/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function log(...args: unknown[]) {
1111

1212
interface SetupConfig {
1313
/** Directory of the lang package. e.g. __dirname */
14-
directory: string
14+
dirname: string
1515
/** Package name of tree-sitter package. e.g. tree-sitter-css */
1616
treeSitterPackage: string
1717
}
@@ -20,7 +20,7 @@ interface SetupConfig {
2020
* Move prebuild or build parser
2121
*/
2222
function postinstall(config: SetupConfig) {
23-
const dir = config.directory
23+
const dir = config.dirname
2424
const parser = path.join(dir, 'parser.so')
2525
if (fs.existsSync(parser)) {
2626
log('parser already exists, skipping build')
@@ -41,8 +41,8 @@ function postinstall(config: SetupConfig) {
4141
}
4242

4343
function buildSrc(config: SetupConfig) {
44-
const { directory, treeSitterPackage } = config
45-
const existing = path.join(directory, 'src')
44+
const { dirname } = config
45+
const existing = path.join(dirname, 'src')
4646
if (!fs.existsSync(existing)) {
4747
log('tree-sitter src not found. If you are making a lang package, please run `pnpm source`.')
4848
return

0 commit comments

Comments
 (0)