Skip to content

Commit

Permalink
redesign create-astro (withastro#301)
Browse files Browse the repository at this point in the history
* redesign create astro

* add changeset

* Use npm start

* Update the astro version

* Adds the changeset

Co-authored-by: Fred Schott <[email protected]>
Co-authored-by: Matthew Phillips <[email protected]>
  • Loading branch information
3 people committed Jun 8, 2021
1 parent 9594447 commit 6bca7c8
Show file tree
Hide file tree
Showing 99 changed files with 502 additions and 1,737 deletions.
5 changes: 5 additions & 0 deletions .changeset/large-glasses-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-astro': minor
---

Redesigned create-astro internals
5 changes: 5 additions & 0 deletions .changeset/short-pillows-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-astro': minor
---

New UI
16 changes: 14 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ SOFTWARE.


"""

This license applies to parts of the `src/compiler` subdirectory originating from the
This license applies to parts of the `packages/astro-parser` subdirectory originating from the
https://github.com/sveltejs/svelte repository:


Expand All @@ -34,5 +33,18 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""


"""
This license applies to parts of the `packages/create-astro` subdirectory originating from the
https://github.com/sveltejs/kit repository:

Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/contributors)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
7 changes: 7 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Contributing

## Setting Up the Monorepo

```shell
# git clone && cd ...
yarn install
```

## Making Pull Requests

