Skip to content

Commit edc25b3

Browse files
feat: add more project template fiels
1 parent 68ecd21 commit edc25b3

File tree

6 files changed

+120
-1
lines changed

6 files changed

+120
-1
lines changed

packages/toml/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# ast-grep napi language for toml
2+
3+
## Installation
4+
5+
In a pnpm project, run:
6+
7+
```bash
8+
pnpm install @ast-grep/lang-toml
9+
pnpm install @ast-grep/napi
10+
# install the tree-sitter-cli if no prebuild is available
11+
pnpm install @tree-sitter/cli
12+
```
13+
14+
## Usage
15+
16+
```js
17+
import toml from '@ast-grep/lang-toml'
18+
import { registerDynamicLanguage, parse } from '@ast-grep/napi'
19+
20+
registerDynamicLanguage({ toml })
21+
22+
const sg = parse('toml', `your code`)
23+
sg.root().kind()
24+
```

scripts/create-lang/index.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,23 @@ function askConfiguration() {
4040
])
4141
}
4242

43-
askConfiguration().then(console.log)
43+
async function copyTemplate() {
44+
}
45+
46+
function removeDotFiles() {
47+
}
48+
function renameFiles() {
49+
// Rename files
50+
}
51+
52+
async function main() {
53+
const config = await askConfiguration()
54+
await copyTemplate()
55+
if (process.argv.slice(2).includes('--skip-dot-files')) {
56+
removeDotFiles()
57+
}
58+
renameFiles()
59+
}
60+
61+
main()
62+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Publish package
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
directory:
7+
description: The working directory of the package, useful for monorepos
8+
default: .
9+
type: string
10+
dry-run:
11+
description: Dry run (no publish)
12+
type: boolean
13+
default: true
14+
15+
jobs:
16+
npm-publish:
17+
uses: ast-grep/langs/.github/workflows/release.yml@main
18+
with:
19+
directory: ${{ inputs.directory }}
20+
dry-run: ${{ inputs.dry-run }}
21+
secrets:
22+
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
26+
# ignore generated parser files
27+
parser.so
28+
type.d.ts
29+
# do not include copied directories
30+
src

scripts/create-lang/template/.npmignore

Whitespace-only changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# ast-grep napi language for $NAME$
2+
3+
## Installation
4+
5+
In a pnpm project, run:
6+
7+
```bash
8+
pnpm install $PACKAGE_NAME$
9+
pnpm install @ast-grep/napi
10+
# install the tree-sitter-cli if no prebuild is available
11+
pnpm install @tree-sitter/cli
12+
```
13+
14+
## Usage
15+
16+
```js
17+
import $NAME$ from '$PACKAGE_NAME$'
18+
import { registerDynamicLanguage, parse } from '@ast-grep/napi'
19+
20+
registerDynamicLanguage({ $NAME$ })
21+
22+
const sg = parse('$NAME$', `your code`)
23+
sg.root().kind()
24+
```

0 commit comments

Comments
 (0)