Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cliff-jumperrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/favware/cliff-jumper/main/assets/cliff-jumper.schema.json",
"name": "editor",
"org": "nanoforge-dev",
"packagePath": ".",
Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ To get ready to work on the codebase, please do the following:
3. Copy `.env.example` to `.env` and modify env variable as you wish
4. Run the editor `pnpm run dev`
5. Make your changes
6. Run `pnpm format && pnpm build && pnpm test:unit` to run ESLint/Prettier, build and tests
6. Run `pnpm format && pnpm build && pnpm test` to run ESLint/Prettier, build and tests
7. [Submit a pull request](https://github.com/NanoForge-dev/Editor/compare) (Make sure you follow the [conventional commit format](https://github.com/NanoForge-dev/Editor/blob/main/.github/COMMIT_CONVENTION.md))
72 changes: 72 additions & 0 deletions .github/actions/docker-push/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: docker-push
description: Push Docker image on registry
inputs:
registry:
description: Docker registry
required: true
image:
description: Name of the image
required: true
token:
description: Token able to pull nanoforge-dev/cloud-iac
required: true
github-token:
description: Github token
required: true
runs:
using: composite
steps:
- name: Determine latest tag
id: tag
shell: bash
run: echo "tag=$(git describe --tags --abbrev=0 HEAD~0 || true)" >> $GITHUB_OUTPUT

- name: Log in to the Container registry
uses: docker/login-action@v4
with:
registry: ${{ inputs.registry }}
username: ${{ github.actor }}
password: ${{ inputs.github-token }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ inputs.registry }}/${{ inputs.image }}
tags: |
type=semver,pattern={{version}},value=${{ steps.tag.outputs.tag }}

- name: Build and push Docker image
id: push
uses: docker/build-push-action@v7
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: checkout cloud for tags update
uses: actions/checkout@v6
with:
path: cloud-iac
repository: nanoforge-dev/cloud-iac
token: ${{ inputs.token }}

- name: Install yq and config git
shell: sh
run: |
pip install yq

git config --global user.name "github-actions[bot]"
git config --global user.email "username@users.noreply.github.com"

- name: Update image tag in config file
shell: sh
run: |
cd cloud-iac
python -m yq -Y --indentless --in-place '.image.tag = "${{ steps.tag.outputs.tag }}"' kubernetes/nanoforge/editor-override.yaml

