Skip to content

Commit 26e1f5a

Browse files
committed
Created Dockerfile and fly config + fixed Flexbox issue
1 parent 309d840 commit 26e1f5a

15 files changed

+423
-42
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
target
2+
build

Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FROM rust:latest as wasm-build
2+
3+
RUN mkdir -p /usr/build/
4+
WORKDIR /usr/build/
5+
6+
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
7+
8+
COPY . .
9+
10+
WORKDIR /usr/build/harper-wasm
11+
RUN wasm-pack build --release
12+
13+
FROM node:slim as node-build
14+
15+
RUN mkdir -p /usr/build/
16+
WORKDIR /usr/build/
17+
18+
RUN mkdir harper-wasm
19+
20+
COPY --from=wasm-build /usr/build/harper-wasm/pkg /usr/build/harper-wasm/pkg
21+
COPY web web
22+
COPY alice.txt .
23+
24+
WORKDIR /usr/build/web
25+
26+
RUN yarn install && yarn build
27+
28+
FROM node:slim
29+
30+
COPY --from=node-build /usr/build/web/build /usr/build/web/build
31+
COPY --from=node-build /usr/build/web/package.json /usr/build/web/package.json
32+
COPY --from=node-build /usr/build/web/yarn.lock /usr/build/web/yarn.lock
33+
COPY --from=node-build /usr/build/web/node_modules /usr/build/web/node_modules
34+
35+
WORKDIR /usr/build/web
36+
37+
RUN yarn install
38+
39+
ENV HOST=0.0.0.0
40+
ENV PORT=3000
41+
42+
ENTRYPOINT ["node", "build"]

build.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

english_words.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6841,7 +6841,6 @@ aionial
68416841
ayont
68426842
ayous
68436843
air
6844-
aira
68456844
airable
68466845
airampo
68476846
airan

fly.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
app = "writewithharper"
2+
primary_region = "den"
3+
4+
[build]
5+
6+
[http_service]
7+
internal_port = 3000
8+
force_https = true
9+
auto_stop_machines = true
10+
auto_start_machines = true
11+
min_machines_running = 1
12+
processes = ["app"]
13+
14+
[[vm]]
15+
cpu_kind = "shared"
16+
cpus = 1
17+
memory_mb = 256

web/.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package
6+
.env
7+
.env.*
8+
!.env.example
9+
vite.config.js.timestamp-*
10+
vite.config.ts.timestamp-*

web/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"format": "prettier --plugin-search-dir . --write ."
1313
},
1414
"devDependencies": {
15-
"@sveltejs/adapter-auto": "^2.0.0",
15+
"@flydotio/dockerfile": "^0.5.0",
16+
"@sveltejs/adapter-node": "^3.0.0",
1617
"@sveltejs/kit": "^1.20.4",
1718
"@typescript-eslint/eslint-plugin": "^6.0.0",
1819
"@typescript-eslint/parser": "^6.0.0",

web/src/app.css

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
position: relative;
1717
}
1818

19-
.underlinespecial:after {
19+
.underlinespecial::after {
2020
transition-property: all;
2121
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
2222
transition-duration: 150ms;
@@ -30,3 +30,26 @@
3030
bottom: -3px;
3131
left: 0;
3232
}
33+
34+
textarea {
35+
--tw-ring-shadow: 0 0 #000 !important;
36+
}
37+
38+
.animate-bigbounce{
39+
animation: bigbounce 1s infinite;
40+
}
41+
42+
.animate-after-bigbounce::after {
43+
animation: bigbounce 1s infinite;
44+
}
45+
46+
@keyframes bigbounce {
47+
0%, 100% {
48+
transform: translateY(-40%);
49+
animation-timing-function: cubic-bezier(0.8,0,1,1);
50+
}
51+
50% {
52+
transform: none;
53+
animation-timing-function: cubic-bezier(0,0,0.2,1);
54+
}
55+
}

web/src/app.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
%sveltekit.head%
99
</head>
1010

11-
<body data-sveltekit-preload-data="hover">
12-
<div style="display: contents">%sveltekit.body%</div>
11+
<body data-sveltekit-preload-data="hover" class="m-0 p-0 w-full h-full">
12+
<div style="display: contents" class="m-0 p-0 w-full h-full">%sveltekit.body%</div>
1313
</body>
1414

1515
</html>

web/src/lib/Editor.svelte

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,36 @@
1010
1111
let lints: Lint[] = [];
1212
let focused: number | undefined;
13+
let editor: HTMLTextAreaElement | null;
1314
1415
$: lintText(content).then((newLints) => (lints = newLints));
16+
$: boxHeight = calcHeight(content);
1517
16-
$: console.log(focused);
18+
function calcHeight(boxContent: string): number {
19+
let numberOfLineBreaks = (boxContent.match(/\n/g) || []).length;
20+
let newHeight = 20 + numberOfLineBreaks * 30 + 12 + 2;
21+
console.log(newHeight);
22+
return newHeight;
23+
}
1724
</script>
1825

19-
<div class="flex flex-row w-full h-full [&>*]:m-5">
20-
<Card class="flex-auto max-w-full p-5 grid z-10 text-lg overflow-auto">
26+
<div class="flex flex-row w-full h-full p-5">
27+
<Card
28+
class="flex-grow h-full p-5 grid z-10 max-w-full text-lg overflow-auto mr-5"
29+
on:click={() => editor && editor.focus()}
30+
>
2131
<div class="m-0 p-0" style="grid-row: 1; grid-column: 1">
2232
<Underlines {content} focusLintIndex={focused} />
2333
</div>
2434
<textarea
25-
class="w-full m-0 rounded-none p-0 z-0 bg-transparent border-none text-lg resize-none"
26-
rows={content.length - content.replaceAll('\n', '').length + 1}
35+
bind:this={editor}
36+
class="w-full m-0 rounded-none p-0 z-0 bg-transparent border-none text-lg resize-none focus:border-0"
2737
spellcheck="false"
28-
style="grid-row: 1; grid-column: 1"
38+
style={`grid-row: 1; grid-column: 1; height: ${boxHeight}px`}
2939
bind:value={content}
3040
></textarea>
3141
</Card>
32-
<Card class="flex flex-col flex-grow overflow-auto h-full">
42+
<Card class="flex flex-col flex-none basis-[400px] overflow-auto h-full">
3343
<h2 class="text-2xl font-bold m-1">Suggestions</h2>
3444
{#each lints as lint, i}
3545
<Card class="m-1 hover:translate-x-3 transition-all" on:click={() => (focused = i)}>
@@ -51,7 +61,7 @@
5161
{#each lint.suggestions as suggestion}
5262
<Button
5363
color="primary"
54-
class="w-full mb-1"
64+
class="w-full m-1"
5565
style="height: 40px; margin: 5px 0px;"
5666
on:click={() =>
5767
applySuggestion(content, suggestion, lint.span).then(

0 commit comments

Comments
 (0)