redesign create-astro (#301)
* redesign create astro * add changeset * Use npm start * Update the astro version * Adds the changeset Co-authored-by: Fred Schott <fks@Freds-MBP.attlocal.net> Co-authored-by: Matthew Phillips <matthew@skypack.dev>
5
.changeset/large-glasses-sneeze.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'create-astro': minor
|
||||
---
|
||||
|
||||
Redesigned create-astro internals
|
5
.changeset/short-pillows-study.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'create-astro': minor
|
||||
---
|
||||
|
||||
New UI
|
16
LICENSE
|
@ -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:
|
||||
|
||||
|
||||
|
@ -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.
|
||||
"""
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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": "../.."
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Astro Blog Example
|
||||
|
||||
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!
|
||||
|
||||
Features:
|
||||
|
||||
- ✅ SEO-friendly setup with canonical URLs and OpenGraph data
|
||||
|
@ -7,24 +9,39 @@ Features:
|
|||
- ✅ 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://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:
|
||||
|
||||
Will output static site at `./dist`
|
||||
| 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?
|
||||
|
||||
Feel free to check [our documentation](https://github.com/snowpackjs/astro) or jump into our [Discord server](https://discord.gg/EsGdSGen).
|
||||
|
|
|
@ -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'
|
||||
},
|
||||
};
|
||||
|
|
|
@ -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",
|
||||
|
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"name": "@example/doc",
|
||||
"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'"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "^0.12.9",
|
||||
"nodemon": "^2.0.7"
|
||||
},
|
||||
"snowpack": {
|
||||
"workspaceRoot": "../.."
|
||||
}
|
||||
}
|
15
examples/docs/package.json
Normal file
|
@ -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": "../.."
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -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": "../.."
|
||||
|
|
18
examples/portfolio/.gitignore
vendored
Normal file
|
@ -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
|
|
@ -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"
|
||||
|
|
18
examples/starter/.gitignore
vendored
Normal file
|
@ -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
|
|
@ -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"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -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": "../.."
|
||||
|
|
|
@ -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",
|
||||
|
@ -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",
|
||||
|
|
1
packages/create-astro/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
yarn.lock
|
|
@ -1,35 +0,0 @@
|
|||
# create-astro
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- ✨ New template: Blog
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Bugfix: Template selection spacing
|
||||
- Bugfix: Getting Started template font display in Firefox
|
||||
- Bugfix: CLI contrast improvement
|
||||
- All templates: more readable Astro config
|
||||
|
||||
## 0.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Rename the `--run` option to `--skip-install` for clarity.
|
||||
- Bugfix: `npm init astro` on npm v7
|
||||
|
||||
## 0.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Update template dependencies
|
||||
|
||||
## 0.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- ed63132: Added **interactive mode** with a fesh new UI.
|
||||
|
||||
Included a new **blank** starter to get up and running even faster.
|
|
@ -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.
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
import cli from './dist/index.js';
|
||||
cli(process.argv);
|
14
packages/create-astro/create-astro.mjs
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
const currentVersion = process.versions.node;
|
||||
const requiredMajorVersion = parseInt(currentVersion.split('.')[0], 10);
|
||||
const minimumMajorVersion = 10;
|
||||
|
||||
if (requiredMajorVersion < minimumMajorVersion) {
|
||||
console.error(`Node.js v${currentVersion} is out of date and unsupported!`);
|
||||
console.error(`Please use Node.js v${minimumMajorVersion} or higher.`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
import('./dist/index.js').then(({main}) => main());
|
|
@ -6,11 +6,10 @@
|
|||
".": "./create-astro.js"
|
||||
},
|
||||
"bin": {
|
||||
"create-astro": "./create-astro.js"
|
||||
"create-astro": "./create-astro.mjs"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "ENV=production ../../scripts/index.js build src/index.tsx",
|
||||
"postbuild": "../../scripts/index.js copy \"src/templates/**\" --tgz",
|
||||
"build": "astro-scripts build \"src/*.ts\"",
|
||||
"prepare": "yarn build",
|
||||
"test": "uvu"
|
||||
},
|
||||
|
@ -19,13 +18,12 @@
|
|||
"create-astro.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"decamelize": "^5.0.0",
|
||||
"decompress": "^4.2.1",
|
||||
"ink": "^3.0.8",
|
||||
"ink-select-input": "^4.2.0",
|
||||
"ink-text-input": "^4.0.1",
|
||||
"react": "^16.14.0",
|
||||
"source-map-support": "^0.5.19"
|
||||
"@types/degit": "^2.8.2",
|
||||
"@types/prompts": "^2.0.12",
|
||||
"degit": "^2.8.4",
|
||||
"kleur": "^4.1.1",
|
||||
"prompts": "^2.4.1",
|
||||
"yargs-parser": "^20.2.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"uvu": "^0.5.1"
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
import React, { FC, useEffect } from 'react';
|
||||
import { prepareTemplate, isEmpty, emptyDir } from '../utils';
|
||||
import Header from './Header';
|
||||
import Install from './Install';
|
||||
import ProjectName from './ProjectName';
|
||||
import Template from './Template';
|
||||
import Confirm from './Confirm';
|
||||
import Finalize from './Finalize';
|
||||
|
||||
interface Context {
|
||||
use: 'npm' | 'yarn';
|
||||
skipInstall?: boolean;
|
||||
projectExists?: boolean;
|
||||
force?: boolean;
|
||||
projectName?: string;
|
||||
template?: string;
|
||||
templates: string[];
|
||||
ready?: boolean;
|
||||
}
|
||||
|
||||
const getStep = ({ projectName, projectExists: exists, template, force, ready, skipInstall }: Context) => {
|
||||
switch (true) {
|
||||
case !projectName:
|
||||
return {
|
||||
key: 'projectName',
|
||||
Component: ProjectName,
|
||||
};
|
||||
case projectName && exists === true && typeof force === 'undefined':
|
||||
return {
|
||||
key: 'force',
|
||||
Component: Confirm,
|
||||
};
|
||||
case (exists === false || force) && !template:
|
||||
return {
|
||||
key: 'template',
|
||||
Component: Template,
|
||||
};
|
||||
case !ready && !skipInstall:
|
||||
return {
|
||||
key: 'install',
|
||||
Component: Install,
|
||||
};
|
||||
case ready:
|
||||
return {
|
||||
key: 'final',
|
||||
Component: Finalize,
|
||||
};
|
||||
default:
|
||||
return {
|
||||
key: 'empty',
|
||||
Component: () => <></>,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const App: FC<{ context: Context }> = ({ context }) => {
|
||||
const [state, setState] = React.useState(context);
|
||||
const step = React.useRef(getStep(context));
|
||||
const onSubmit = (value: string | boolean) => {
|
||||
const { key } = step.current;
|
||||
const newState = { ...state, [key]: value };
|
||||
step.current = getStep(newState);
|
||||
setState(newState);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
let isSubscribed = true;
|
||||
if (state.projectName && typeof state.projectExists === 'undefined') {
|
||||
const newState = { ...state, projectExists: !isEmpty(state.projectName) };
|
||||
step.current = getStep(newState);
|
||||
if (isSubscribed) {
|
||||
setState(newState);
|
||||
}
|
||||
}
|
||||
|
||||
if (state.projectName && (state.projectExists === false || state.force) && state.template) {
|
||||
if (state.force) emptyDir(state.projectName);
|
||||
prepareTemplate({
|
||||
use: context.use,
|
||||
templateName: state.template,
|
||||
projectName: state.projectName,
|
||||
skipInstall: state.skipInstall,
|
||||
}).then(() => {
|
||||
if (isSubscribed) {
|
||||
setState((v) => {
|
||||
const newState = { ...v, ready: true };
|
||||
step.current = getStep(newState);
|
||||
return newState;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return () => {
|
||||
isSubscribed = false;
|
||||
};
|
||||
}, [state]);
|
||||
const { Component } = step.current;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header context={state} />
|
||||
<Component context={state} onSubmit={onSubmit} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
|
@ -1,50 +0,0 @@
|
|||
import React, { FC } from 'react';
|
||||
import { Box, Text, useApp } from 'ink';
|
||||
import { relative } from 'path';
|
||||
import Spacer from './Spacer';
|
||||
import Select from './Select';
|
||||
|
||||
const Confirm: FC<{ message?: any; context: any; onSubmit: (value: boolean) => void }> = ({ message, context: { projectName }, onSubmit }) => {
|
||||
const { exit } = useApp();
|
||||
const handleSubmit = (v: boolean) => {
|
||||
if (!v) return exit();
|
||||
onSubmit(v);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box display="flex">
|
||||
{!message ? (
|
||||
<>
|
||||
<Text color="#FFBE2D">{'[uh-oh]'}</Text>
|
||||
<Text>
|
||||
{' '}
|
||||
It appears <Text color="#17C083">./{relative(process.cwd(), projectName)}</Text> is not empty. Overwrite?
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
message
|
||||
)}
|
||||
</Box>
|
||||
<Box display="flex">
|
||||
<Spacer width={6} />
|
||||
<Select
|
||||
items={[
|
||||
{
|
||||
value: false,
|
||||
label: 'no',
|
||||
},
|
||||
{
|
||||
value: true,
|
||||
label: 'yes',
|
||||
description: <Text color="#FF1639">overwrite</Text>,
|
||||
},
|
||||
]}
|
||||
onSelect={handleSubmit}
|
||||
/>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Confirm;
|
|
@ -1,5 +0,0 @@
|
|||
import React from 'react';
|
||||
import { Text } from 'ink';
|
||||
import { isWin } from '../utils';
|
||||
|
||||
export default ({ children }) => (isWin() ? null : <Text>{children}</Text>);
|
|
@ -1,12 +0,0 @@
|
|||
import React, { FC } from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import { isDone } from '../utils';
|
||||
|
||||
const Exit: FC<{ didError?: boolean }> = ({ didError }) =>
|
||||
isDone ? null : (
|
||||
<Box marginTop={1} display="flex">
|
||||
<Text color={didError ? '#FF1639' : '#FFBE2D'}>[abort]</Text>
|
||||
<Text> astro cancelled</Text>
|
||||
</Box>
|
||||
);
|
||||
export default Exit;
|
|
@ -1,35 +0,0 @@
|
|||
import React, { FC, useEffect } from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import { relative } from 'path';
|
||||
import { cancelProcessListeners } from '../utils';
|
||||
|
||||
const Finalize: FC<{ context: any }> = ({ context: { use, projectName } }) => {
|
||||
useEffect(() => {
|
||||
cancelProcessListeners();
|
||||
process.exit(0);
|
||||
}, []);
|
||||
|
||||
const projectPath = `./${relative(process.cwd(), projectName)}`;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box display="flex">
|
||||
<Text color="#17C083">{'[ yes ]'}</Text>
|
||||
<Text>
|
||||
{' '}
|
||||
Project initialized at <Text color="#3894FF">{projectPath}</Text>
|
||||
</Text>
|
||||
</Box>
|
||||
<Box display="flex" marginY={1}>
|
||||
<Text dimColor>{'[ tip ]'}</Text>
|
||||
<Box display="flex" marginLeft={1} flexDirection="column">
|
||||
<Text>Get started by running</Text>
|
||||
<Text color="#3894FF">cd {projectPath}</Text>
|
||||
<Text color="#3894FF">{use} start</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Finalize;
|
|
@ -1,28 +0,0 @@
|
|||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
|
||||
const getMessage = ({ projectName, template }) => {
|
||||
switch (true) {
|
||||
case !projectName:
|
||||
return <Text dimColor>Gathering mission details</Text>;
|
||||
case !template:
|
||||
return <Text dimColor>Optimizing navigational system</Text>;
|
||||
default:
|
||||
return (
|
||||
<Text color="black" backgroundColor="white">
|
||||
{' '}
|
||||
{projectName}{' '}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const Header: React.FC<{ context: any }> = ({ context }) => (
|
||||
<Box width={48} display="flex" marginY={1}>
|
||||
<Text backgroundColor="#882DE7" color="white">
|
||||
{' astro '}
|
||||
</Text>
|
||||
<Box marginLeft={1}>{getMessage(context)}</Box>
|
||||
</Box>
|
||||
);
|
||||
export default Header;
|
|
@ -1,81 +0,0 @@
|
|||
import React, { FC } from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import decamelize from 'decamelize';
|
||||
import { ARGS, ARG } from '../config';
|
||||
|
||||
const Type: FC<{ type: any; enum?: string[] }> = ({ type, enum: e }) => {
|
||||
if (type === Boolean) {
|
||||
return (
|
||||
<>
|
||||
<Text color="#3894FF">true</Text>
|
||||
<Text dimColor>|</Text>
|
||||
<Text color="#3894FF">false</Text>
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (e?.length > 0) {
|
||||
return (
|
||||
<>
|
||||
{e.map((item, i, { length: len }) => {
|
||||
if (i !== len - 1) {
|
||||
return (
|
||||
<Box key={item}>
|
||||
<Text color="#17C083">{item}</Text>
|
||||
<Text dimColor>|</Text>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Text color="#17C083" key={item}>
|
||||
{item}
|
||||
</Text>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return <Text color="#3894FF">string</Text>;
|
||||
};
|
||||
|
||||
const Command: FC<{ name: string; info: ARG }> = ({ name, info: { alias, description, type, enum: e } }) => {
|
||||
return (
|
||||
<Box display="flex" alignItems="flex-start">
|
||||
<Box width={24} display="flex" flexGrow={0}>
|
||||
<Text color="whiteBright">--{name}</Text>
|
||||
{alias && <Text dimColor> -{alias}</Text>}
|
||||
</Box>
|
||||
<Box width={24}>
|
||||
<Type type={type} enum={e} />
|
||||
</Box>
|
||||
<Box>
|
||||
<Text>{description}</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
const Help: FC<{ context: any }> = ({ context: { templates } }) => {
|
||||
return (
|
||||
<>
|
||||
<Box width={48} display="flex" marginY={1}>
|
||||
<Text backgroundColor="#882DE7" color="white">
|
||||
{' astro '}
|
||||
</Text>
|
||||
<Box marginLeft={1}>
|
||||
<Text color="black" backgroundColor="white">
|
||||
{' '}
|
||||
help{' '}
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
<Box marginBottom={1} marginLeft={2} display="flex" flexDirection="column">
|
||||
{Object.entries(ARGS).map(([name, info]) => (
|
||||
<Command key={name} name={decamelize(name, { separator: '-' })} info={name === 'template' ? { ...info, enum: templates.map(({ value }) => value) } : info} />
|
||||
))}
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default Help;
|
|
@ -1,23 +0,0 @@
|
|||
import React, { FC } from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import Spacer from './Spacer';
|
||||
import Spinner from './Spinner';
|
||||
|
||||
const Install: FC<{ context: any }> = ({ context: { use } }) => {
|
||||
return (
|
||||
<>
|
||||
<Box display="flex">
|
||||
<Spinner />
|
||||
<Text> Initiating launch sequence...</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Spacer />
|
||||
<Text dimColor>
|
||||
(aka running <Text dimColor>{use === 'npm' ? 'npm install' : 'yarn'}</Text>)
|
||||
</Text>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Install;
|
|
@ -1,26 +0,0 @@
|
|||
import React, { FC } from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import Spacer from './Spacer';
|
||||
import TextInput from 'ink-text-input';
|
||||
// @ts-expect-error
|
||||
const { default: Input } = TextInput;
|
||||
|
||||
const ProjectName: FC<{ onSubmit: (value: string) => void }> = ({ onSubmit }) => {
|
||||
const [value, setValue] = React.useState('');
|
||||
const handleSubmit = (v: string) => onSubmit(v);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box display="flex">
|
||||
<Text color="#17C083">{'[query]'}</Text>
|
||||
<Text> What is your project name?</Text>
|
||||
</Box>
|
||||
<Box display="flex">
|
||||
<Spacer />
|
||||
<Input value={value} onChange={setValue} onSubmit={handleSubmit} placeholder="my-project" />
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProjectName;
|
|
@ -1,32 +0,0 @@
|
|||
import SelectInput from 'ink-select-input';
|
||||
import React, { FC } from 'react';
|
||||
import { Text, Box } from 'ink';
|
||||
// @ts-expect-error
|
||||
const { default: Select } = SelectInput;
|
||||
|
||||
interface Props {
|
||||
isSelected?: boolean;
|
||||
label: string;
|
||||
description?: string;
|
||||
}
|
||||
const Indicator: FC<Props> = ({ isSelected }) => (isSelected ? <Text color="#3894FF">[ </Text> : <Text>{' '}</Text>);
|
||||
const Item: FC<Props> = ({ isSelected = false, label, description }) => (
|
||||
<Box display="flex">
|
||||
<Text color={isSelected ? '#3894FF' : 'white'} dimColor={!isSelected}>
|
||||
{label}
|
||||
</Text>
|
||||
{isSelected && description && typeof description === 'string' && <Text> {description}</Text>}
|
||||
{isSelected && description && typeof description !== 'string' && <Box marginLeft={1}>{description}</Box>}
|
||||
</Box>
|
||||
);
|
||||
|
||||
interface SelectProps {
|
||||
items: { value: string | number | boolean; label: string; description?: any }[];
|
||||
onSelect(value: string | number | boolean): void;
|
||||
}
|
||||
const CustomSelect: FC<SelectProps> = ({ items, onSelect }) => {
|
||||
const handleSelect = ({ value }) => onSelect(value);
|
||||
return <Select indicatorComponent={Indicator} itemComponent={Item} items={items} onSelect={handleSelect} />;
|
||||
};
|
||||
|
||||
export default CustomSelect;
|
|
@ -1,5 +0,0 @@
|
|||
import React, { FC } from 'react';
|
||||
import { Box } from 'ink';
|
||||
|
||||
const Spacer: FC<{ width?: number }> = ({ width = 8 }) => <Box width={width} />;
|
||||
export default Spacer;
|
|
@ -1,200 +0,0 @@
|
|||
import React, { FC, useEffect, useState } from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
|
||||
const Spinner: FC<{ type?: keyof typeof spinners }> = ({ type = 'countdown' }) => {
|
||||
const { interval, frames } = spinners[type];
|
||||
const [i, setI] = useState(0);
|
||||
useEffect(() => {
|
||||
const _ = setInterval(() => {
|
||||
setI((v) => (v < frames.length - 1 ? v + 1 : 0));
|
||||
}, interval);
|
||||
|
||||
return () => clearInterval(_);
|
||||
}, []);
|
||||
|
||||
return frames[i];
|
||||
};
|
||||
|
||||
const spinners = {
|
||||
countdown: {
|
||||
interval: 80,
|
||||
frames: [
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#17C083"> </Text>
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
<Text backgroundColor="#882DE7"> </Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
<Text backgroundColor="#17C083">{' '}</Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#882DE7"> </Text>
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
<Text backgroundColor="#17C083"> </Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
<Text backgroundColor="#23B1AF"> </Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
<Text backgroundColor="#2CA5D2"> </Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
<Text backgroundColor="#3894FF"> </Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
<Text backgroundColor="#5076F9"> </Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
<Text backgroundColor="#6858F1"> </Text>
|
||||
</Box>,
|
||||
<Box display="flex">
|
||||
<Text backgroundColor="#882DE7">{' '}</Text>
|
||||
</Box>,
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
export default Spinner;
|
|
@ -1,23 +0,0 @@
|
|||
import React, { FC } from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import Spacer from './Spacer';
|
||||
import Select from './Select';
|
||||
|
||||
const Template: FC<{ context: any; onSubmit: (value: string) => void }> = ({ context: { templates }, onSubmit }) => {
|
||||
const items = templates.map(({ title: label, ...rest }) => ({ ...rest, label }));
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box display="flex">
|
||||
<Text color="#17C083">{'[query]'}</Text>
|
||||
<Text> Which template should be used?</Text>
|
||||
</Box>
|
||||
<Box display="flex">
|
||||
<Spacer width={6} />
|
||||
<Select items={items} onSelect={onSubmit} />
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Template;
|
|
@ -1,6 +0,0 @@
|
|||
import React, { FC } from 'react';
|
||||
import { Text } from 'ink';
|
||||
import pkg from '../../package.json';
|
||||
|
||||
const Version: FC = () => <Text color="#17C083">v{pkg.version}</Text>;
|
||||
export default Version;
|
|
@ -1,50 +0,0 @@
|
|||
import type * as arg from 'arg';
|
||||
import decamelize from 'decamelize';
|
||||
|
||||
export interface ARG {
|
||||
type: any;
|
||||
description: string;
|
||||
enum?: string[];
|
||||
alias?: string;
|
||||
}
|
||||
|
||||
export const ARGS: Record<string, ARG> = {
|
||||
template: {
|
||||
type: String,
|
||||
description: 'specifies template to use',
|
||||
},
|
||||
use: {
|
||||
type: String,
|
||||
enum: ['npm', 'yarn'],
|
||||
description: 'specifies package manager to use',
|
||||
},
|
||||
skipInstall: {
|
||||
type: Boolean,
|
||||
description: 'should installing dependencies be skipped?',
|
||||
},
|
||||
force: {
|
||||
type: Boolean,
|
||||
alias: 'f',
|
||||
description: 'should existing files be overwritten?',
|
||||
},
|
||||
version: {
|
||||
type: Boolean,
|
||||
alias: 'v',
|
||||
description: 'prints current version',
|
||||
},
|
||||
help: {
|
||||
type: Boolean,
|
||||
alias: 'h',
|
||||
description: 'prints this message',
|
||||
},
|
||||
};
|
||||
|
||||
export const args = Object.entries(ARGS).reduce((acc, [name, info]) => {
|
||||
const key = `--${decamelize(name, { separator: '-' })}`;
|
||||
const spec = { ...acc, [key]: info.type };
|
||||
|
||||
if (info.alias) {
|
||||
spec[`-${info.alias}`] = key;
|
||||
}
|
||||
return spec;
|
||||
}, {} as arg.Spec);
|
87
packages/create-astro/src/index.ts
Normal file
|
@ -0,0 +1,87 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { bold, cyan, gray, green, red } from 'kleur/colors';
|
||||
import prompts from 'prompts';
|
||||
import degit from 'degit';
|
||||
import yargs from 'yargs-parser';
|
||||
import { TEMPLATES } from './templates';
|
||||
const args = yargs(process.argv);
|
||||
prompts.override(args);
|
||||
|
||||
export function mkdirp(dir: string) {
|
||||
try {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
} catch (e) {
|
||||
if (e.code === 'EEXIST') return;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const { version } = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8'));
|
||||
|
||||
export async function main() {
|
||||
console.log('\n' + bold('Welcome to Astro!') + gray(` (create-astro v${version})`));
|
||||
console.log(`If you encounter a problem, visit ${cyan('https://github.com/snowpack/astro/issues')} to search or file a new issue.\n`);
|
||||
|
||||
console.log(green(`>`) + gray(` Prepare for liftoff.`));
|
||||
console.log(green(`>`) + gray(` Gathering mission details...`));
|
||||
|
||||
const cwd = args['_'][2] || '.';
|
||||
if (fs.existsSync(cwd)) {
|
||||
if (fs.readdirSync(cwd).length > 0) {
|
||||
const response = await prompts({
|
||||
type: 'confirm',
|
||||
name: 'forceOverwrite',
|
||||
message: 'Directory not empty. Continue?',
|
||||
initial: false
|
||||
});
|
||||
if (!response.forceOverwrite) {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mkdirp(cwd);
|
||||
}
|
||||
|
||||
const options = /** @type {import('./types/internal').Options} */ (await prompts([
|
||||
{
|
||||
type: 'select',
|
||||
name: 'template',
|
||||
message: 'Which app template would you like to use?',
|
||||
choices: TEMPLATES
|
||||
},
|
||||
]));
|
||||
|
||||
const emitter = degit(`snowpackjs/astro/examples/${options.template}`, {
|
||||
cache: false,
|
||||
force: true,
|
||||
verbose: false,
|
||||
});
|
||||
|
||||
try {
|
||||
// emitter.on('info', info => { console.log(info.message) });
|
||||
await emitter.clone(cwd);
|
||||
} catch (err) {
|
||||
// degit is compiled, so the stacktrace is pretty noisy. Just report the message.
|
||||
console.error(red(err.message));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(bold(green('✔ Copied project files')));
|
||||
|
||||
console.log('\nNext steps:');
|
||||
let i = 1;
|
||||
|
||||
const relative = path.relative(process.cwd(), cwd);
|
||||
if (relative !== '') {
|
||||
console.log(` ${i++}: ${bold(cyan(`cd ${relative}`))}`);
|
||||
}
|
||||
|
||||
console.log(` ${i++}: ${bold(cyan('npm install'))} (or pnpm install, yarn, etc)`);
|
||||
console.log(` ${i++}: ${bold(cyan('git init && git add -A && git commit -m "Initial commit"'))} (optional step)`);
|
||||
console.log(` ${i++}: ${bold(cyan('npm start'))} (or pnpm, yarn, etc)`);
|
||||
|
||||
console.log(`\nTo close the dev server, hit ${bold(cyan('Ctrl-C'))}`);
|
||||
console.log('\nStuck? Visit us at https://astro.build/chat\n');
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
import 'source-map-support/register.js';
|
||||
import React from 'react';
|
||||
import App from './components/App';
|
||||
import Version from './components/Version';
|
||||
import Exit from './components/Exit';
|
||||
import { render } from 'ink';
|
||||
import { getTemplates, addProcessListeners } from './utils';
|
||||
import { args as argsConfig } from './config';
|
||||
import arg from 'arg';
|
||||
import Help from './components/Help';
|
||||
|
||||
/** main `create-astro` CLI */
|
||||
export default async function createAstro() {
|
||||
const args = arg(argsConfig);
|
||||
const projectName = args._[0];
|
||||
if (args['--version']) {
|
||||
return render(<Version />);
|
||||
}
|
||||
const templates = await getTemplates();
|
||||
if (args['--help']) {
|
||||
return render(<Help context={{ templates }} />);
|
||||
}
|
||||
|
||||
const pkgManager = /yarn/.test(process.env.npm_execpath) ? 'yarn' : 'npm';
|
||||
const use = (args['--use'] ?? pkgManager) as 'npm' | 'yarn';
|
||||
const template = args['--template'];
|
||||
const force = args['--force'];
|
||||
const skipInstall = args['--skip-install'];
|
||||
|
||||
const app = render(<App context={{ projectName, template, templates, force, skipInstall, use }} />);
|
||||
|
||||
const onError = () => {
|
||||
if (app) app.clear();
|
||||
render(<Exit didError />);
|
||||
};
|
||||
const onExit = () => {
|
||||
if (app) app.clear();
|
||||
render(<Exit />);
|
||||
};
|
||||
addProcessListeners([
|
||||
['uncaughtException', onError],
|
||||
['exit', onExit],
|
||||
['SIGINT', onExit],
|
||||
['SIGTERM', onExit],
|
||||
]);
|
||||
}
|
16
packages/create-astro/src/templates.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
export const TEMPLATES = [,
|
||||
{
|
||||
title: 'Starter Kit (Generic)',
|
||||
value: 'starter'
|
||||
}, {
|
||||
title: 'Blog',
|
||||
value: 'blog'
|
||||
},
|
||||
{
|
||||
title: 'Documentation',
|
||||
value: 'docs'
|
||||
},
|
||||
{
|
||||
title: 'Portfolio',
|
||||
value: 'portfolio'
|
||||
}];
|
|
@ -1,47 +0,0 @@
|
|||
# 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
|
||||
|
||||
## 🚀 Project Structure
|
||||
|
||||
Inside of your Astro project, you'll see the following folders and files:
|
||||
|
||||
```
|
||||
/
|
||||
├── public/
|
||||
│ ├── robots.txt
|
||||
│ └── favicon.ico
|
||||
├── src/
|
||||
│ ├── components/
|
||||
│ │ └── Tour.astro
|
||||
│ └── pages/
|
||||
│ └── index.astro
|
||||
└── package.json
|
||||
```
|
||||
|
||||
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
|
||||
|
||||
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
|
||||
|
||||
Any static assets, like images, can be placed in the `public/` directory.
|
||||
|
||||
## 🧞 Commands
|
||||
|
||||
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?
|
||||
|
||||
Feel free to check [our documentation](https://github.com/snowpackjs/astro) or jump into our [Discord server](https://discord.gg/EsGdSGen).
|
|
@ -1,14 +0,0 @@
|
|||
export default {
|
||||
// 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: {
|
||||
site: 'http://example.com', // 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'
|
||||
},
|
||||
};
|
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 28 KiB |
|
@ -1,25 +0,0 @@
|
|||
body {
|
||||
font-family: 'Spectral', serif;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
p {
|
||||
line-height: 2;
|
||||
}
|
||||
|
||||
a {
|
||||
color: crimson;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
max-width: 60rem;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding-left: 2rem;
|
||||
padding-right: 2rem;
|
||||
}
|
Before Width: | Height: | Size: 150 KiB |
Before Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 164 KiB |
|
@ -1,39 +0,0 @@
|
|||
---
|
||||
// props
|
||||
export let title: string;
|
||||
export let description: string;
|
||||
export let image: string | undefined;
|
||||
export let type: string | undefined;
|
||||
export let next: string | undefined;
|
||||
export let prev: string | undefined;
|
||||
export let canonicalURL: string | undefined;
|
||||
---
|
||||
|
||||
<!-- Common -->
|
||||
<meta charset="UTF-8">
|
||||
<title>{title}</title>
|
||||
<meta name="description" content={description}>
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/global.css">
|
||||
<!-- Sitemap -->
|
||||
<link rel="sitemap" href="/sitemap.xml">
|
||||
<!-- RSS -->
|
||||
<link rel="alternate" type="application/rss+xml" href="/feed/posts.xml">
|
||||
|
||||
<!-- SEO -->
|
||||
<link rel="canonical" href={canonicalURL}>
|
||||
{next && <link rel="next" href={new URL(next, canonicalURL).href}>}
|
||||
{prev && <link rel="prev" href={new URL(prev, canonicalURL).href}>}
|
||||
|
||||
<!-- OpenGraph -->
|
||||
<meta property="og:title" content={title}>
|
||||
<meta property="og:description" content={description}>
|
||||
{image && (<meta property="og:image" content={new URL(image, canonicalURL)}>)}
|
||||
|
||||
<!-- Twitter -->
|
||||
<meta name="twitter:card" content={image ? 'summary_large_image' : 'summary'}>
|
||||
<meta name="twitter:site" content="@astro">
|
||||
<meta name="twitter:title" content={title}>
|
||||
<meta name="twitter:description" content={description}>
|
||||
{image && (<meta name="twitter:image" content={image}>)}
|
|
@ -1,59 +0,0 @@
|
|||
---
|
||||
export let title;
|
||||
---
|
||||
|
||||
<style lang="scss">
|
||||
.header {
|
||||
text-align: center;
|
||||
|
||||
@media (min-width: 600px) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0;
|
||||
font-size: 1.2em;
|
||||
letter-spacing: -0.03em;
|
||||
font-weight: 400;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.nav {
|
||||
text-align: center;
|
||||
|
||||
@media (min-width: 600px) {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
display: block;
|
||||
font-size: 1.2em;
|
||||
letter-spacing: -0.02em;
|
||||
margin-left: 0.75em;
|
||||
margin-right: 0.75em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<nav class="header">
|
||||
<h1 class="title">Don’s Blog</h1>
|
||||
<ul class="nav">
|
||||
<li><a href="/posts">All Posts</a></li>
|
||||
<li><a href="/author/don">Author: Don</a></li>
|
||||
<li><a href="/author/sancho">Author: Sancho</a></li>
|
||||
<li><a href="/about">About</a></li>
|
||||
</ul>
|
||||
</nav>
|
|
@ -1,40 +0,0 @@
|
|||
---
|
||||
export let prevUrl: string;
|
||||
export let nextUrl: string;
|
||||
---
|
||||
|
||||
<style lang="scss">
|
||||
.nav {
|
||||
display: flex;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
padding-top: 4rem;
|
||||
padding-bottom: 4rem;
|
||||
}
|
||||
|
||||
.prev,
|
||||
.next {
|
||||
display: block;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.8em;
|
||||
|
||||
&[href="#"] {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.prev {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.next {
|
||||
margin-left: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="wrapper">
|
||||
<nav class="nav">
|
||||
<a class="prev" href={prevUrl || '#'}>Prev</a>
|
||||
<a class="next" href={nextUrl || '#'}>Next</a>
|
||||
</nav>
|
||||
</div>
|
|
@ -1,63 +0,0 @@
|
|||
---
|
||||
export let post;
|
||||
export let author;
|
||||
|
||||
function formatDate(date) {
|
||||
return new Date(date).toUTCString().replace(/(\d\d\d\d) .*/, '$1'); // remove everything after YYYY
|
||||
}
|
||||
---
|
||||
|
||||
<style lang="scss">
|
||||
.post {
|
||||
padding-top: 6rem;
|
||||
padding-bottom: 6rem;
|
||||
border-bottom: 1px solid rgba(black, 0.25);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.author {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.date {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.description {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
.link {
|
||||
text-transform: uppercase;
|
||||
font-size: 0.8em;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-weight: 700;
|
||||
font-size: 2.75em;
|
||||
line-height: 1;
|
||||
letter-spacing: -0.04em;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
time {
|
||||
display: block;
|
||||
margin-top: 0.25rem;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<article class="post">
|
||||
|
||||
<div class="data">
|
||||
<h1>{post.title}</h1>
|
||||
<a class="author" href={`/author/${post.author}`}>{author.name}</a>
|
||||
<time class="date" datetime={post.date}>{formatDate(post.date)}</time>
|
||||
<p class="description">
|
||||
{post.description}
|
||||
<a class="link" href={post.url}>Read</a>
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"don": {
|
||||
"name": "Don Quixote",
|
||||
"image": "/authors/don.jpg"
|
||||
},
|
||||
"sancho": {
|
||||
"name": "Sancho Panza",
|
||||
"image": "/authors/sancho.jpg"
|
||||
}
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
---
|
||||
import MainHead from '../components/MainHead.astro';
|
||||
import Nav from '../components/Nav.astro';
|
||||
|
||||
export let content;
|
||||
|
||||
import authorData from '../data/authors.json';
|
||||
---
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>{content.title}</title>
|
||||
<MainHead title={content.title} description={content.description} image={content.image} canonicalURL={Astro.request.canonicalURL} />
|
||||
<style lang="scss">
|
||||
.title {
|
||||
margin-top: 4rem;
|
||||
margin-bottom: 4rem;
|
||||
font-size: 3em;
|
||||
letter-spacing: -0.04em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.description {
|
||||
margin-bottom: 4rem;
|
||||
font-size: 1.4em;
|
||||
font-weight: 400;
|
||||
text-align: justify;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.article {
|
||||
margin-top: 4rem;
|
||||
margin-bottom: 6rem;
|
||||
|
||||
:global(p) {
|
||||
font-size: 1.3em;
|
||||
line-height: 2;
|
||||
margin-top: 2em;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
}
|
||||
|
||||
.posts {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 6rem;
|
||||
padding-bottom: 6rem;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<Nav />
|
||||
|
||||
<main class="wrapper">
|
||||
<h1 class="title">{content.title}</h1>
|
||||
<h3 class="description">{content.description}</h3>
|
||||
<img class="img" src={content.image} alt={content.title}>
|
||||
<article class="article">
|
||||
<slot />
|
||||
</article>
|
||||
<footer class="footer">
|
||||
<a class="posts" href="/posts">All Posts</a>
|
||||
</footer>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
|
@ -1,108 +0,0 @@
|
|||
---
|
||||
import MainHead from '../components/MainHead.astro';
|
||||
import Nav from '../components/Nav.astro';
|
||||
import PostPreview from '../components/PostPreview.astro';
|
||||
import Pagination from '../components/Pagination.astro';
|
||||
|
||||
// page
|
||||
let title = 'Don’s Blog';
|
||||
let description = 'An example blog on Astro';
|
||||
let canonicalURL = Astro.request.canonicalURL;
|
||||
const author = authorData[collection.params.author];
|
||||
|
||||
// collection
|
||||
import authorData from '../data/authors.json';
|
||||
export let collection: any;
|
||||
export async function createCollection() {
|
||||
/** Load posts */
|
||||
let allPosts = Astro.fetchContent('./post/*.md');
|
||||
let allAuthors = new Set();
|
||||
|
||||
/** Loop through all posts, gather all authors */
|
||||
let routes = [];
|
||||
for (const post of allPosts) {
|
||||
if (!allAuthors.has(post.author)) {
|
||||
allAuthors.add(post.author);
|
||||
routes.push({ author: post.author });
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
/** Sort posts newest -> oldest, filter by params.author */
|
||||
async data({ params }) {
|
||||
allPosts.sort((a, b) => new Date(b.date) - new Date(a.date));
|
||||
return allPosts.filter((post) => post.author === params.author);
|
||||
},
|
||||
/** Set page size */
|
||||
pageSize: 3,
|
||||
/** Set permalink URL */
|
||||
permalink: ({ params }) => `/author/${params.author}`,
|
||||
/** Pass back all routes so Astro can generate the static build */
|
||||
routes,
|
||||
};
|
||||
}
|
||||
---
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>{title}</title>
|
||||
<MainHead
|
||||
title={title}
|
||||
description={description}
|
||||
image={collection.data[0].image}
|
||||
canonicalURL={canonicalURL}
|
||||
prev={collection.url.prev}
|
||||
next={collection.url.next}
|
||||
/>
|
||||
|
||||
<style lang="scss">
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 3em;
|
||||
letter-spacing: -0.04em;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
margin-right: 0.5em;
|
||||
border-radius: 50%;
|
||||
overflow:hidden;
|
||||
|
||||
&-img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.count {
|
||||
font-size: 1em;
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<Nav title={title} />
|
||||
|
||||
<main class="wrapper">
|
||||
<h1 class="title">
|
||||
<div class="avatar"><img class="avatar-img" src={author.image} alt={author.name}></div>
|
||||
{author.name}
|
||||
</h1>
|
||||
<small class="count">{collection.start + 1}–{collection.end + 1} of {collection.total}</small>
|
||||
{collection.data.map((post) => <PostPreview post={post} author={author} />)}
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<Pagination prevUrl={collection.url.prev} nextUrl={collection.url.next} />
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
|
@ -1,83 +0,0 @@
|
|||
---
|
||||
import MainHead from '../components/MainHead.astro';
|
||||
import Nav from '../components/Nav.astro';
|
||||
import PostPreview from '../components/PostPreview.astro';
|
||||
import Pagination from '../components/Pagination.astro';
|
||||
|
||||
// page
|
||||
let title = 'Don’s Blog';
|
||||
let description = 'An example blog on Astro';
|
||||
let canonicalURL = Astro.request.canonicalURL;
|
||||
|
||||
// collection
|
||||
import authorData from '../data/authors.json';
|
||||
export let collection: any;
|
||||
export async function createCollection() {
|
||||
return {
|
||||
/** Load posts, sort newest -> oldest */
|
||||
async data() {
|
||||
let allPosts = Astro.fetchContent('./post/*.md');
|
||||
allPosts.sort((a, b) => new Date(b.date) - new Date(a.date));
|
||||
return allPosts;
|
||||
},
|
||||
/** Set page size */
|
||||
pageSize: 2,
|
||||
/** Generate RSS feed (only for main /posts/ feed) */
|
||||
rss: {
|
||||
title: 'Don’s Blog',
|
||||
description: 'An example blog on Astro',
|
||||
customData: `<language>en-us</language>`,
|
||||
item: (item) => ({
|
||||
title: item.title,
|
||||
description: item.description,
|
||||
link: item.url,
|
||||
pubDate: item.date,
|
||||
}),
|
||||
}
|
||||
};
|
||||
}
|
||||
---
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>{title}</title>
|
||||
<MainHead
|
||||
title={title}
|
||||
description={description}
|
||||
image={collection.data[0].image}
|
||||
canonicalURL={canonicalURL}
|
||||
prev={collection.url.prev}
|
||||
next={collection.url.next}
|
||||
/>
|
||||
|
||||
<style lang="scss">
|
||||
.title {
|
||||
font-size: 3em;
|
||||
letter-spacing: -0.04em;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.count {
|
||||
font-size: 1em;
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<Nav title={title} />
|
||||
|
||||
<main class="wrapper">
|
||||
<h1 class="title">All Posts</h1>
|
||||
<small class="count">{collection.start + 1}–{collection.end + 1} of {collection.total}</small>
|
||||
{collection.data.map((post) => <PostPreview post={post} author={authorData[post.author]} />)}
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<Pagination prevUrl={collection.url.prev} nextUrl={collection.url.next} />
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
|
@ -1,61 +0,0 @@
|
|||
---
|
||||
import MainHead from '../components/MainHead.astro';
|
||||
import Nav from '../components/Nav.astro';
|
||||
|
||||
let title = "About";
|
||||
---
|
||||
<html>
|
||||
<head>
|
||||
<MainHead
|
||||
title={title}
|
||||
canonicalURL={Astro.request.canonicalURL}
|
||||
/>
|
||||
<style lang="scss">
|
||||
|
||||
.text {
|
||||
padding-bottom: 6rem;
|
||||
|
||||
p {
|
||||
font-size: 1.2em;
|
||||
line-height: 2;
|
||||
margin-top: 2em;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
}
|
||||
|
||||
.hero {
|
||||
display: block;
|
||||
height: 16rem;
|
||||
overflow: hidden;
|
||||
margin: 4rem 0;
|
||||
|
||||
&-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 3em;
|
||||
letter-spacing: -0.04em;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 0;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<Nav title={title} />
|
||||
|
||||
<main class="wrapper">
|
||||
<h1 class="title">{title}</h1>
|
||||
<figure class="hero"><img class="hero-img" src="/images/chapter-01.jpg"></figure>
|
||||
<div class="text">
|
||||
<p>The book cover and spine above and the images which follow were not part of the original Ormsby translation—they are taken from the 1880 edition of J. W. Clark, illustrated by Gustave Doré. Clark in his edition states that, “The English text of ‘Don Quixote’ adopted in this edition is that of Jarvis, with occasional corrections from Motteaux.”</p>
|
||||
<p>See in the introduction below John Ormsby’s critique of both the Jarvis and Motteaux translations. It has been elected in the present Project Gutenberg edition to attach the famous engravings of Gustave Doré to the Ormsby translation instead of the Jarvis/Motteaux. The detail of many of the Doré engravings can be fully appreciated only by utilizing the “Full Size” button to expand them to their original dimensions. Ormsby in his Preface has criticized the fanciful nature of Doré’s illustrations; others feel these woodcuts and steel engravings well match Quixote’s dreams.</p>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,43 +0,0 @@
|
|||
---
|
||||
import MainHead from '../components/MainHead.astro';
|
||||
import Nav from '../components/Nav.astro';
|
||||
import PostPreview from '../components/PostPreview.astro';
|
||||
import Pagination from '../components/Pagination.astro';
|
||||
|
||||
// page
|
||||
let title = 'Don’s Blog';
|
||||
let description = 'An example blog on Astro';
|
||||
|
||||
// collection
|
||||
// note: we want to show first 3 posts here, but we don’t want to paginate at /1, /2, /3, etc.
|
||||
// so we show a preview of posts here, but actually paginate from $posts.astro
|
||||
import authorData from '../data/authors.json';
|
||||
|
||||
let allPosts = Astro.fetchContent('./post/*.md');
|
||||
allPosts.sort((a, b) => new Date(b.date) - new Date(a.date));
|
||||
let firstPage = allPosts.slice(0, 2);
|
||||
---
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>{title}</title>
|
||||
<MainHead
|
||||
title={title}
|
||||
description={description}
|
||||
image={firstPage[0].image}
|
||||
canonicalURL={Astro.request.canonicalURL.href}
|
||||
/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<Nav />
|
||||
|
||||
<main class="wrapper">
|
||||
{firstPage.map((post) => <PostPreview post={post} author={authorData[post.author]} />)}
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<Pagination nextUrl="/posts/2" />
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
layout: ../../layouts/post.astro
|
||||
title: Chapter I
|
||||
tag: movie
|
||||
date: 2021-05-17
|
||||
image: /images/chapter-01.jpg
|
||||
author: don
|
||||
description: Which Treats of the Character and Pursuits of the Famous Gentleman Don Quixote of La Mancha
|
||||
---
|
||||
|
||||
In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing. An olla of rather more beef than mutton, a salad on most nights, scraps on Saturdays, lentils on Fridays, and a pigeon or so extra on Sundays, made away with three-quarters of his income. The rest of it went in a doublet of fine cloth and velvet breeches and shoes to match for holidays, while on week-days he made a brave figure in his best homespun. He had in his house a housekeeper past forty, a niece under twenty, and a lad for the field and market-place, who used to saddle the hack as well as handle the bill-hook. The age of this gentleman of ours was bordering on fifty; he was of a hardy habit, spare, gaunt-featured, a very early riser and a great sportsman. They will have it his surname was Quixada or Quesada (for here there is some difference of opinion among the authors who write on the subject), although from reasonable conjectures it seems plain that he was called Quexana. This, however, is of but little importance to our tale; it will be enough not to stray a hair’s breadth from the truth in the telling of it.
|
||||
|
||||
You must know, then, that the above-named gentleman whenever he was at leisure (which was mostly all the year round) gave himself up to reading books of chivalry with such ardour and avidity that he almost entirely neglected the pursuit of his field-sports, and even the management of his property; and to such a pitch did his eagerness and infatuation go that he sold many an acre of tillageland to buy books of chivalry to read, and brought home as many of them as he could get. But of all there were none he liked so well as those of the famous Feliciano de Silva’s composition, for their lucidity of style and complicated conceits were as pearls in his sight, particularly when in his reading he came upon courtships and cartels, where he often found passages like “the reason of the unreason with which my reason is afflicted so weakens my reason that with reason I murmur at your beauty;” or again, “the high heavens, that of your divinity divinely fortify you with the stars, render you deserving of the desert your greatness deserves.” Over conceits of this sort the poor gentleman lost his wits, and used to lie awake striving to understand them and worm the meaning out of them; what Aristotle himself could not have made out or extracted had he come to life again for that special purpose. He was not at all easy about the wounds which Don Belianis gave and took, because it seemed to him that, great as were the surgeons who had cured him, he must have had his face and body covered all over with seams and scars. He commended, however, the author’s way of ending his book with the promise of that interminable adventure, and many a time was he tempted to take up his pen and finish it properly as is there proposed, which no doubt he would have done, and made a successful piece of work of it too, had not greater and more absorbing thoughts prevented him.
|
|
@ -1,15 +0,0 @@
|
|||
---
|
||||
layout: ../../layouts/post.astro
|
||||
title: Chapter II
|
||||
tag: movie
|
||||
date: 2021-05-18
|
||||
image: /images/chapter-02.jpg
|
||||
author: sancho
|
||||
description: Which Treats of the First Sally the Ingenious Don Quixote Made From Home
|
||||
---
|
||||
|
||||
These preliminaries settled, he did not care to put off any longer the execution of his design, urged on to it by the thought of all the world was losing by his delay, seeing what wrongs he intended to right, grievances to redress, injustices to repair, abuses to remove, and duties to discharge. So, without giving notice of his intention to anyone, and without anybody seeing him, one morning before the dawning of the day (which was one of the hottest of the month of July) he donned his suit of armour, mounted Rocinante with his patched-up helmet on, braced his buckler, took his lance, and by the back door of the yard sallied forth upon the plain in the highest contentment and satisfaction at seeing with what ease he had made a beginning with his grand purpose. But scarcely did he find himself upon the open plain, when a terrible thought struck him, one all but enough to make him abandon the enterprise at the very outset. It occurred to him that he had not been dubbed a knight, and that according to the law of chivalry he neither could nor ought to bear arms against any knight; and that even if he had been, still he ought, as a novice knight, to wear white armour, without a device upon the shield until by his prowess he had earned one. These reflections made him waver in his purpose, but his craze being stronger than any reasoning, he made up his mind to have himself dubbed a knight by the first one he came across, following the example of others in the same case, as he had read in the books that brought him to this pass. As for white armour, he resolved, on the first opportunity, to scour his until it was whiter than an ermine; and so comforting himself he pursued his way, taking that which his horse chose, for in this he believed lay the essence of adventures.
|
||||
|
||||
Thus setting out, our new-fledged adventurer paced along, talking to himself and saying, “Who knows but that in time to come, when the veracious history of my famous deeds is made known, the sage who writes it, when he has to set forth my first sally in the early morning, will do it after this fashion? ‘Scarce had the rubicund Apollo spread o’er the face of the broad spacious earth the golden threads of his bright hair, scarce had the little birds of painted plumage attuned their notes to hail with dulcet and mellifluous harmony the coming of the rosy Dawn, that, deserting the soft couch of her jealous spouse, was appearing to mortals at the gates and balconies of the Manchegan horizon, when the renowned knight Don Quixote of La Mancha, quitting the lazy down, mounted his celebrated steed Rocinante and began to traverse the ancient and famous Campo de Montiel;’” which in fact he was actually traversing. “Happy the age, happy the time,” he continued, “in which shall be made known my deeds of fame, worthy to be moulded in brass, carved in marble, limned in pictures, for a memorial for ever. And thou, O sage magician, whoever thou art, to whom it shall fall to be the chronicler of this wondrous history, forget not, I entreat thee, my good Rocinante, the constant companion of my ways and wanderings.” Presently he broke out again, as if he were love-stricken in earnest, “O Princess Dulcinea, lady of this captive heart, a grievous wrong hast thou done me to drive me forth with scorn, and with inexorable obduracy banish me from the presence of thy beauty. O lady, deign to hold in remembrance this heart, thy vassal, that thus in anguish pines for love of thee.”
|
||||
|
||||
So he went on stringing together these and other absurdities, all in the style of those his books had taught him, imitating their language as well as he could; and all the while he rode so slowly and the sun mounted so rapidly and with such fervour that it was enough to melt his brains if he had any. Nearly all day he travelled without anything remarkable happening to him, at which he was in despair, for he was anxious to encounter someone at once upon whom to try the might of his strong arm.
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
layout: ../../layouts/post.astro
|
||||
title: Chapter III
|
||||
tag: movie
|
||||
date: 2021-05-19
|
||||
image: /images/chapter-03.jpg
|
||||
author: don
|
||||
description: Wheren is Related the Droll Way in which Don Quixote Had Himself Dubbed a Knight
|
||||
---
|
||||
|
||||
Harassed by this reflection, he made haste with his scanty pothouse supper, and having finished it called the landlord, and shutting himself into the stable with him, fell on his knees before him, saying, “From this spot I rise not, valiant knight, until your courtesy grants me the boon I seek, one that will redound to your praise and the benefit of the human race.” The landlord, seeing his guest at his feet and hearing a speech of this kind, stood staring at him in bewilderment, not knowing what to do or say, and entreating him to rise, but all to no purpose until he had agreed to grant the boon demanded of him. “I looked for no less, my lord, from your High Magnificence,” replied Don Quixote, “and I have to tell you that the boon I have asked and your liberality has granted is that you shall dub me knight to-morrow morning, and that to-night I shall watch my arms in the chapel of this your castle; thus to-morrow, as I have said, will be accomplished what I so much desire, enabling me lawfully to roam through all the four quarters of the world seeking adventures on behalf of those in distress, as is the duty of chivalry and of knights-errant like myself, whose ambition is directed to such deeds.”
|
||||
|
||||
The landlord, who, as has been mentioned, was something of a wag, and had already some suspicion of his guest’s want of wits, was quite convinced of it on hearing talk of this kind from him, and to make sport for the night he determined to fall in with his humour. So he told him he was quite right in pursuing the object he had in view, and that such a motive was natural and becoming in cavaliers as distinguished as he seemed and his gallant bearing showed him to be; and that he himself in his younger days had followed the same honourable calling, roaming in quest of adventures in various parts of the world, among others the Curing-grounds of Malaga, the Isles of Riaran, the Precinct of Seville, the Little Market of Segovia, the Olivera of Valencia, the Rondilla of Granada, the Strand of San Lucar, the Colt of Cordova, the Taverns of Toledo, and divers other quarters, where he had proved the nimbleness of his feet and the lightness of his fingers, doing many wrongs, cheating many widows, ruining maids and swindling minors, and, in short, bringing himself under the notice of almost every tribunal and court of justice in Spain; until at last he had retired to this castle of his, where he was living upon his property and upon that of others; and where he received all knights-errant of whatever rank or condition they might be, all for the great love he bore them and that they might share their substance with him in return for his benevolence. He told him, moreover, that in this castle of his there was no chapel in which he could watch his armour, as it had been pulled down in order to be rebuilt, but that in a case of necessity it might, he knew, be watched anywhere, and he might watch it that night in a courtyard of the castle, and in the morning, God willing, the requisite ceremonies might be performed so as to have him dubbed a knight, and so thoroughly dubbed that nobody could be more so. He asked if he had any money with him, to which Don Quixote replied that he had not a farthing, as in the histories of knights-errant he had never read of any of them carrying any. On this point the landlord told him he was mistaken; for, though not recorded in the histories, because in the author’s opinion there was no need to mention anything so obvious and necessary as money and clean shirts, it was not to be supposed therefore that they did not carry them, and he might regard it as certain and established that all knights-errant (about whom there were so many full and unimpeachable books) carried well-furnished purses in case of emergency, and likewise carried shirts and a little box of ointment to cure the wounds they received. For in those plains and deserts where they engaged in combat and came out wounded, it was not always that there was someone to cure them, unless indeed they had for a friend some sage magician to succour them at once by fetching through the air upon a cloud some damsel or dwarf with a vial of water of such virtue that by tasting one drop of it they were cured of their hurts and wounds in an instant and left as sound as if they had not received any damage whatever. But in case this should not occur, the knights of old took care to see that their squires were provided with money and other requisites, such as lint and ointments for healing purposes; and when it happened that knights had no squires (which was rarely and seldom the case) they themselves carried everything in cunning saddle-bags that were hardly seen on the horse’s croup, as if it were something else of more importance, because, unless for some such reason, carrying saddle-bags was not very favourably regarded among knights-errant. He therefore advised him (and, as his godson so soon to be, he might even command him) never from that time forth to travel without money and the usual requirements, and he would find the advantage of them when he least expected it.
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"name": "TODO",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"start": "astro dev",
|
||||
"build": "astro build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "latest"
|
||||
}
|
||||
}
|
|
@ -1,148 +0,0 @@
|
|||
import { ChildProcess, spawn } from 'child_process';
|
||||
import { promises as fs, readdirSync, existsSync, lstatSync, rmdirSync, unlinkSync } from 'fs';
|
||||
import { basename, resolve } from 'path';
|
||||
import { fileURLToPath, URL } from 'url';
|
||||
import decompress from 'decompress';
|
||||
|
||||
const listeners = new Map();
|
||||
|
||||
export async function addProcessListeners(handlers: [NodeJS.Signals | string, NodeJS.SignalsListener][]) {
|
||||
for (const [event, handler] of handlers) {
|
||||
listeners.set(event, handler);
|
||||
process.once(event as NodeJS.Signals, handler);
|
||||
}
|
||||
}
|
||||
|
||||
export async function cancelProcessListeners() {
|
||||
for (const [event, handler] of listeners.entries()) {
|
||||
process.off(event, handler);
|
||||
listeners.delete(event);
|
||||
}
|
||||
}
|
||||
|
||||
export async function getTemplates() {
|
||||
const templatesRoot = fileURLToPath(new URL('./templates', import.meta.url));
|
||||
const templateFiles = await fs.readdir(templatesRoot, 'utf8');
|
||||
const templates = templateFiles.filter((t) => t.endsWith('.tgz'));
|
||||
const metafile = templateFiles.find((t) => t.endsWith('meta.json'));
|
||||
|
||||
const meta = await fs.readFile(resolve(templatesRoot, metafile)).then((r) => JSON.parse(r.toString()));
|
||||
|
||||
return templates
|
||||
.map((template) => {
|
||||
const value = basename(template, '.tgz');
|
||||
if (meta[value]) return { ...meta[value], value };
|
||||
return { value };
|
||||
})
|
||||
.sort((a, b) => {
|
||||
const aRank = a.rank ?? 0;
|
||||
const bRank = b.rank ?? 0;
|
||||
if (aRank > bRank) return -1;
|
||||
if (bRank > aRank) return 1;
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
const childrenProcesses: ChildProcess[] = [];
|
||||
export let isDone = false;
|
||||
|
||||
export async function rewriteFiles(projectName: string) {
|
||||
const dest = resolve(projectName);
|
||||
const tasks = [];
|
||||
tasks.push(fs.rename(resolve(dest, '_gitignore'), resolve(dest, '.gitignore')));
|
||||
tasks.push(
|
||||
fs
|
||||
.readFile(resolve(dest, 'package.json'))
|
||||
.then((res) => JSON.parse(res.toString()))
|
||||
.then((json) => JSON.stringify({ ...json, name: getValidPackageName(projectName) }, null, 2))
|
||||
.then((res) => fs.writeFile(resolve(dest, 'package.json'), res))
|
||||
);
|
||||
|
||||
return Promise.all(tasks);
|
||||
}
|
||||
|
||||
export async function prepareTemplate(options: { use: 'npm' | 'yarn'; templateName: string; projectName: string; skipInstall?: boolean }) {
|
||||
const { use, templateName, projectName, skipInstall } = options;
|
||||
const dest = resolve(projectName);
|
||||
const template = fileURLToPath(new URL(`./templates/${templateName}.tgz`, import.meta.url));
|
||||
await decompress(template, dest);
|
||||
await rewriteFiles(projectName);
|
||||
if (!skipInstall) {
|
||||
await run(use, use === 'npm' ? 'i' : null, dest).catch(() => cleanup(true));
|
||||
}
|
||||
isDone = true;
|
||||
return;
|
||||
}
|
||||
|
||||
export function cleanup(didError = false) {
|
||||
killChildren();
|
||||
setTimeout(() => {
|
||||
process.exit(didError ? 1 : 0);
|
||||
}, 200);
|
||||
}
|
||||
|
||||
export function killChildren() {
|
||||
childrenProcesses.forEach((p) => p.kill('SIGINT'));
|
||||
}
|
||||
|
||||
export function run(pkgManager: 'npm' | 'yarn', command: string, projectPath: string, stdio: any = 'ignore'): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const p = spawn(pkgManager, command ? [command] : [], {
|
||||
shell: true,
|
||||
stdio,
|
||||
cwd: projectPath,
|
||||
});
|
||||
p.once('exit', () => resolve());
|
||||
p.once('error', reject);
|
||||
childrenProcesses.push(p);
|
||||
});
|
||||
}
|
||||
|
||||
export function isWin() {
|
||||
return process.platform === 'win32';
|
||||
}
|
||||
|
||||
export function isEmpty(path) {
|
||||
try {
|
||||
const files = readdirSync(resolve(path));
|
||||
if (files.length > 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.code !== 'ENOENT') throw err;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function emptyDir(dir) {
|
||||
dir = resolve(dir);
|
||||
if (!existsSync(dir)) {
|
||||
return;
|
||||
}
|
||||
for (const file of readdirSync(dir)) {
|
||||
const abs = resolve(dir, file);
|
||||
if (lstatSync(abs).isDirectory()) {
|
||||
emptyDir(abs);
|
||||
rmdirSync(abs);
|
||||
} else {
|
||||
unlinkSync(abs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getValidPackageName(projectName: string) {
|
||||
const packageNameRegExp = /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
|
||||
|
||||
if (packageNameRegExp.test(projectName)) {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
return projectName
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/\s+/g, '-')
|
||||
.replace(/^[._]/, '')
|
||||
.replace(/[^a-z0-9-~]+/g, '-');
|
||||
}
|
|
@ -5,36 +5,40 @@ import { suite } from 'uvu';
|
|||
import execa from 'execa';
|
||||
import del from 'del';
|
||||
import * as assert from 'uvu/assert';
|
||||
import {TEMPLATES} from '../dist/templates.js';
|
||||
|
||||
const CreateAstro = suite('npm init astro');
|
||||
|
||||
const cwd = fileURLToPath(path.dirname(import.meta.url));
|
||||
const templates = fs.readdirSync(path.join(cwd, '..', 'src', 'templates'));
|
||||
const fixturesDir = path.join(cwd, 'fixtures');
|
||||
|
||||
CreateAstro.before(async () => {
|
||||
const fixturesDir = path.join(cwd, 'fixtures');
|
||||
await del(fixturesDir);
|
||||
await fs.promises.mkdir(fixturesDir);
|
||||
});
|
||||
|
||||
for (const template of templates) {
|
||||
CreateAstro(template, async () => {
|
||||
const { stdout } = await execa('../../create-astro.js', [`./${template}`, '--template', template, '--skip-install'], { cwd: path.join(cwd, 'fixtures') });
|
||||
for (const {value: template} of TEMPLATES) {
|
||||
// TODO: Unskip once repo is made public. Because the repo is private, the templates can't yet be downloaded.
|
||||
CreateAstro.skip(template, async () => {
|
||||
const testDirectory = path.join(fixturesDir, template);
|
||||
const { stdout } = await execa('../../create-astro.mjs', [testDirectory, '--template', template, '--force-overwrite'], { cwd: path.join(cwd, 'fixtures') });
|
||||
|
||||
console.log(stdout);
|
||||
// test: path should formatted as './{dirName}'
|
||||
assert.not.match(stdout, '././');
|
||||
|
||||
const DOES_HAVE = ['.gitignore', 'package.json', 'public', 'src'];
|
||||
const DOES_NOT_HAVE = ['_gitignore', 'meta.json', 'node_modules', 'yarn.lock'];
|
||||
const DOES_NOT_HAVE = ['meta.json', 'node_modules', 'yarn.lock'];
|
||||
|
||||
// test: template contains essential files & folders
|
||||
for (const file of DOES_HAVE) {
|
||||
assert.ok(fs.existsSync(path.join(cwd, template, file)), `has ${file}`);
|
||||
console.log(path.join(testDirectory, file));
|
||||
assert.ok(fs.existsSync(path.join(testDirectory, file)), `has ${file}`);
|
||||
}
|
||||
|
||||
// test: template DOES NOT contain files supposed to be stripped away
|
||||
for (const file of DOES_NOT_HAVE) {
|
||||
assert.not.ok(fs.existsSync(path.join(cwd, template, file)), `does not have ${file}`);
|
||||
assert.not.ok(fs.existsSync(path.join(testDirectory, file)), `does not have ${file}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
11
packages/create-astro/tsconfig.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"include": ["src", "index.d.ts"],
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"target": "ES2020",
|
||||
"module": "ES2020",
|
||||
"outDir": "./dist",
|
||||
"declarationDir": "./dist/types"
|
||||
}
|
||||
}
|
172
packages/create-astro/yarn.lock
Normal file
|
@ -0,0 +1,172 @@
|
|||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
at-least-node@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
|
||||
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
|
||||
|
||||
cross-spawn@^7.0.3:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
|
||||
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
|
||||
dependencies:
|
||||
path-key "^3.1.0"
|
||||
shebang-command "^2.0.0"
|
||||
which "^2.0.1"
|
||||
|
||||
degit@^2.8.4:
|
||||
version "2.8.4"
|
||||
resolved "https://registry.yarnpkg.com/degit/-/degit-2.8.4.tgz#3bb9c5c00f157c44724dd4a50724e4aa75a54d38"
|
||||
integrity sha512-vqYuzmSA5I50J882jd+AbAhQtgK6bdKUJIex1JNfEUPENCgYsxugzKVZlFyMwV4i06MmnV47/Iqi5Io86zf3Ng==
|
||||
|
||||
execa@^5.0.0:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd"
|
||||
integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==
|
||||
dependencies:
|
||||
cross-spawn "^7.0.3"
|
||||
get-stream "^6.0.0"
|
||||
human-signals "^2.1.0"
|
||||
is-stream "^2.0.0"
|
||||
merge-stream "^2.0.0"
|
||||
npm-run-path "^4.0.1"
|
||||
onetime "^5.1.2"
|
||||
signal-exit "^3.0.3"
|
||||
strip-final-newline "^2.0.0"
|
||||
|
||||
fs-extra@^9.0.0:
|
||||
version "9.1.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
|
||||
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
|
||||
dependencies:
|
||||
at-least-node "^1.0.0"
|
||||
graceful-fs "^4.2.0"
|
||||
jsonfile "^6.0.1"
|
||||
universalify "^2.0.0"
|
||||
|
||||
get-stream@^6.0.0:
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
|
||||
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==
|
||||
|
||||
graceful-fs@^4.1.6, graceful-fs@^4.2.0:
|
||||
version "4.2.6"
|
||||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee"
|
||||
integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==
|
||||
|
||||
human-signals@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0"
|
||||
integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==
|
||||
|
||||
is-stream@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3"
|
||||
integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==
|
||||
|
||||
isexe@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
||||
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
|
||||
|
||||
jsonfile@^6.0.1:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
|
||||
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
|
||||
dependencies:
|
||||
universalify "^2.0.0"
|
||||
optionalDependencies:
|
||||
graceful-fs "^4.1.6"
|
||||
|
||||
kleur@^3.0.3:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
|
||||
integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==
|
||||
|
||||
kleur@^4.1.1:
|
||||
version "4.1.4"
|
||||
resolved "https://registry.yarnpkg.com/kleur/-/kleur-4.1.4.tgz#8c202987d7e577766d039a8cd461934c01cda04d"
|
||||
integrity sha512-8QADVssbrFjivHWQU7KkMgptGTl6WAcSdlbBPY4uNF+mWr6DGcKrvY2w4FQJoXch7+fKMjj0dRrL75vk3k23OA==
|
||||
|
||||
merge-stream@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
|
||||
integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==
|
||||
|
||||
mimic-fn@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
|
||||
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
|
||||
|
||||
npm-run-path@^4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea"
|
||||
integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==
|
||||
dependencies:
|
||||
path-key "^3.0.0"
|
||||
|
||||
onetime@^5.1.2:
|
||||
version "5.1.2"
|
||||
resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e"
|
||||
integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==
|
||||
dependencies:
|
||||
mimic-fn "^2.1.0"
|
||||
|
||||
path-key@^3.0.0, path-key@^3.1.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
|
||||
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
|
||||
|
||||
prompts@^2.4.1:
|
||||
version "2.4.1"
|
||||
resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.1.tgz#befd3b1195ba052f9fd2fde8a486c4e82ee77f61"
|
||||
integrity sha512-EQyfIuO2hPDsX1L/blblV+H7I0knhgAd82cVneCwcdND9B8AuCDuRcBH6yIcG4dFzlOUqbazQqwGjx5xmsNLuQ==
|
||||
dependencies:
|
||||
kleur "^3.0.3"
|
||||
sisteransi "^1.0.5"
|
||||
|
||||
shebang-command@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
|
||||
integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
|
||||
dependencies:
|
||||
shebang-regex "^3.0.0"
|
||||
|
||||
shebang-regex@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
|
||||
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
|
||||
|
||||
signal-exit@^3.0.3:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
|
||||
integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
|
||||
|
||||
sisteransi@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
|
||||
integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==
|
||||
|
||||
strip-final-newline@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"
|
||||
integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==
|
||||
|
||||
universalify@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
|
||||
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==
|
||||
|
||||
which@^2.0.1:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
|
||||
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
|
||||
dependencies:
|
||||
isexe "^2.0.0"
|
||||
|
||||
yargs-parser@^20.0.0:
|
||||
version "20.2.7"
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.7.tgz#61df85c113edfb5a7a4e36eb8aa60ef423cbc90a"
|
||||
integrity sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==
|
37
yarn.lock
|
@ -1399,6 +1399,11 @@
|
|||
dependencies:
|
||||
"@types/babel-types" "*"
|
||||
|
||||
"@types/degit@^2.8.2":
|
||||
version "2.8.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/degit/-/degit-2.8.2.tgz#a5878ecf8914c1408b31f2efda284add6e7ea7ce"
|
||||
integrity sha512-wUOqW7nZ8AYgm4OKa9i/RD72CrU/X4Vfx2Oez/51qC3RMgPyF3ZUQVLFjV8McV6/ivR7lOlfidRFgGZj7MZe1A==
|
||||
|
||||
"@types/estree@0.0.39":
|
||||
version "0.0.39"
|
||||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
|
||||
|
@ -1478,6 +1483,13 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-5.0.3.tgz#e7b5aebbac150f8b5fdd4a46e7f0bd8e65e19109"
|
||||
integrity sha512-kUNnecmtkunAoQ3CnjmMkzNU/gtxG8guhi+Fk2U/kOpIKjIMKnXGp4IJCgQJrXSgMsWYimYG4TGjz/UzbGEBTw==
|
||||
|
||||
"@types/prompts@^2.0.12":
|
||||
version "2.0.12"
|
||||
resolved "https://registry.yarnpkg.com/@types/prompts/-/prompts-2.0.12.tgz#5cc1557f88e4d69dad93230fff97a583006f858b"
|
||||
integrity sha512-Hr6osqfNg3IcQT3pJDXCsSnb0KnldY/hXeJCKJriwbZLnedN9n1e8kcZwLc25GIWULDb6h5aEyOBbf33XpZBXQ==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/pug@^2.0.4":
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/pug/-/pug-2.0.4.tgz#8772fcd0418e3cd2cc171555d73007415051f4b2"
|
||||
|
@ -3279,6 +3291,11 @@ defined@^1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693"
|
||||
integrity sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=
|
||||
|
||||
degit@^2.8.4:
|
||||
version "2.8.4"
|
||||
resolved "https://registry.yarnpkg.com/degit/-/degit-2.8.4.tgz#3bb9c5c00f157c44724dd4a50724e4aa75a54d38"
|
||||
integrity sha512-vqYuzmSA5I50J882jd+AbAhQtgK6bdKUJIex1JNfEUPENCgYsxugzKVZlFyMwV4i06MmnV47/Iqi5Io86zf3Ng==
|
||||
|
||||
del@^2.2.0:
|
||||
version "2.2.2"
|
||||
resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8"
|
||||
|
@ -5678,7 +5695,12 @@ kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3:
|
|||
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
|
||||
integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==
|
||||
|
||||
kleur@^4.0.3, kleur@^4.1.4:
|
||||
kleur@^3.0.3:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
|
||||
integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==
|
||||
|
||||
kleur@^4.0.3, kleur@^4.1.1, kleur@^4.1.4:
|
||||
version "4.1.4"
|
||||
resolved "https://registry.yarnpkg.com/kleur/-/kleur-4.1.4.tgz#8c202987d7e577766d039a8cd461934c01cda04d"
|
||||
integrity sha512-8QADVssbrFjivHWQU7KkMgptGTl6WAcSdlbBPY4uNF+mWr6DGcKrvY2w4FQJoXch7+fKMjj0dRrL75vk3k23OA==
|
||||
|
@ -7824,6 +7846,14 @@ promise@^7.0.1:
|
|||
dependencies:
|
||||
asap "~2.0.3"
|
||||
|
||||
prompts@^2.4.1:
|
||||
version "2.4.1"
|
||||
resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.1.tgz#befd3b1195ba052f9fd2fde8a486c4e82ee77f61"
|
||||
integrity sha512-EQyfIuO2hPDsX1L/blblV+H7I0knhgAd82cVneCwcdND9B8AuCDuRcBH6yIcG4dFzlOUqbazQqwGjx5xmsNLuQ==
|
||||
dependencies:
|
||||
kleur "^3.0.3"
|
||||
sisteransi "^1.0.5"
|
||||
|
||||
promzard@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/promzard/-/promzard-0.3.0.tgz#26a5d6ee8c7dee4cb12208305acfb93ba382a9ee"
|
||||
|
@ -8853,6 +8883,11 @@ simple-swizzle@^0.2.2:
|
|||
dependencies:
|
||||
is-arrayish "^0.3.1"
|
||||
|
||||
sisteransi@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
|
||||
integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==
|
||||
|
||||
slash@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
|
||||
|
|