Skip to content

Commit d5773e6

Browse files
committed
wip kit converstion
1 parent 13bd721 commit d5773e6

File tree

128 files changed

+5693
-34917
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+5693
-34917
lines changed

.eslintrc

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"airbnb-base",
5+
"plugin:prettier/recommended"
6+
],
7+
"env": {
8+
"browser": true,
9+
"es6": true,
10+
"jest/globals": true
11+
},
12+
"parserOptions": {
13+
"ecmaVersion": 2019,
14+
"sourceType": "module"
15+
},
16+
"plugins": ["svelte3", "prettier", "jest"],
17+
"overrides": [
18+
{
19+
"files": ["**/*.svelte"],
20+
"processor": "svelte3/svelte3"
21+
}
22+
],
23+
"rules": {
24+
"no-underscore-dangle": "off",
25+
"no-unused-vars": [
26+
1,
27+
{ "argsIgnorePattern": "res|next|resolve|reject|^err" }
28+
],
29+
"arrow-body-style": [2, "as-needed"],
30+
"import/prefer-default-export": 0,
31+
"import/no-dynamic-require": "warn",
32+
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
33+
"max-len": "off",
34+
"jest/no-disabled-tests": "warn",
35+
"jest/no-focused-tests": "error",
36+
"jest/no-identical-title": "error",
37+
"jest/prefer-to-have-length": "warn",
38+
"jest/valid-expect": "error"
39+
}
40+
}

.gitignore

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
.env
2-
3-
.DS_Store
4-
/node_modules/
5-
/src/node_modules/@sapper/
61
yarn-error.log
72
/cypress/screenshots/
8-
/__sapper__/
93

104
# Logs
115
logs
@@ -26,15 +20,6 @@ lib-cov
2620
# Coverage directory used by tools like istanbul
2721
coverage
2822

29-
# nyc test coverage
30-
.nyc_output
31-
32-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
33-
.grunt
34-
35-
# Bower dependency directory (https://bower.io/)
36-
bower_components
37-
3823
# node-waf configuration
3924
.lock-wscript
4025

@@ -62,3 +47,13 @@ typings/
6247

6348
# Yarn Integrity file
6449
.yarn-integrity
50+
51+
52+
.DS_Store
53+
node_modules
54+
/.svelte
55+
/build
56+
/functions
57+
58+
59+
.env

.node-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10.15.0
1+
14.6.0

.prettierrc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"singleQuote": true,
3+
"printWidth": 80,
4+
"trailingComma": "all",
5+
"arrowParens": "avoid",
6+
"endOfLine": "auto",
7+
"plugins": ["prettier-plugin-svelte"],
8+
9+
"svelteSortOrder": "scripts-markup-styles",
10+
"svelteStrictMode": true,
11+
"svelteBracketNewLine": false,
12+
"svelteAllowShorthand": false,
13+
"svelteIndentScriptAndStyle": true
14+
}

.vscode/settings.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
"statusBar.border": "#242e3c",
1414
"titleBar.border": "#242e3c"
1515
},
16-
"peacock.affectActivityBar": false,
17-
"peacock.color": "#242E3C",
16+
1817
"editor.codeActionsOnSave": {
1918
"source.fixAll.eslint": true
2019
}

README.md

+23-58
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,39 @@
1-
# unspecified.io
1+
# create-svelte
22

3-
## Running the project
3+
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte);
44

5-
However you get the code, you can install dependencies and run the project in development mode with:
5+
## Creating a project
66