git add kubernetes/nanoforge/editor-override.yaml || echo "No changes to add"
git commit -m "chore(editor): release docker nanoforge-dev/editor@${{ steps.tag.outputs.tag }}" || echo "No changes to commit"
git push || echo "No changes to push"
1 change: 1 addition & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ jobs:
dry: ${{ inputs.dry_run }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_REPO: ${{ github.repository }}
1 change: 1 addition & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ jobs:
with:
commit: ${{ github.sha }}
branch: ${{ github.head_ref }}
format: '{version}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 23 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,29 @@ on:
type: boolean
default: false

env:
REGISTRY: ghcr.io
ORG_NAME: ${{ github.repository_owner }}
IMAGE_NAME: ${{ github.event.repository.name }}
CONFIG_FILE: kubernetes/nanoforge/editor-override.yaml

permissions:
contents: write
packages: write
attestations: write
id-token: write

jobs:
npm-publish:
name: npm publish
create-release:
name: Create release
runs-on: ubuntu-latest
if: github.repository_owner == 'NanoForge-dev'
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true

- name: Prepare
uses: ./.github/actions/prepare
Expand All @@ -28,6 +40,15 @@ jobs:
with:
package: '@nanoforge-dev/editor'
dry: ${{ inputs.dry_run }}
format: '{version}'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Push Docker image
uses: ./.github/actions/docker-push
with:
registry: ${{ env.REGISTRY }}
image: ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}
token: ${{ secrets.TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ jobs:

- name: Run linter
run: pnpm lint

- name: Run tests
run: pnpm test:unit
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pnpm lint
pnpm build
pnpm test
pnpm test:unit
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM node:25-slim AS base

ENV PNPM_HOME="/pnpm"
ENV CI="true"
ENV PATH="$PNPM_HOME:$PATH"

RUN npm install -g pnpm

COPY pnpm-workspace.yaml /app/pnpm-workspace.yaml
COPY pnpm-lock.yaml /app/pnpm-lock.yaml
COPY package.json /app/package.json

WORKDIR /app

FROM base AS prod

RUN pnpm install --frozen-lockfile
COPY . /app
RUN pnpm run build

FROM oven/bun:1.3 AS final

WORKDIR /app
COPY --from=prod /app/dist /app/dist

CMD [ "bun", "run", "./dist/index.js" ]
28 changes: 15 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"files": [
"dist"
],
"main": "./dist/index.html",
"module": "./dist/index.html",
"main": "./dist/index.js",
"module": "./dist/index.js",
"exports": {
"./package.json": "./package.json"
},
Expand All @@ -42,11 +42,14 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint --format=pretty src",
"format": "prettier --write . && eslint --fix --format=pretty src",
"test": "pnpm run test:unit --run",
"test:unit": "vitest",
"test:e2e": "playwright test",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r . --include-path '.'",
"release": "cliff-jumper",
"test": "pnpm run test:unit && pnpm run test:e2e",
"test:unit": "vitest run -c vite.config.ts",
"test:unit:watch": "vitest -c vite.config.ts",
"test:e2e": "vitest run -c vite.config.e2e.ts",
"test:e2e:watch": "vitest -c vite.config.e2e.ts",
"test:coverage": "pnpm run test:unit --coverage && pnpm run test:e2e --coverage",
"prepare": "husky"
},
"devDependencies": {
Expand All @@ -62,11 +65,11 @@
"@nanoforge-dev/utils-eslint-config": "catalog:lint",
"@nanoforge-dev/utils-prettier-config": "catalog:lint",
"@playwright/test": "catalog:test",
"@sveltejs/adapter-auto": "catalog:core",
"@sveltejs/kit": "catalog:core",
"@sveltejs/vite-plugin-svelte": "catalog:core",
"@trivago/prettier-plugin-sort-imports": "catalog:lint",
"@tsconfig/svelte": "catalog:build",
"@types/bun": "^1.3.11",
"@types/file-saver": "catalog:components",
"@unocss/extractor-svelte": "catalog:css",
"@unocss/preset-icons": "catalog:css",
Expand All @@ -76,17 +79,22 @@
"@vitest/coverage-v8": "catalog:test",
"eslint": "catalog:lint",
"eslint-plugin-svelte": "catalog:lint",
"file-saver": "catalog:components",
"flowbite": "catalog:components",
"flowbite-svelte": "catalog:components",
"globals": "catalog:lint",
"husky": "catalog:ci",
"idb": "catalog:components",
"jszip": "catalog:components",
"lint-staged": "catalog:ci",
"monaco-editor": "catalog:components",
"playwright": "catalog:test",
"prettier": "catalog:lint",
"prettier-plugin-svelte": "catalog:lint",
"svelte": "catalog:core",
"svelte-adapter-bun": "catalog:build",
"svelte-check": "catalog:core",
"svelte-kit-sessions": "catalog:core",
"svelte-sonner": "catalog:components",
"typescript": "catalog:build",
"typescript-eslint": "catalog:lint",
Expand All @@ -95,7 +103,7 @@
"vitest": "catalog:test",
"vitest-browser-svelte": "catalog:test"
},
"packageManager": "pnpm@10.28.1",
"packageManager": "pnpm@10.33.0",
"engines": {
"node": "25"
},
Expand All @@ -109,11 +117,5 @@
"src/**/*.{ts,svelte}": [
"eslint --fix"
]
},
"dependencies": {
"svelte-kit-sessions": "catalog:core",
"file-saver": "catalog:components",
"idb": "catalog:components",
"jszip": "catalog:components"
}
}
Loading
Loading