Skip to content

Commit

Permalink
Merge pull request #22 from serenity-kit/migrate-to-pnpm
Browse files Browse the repository at this point in the history
switch from yarn to pnpm
  • Loading branch information
nikgraf authored Aug 18, 2023
2 parents 74608cc + 64ad435 commit 6f1b09c
Show file tree
Hide file tree
Showing 27 changed files with 8,162 additions and 7,925 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3 # needed until 18 becomes the default
- uses: pnpm/action-setup@v2
with:
node-version: 18
cache: yarn
version: 8
- name: Build
working-directory: ./examples/backend
run: yarn build
run: pnpm build
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only ./examples/backend
env:
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/tests-and-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3 # needed until 18 becomes the default
- uses: pnpm/action-setup@v2
with:
node-version: 18
cache: yarn
version: 8

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Generate Prisma Types
run: cd examples/backend && pnpm prisma generate
- name: Typecheck
run: yarn ts:check
run: pnpm ts:check
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3 # needed until 18 becomes the default
- uses: pnpm/action-setup@v2
with:
node-version: 18
cache: yarn
version: 8
- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Linting
run: yarn lint
run: pnpm lint
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3 # needed until 18 becomes the default
- uses: pnpm/action-setup@v2
with:
node-version: 18
cache: yarn
version: 8
- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Test
run: yarn test
run: pnpm test
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,16 @@ If you have any further ideas or suggestions please let us know.
## Setup and Run the Example

```sh
yarn
pnpm install
cp examples/backend/.env.example examples/backend/.env
docker-compose up
# in another tab
cd examples/backend
yarn prisma migrate dev
yarn dev
pnpm prisma migrate dev
pnpm dev
# in another tab
cd examples/frontend
yarn dev
pnpm dev
```

## Run the example with ngrok
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/snapshots/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Run the Benchmarks

```sh
yarn init:data
yarn load:automerge
pnpm init:data
pnpm load:automerge
```

To reduce the amount of changes used for the benchmark uncomment this line in `initData.js`:
Expand Down
16 changes: 8 additions & 8 deletions examples/backend/fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ app = "secsync"
primary_region = "ams"

[deploy]
release_command = "yarn prisma:prod:migrate"
release_command = "pnpm prisma:prod:migrate"

[env]
PORT = "8080"
PORT = "8080"

[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
internal_port = 8080
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
17 changes: 8 additions & 9 deletions examples/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,32 @@
"devDependencies": {
"@types/node": "16.11.9",
"@types/uuid": "^8.3.3",
"@types/ws": "^8.2.1",
"@types/ws": "^8.5.5",
"@vercel/ncc": "^0.36.1",
"prettier": "^2.5.0",
"prisma": "^4.16.1",
"ts-node": "10.4.0",
"ts-node-dev": "^1.1.8"
},
"scripts": {
"ts:check": "yarn tsc --noEmit",
"test": "ts-node ./src/script.ts",
"ts:check": "pnpm tsc --noEmit",
"test": "echo \"No tests yet\"",
"lint": "echo \"No linting setup\"",
"dev": "ts-node-dev --transpile-only --no-notify ./src/index.ts",
"clean": "rm -rf build",
"build": "yarn && yarn clean && yarn prisma:prod:generate && yarn ncc build ./src/index.ts -o build",
"deploy": "yarn build && fly launch",
"prisma:prod:migrate": "yarn global add prisma@4 && DATABASE_URL=$DATABASE_URL prisma migrate deploy",
"build": "pnpm && pnpm clean && pnpm prisma:prod:generate && pnpm ncc build ./src/index.ts -o build",
"deploy": "pnpm build && fly launch",
"prisma:prod:migrate": "pnpm global add prisma@4 && DATABASE_URL=$DATABASE_URL prisma migrate deploy",
"prisma:prod:generate": "DATABASE_URL=$DATABASE_URL prisma generate",
"prisma:prod:studio": "DATABASE_URL=$DATABASE_URL prisma studio",
"start:prod": "PORT=$PORT DATABASE_URL=$DATABASE_URL NODE_ENV=production node ./build"
},
"dependencies": {
"@prisma/client": "^4.16.1",
"apollo-server-express": "^3.5.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"graphql": "^16.0.1",
"libsodium-wrappers": "^0.7.11",
"make-promises-safe": "^5.1.0",
"nexus": "^1.1.0",
"secsync": "*",
"uuid": "^8.3.2",
"ws": "^8.3.0"
Expand Down
7 changes: 0 additions & 7 deletions examples/backend/src/generated/schema.graphql

This file was deleted.

129 changes: 0 additions & 129 deletions examples/backend/src/generated/typings.ts

This file was deleted.

11 changes: 0 additions & 11 deletions examples/backend/src/graphql/Query.ts

This file was deleted.

19 changes: 0 additions & 19 deletions examples/backend/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
require("make-promises-safe"); // installs an 'unhandledRejection' handler
import {
ApolloServerPluginLandingPageDisabled,
ApolloServerPluginLandingPageGraphQLPlayground,
} from "apollo-server-core";
import { ApolloServer } from "apollo-server-express";
import cors from "cors";
import express from "express";
import { createServer } from "http";
Expand All @@ -12,20 +7,8 @@ import { WebSocketServer } from "ws";
import { createSnapshot as createSnapshotDb } from "./database/createSnapshot";
import { createUpdate as createUpdateDb } from "./database/createUpdate";
import { getOrCreateDocument as getOrCreateDocumentDb } from "./database/getOrCreateDocument";
import { schema } from "./schema";

async function main() {
const apolloServer = new ApolloServer({
// @ts-expect-error
schema,
plugins: [
process.env.NODE_ENV === "production"
? ApolloServerPluginLandingPageDisabled()
: ApolloServerPluginLandingPageGraphQLPlayground(),
],
});
await apolloServer.start();

const allowedOrigin =
process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test"
? "http://localhost:3000"
Expand All @@ -34,7 +17,6 @@ async function main() {

const app = express();
app.use(cors(corsOptions));
apolloServer.applyMiddleware({ app, cors: corsOptions });

const server = createServer(app);

Expand All @@ -60,7 +42,6 @@ async function main() {
const port = process.env.PORT ? parseInt(process.env.PORT) : 4000;
server.listen(port, () => {
console.log(`🚀 App ready at http://localhost:${port}/`);
console.log(`🚀 GraphQL service ready at http://localhost:${port}/graphql`);
console.log(`🚀 Websocket service ready at ws://localhost:${port}`);
});
}
Expand Down
12 changes: 0 additions & 12 deletions examples/backend/src/schema.ts

This file was deleted.

Loading

0 comments on commit 6f1b09c

Please sign in to comment.