Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkurt committed May 12, 2020
0 parents commit 96b8dbf
Show file tree
Hide file tree
Showing 16 changed files with 5,105 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
.envrc
13 changes: 13 additions & 0 deletions README.md
@@ -0,0 +1,13 @@
# Deno + Apollo Client + Snowpack

This project uses snowpack.dev to make the `@apollo/client` node module useful in a Deno app. Snowpack turns most npm modules into ES modules you can import directly.

The npm cruft exists only in the `/deps/` directory. Snowpack installs everything to `/deps/web_modules`, which is symlinked back to the root dir. This allows the Deno app to just `import` directly from `./web_modules/@apollo/client.js` and do useful things.

You can make Snowpack install other npms by adding them to `knownEntrypoints` in `/deps/snowpack.config.json`.

## Run it

1. `flyctl auth token`, put it in an env var named `FLY_AUTH_TOKEN`
2. `cd deps; yarn install; snowpack install; cd ..`
3. `deno --allow-env --allow-net server.tst`
4 changes: 4 additions & 0 deletions deps/.gitignore
@@ -0,0 +1,4 @@
.build
build
web_modules
node_modules
18 changes: 18 additions & 0 deletions deps/package.json
@@ -0,0 +1,18 @@
{
"scripts": {
"prepare": "snowpack",
"start": "snowpack dev",
"build": "snowpack build",
"test": "echo \"This template does not include a test runner by default.\" && exit 1"
},
"webDependencies": {
"canvas-confetti": "^1.2.0"
},
"devDependencies": {
"snowpack": "^2.0.0-0"
},
"dependencies": {
"@apollo/client": "^3.0.0-beta.44",
"graphql": "^15.0.0"
}
}
Binary file added deps/public/favicon.ico
Binary file not shown.
14 changes: 14 additions & 0 deletions deps/public/index.css
@@ -0,0 +1,14 @@
#img {
display: block;
margin: auto;
height: 128px;
width: 128px;
padding: 2rem;
}

#canvas {
display: block;
margin: 2rem auto;
width: 540px;
height: 540px;
}
27 changes: 27 additions & 0 deletions deps/public/index.html
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Web site created using create-snowpack-app" />
<link rel="stylesheet" type="text/css" href="/index.css" />
<title>Snowpack App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<img id="img" src="/logo.svg" />
<canvas id="canvas"></canvas>
<script type="module" src="/_dist_/index.js"></script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
7 changes: 7 additions & 0 deletions deps/public/logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions deps/public/robots.txt
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
12 changes: 12 additions & 0 deletions deps/snowpack.config.json
@@ -0,0 +1,12 @@
{
"scripts": {
"mount:public": "mount public --to .",
"mount:web_modules": "mount web_modules",
"mount:src": "mount src --to _dist_"
},
"installOptions": {},
"devOptions": {},
"knownEntrypoints": [
"@apollo/client"
]
}
5 changes: 5 additions & 0 deletions deps/snowpack.lock.json
@@ -0,0 +1,5 @@
{
"imports": {
"canvas-confetti": "https://cdn.pika.dev/pin/canvas-confetti@v1.2.0-kzcveexqNXJywloAjiQb/canvas-confetti.js"
}
}
11 changes: 11 additions & 0 deletions deps/src/index.js
@@ -0,0 +1,11 @@
/**
* This file is just a silly example to show everything working in the browser.
* When you're ready to start on your site, clear the file. Happy hacking!
**/

import confetti from "canvas-confetti";

confetti.create(document.getElementById("canvas"), {
resize: true,
useWorker: true,
})({ particleCount: 200, spread: 200 });

0 comments on commit 96b8dbf

Please sign in to comment.