diff --git a/.github/workflows/deploy-playground.yml b/.github/workflows/deploy-playground.yml new file mode 100644 index 00000000..c651460e --- /dev/null +++ b/.github/workflows/deploy-playground.yml @@ -0,0 +1,63 @@ +name: Deploy Playground + +on: + push: + branches: [master, main] + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build UMD bundle + run: npm run build:umd + + - name: Prepare playground files + run: | + mkdir -p _site/dist + cp samples/language-service-sample/index.html _site/ + cp samples/language-service-sample/app.js _site/ + cp samples/language-service-sample/styles.css _site/ + cp dist/bundle.js _site/dist/ + + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: '_site' + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index 37dd5dcd..988e63ee 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,14 @@ Parser.evaluate('6 * x', { x: 7 }) // 42 - **Object Construction** - Create objects and arrays in expressions - **Language Service** - IDE integration with completions, hover info, and highlighting +## Playground Example + +Try out the expression evaluator and its language server capabilities directly in your browser at the [Playground](https://pro-fa.github.io/expr-eval/). The playground provides an interactive environment with: +- Live expression evaluation +- Code completions and IntelliSense +- Syntax highlighting +- Hover information for functions and variables + ## Running Tests ```bash