Skip to content

Commit

Permalink
feat(apps): transpile via django (#18201)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra authored Nov 7, 2023
1 parent 2ce7ea6 commit 06e9938
Show file tree
Hide file tree
Showing 15 changed files with 658 additions and 78 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@
!share/GeoLite2-City.mmdb
!hogvm/python
!unit.json
!plugin-transpiler/src
!plugin-transpiler/*.*
18 changes: 18 additions & 0 deletions .github/actions/run-backend-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@ runs:
run: |
sudo apt-get update && sudo apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x.x

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- name: Install plugin-transpiler
shell: bash
run: |
cd plugin-transpiler
pnpm install
pnpm run build
- uses: syphar/restore-virtualenv@v1
id: cache-backend-tests
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
- mypy.ini
- pytest.ini
- frontend/src/queries/schema.json # Used for generating schema.py
- plugin-transpiler/src # Used for transpiling plugins
# Make sure we run if someone is explicitly change the workflow
- .github/workflows/ci-backend.yml
- .github/actions/run-backend-tests/action.yml
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ gen/
upgrade/
hogvm/typescript/dist
.wokeignore
plugin-transpiler/dist
3 changes: 3 additions & 0 deletions plugin-transpiler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Plugin Transpiler

This project transpiles frontend plugins and site apps.
13 changes: 13 additions & 0 deletions plugin-transpiler/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env node
import * as esbuild from 'esbuild'
;(async function build() {
let result = await esbuild.build({
entryPoints: ['src/index.ts'],
bundle: true,
outdir: 'dist',
})
if (!result.errors.length) {
// eslint-disable-next-line no-console
console.log('Build succeeded')
}
})()
21 changes: 21 additions & 0 deletions plugin-transpiler/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "plugin-transpiler",
"version": "1.0.0",
"description": "Transpiles site apps TSX to browser JS via stdin/stdout",
"main": "transpile.mjs",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc -b && node build.mjs",
"start:dist": "node dist/index.js",
"start": "npm run build && npm run start:dist"
},
"author": "PostHog Inc.",
"license": "MIT",
"devDependencies": {
"@babel/standalone": "^7.23.2",
"@types/babel__standalone": "^7.1.6",
"@types/node": "^20.8.9",
"esbuild": "^0.19.5",
"typescript": "^5.2.2"
}
}
Loading

0 comments on commit 06e9938

Please sign in to comment.