-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate to Vite and Bun to build the frontend
Dropped some dependencies which no longer worked: - monaco-editor-vue3 - replaced with a tiny wrapper. - polyfill for streaming classes - replaced with vite plugin for polyfills. - buffer - replaced base64 encoding with calls from the `fetch.pb.ts`. Dropped the code that sets up monaco in `main.ts` in favor of Vite monaco plugin that does that for you. Updated `monaco-yaml` as the old version didn't work with Vite. Switched from `Jest` to `bun:test`. Use TypeScript in the tailwind config, as it imports `colors.ts` now. Had to use TypeScript for `colors` as Vite can't import CommonJS modules. Add eslint linter to the `lint` dependencies, enable a bit more linters and fix all detected errors. Fixes: #294 Signed-off-by: Artem Chernyshev <[email protected]>
- Loading branch information
Showing
58 changed files
with
518 additions
and
34,308 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
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. | ||
# | ||
# Generated on 2024-06-03T11:20:02Z by kres f292767. | ||
# Generated on 2024-06-06T12:40:29Z by kres 14c10c9-dirty. | ||
|
||
ARG JS_TOOLCHAIN | ||
ARG TOOLCHAIN | ||
|
@@ -20,17 +20,16 @@ ENV GOPATH /go | |
ENV PATH ${PATH}:/usr/local/go/bin | ||
|
||
# runs markdownlint | ||
FROM docker.io/node:22.2.0-alpine3.19 AS lint-markdown | ||
FROM docker.io/oven/bun:1.1.12-alpine AS lint-markdown | ||
WORKDIR /src | ||
RUN npm i -g [email protected] | ||
RUN npm i [email protected] | ||
RUN bun i [email protected] [email protected] | ||
COPY .markdownlint.json . | ||
COPY ./docs ./docs | ||
COPY ./CHANGELOG.md ./CHANGELOG.md | ||
COPY ./CONTRIBUTING.md ./CONTRIBUTING.md | ||
COPY ./DEVELOPMENT.md ./DEVELOPMENT.md | ||
COPY ./README.md ./README.md | ||
RUN markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js . | ||
RUN bunx markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js . | ||
|
||
# collects proto specs | ||
FROM scratch AS proto-specs | ||
|
@@ -84,21 +83,16 @@ ARG PROTOBUF_GRPC_GATEWAY_TS_VERSION | |
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/siderolabs/protoc-gen-grpc-gateway-ts@v${PROTOBUF_GRPC_GATEWAY_TS_VERSION} | ||
RUN mv /go/bin/protoc-gen-grpc-gateway-ts /bin | ||
COPY frontend/package.json ./ | ||
COPY frontend/package-lock.json ./ | ||
RUN --mount=type=cache,target=/src/node_modules npm version ${VERSION} | ||
RUN --mount=type=cache,target=/src/node_modules npm ci && npm run verify | ||
COPY frontend/.eslintrc.yaml ./ | ||
COPY frontend/babel.config.js ./ | ||
COPY frontend/jest.config.js ./ | ||
COPY frontend/tsconfig.json ./ | ||
RUN --mount=type=cache,target=/src/node_modules bun install | ||
COPY frontend/tsconfig*.json ./ | ||
COPY frontend/bunfig.toml ./ | ||
COPY frontend/*.html ./ | ||
COPY frontend/*.ts ./ | ||
COPY frontend/*.js ./ | ||
COPY ./frontend/src ./src | ||
COPY ./frontend/tests ./tests | ||
COPY ./frontend/public ./public | ||
COPY ./frontend/babel.config.js ./babel.config.js | ||
COPY ./frontend/jest.config.js ./jest.config.js | ||
COPY ./frontend/test ./test | ||
COPY ./frontend/eslint.config.js ./eslint.config.js | ||
COPY ./frontend/postcss.config.js ./postcss.config.js | ||
COPY ./frontend/tailwind.config.js ./tailwind.config.js | ||
COPY ./frontend/vue.config.js ./vue.config.js | ||
|
||
# build tools | ||
FROM --platform=${BUILDPLATFORM} toolchain AS tools | ||
|
@@ -139,14 +133,14 @@ RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \ | |
|
||
# builds frontend | ||
FROM --platform=${BUILDPLATFORM} js AS frontend | ||
ARG NODE_BUILD_ARGS | ||
RUN --mount=type=cache,target=/src/node_modules npm run build ${NODE_BUILD_ARGS} | ||
ARG JS_BUILD_ARGS | ||
RUN --mount=type=cache,target=/src/node_modules bun run build ${JS_BUILD_ARGS} | ||
RUN mkdir -p /internal/frontend/dist | ||
RUN cp -rf ./dist/* /internal/frontend/dist | ||
|
||
# runs eslint | ||
FROM js AS lint-eslint | ||
RUN --mount=type=cache,target=/src/node_modules npm run lint | ||
RUN --mount=type=cache,target=/src/node_modules bun run lint | ||
|
||
# runs protobuf compiler | ||
FROM js AS proto-compile-frontend | ||
|
@@ -184,7 +178,8 @@ RUN rm /frontend/src/api/omni/specs/ephemeral.proto | |
|
||
# runs js unit-tests | ||
FROM js AS unit-tests-frontend | ||
RUN --mount=type=cache,target=/src/node_modules CI=true npm run test | ||
RUN --mount=type=cache,target=/src/node_modules bun add -d @happy-dom/global-registrator | ||
RUN --mount=type=cache,target=/src/node_modules CI=true bun run test | ||
|
||
FROM tools AS embed-generate | ||
ARG SHA | ||
|
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,4 +1,24 @@ | ||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. | ||
# | ||
# Generated on 2021-03-25T18:30:52Z by kres 9833490-dirty. | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
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,2 @@ | ||
[test] | ||
preload = "./test/setup.ts" |
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,39 @@ | ||
// Copyright (c) 2024 Sidero Labs, Inc. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the LICENSE file. | ||
|
||
// THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. | ||
// | ||
// Generated on 2024-06-06T10:10:11Z by kres 827a05c-dirty. | ||
|
||
// run bun install eslint-plugin-vue typescript-eslint -d for each frontend | ||
// to make the linter work | ||
//@ts-check | ||
import pluginVue from 'eslint-plugin-vue' | ||
import tseslint from 'typescript-eslint'; | ||
|
||
export default [ | ||
...tseslint.configs.recommended, | ||
...pluginVue.configs['flat/essential'], | ||
{ | ||
rules: { | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"no-console": "off", | ||
"vue/multi-word-component-names": "off", | ||
"vue/no-unused-vars": "error" | ||
}, | ||
plugins: { | ||
'typescript-eslint': tseslint.plugin, | ||
}, | ||
languageOptions: { | ||
parserOptions: { | ||
parser: tseslint.parser, | ||
project: './tsconfig.json', | ||
extraFileExtensions: ['.vue'], | ||
sourceType: 'module', | ||
}, | ||
}, | ||
} | ||
] | ||
|
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
Oops, something went wrong.