Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add slangroom grammar package #196

Merged
merged 28 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
24ad770
initial package structure
FilippoTrotter Aug 23, 2024
08543f5
change example to slangroom
FilippoTrotter Aug 23, 2024
2d278b7
fix: scenario statement
FilippoTrotter Aug 23, 2024
182581e
update makefile
FilippoTrotter Aug 23, 2024
31700f6
add first simple tests
FilippoTrotter Aug 23, 2024
c71a1bb
fix: add License
FilippoTrotter Aug 26, 2024
23865a3
fix: given have statement
FilippoTrotter Aug 26, 2024
f98d7f5
fix: send can be optional
FilippoTrotter Aug 26, 2024
d07c232
fix: ethereum actions
FilippoTrotter Aug 26, 2024
51e8efe
fix: Helpers send
FilippoTrotter Aug 26, 2024
2d36ca8
update keywords list
FilippoTrotter Aug 26, 2024
4aee312
update Given name statement
FilippoTrotter Aug 26, 2024
8382eda
fix: add the possibility of having more than one scenario
FilippoTrotter Aug 26, 2024
f0e1862
update test list
FilippoTrotter Aug 26, 2024
60967e3
add some others test from didroom
FilippoTrotter Aug 27, 2024
4ff3d20
add grammar test to github actions
FilippoTrotter Aug 27, 2024
25db990
fix(grammar): add missing syntax.grammar.d.ts file
matteo-cristino Aug 28, 2024
9ff39db
chore(grammar): remove package-lock since using pnpm
matteo-cristino Aug 28, 2024
a05616b
chore: add grammar to workspace
matteo-cristino Aug 28, 2024
f1ab7b6
chore(grammar): remove capital letter from package name
matteo-cristino Aug 28, 2024
b06f287
chore: add test:grammar command to test grammar
matteo-cristino Aug 28, 2024
95be7e5
ci: update grammar test
matteo-cristino Aug 28, 2024
edee98c
refactor(grammar): remove unused Makefile
matteo-cristino Aug 28, 2024
650f7d4
chore: add missing license headers
matteo-cristino Aug 28, 2024
473f58f
chore: add grammar package acknowledgement in the readme
matteo-cristino Aug 28, 2024
a289008
chore: Give to Cesar what is to Cesar
puria Aug 28, 2024
891af63
feat(grammar): publish npm package on main merge
puria Aug 28, 2024
6db7c5d
pnpm-lock ❗
puria Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
while ! nc -z 0.0.0.0 8090; do echo "pocketbase not ready" && sleep 1; done
- name: 🧪 Run the tests
run: pnpm coverage
- name: 🧪 Test grammar package
run: pnpm test:grammar
- name: 📨 Setup playwright
run: |
npx playwright install
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/grammar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SPDX-FileCopyrightText: 2024 Dyne.org foundation
#
# SPDX-License-Identifier: AGPL-3.0-or-later

name: 🪶 Grammar publish

on:
push:
branches:
- main
paths: [ "grammar" ]

permissions:
contents: write
issues: write
id-token: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:

publish:
runs-on: ubuntu-latest
needs: build_and_test
if: github.ref == 'refs/heads/main'
steps:
- name: 🛠️ Prepare pnpm workspace
uses: dyne/pnpm@main
- name: 📦 Releases
working-directory: ./grammar
run: npx semantic-release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,15 @@ node_modules

