Skip to content

Commit

Permalink
chore: fix frontend build
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack committed Aug 23, 2023
1 parent f5817c5 commit efc3815
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 19 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/*/node_modules
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
# temp folder
tmp

# Frontend asset
web/dist

# build folder
build

Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
FROM node:18.12.1-alpine3.16 AS frontend
WORKDIR /frontend-build

COPY ./frontend/web/package.json ./frontend/web/pnpm-lock.yaml ./
COPY ./frontend/ .

RUN corepack enable && pnpm i --frozen-lockfile
WORKDIR /frontend-build/web

COPY ./frontend/web/ .
RUN corepack enable && pnpm i --frozen-lockfile

RUN pnpm build

Expand All @@ -15,7 +15,7 @@ FROM golang:1.19.3-alpine3.16 AS backend
WORKDIR /backend-build

COPY . .
COPY --from=frontend /frontend-build/dist ./server/dist
COPY --from=frontend /frontend-build/web/dist ./server/dist

RUN CGO_ENABLED=0 go build -o slash ./cmd/slash/main.go

Expand Down
2 changes: 1 addition & 1 deletion frontend/extension/src/background.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Shortcut } from "../../types/proto/api/v2/shortcut_service_pb";
import type { Shortcut } from "@pbtypes/proto/api/v2/shortcut_service_pb";
import { Storage } from "@plasmohq/storage";

const storage = new Storage();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Button, IconButton, Input, Modal, ModalDialog } from "@mui/joy";
import { CreateShortcutResponse, OpenGraphMetadata, Visibility } from "@pbtypes/proto/api/v2/shortcut_service_pb";
import { useStorage } from "@plasmohq/storage/hook";
import axios from "axios";
import { useEffect, useState } from "react";
import { toast } from "react-hot-toast";
import { CreateShortcutResponse, OpenGraphMetadata, Visibility } from "../../../types/proto/api/v2/shortcut_service_pb";
import Icon from "./Icon";

const generateTempName = (length = 6) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/extension/src/components/PullShortcutsButton.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { IconButton } from "@mui/joy";
import { ListShortcutsResponse } from "@pbtypes/proto/api/v2/shortcut_service_pb";
import { useStorage } from "@plasmohq/storage/hook";
import axios from "axios";
import { useEffect } from "react";
import { toast } from "react-hot-toast";
import { ListShortcutsResponse } from "../../../types/proto/api/v2/shortcut_service_pb";
import Icon from "./Icon";

const PullShortcutsButton = () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/extension/src/components/ShortcutView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Shortcut } from "../../../types/proto/api/v2/shortcut_service_pb";
import type { Shortcut } from "@pbtypes/proto/api/v2/shortcut_service_pb";
import { useStorage } from "@plasmohq/storage/hook";
import classNames from "classnames";
import { useEffect, useState } from "react";
Expand Down
2 changes: 1 addition & 1 deletion frontend/extension/src/components/ShortcutsContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Shortcut } from "../../../types/proto/api/v2/shortcut_service_pb";
import type { Shortcut } from "@pbtypes/proto/api/v2/shortcut_service_pb";
import { useStorage } from "@plasmohq/storage/hook";
import classNames from "classnames";
import ShortcutView from "./ShortcutView";
Expand Down
2 changes: 1 addition & 1 deletion frontend/extension/src/options.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Shortcut } from "../../types/proto/api/v2/shortcut_service_pb";
import { Button, Divider, Input } from "@mui/joy";
import type { Shortcut } from "@pbtypes/proto/api/v2/shortcut_service_pb";
import { useStorage } from "@plasmohq/storage/hook";
import { useEffect, useState } from "react";
import { Toaster, toast } from "react-hot-toast";
Expand Down
2 changes: 1 addition & 1 deletion frontend/extension/src/popup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Shortcut } from "../../types/proto/api/v2/shortcut_service_pb";
import { Button, Divider, IconButton } from "@mui/joy";
import type { Shortcut } from "@pbtypes/proto/api/v2/shortcut_service_pb";
import { useStorage } from "@plasmohq/storage/hook";
import { Toaster } from "react-hot-toast";
import CreateShortcutsButton from "@/components/CreateShortcutsButton";
Expand Down
6 changes: 5 additions & 1 deletion frontend/extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
"include": [
".plasmo/index.d.ts",
"./**/*.ts",
"./**/*.tsx"
"./**/*.tsx",
"../types"
],
"compilerOptions": {
"paths": {
"@/*": [
"./src/*"
],
"@pbtypes/*": [
"../types/*"
]
},
"baseUrl": "."
Expand Down
2 changes: 1 addition & 1 deletion frontend/web/src/components/setting/AccessTokenSection.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Button, IconButton } from "@mui/joy";
import { ListUserAccessTokensResponse, UserAccessToken } from "@pbtypes/proto/api/v2/user_service_pb";
import axios from "axios";
import copy from "copy-to-clipboard";
import { useEffect, useState } from "react";
import { toast } from "react-hot-toast";
import { ListUserAccessTokensResponse, UserAccessToken } from "../../../../types/proto/api/v2/user_service_pb";
import useUserStore from "../../stores/v1/user";
import { showCommonDialog } from "../Alert";
import CreateAccessTokenDialog from "../CreateAccessTokenDialog";
Expand Down
13 changes: 11 additions & 2 deletions frontend/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"jsx": "react-jsx",
"paths": {
"@/*": [
"./src/*"
],
"@pbtypes/*": [
"../types/*"
]
},
"baseUrl": "."
},
"include": ["./src"]
"include": ["./src", "../types"]
}
2 changes: 1 addition & 1 deletion scripts/.air.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ tmp_dir = ".air"
bin = "./.air/slash --mode dev"
cmd = "go build -o ./.air/slash ./cmd/slash/main.go"
delay = 1000
exclude_dir = [".air", "web", "extension", "frontend", "build"]
exclude_dir = [".air", "frontend", "build"]
exclude_file = []
exclude_regex = []
exclude_unchanged = false
Expand Down

0 comments on commit efc3815

Please sign in to comment.