7-
```bash
8-
cd my-app
9-
npm install # or yarn
10-
npm run dev
11-
```
12-
13-
Open up [localhost:3000](http://localhost:3000) and start clicking around.
14-
15-
Consult [sapper.svelte.dev](https://sapper.svelte.dev) for help getting started.
16-
17-
## Structure
18-
19-
Sapper expects to find two directories in the root of your project — `src` and `static`.
20-
21-
### src
22-
23-
The [src](src) directory contains the entry points for your app — `client.js`, `server.js` and (optionally) a `service-worker.js` — along with a `template.html` file and a `routes` directory.
24-
25-
#### src/routes
26-
27-
This is the heart of your Sapper app. There are two kinds of routes — _pages_, and _server routes_.
28-
29-
**Pages** are Svelte components written in `.svelte` files. When a user first visits the application, they will be served a server-rendered version of the route in question, plus some JavaScript that 'hydrates' the page and initialises a client-side router. From that point forward, navigating to other pages is handled entirely on the client for a fast, app-like feel. (Sapper will preload and cache the code for these subsequent pages, so that navigation is instantaneous.)
30-
31-
**Server routes** are modules written in `.js` files, that export functions corresponding to HTTP methods. Each function receives Express `request` and `response` objects as arguments, plus a `next` function. This is useful for creating a JSON API, for example.
7+
If you're seeing this, you've probably already done this step. Congrats!
328

33-
There are three simple rules for naming the files that define your routes:
34-
35-
- A file called `src/routes/about.svelte` corresponds to the `/about` route. A file called `src/routes/blog/[slug].svelte` corresponds to the `/blog/:slug` route, in which case `params.slug` is available to the route
36-
- The file `src/routes/index.svelte` (or `src/routes/index.js`) corresponds to the root of your app. `src/routes/about/index.svelte` is treated the same as `src/routes/about.svelte`.
37-
- Files and directories with a leading underscore do _not_ create routes. This allows you to colocate helper modules and components with the routes that depend on them — for example you could have a file called `src/routes/_helpers/datetime.js` and it would _not_ create a `/_helpers/datetime` route
38-
39-
### static
40-
41-
The [static](static) directory contains any static assets that should be available. These are served using [sirv](https://github.com/lukeed/sirv).
42-
43-
In your [service-worker.js](src/service-worker.js) file, you can import these as `files` from the generated manifest...
9+
```bash
10+
# create a new project in the current directory
11+
npm init svelte@next
4412

45-
```js
46-
import { files } from "@sapper/service-worker";
13+
# create a new project in my-app
14+
npm init svelte@next my-app
4715
```
4816

49-
...so that you can cache them (though you can choose not to, for example if you don't want to cache very large files).
50-
51-
## Bundler config
17+
> Note: the `@next` is temporary
5218
53-
Sapper uses Rollup or webpack to provide code-splitting and dynamic imports, as well as compiling your Svelte components. With webpack, it also provides hot module reloading. As long as you don't do anything daft, you can edit the configuration files to add whatever plugins you'd like.
19+
## Developing
5420

55-
## Production mode and deployment
56-
57-
To start a production version of your app, run `npm run build && npm start`. This will disable live reloading, and activate the appropriate bundler plugins.
58-
59-
You can deploy your application to any environment that supports Node 8 or above. As an example, to deploy to [Now](https://zeit.co/now), run these commands:
21+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
6022

6123
```bash
62-
npm install -g now
63-
now
24+
npm run dev
25+
26+
# or start the server and open the app in a new browser tab
27+
npm run dev -- --open
6428
```
6529

66-
## Using external components
30+
## Building
6731

68-
When using Svelte components installed from npm, such as [@sveltejs/svelte-virtual-list](https://github.com/sveltejs/svelte-virtual-list), Svelte needs the original component source (rather than any precompiled JavaScript that ships with the component). This allows the component to be rendered server-side, and also keeps your client-side app smaller.
32+
Svelte apps are built with _adapters_, which optimise your project for deployment to different environments, like [Begin](https://begin.com), [Netlify](https://www.netlify.com), [Vercel](https://vercel.com) and so on. (You can also create your own adapter — instructions TODO.)
6933

70-
Because of that, it's essential that the bundler doesn't treat the package as an _external dependency_. You can either modify the `external` option under `server` in [rollup.config.js](rollup.config.js) or the `externals` option in [webpack.config.js](webpack.config.js), or simply install the package to `devDependencies` rather than `dependencies`, which will cause it to get bundled (and therefore compiled) with your app:
34+
By default, `npm run build` will generate a Node app that you can run with `node build`. To use a different adapter, install it and update your `svelte.config.cjs` accordingly. The following official adapters are available:
7135

72-
```bash
73-
npm install -D @sveltejs/svelte-virtual-list
74-
```
36+
- [@sveltejs/adapter-node](https://github.com/sveltejs/kit/tree/master/packages/adapter-node)
37+
- [@sveltejs/adapter-static](https://github.com/sveltejs/kit/tree/master/packages/adapter-static)
38+
- [@sveltejs/adapter-netlify](https://github.com/sveltejs/kit/tree/master/packages/adapter-netlify)
39+
- ...more soon

package.json

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "unspecified",
3+
"version": "0.0.1",
4+
"scripts": {
5+
"dev": "svelte-kit dev",
6+
"build": "svelte-kit build",
7+
"start": "svelte-kit start"
8+
},
9+
"devDependencies": {
10+
"@fullhuman/postcss-purgecss": "^4.0.2",
11+
"@sveltejs/adapter-node": "next",
12+
"@sveltejs/kit": "next",
13+
"@svitejs/vite-plugin-svelte": "^0.11.0",
14+
"@tailwindcss/aspect-ratio": "^0.2.0",
15+
"@tailwindcss/forms": "^0.2.1",
16+
"@tailwindcss/typography": "^0.4.0",
17+
"@tailwindcss/ui": "^0.7.2",
18+
"autoprefixer": "^10.2.5",
19+
"cssnano": "^4.1.10",
20+
"eslint": "^7.22.0",
21+
"eslint-config-airbnb-base": "^14.2.1",
22+
"eslint-config-prettier": "^8.1.0",
23+
"eslint-plugin-import": "^2.22.1",
24+
"eslint-plugin-jest": "^24.3.1",
25+
"eslint-plugin-prettier": "^3.3.1",
26+
"eslint-plugin-svelte3": "^3.1.2",
27+
"postcss": "^8.2.8",
28+
"postcss-cli": "^8.3.1",
29+
"postcss-load-config": "^3.0.1",
30+
"prettier": "^2.2.1",
31+
"prettier-eslint": "^12.0.0",
32+
"prettier-eslint-cli": "^5.0.1",
33+
"prettier-plugin-svelte": "^2.2.0",
34+
"svelte": "^3.35.0",
35+
"svelte-preprocess": "^4.6.9",
36+
"tailwindcss": "^2.0.3",
37+
"tailwindcss-font-inter": "^2.0.2",
38+
"vite": "^2.1.0"
39+
},
40+
"type": "module",
41+
"engines": {
42+
"node": ">= 14.6.0"
43+
}
44+
}

0 commit comments

Comments
 (0)