When making a pull request, add a changeset which helps with releases.
Expand Down
8 changes: 3 additions & 5 deletions examples/astro-markdown/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"name": "@example/astro-markdown",
"name": "@astrojs/markdown-example",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "astro dev",
"build": "astro build",
"astro-dev": "nodemon --delay 0.5 -w ../../packages/astro/dist -x '../../packages/astro/astro.mjs dev'"
"build": "astro build"
},
"devDependencies": {
"astro": "0.12.9",
"nodemon": "^2.0.7"
"astro": "^0.12.9"
},
"snowpack": {
"workspaceRoot": "../.."
Expand Down
File renamed without changes.
41 changes: 29 additions & 12 deletions examples/blog/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,47 @@
# Astro Blog Example

> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
Features:

- ✅ SEO-friendly setup with canonical URLs and OpenGraph data
- ✅ Full Markdown support
- ✅ RSS 2.0 generation
- ✅ Sitemap.xml generation

## Setup
## 🚀 Project Structure

Inside of your Astro project, you'll see the following folders and files:

```
yarn
/
├── public/
│ ├── robots.txt
│ └── favicon.ico
├── src/
│ ├── components/
│ │ └── Tour.astro
│ └── pages/
│ └── index.astro
└── package.json
```

## Dev
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.

```
yarn start
```
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.

Preview at `http:https://localhost:3000`
Any static assets, like images, can be placed in the `public/` directory.

## Build
## 🧞 Commands

```
yarn build
```
All commands are run from the root of the project, from a terminal:

| Command | Action |
|:----------------|:--------------------------------------------|
| `npm install` | Installs dependencies |
| `npm run start` | Starts local dev server at `localhost:3000` |
| `npm run build` | Build your production site to `./dist/` |

## 👀 Want to learn more?

Will output static site at `./dist`
Feel free to check [our documentation](https://github.com/snowpackjs/astro) or jump into our [Discord server](https://discord.gg/EsGdSGen).
16 changes: 10 additions & 6 deletions examples/blog/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
export default {
projectRoot: '.',
pages: './src/pages',
public: './public',
dist: './dist',
// projectRoot: '.', // Where to resolve all URLs relative to. Useful if you have a monorepo project.
// pages: './src/pages', // Path to Astro components, pages, and data
// dist: './dist', // When running `astro build`, path to final static output
// public: './public', // A folder of static files Astro will copy to the root. Useful for favicons, images, and other files that don’t need processing.
buildOptions: {
sitemap: true,
site: 'https://mysite.dev/', // change
// site: '', // Your public domain, e.g.: https://my-site.dev/. Used to generate sitemaps and canonical URLs.
// sitemap: true, // Generate sitemap (set to "false" to disable)
},
devOptions: {
// port: 3000, // The port to run the dev server on.
// tailwindConfig: '', // Path to tailwind.config.js if used, e.g. './tailwind.config.js'
},
};
File renamed without changes.
5 changes: 2 additions & 3 deletions examples/blog/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"name": "@example/blog",
"name": "@astrojs/example-blog",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "astro dev",
"build": "astro build",
"astro-dev": "nodemon --delay 0.5 -w ../../packages/astro/dist -x '../../packages/astro/astro.mjs dev'"
"build": "astro build"
},
"devDependencies": {
"astro": "^0.12.9",
Expand Down
File renamed without changes
17 changes: 0 additions & 17 deletions examples/doc/package.json

This file was deleted.

File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions examples/docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@astrojs/docs-template",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "astro dev",
"build": "astro build"
},
"devDependencies": {
"astro": "^0.12.9"
},
"snowpack": {
"workspaceRoot": "../.."
}
}
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 3 additions & 5 deletions examples/kitchen-sink/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"name": "@example/kitchen-sink",
"name": "@astrojs/kitchen-sink-example",
"private": true,
"version": "1.0.0",
"scripts": {
"start": "astro dev",
"build": "astro build",
"astro-dev": "nodemon --delay 0.5 -w ../../packages/astro/dist -x '../../packages/astro/astro.mjs dev'"
"build": "astro build"
},
"devDependencies": {
"astro": "^0.12.9",
"nodemon": "^2.0.7"
"astro": "^0.12.9"
},
"snowpack": {
"workspaceRoot": "../.."
Expand Down
18 changes: 18 additions & 0 deletions examples/portfolio/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# build output
dist

# dependencies
node_modules/
.snowpack/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
5 changes: 2 additions & 3 deletions examples/portfolio/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"name": "@example/portfolio",
"name": "@astrojs/portfolio-template",
"private": true,
"version": "0.0.1",
"scripts": {
"start": "astro dev",
"build": "astro build",
"astro-dev": "nodemon --delay 0.5 -w ../../packages/astro/dist -x '../../packages/astro/astro.mjs dev'"
"build": "astro build"
},
"devDependencies": {
"astro": "^0.12.9"
Expand Down
18 changes: 18 additions & 0 deletions examples/starter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# build output
dist

# dependencies
node_modules/
.snowpack/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "TODO",
"name": "@astrojs/starter-kit",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "astro dev",
"build": "astro build"
},
"devDependencies": {
"astro": "latest"
"astro": "^0.12.9"
}
}
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 4 additions & 5 deletions examples/tailwindcss/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"name": "@example/tailwindcss",
"name": "@astrojs/tailwind-example",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "astro dev",
"build": "astro build",
"astro-dev": "nodemon --delay 0.5 -w ../../packages/astro/dist -x '../../packages/astro/astro.mjs dev'"
"build": "astro build"
},
"devDependencies": {
"astro": "^0.12.9",
"tailwindcss": "^2.1.2"
"tailwindcss": "^2.1.2",
"astro": "^0.12.9"
},
"snowpack": {
"workspaceRoot": "../.."
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"release": "yarn build && yarn changeset publish",
"benchmark": "yarn workspace astro run benchmark",
"build": "yarn build:core",
"build:all": "lerna run build",
"build:one": "lerna run build --scope",
"build:core": "lerna run build --scope astro --scope @astrojs/parser --scope @astrojs/markdown-support",
"build:vscode": "lerna run build --scope astro-languageserver --scope astro-vscode --scope @astrojs/parser",
"dev:vscode": "lerna run dev --scope astro-languageserver --scope astro-vscode --scope @astrojs/parser --parallel --stream",
Expand All @@ -15,16 +17,13 @@
"test:core": "yarn workspace astro run test"
},
"workspaces": [
"packages/!(create-astro)*",
"packages/renderers/*",
"packages/*",
"examples/*",
"tools/*",
"scripts",
"www"
],
"engines": {
"vscode": "^1.22.0"
},
"volta": {
"node": "14.16.1",
"npm": "7.11.2",
Expand Down
1 change: 0 additions & 1 deletion packages/create-astro/.gitignore

This file was deleted.

35 changes: 0 additions & 35 deletions packages/create-astro/CHANGELOG.md

This file was deleted.

17 changes: 4 additions & 13 deletions packages/create-astro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,13 @@ yarn create astro

```bash
# npm 6.x
npm init astro my-astro-project --template blank
npm init astro my-astro-project --template starter

# npm 7+, extra double-dash is needed:
npm init astro my-astro-project -- --template blank
npm init astro my-astro-project -- --template starter

# yarn
yarn create astro my-astro-project --template blank
yarn create astro my-astro-project --template starter
```

To see all available options, use the `--help` flag.

### Templates

The following templates are included:

- `starter`
- `blank`

Feel free to [open a PR](https://github.com/snowpackjs/astro/pulls) to add additional templates.
[Check out the full list](https://github.com/snowpackjs/astro/tree/main/examples) of example starter templates, available on GitHub.
Loading

0 comments on commit 6bca7c8

Please sign in to comment.