Skip to content

Commit

Permalink
update welcome message (#1196)
Browse files Browse the repository at this point in the history
* update welcome message

* make our next steps consistent with our FAQ

* no adapter by default

* replace references to npm start with npm run preview

* couple more simplifications
  • Loading branch information
Rich Harris authored Apr 24, 2021
1 parent 1b816b2 commit 6f2b4a6
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 42 deletions.
5 changes: 5 additions & 0 deletions .changeset/flat-parrots-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

Update welcome message
5 changes: 5 additions & 0 deletions .changeset/late-glasses-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

No adapter by default
6 changes: 6 additions & 0 deletions .changeset/tame-lobsters-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sveltejs/adapter-static': patch
'@sveltejs/kit': patch
---

Remove references to npm start
2 changes: 1 addition & 1 deletion packages/adapter-static/test/apps/spa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ Before creating a production version of your app, install an [adapter](https://k
npm run build
```

> You can preview the built app with `npm start`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
12 changes: 7 additions & 5 deletions packages/create-svelte/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ import { bold, cyan, gray, green, red } from 'kleur/colors';
import prompts from 'prompts';
import { mkdirp, copy } from './utils.js';

// prettier-ignore
const disclaimer = `
Welcome to the SvelteKit setup wizard!
${bold(cyan('Welcome to SvelteKit!'))}
SvelteKit is in public beta now. There are definitely bugs and some feature might not work yet.
If you encounter an issue, have a look at https://github.com/sveltejs/kit/issues and open a new one, if it is not already tracked.
${bold(red('This is beta software; expect bugs and missing features.'))}
If you encounter a problem, open an issue on ${cyan('https://github.com/sveltejs/kit/issues')} if none exists already.
`;

const { version } = JSON.parse(fs.readFileSync(new URL('package.json', import.meta.url), 'utf-8'));

async function main() {
console.log(gray(`\ncreate-svelte version ${version}`));
console.log(red(disclaimer));
console.log(disclaimer);

const cwd = process.argv[2] || '.';

Expand Down Expand Up @@ -130,7 +132,7 @@ async function main() {

// prettier-ignore
console.log(` ${i++}: ${bold(cyan('git init && git add -A && git commit -m "Initial commit"'))} (optional step)`);
console.log(` ${i++}: ${bold(cyan('npm install'))} (or pnpm install, or yarn)`);
console.log(` ${i++}: ${bold(cyan('npm install'))} (or pnpm install, etc)`);
console.log(` ${i++}: ${bold(cyan('npm run dev -- --open'))}`);

console.log(`\nTo close the dev server, hit ${bold(cyan('Ctrl-C'))}`);
Expand Down
11 changes: 2 additions & 9 deletions packages/create-svelte/shared/+typescript/svelte.config.cjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
const sveltePreprocess = require('svelte-preprocess');
const node = require('@sveltejs/adapter-node');
const pkg = require('./package.json');
const preprocess = require('svelte-preprocess');

/** @type {import('@sveltejs/kit').Config} */
module.exports = {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: sveltePreprocess(),
preprocess: preprocess(),

kit: {
// By default, `npm run build` will create a standard Node app.
// You can create optimized builds for different platforms by
// specifying a different adapter
adapter: node(),

// hydrate the <div id="svelte"> element in src/app.html
target: '#svelte'
}
Expand Down
8 changes: 0 additions & 8 deletions packages/create-svelte/shared/-typescript/svelte.config.cjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
const node = require('@sveltejs/adapter-node');
const pkg = require('./package.json');

/** @type {import('@sveltejs/kit').Config} */
module.exports = {
kit: {
// By default, `npm run build` will create a standard Node app.
// You can create optimized builds for different platforms by
// specifying a different adapter
adapter: node(),

// hydrate the <div id="svelte"> element in src/app.html
target: '#svelte'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"preview": "svelte-kit preview"
},
"devDependencies": {
"@sveltejs/adapter-node": "workspace:*",
"@sveltejs/kit": "workspace:*",
"svelte": "^3.29.0",
"vite": "^2.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@ import type { RequestHandler } from '@sveltejs/kit';

// GET /todos.json
export const get: RequestHandler = async (request) => {
if (!request.context.userid) {
// the user has never visited the site before
// and so doesn't yet have a userid, which is
// set in `handle`, in src/hooks.js
return { body: [] };
}

// request.context.userid comes from src/hooks.js
const response = await api(request, `todos/${request.context.userid}`);

if (response.status === 404) {
// the user has visited before, but hasn't yet
// created a todo list. start with an empty array
// user hasn't created a todo list.
// start with an empty array
return { body: [] };
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,7 @@
<div class="todo" class:done={todo.done} transition:scale|local={{start:0.7}} animate:flip={{duration:200}}>
<form action="/todos/{todo.uid}.json?_method=patch" method="post" use:enhance={{
pending: (data) => {
const done = !!data.get('done');

todos = todos.map(t => {
if (t === todo) return { ...t, done };
return t;
});
todo.done = !!data.get('done');
},
result: patch
}}>
Expand Down Expand Up @@ -205,4 +200,4 @@
transition: opacity 0.2s;
opacity: 1;
}
</style>
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"preview": "svelte-kit preview"
},
"devDependencies": {
"@sveltejs/adapter-node": "workspace:*",
"@sveltejs/kit": "workspace:*",
"svelte": "^3.29.0",
"vite": "^2.1.0"
Expand Down
4 changes: 3 additions & 1 deletion packages/kit/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ prog
const { build } = await import('./core/build/index.js');
const build_data = await build(config);

console.log(`\nRun ${colors.bold().cyan('npm start')} to try your app locally.`);
console.log(
`\nRun ${colors.bold().cyan('npm run preview')} to preview your production build locally.`
);

if (config.kit.adapter) {
const { adapt } = await import('./core/adapt/index.js');
Expand Down

0 comments on commit 6f2b4a6

Please sign in to comment.