Skip to content

Commit d7e5a34

Browse files
authored
CLI (#84)
* move to packages * update deps * update deps * actions maintenance * don't use blob * cli * fix default import * use synthetic default imports * remove comment * cli packaging * node 18 guard * packages * build system * testing * test pipeline * pipelines * changelog * version bump * update locales * update deps * update deps * update dependecies
1 parent 13dfd93 commit d7e5a34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2829
-1283
lines changed

.dockerignore

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
*
22

3-
!/packages/backend/src
4-
!/packages/backend/Cargo.lock
5-
!/packages/backend/Cargo.toml
3+
!/packages
4+
!/package.json
5+
!/pnpm-lock.yaml
6+
!/pnpm-workspace.yaml
67

7-
!/packages/frontend/locales
8-
!/packages/frontend/src
9-
!/packages/frontend/static
10-
!/packages/frontend/.npmrc
11-
!/packages/frontend/package.json
12-
!/packages/frontend/pnpm-lock.yaml
13-
!/packages/frontend/svelte.config.js
14-
!/packages/frontend/tsconfig.json
15-
!/packages/frontend/vite.config.js
8+
**/target
9+
**/node_modules
10+
**/dist
11+
**/bin
12+
**/*.tsbuildinfo
13+
**/build
14+
**/.svelte
15+
**/.svelte-kit

.github/workflows/docker.yml renamed to .github/workflows/release.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,47 @@ on:
44
workflow_dispatch:
55
push:
66
tags:
7-
- "v*.*.*"
7+
- 'v*.*.*'
88

99
jobs:
10+
cli:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version-file: '.nvmrc'
18+
- uses: pnpm/action-setup@v2
19+
20+
- run: |
21+
pnpm install --frozen-lockfile
22+
pnpm run build
23+
1024
docker:
1125
runs-on: ubuntu-latest
1226
steps:
13-
- name: Set up QEMU
14-
uses: docker/setup-qemu-action@v1
15-
- name: Set up Docker Buildx
16-
uses: docker/setup-buildx-action@v1
27+
- uses: actions/checkout@v3
28+
- uses: docker/setup-qemu-action@v2
29+
- uses: docker/setup-buildx-action@v2
1730
with:
1831
install: true
1932
- name: Docker Labels
2033
id: meta
21-
uses: crazy-max/ghaction-docker-meta@v2
34+
uses: docker/metadata-action@v4
2235
with:
2336
images: cupcakearmy/cryptgeon
2437
tags: |
2538
type=semver,pattern={{version}}
2639
type=semver,pattern={{major}}.{{minor}}
2740
type=semver,pattern={{major}}
2841
- name: Login to DockerHub
29-
uses: docker/login-action@v1
42+
uses: docker/login-action@v2
3043
with:
3144
username: ${{ secrets.DOCKERHUB_USERNAME }}
3245
password: ${{ secrets.DOCKERHUB_TOKEN }}
3346
- name: Build and push
34-
uses: docker/build-push-action@v2
47+
uses: docker/build-push-action@v4
3548
with:
3649
platforms: linux/amd64,linux/arm64
3750
push: true

.github/workflows/test.yaml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,29 @@ jobs:
1010
test:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v2
13+
- uses: actions/checkout@v3
14+
15+
# Node
16+
- uses: actions/setup-node@v3
1517
with:
16-
node-version: "16"
18+
node-version-file: '.nvmrc'
19+
- uses: pnpm/action-setup@v2
1720

18-
- uses: docker/setup-qemu-action@v1
19-
- uses: docker/setup-buildx-action@v1
21+
# Docker
22+
- uses: docker/setup-qemu-action@v2
23+
- uses: docker/setup-buildx-action@v2
2024
with:
2125
install: true
22-
- name: Build docker image
23-
run: npm run test:prepare
2426

2527
- name: Prepare
2628
run: |
27-
npm install playwright
28-
npx playwright install --with-deps
29+
pnpm install --frozen-lockfile
30+
pnpm exec playwright install --with-deps
31+
pnpm run test:prepare
2932
3033
- name: Run your tests
31-
run: npm test
32-
- uses: actions/upload-artifact@v2
33-
if: always()
34+
run: pnpm test
35+
- uses: actions/upload-artifact@v3
3436
with:
3537
name: test-results
3638
path: test-results

.gitignore

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1+
.env
2+
*.tsbuildinfo
3+
node_modules
4+
dist
5+
bin
16

2-
# Backend
37
target
48

5-
# Client
6-
.DS_Store
7-
node_modules
8-
/.svelte
9-
/build
10-
/functions
11-
.env
12-
13-
General
9+
# Testing
1410
test-results

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v18.16

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.3.0] - 2023-05-XX
9+
10+
### Added
11+
12+
- New CLI 🎉
13+
- Russian language
14+
15+
### Changed
16+
17+
- Moved to monorepo
18+
819
## [2.2.0] - 2023-01-14
920

