Skip to content

Commit b71b573

Browse files
committed
feat: remove Docker, enhance DX
1 parent 2f7d01d commit b71b573

File tree

9 files changed

+48
-85
lines changed

9 files changed

+48
-85
lines changed

docker-compose.yaml

-30
This file was deleted.

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
"scripts": {
66
"start-plugin": "cd plugin && pnpm watch",
77
"start-server": "cd server && pnpm dev",
8+
"start-server-prod": "cd server && pnpm prod",
9+
"build-plugin": "cd plugin && pnpm build",
10+
"build-server": "cd server && pnpm build",
11+
"lint-plugin": "cd plugin && pnpm lint",
12+
"lint-server": "cd server && pnpm lint",
813
"start": "concurrently \"pnpm start-server\" \"pnpm start-plugin\"",
914
"lint": "concurrently \"pnpm lint-server\" \"pnpm lint-plugin\"",
1015
"build": "concurrently \"pnpm build-server\" \"pnpm build-plugin\"",

plugin/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"lint:format": "prettier --write \"src/**/*.{ts,tsx}\""
3030
},
3131
"dependencies": {
32+
"@figma/plugin-typings": "^1.99.0",
3233
"react": "^16.8.6",
3334
"react-dom": "^16.8.6",
3435
"ts-loader": "^6.0.4",

plugin/pnpm-lock.yaml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugin/src/code.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import "figma-plugin-types";
2-
31
const width = 400;
42
const height = 500;
53
let timer: number | ReturnType<typeof setTimeout>;
@@ -68,7 +66,7 @@ figma.ui.onmessage = async (msg: MessageData) => {
6866

6967
case "show":
7068
if (isShowMessage(msg)) {
71-
const node = figma.getNodeById(msg.show);
69+
const node = await figma.getNodeByIdAsync(msg.show);
7270
if (node?.type !== "DOCUMENT" && node?.type !== "PAGE") {
7371
figma.currentPage.selection = [node as SceneNode];
7472
figma.viewport.scrollAndZoomIntoView([node as SceneNode]);
@@ -86,7 +84,7 @@ function* walkTree(node: BaseNode): Generator<BaseNode, void, unknown> {
8684
yield node;
8785
if ("children" in node) {
8886
for (const child of node.children) {
89-
yield * walkTree(child);
87+
yield* walkTree(child);
9088
}
9189
}
9290
}

plugin/src/hooks/useDebounce.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function useDebounceCallback<T extends (...args: any[]) => void>(
2323
callback: T,
2424
delay: number
2525
) {
26-
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
26+
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
2727

2828
const debouncedCallback = useCallback(
2929
(...args: Parameters<T>) => {

plugin/src/ui/components/Login.tsx

+28-6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ interface LoginPageProps {
77
}
88

99
const LoginPage: React.FC<LoginPageProps> = ({ loading, startOAuthFlow }) => {
10+
const cancelLogin = () => {
11+
parent.postMessage({ pluginMessage: { type: "quit" } }, "*");
12+
};
1013
return (
1114
<div
1215
className="login-container"
@@ -21,13 +24,32 @@ const LoginPage: React.FC<LoginPageProps> = ({ loading, startOAuthFlow }) => {
2124
<p className="login-subtitle">
2225
Please login to start using plugin again.
2326
</p>
24-
<button
25-
className={`login-button ${loading ? "loading" : ""}`}
26-
onClick={startOAuthFlow}
27-
disabled={loading}
27+
<div
28+
style={{ display: "flex", flexDirection: "column", gap: "0.75rem" }}
2829
>
29-
{loading ? <span className="spinner"></span> : "Log in with Figma"}
30-
</button>
30+
<button
31+
className={`login-button ${loading ? "loading" : ""}`}
32+
onClick={startOAuthFlow}
33+
disabled={loading}
34+
>
35+
{loading ? <span className="spinner"></span> : "Log in with Figma"}
36+
</button>
37+
{loading && (
38+
<button
39+
type="button"
40+
style={{
41+
cursor: "pointer",
42+
backgroundColor: "transparent",
43+
border: "none",
44+
fontSize: "1rem",
45+
color: "var(--purple-color)",
46+
}}
47+
onClick={cancelLogin}
48+
>
49+
Cancel
50+
</button>
51+
)}
52+
</div>
3153
</div>
3254
</div>
3355
);

plugin/tsconfig.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"lib": ["dom", "es2017"],
1111
"module": "commonjs",
1212
"target": "ES2015",
13-
"jsx": "react"
13+
"jsx": "react",
14+
"typeRoots": ["./node_modules/@types", "./node_modules/@figma"]
1415
},
15-
"include": ["src/**/*.ts"],
16-
"exclude": ["node_modules"]
16+
"include": ["src/**/*.ts"]
1717
}

server/Dockerfile

-41
This file was deleted.

0 commit comments

Comments
 (0)