-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: setup TS + Rust monorepo (#146)
* refactor: rename runtime to old-runtime * refactor: rename cli to old-cli * refactor: rename serverless to old-serverless * refactor: update lockfile * refactor: rename rust packages * feat: update turborepo * chore: remove useless log file * chore: update lockfile * refactor: remove useless baseBranch field * refactor: ignore old-* packages * feat: add test pipeline * refactor: migrate common & prisma to website * fix: add missing prisma postinstall * fix(runtime): set methods public to self * fix(runtime: increase memory_reached timeout * chore: add changesets * refactor(runtime): replace reqwest by hyper * feat: add js-runtime package * fix: ci * refactor: migrate serverless dockerfile to rust * fix(serverless): create deployments folder when not exists * fix: docker start command
- Loading branch information
Showing
181 changed files
with
1,361 additions
and
1,595 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@lagon/www': patch | ||
--- | ||
|
||
Use PostHog instead of Splitbee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@lagon/website': patch | ||
--- | ||
|
||
Move common & prisma packages to website |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@lagon/cli': patch | ||
'@lagon/runtime': patch | ||
'@lagon/serverless': patch | ||
--- | ||
|
||
Move from Node.js to Rust |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
node_modules | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
dist/ | ||
packages/old-*/**/* | ||
runtime.js | ||
|
||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[workspace] | ||
members = [ | ||
"packages/rust-runtime", | ||
"packages/rust-serverless", | ||
"packages/rust-cli", | ||
"packages/runtime", | ||
"packages/serverless", | ||
"packages/cli", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,15 @@ | ||
FROM node:16-slim as builder | ||
FROM rust:1.63 as builder | ||
|
||
RUN apt update | ||
RUN apt install -y python3 make g++ openssl | ||
|
||
RUN npm install -g pnpm | ||
WORKDIR /app | ||
COPY . . | ||
|
||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ | ||
COPY packages/runtime/package.json ./packages/runtime/package.json | ||
COPY packages/serverless/package.json ./packages/serverless/package.json | ||
COPY packages/prisma/package.json ./packages/prisma/package.json | ||
COPY packages/common/package.json ./packages/common/package.json | ||
|
||
RUN pnpm install --frozen-lockfile | ||
|
||
COPY packages/runtime/ ./packages/runtime/ | ||
COPY packages/serverless/ ./packages/serverless/ | ||
COPY packages/prisma/ ./packages/prisma/ | ||
COPY packages/common/ ./packages/common/ | ||
|
||
WORKDIR /app/packages/runtime | ||
RUN pnpm build | ||
RUN pnpm build:runtime | ||
WORKDIR /app/packages/serverless | ||
RUN cargo build --release | ||
|
||
WORKDIR /app/packages/prisma | ||
RUN pnpm prisma generate | ||
# TODO: use a smaller image | ||
FROM rust:1.63 | ||
|
||
WORKDIR /app/packages/serverless | ||
RUN pnpm build | ||
COPY --from=builder /app/target/release/lagon-serverless /usr/local/bin/lagon-serverless | ||
|
||
EXPOSE 4000 | ||
ENV NODE_ENV=production | ||
CMD [ "pnpm", "start" ] | ||
CMD ["lagon-serverless"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,8 @@ | ||
{ | ||
"name": "@lagon/cli", | ||
"version": "0.0.11", | ||
"version": "0.1.0", | ||
"description": "CLI for Lagon", | ||
"type": "module", | ||
"files": [ | ||
"dist" | ||
], | ||
"bin": { | ||
"lagon": "dist/index.js" | ||
}, | ||
"scripts": { | ||
"watch": "tsup src/index.ts --format=esm --watch", | ||
"build": "tsup src/index.ts --format=esm --define.process.env.NODE_ENV \\\"production\\\"", | ||
"lint": "eslint --cache --ignore-pattern dist .", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"@lagon/runtime": "workspace:0.0.6", | ||
"@trpc/client": "^9.25.3", | ||
"chalk": "^5.0.1", | ||
"commander": "^9.3.0", | ||
"esbuild": "^0.14.41", | ||
"fastify": "^3.29.0", | ||
"inquirer": "^9.0.0", | ||
"node-fetch": "^3.2.6", | ||
"open": "^8.4.0", | ||
"update-notifier": "^6.0.1" | ||
}, | ||
"devDependencies": { | ||
"@lagon/common": "workspace:0.0.2", | ||
"@types/inquirer": "^8.2.1", | ||
"@types/update-notifier": "^5.1.0" | ||
"build": "cargo build" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "@lagon/js-runtime", | ||
"version": "0.1.0", | ||
"description": "JavaScript Runtime", | ||
"private": true, | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"test": "vitest --run", | ||
"build": "tsup src/index.ts --format=esm --dts", | ||
"lint": "eslint --cache --ignore-pattern dist .", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"web-streams-polyfill": "^3.2.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
import { atob, btoa } from '../runtime/base64'; | ||
|
||
describe('base64', () => { | ||
it('should encode with atob', async () => { | ||
expect(atob('Hello World')).toEqual('\x1Dée¡j+\x95'); | ||
}); | ||
|
||
it('should decode with btoa', async () => { | ||
expect(btoa('\x1Dée¡j+\x95')).toEqual('HelloWorlQ=='); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
import { TextEncoder, TextDecoder } from '../runtime/encoding'; | ||
|
||
describe('encoding', () => { | ||
it('should encode', async () => { | ||
expect(new TextEncoder().encode('Hello World')).toEqual( | ||
new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]), | ||
); | ||
}); | ||
|
||
it('should decode', async () => { | ||
expect(new TextDecoder().decode(new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]))).toEqual( | ||
'Hello World', | ||
); | ||
}); | ||
|
||
it('should encode and decode', async () => { | ||
const encoded = new TextEncoder().encode('Hello World'); | ||
const decoded = new TextDecoder().decode(encoded); | ||
|
||
expect(decoded).toEqual('Hello World'); | ||
}); | ||
|
||
it('should have encoding field on TextEncoder', async () => { | ||
expect(new TextEncoder().encoding).toEqual('utf-8'); | ||
}); | ||
|
||
it('should have encoding field on TextDecoder', async () => { | ||
expect(new TextDecoder().encoding).toEqual('utf-8'); | ||
}); | ||
}); |
Oops, something went wrong.