Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 02b3259

Browse files
committedMay 26, 2022
experiment with getting node_modules to work
1 parent cad3afc commit 02b3259

File tree

15 files changed

+3392
-46
lines changed

15 files changed

+3392
-46
lines changed
 

‎.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.DS_Store
2-
node_modules
2+
/node_modules
33
/build
44
/.svelte-kit
55
/package

‎content/tutorial/01-svelte/07-lifecycle/03-update/app-a/node_modules/.modules.yaml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎content/tutorial/01-svelte/07-lifecycle/03-update/app-a/node_modules/.pnpm/elizabot@0.0.3/node_modules/elizabot/.eslintrc.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎content/tutorial/01-svelte/07-lifecycle/03-update/app-a/node_modules/.pnpm/elizabot@0.0.3/node_modules/elizabot/README.md

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎content/tutorial/01-svelte/07-lifecycle/03-update/app-a/node_modules/.pnpm/elizabot@0.0.3/node_modules/elizabot/elizabot.js

Lines changed: 394 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎content/tutorial/01-svelte/07-lifecycle/03-update/app-a/node_modules/.pnpm/elizabot@0.0.3/node_modules/elizabot/elizadata.js

Lines changed: 614 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎content/tutorial/01-svelte/07-lifecycle/03-update/app-a/node_modules/.pnpm/elizabot@0.0.3/node_modules/elizabot/package.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎content/tutorial/01-svelte/07-lifecycle/03-update/app-a/node_modules/.pnpm/lock.yaml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎content/tutorial/01-svelte/07-lifecycle/03-update/app-a/node_modules/elizabot

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎content/tutorial/01-svelte/07-lifecycle/03-update/app-a/package-lock.json

Lines changed: 2194 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"dependencies": {
3+
"elizabot": "^0.0.3"
4+
},
5+
"type": "module"
6+
}

‎content/tutorial/01-svelte/07-lifecycle/03-update/app-a/pnpm-lock.yaml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎content/tutorial/01-svelte/07-lifecycle/03-update/app-a/src/lib/App.svelte

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
1616
const eliza = new Eliza();
1717
18-
let comments = [
19-
{ author: 'eliza', text: eliza.getInitial() }
20-
];
18+
let comments = [{ author: 'eliza', text: eliza.getInitial() }];
2119
2220
function handleKeydown(event) {
2321
if (event.key === 'Enter') {
@@ -41,16 +39,32 @@
4139
});
4240
4341
setTimeout(() => {
44-
comments = comments.filter(comment => !comment.placeholder).concat({
45-
author: 'eliza',
46-
text: reply
47-
});
42+
comments = comments
43+
.filter((comment) => !comment.placeholder)
44+
.concat({
45+
author: 'eliza',
46+
text: reply
47+
});
4848
}, 500 + Math.random() * 500);
4949
}, 200 + Math.random() * 200);
5050
}
5151
}
5252
</script>
5353

54+
<div class="chat">
55+
<h1>Eliza</h1>
56+
57+
<div class="scrollable" bind:this={div}>
58+
{#each comments as comment}
59+
<article class={comment.author}>
60+
<span>{comment.text}</span>
61+
</article>
62+
{/each}
63+
</div>
64+
65+
<input on:keydown={handleKeydown} />
66+
</div>
67+
5468
<style>
5569
.chat {
5670
display: flex;
@@ -85,23 +99,9 @@
8599
}
86100
87101
.user span {
88-
background-color: #0074D9;
102+
background-color: #0074d9;
89103
color: white;
90104
border-radius: 1em 1em 0 1em;
91105
word-break: break-all;
92106
}
93107
</style>
94-
95-
<div class="chat">
96-
<h1>Eliza</h1>
97-
98-
<div class="scrollable" bind:this={div}>
99-
{#each comments as comment}
100-
<article class={comment.author}>
101-
<span>{comment.text}</span>
102-
</article>
103-
{/each}
104-
</div>
105-
106-
<input on:keydown={handleKeydown}>
107-
</div>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import adapter from '@sveltejs/adapter-auto';
2+
3+
/** @type {import('@sveltejs/kit').Config} */
4+
const config = {
5+
kit: {
6+
adapter: adapter(),
7+
8+
vite: {
9+
optimizeDeps: {
10+
include: ['elizabot']
11+
}
12+
}
13+
}
14+
};
15+
16+
export default config;

‎content/tutorial/01-svelte/07-lifecycle/03-update/app-b/src/lib/App.svelte

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
let autoscroll;
77
88
beforeUpdate(() => {
9-
autoscroll = div && (div.offsetHeight + div.scrollTop) > (div.scrollHeight - 20);
9+
autoscroll = div && div.offsetHeight + div.scrollTop > div.scrollHeight - 20;
1010
});
1111
1212
afterUpdate(() => {
@@ -15,9 +15,7 @@
1515
1616
const eliza = new Eliza();
1717
18-
let comments = [
19-
{ author: 'eliza', text: eliza.getInitial() }
20-
];
18+
let comments = [{ author: 'eliza', text: eliza.getInitial() }];
2119
2220
function handleKeydown(event) {
2321
if (event.key === 'Enter') {
@@ -41,16 +39,32 @@
4139
});
4240
4341
setTimeout(() => {
44-
comments = comments.filter(comment => !comment.placeholder).concat({
45-
author: 'eliza',
46-
text: reply
47-
});
42+
comments = comments
43+
.filter((comment) => !comment.placeholder)
44+
.concat({
45+
author: 'eliza',
46+
text: reply
47+
});
4848
}, 500 + Math.random() * 500);
4949
}, 200 + Math.random() * 200);
5050
}
5151
}
5252
</script>
5353

54+
<div class="chat">
55+
<h1>Eliza</h1>
56+
57+
<div class="scrollable" bind:this={div}>
58+
{#each comments as comment}
59+
<article class={comment.author}>
60+
<span>{comment.text}</span>
61+
</article>
62+
{/each}
63+
</div>
64+
65+
<input on:keydown={handleKeydown} />
66+
</div>
67+
5468
<style>
5569
.chat {
5670
display: flex;
@@ -85,23 +99,9 @@
8599
}
86100
87101
.user span {
88-
background-color: #0074D9;
102+
background-color: #0074d9;
89103
color: white;
90104
border-radius: 1em 1em 0 1em;
91105
word-break: break-all;
92106
}
93107
</style>
94-
95-
<div class="chat">
96-
<h1>Eliza</h1>
97-
98-
<div class="scrollable" bind:this={div}>
99-
{#each comments as comment}
100-
<article class={comment.author}>
101-
<span>{comment.text}</span>
102-
</article>
103-
{/each}
104-
</div>
105-
106-
<input on:keydown={handleKeydown}>
107-
</div>

0 commit comments

Comments
 (0)
Please sign in to comment.