# grammar lezer
!/grammar/Makefile
!/grammar/slangroom.grammar
!/grammar/src/syntax.grammar
!/grammar/src/syntax.grammar.d.ts
!/grammar/src/index.ts
!/grammar/test/*
!/grammar/.npmignore
!/grammar/package.json
!/grammar/rollup.config.js
!/grammar/tsconfig.json
!/grammar/.releaserc



4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ To write new plugins and other technical documentation head your browser to

<img alt="software by Dyne.org" src="https://files.dyne.org/software_by_dyne.png" width="150" />

Copyleft 🄯 2023—2024 by [Dyne.org](https://www.dyne.org) foundation, Amsterdam
Copyleft 🄯 2023—2024 by [Dyne.org](https://www.dyne.org) foundation, Amsterdam.

The grammar package has been created starting from [CodeMirror 6 language package template](https://github.com/codemirror/lang-example).

**[🔝 back to top](#toc)**

Expand Down
9 changes: 9 additions & 0 deletions grammar/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: 2024 Dyne.org foundation
#
# SPDX-License-Identifier: AGPL-3.0-or-later

/src
/test
/node_modules
rollup.config.js
tsconfig.json
43 changes: 43 additions & 0 deletions grammar/.releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2017-2018 Dyne.org foundation
# SPDX-FileCopyrightText: 2017-2021 Dyne.org foundation
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{
"extends": ["semantic-release-commit-filter"]
"repositoryUrl": "[email protected]:dyne/slangroom.git",
"dryRun": false,
"plugins": [
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{ "type": "build", "scope": "deps", "release": "patch" },
{ "type": "build", "scope": "deps-dev", "release": "patch" }
]
}
],
[
"@semantic-release/npm",
{
"npmPublish": true
}
],
[
"@semantic-release/git",
{
"assets": [
"grammar/CHANGELOG.md",
"grammar/pnpm-lock.yaml",
"grammar/package.json"
],
"message": "chore(grammar release): 🚀 ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
],
"branches": [
"main"
]
}
2 changes: 0 additions & 2 deletions grammar/Makefile

This file was deleted.

47 changes: 47 additions & 0 deletions grammar/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "codemirror-lang-slangroom",
"version": "0.1.0",
"description": "Slangroom language support for CodeMirror",
"scripts": {
"test": "mocha test/test.js",
"prepare": "rollup -c"
},
"author": {
"name": "Filippo Trotter"
},
"contributors": [
{ "name": "Matteo Cristino" }
],
"publishConfig": {
"access": "public"
},
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.js",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"types": "dist/index.d.ts",
"sideEffects": false,
"dependencies": {
"@codemirror/language": "^6.0.0",
"@lezer/highlight": "^1.0.0",
"@lezer/lr": "^1.0.0"
},
"devDependencies": {
"@lezer/generator": "^1.0.0",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^13.0.0",
"@semantic-release/git": "^10.0.1",
"@semantic-release/npm": "^12.0.1",
"@semantic-release/release-notes-generator": "^14.0.1",
"mocha": "^9.0.1",
"rollup": "^2.60.2",
"rollup-plugin-dts": "^4.0.1",
"rollup-plugin-ts": "^3.0.2",
"semantic-release-commit-filter": "^1.0.2",
"typescript": "^4.3.4"
},
"license": "AGPL-3.0-or-later"
}
3 changes: 3 additions & 0 deletions grammar/package.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2024 Dyne.org foundation

SPDX-License-Identifier: AGPL-3.0-or-later
16 changes: 16 additions & 0 deletions grammar/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: 2024 Dyne.org foundation
//
// SPDX-License-Identifier: AGPL-3.0-or-later

import typescript from "rollup-plugin-ts"
import {lezer} from "@lezer/generator/rollup"

export default {
input: "src/index.ts",
external: id => id != "tslib" && !/^(\.?\/|\w:)/.test(id),
output: [
{file: "dist/index.cjs", format: "cjs"},
{dir: "./dist", format: "es"}
],
plugins: [lezer(), typescript()]
}
34 changes: 34 additions & 0 deletions grammar/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-FileCopyrightText: 2024 Dyne.org foundation
//
// SPDX-License-Identifier: AGPL-3.0-or-later

import {parser} from "./syntax.grammar"
import {LRLanguage, LanguageSupport, indentNodeProp, foldNodeProp, foldInside, delimitedIndent} from "@codemirror/language"
import {styleTags, tags as t} from "@lezer/highlight"

export const SlangroomLanguage = LRLanguage.define({
parser: parser.configure({
props: [
indentNodeProp.add({
Application: delimitedIndent({closing: ")", align: false})
}),
foldNodeProp.add({
Application: foldInside
}),
styleTags({
Identifier: t.variableName,
Boolean: t.bool,
String: t.string,
LineComment: t.lineComment,
"( )": t.paren
})
]
}),
languageData: {
commentTokens: {line: ";"}
}
})

export function Slangroom() {
return new LanguageSupport(SlangroomLanguage)
}
Loading
Loading