1021
### Changed

Dockerfile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
# FRONTEND
2-
FROM node:16-alpine as client
2+
FROM node:18-alpine as client
33
WORKDIR /tmp
4-
RUN npm install -g pnpm@7
5-
COPY ./packages/frontend ./
6-
RUN pnpm install
7-
RUN pnpm exec svelte-kit sync
4+
RUN npm install -g pnpm@8
5+
COPY . .
6+
RUN pnpm install --frozen-lockfile
87
RUN pnpm run build
98

109

1110
# BACKEND
12-
FROM rust:1.64-alpine as backend
11+
FROM rust:1.69-alpine as backend
1312
WORKDIR /tmp
1413
RUN apk add libc-dev openssl-dev alpine-sdk
1514
COPY ./packages/backend/Cargo.* ./
16-
# https://blog.rust-lang.org/2022/06/22/sparse-registry-testing.html
17-
RUN rustup update nightly
18-
ENV CARGO_UNSTABLE_SPARSE_REGISTRY=true
19-
RUN cargo +nightly fetch
15+
RUN cargo fetch
2016
COPY ./packages/backend ./
21-
RUN cargo +nightly build --release
17+
RUN cargo build --release
2218

2319

2420
# RUNNER
2521
FROM alpine
2622
WORKDIR /app
2723
COPY --from=backend /tmp/target/release/cryptgeon .
28-
COPY --from=client /tmp/build ./frontend
24+
COPY --from=client /tmp/packages/frontend/build ./frontend
2925
ENV FRONTEND_PATH="./frontend"
3026
ENV REDIS="redis://redis/"
3127
EXPOSE 8000

cryptgeon.code-workspace

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55
},
66
{
77
"path": "packages/backend"
8+
},
9+
{
10+
"path": "packages/frontend"
11+
},
12+
{
13+
"path": "packages/cli"
14+
},
15+
{
16+
"path": "packages/shared"
817
}
918
],
1019
"settings": {
11-
"cSpell.words": ["ciphertext", "cryptgeon"],
12-
"i18n-ally.enabledFrameworks": ["svelte"],
13-
"i18n-ally.keystyle": "nested",
14-
"i18n-ally.localesPaths": ["packages/frontend/locales"]
20+
"i18n-ally.localesPaths": ["packages/frontend/locales"],
21+
"cSpell.words": ["cryptgeon"]
1522
}
1623
}

docker-compose.dev.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ services:
1010
- 6379:6379
1111

1212
app:
13-
image: cupcakearmy/cryptgeon:test
1413
build: .
1514
env_file: .dev.env
1615
depends_on:

package.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
{
2+
"packageManager": "[email protected]",
23
"scripts": {
34
"dev:docker": "docker-compose -f docker-compose.dev.yaml up redis",
45
"dev:packages": "pnpm --parallel run dev",
5-
"dev:proxy": "node proxy.mjs",
66
"dev": "run-p dev:*",
7+
"docker:up": "docker compose -f docker-compose.dev.yaml up",
8+
"docker:build": "docker compose -f docker-compose.dev.yaml build",
79
"test": "playwright test --project chrome firefox safari",
810
"test:local": "playwright test --project local",
9-
"test:server": "docker compose -f docker-compose.dev.yaml up",
10-
"test:prepare": "docker compose -f docker-compose.dev.yaml build"
11+
"test:server": "run-s docker:up",
12+
"test:prepare": "run-p build docker:build",
13+
"build": "pnpm run --recursive --filter=!@cryptgeon/backend build"
1114
},
1215
"devDependencies": {
13-
"@playwright/test": "^1.29.2",
14-
"@types/node": "^16.18.11",
15-
"http-proxy": "^1.18.1",
16-
"npm-run-all": "^4.1.5"
16+
"@playwright/test": "^1.33.0",
17+
"@types/node": "^20.1.3",
18+
"npm-run-all": "^4.1.5",
19+
"shelljs": "^0.8.5"
1720
}
1821
}

0 commit comments

Comments
 (0)