Minimal create-astro
CLI (#136)
* feat: add minimal create-astro CLI * docs: update readme
This commit is contained in:
parent
9c980a1017
commit
61ccd59f92
9 changed files with 516 additions and 64 deletions
|
@ -1,2 +1,3 @@
|
||||||
src/parser/parse/**/*.ts
|
src/parser/parse/**/*.ts
|
||||||
vscode/**/*.ts
|
vscode/**/*.ts
|
||||||
|
create-astro/**/*.js
|
||||||
|
|
90
README.md
90
README.md
|
@ -1,75 +1,54 @@
|
||||||
![Astro](./assets/social/banner.png)
|
![Astro](./assets/social/banner.png)
|
||||||
|
|
||||||
**Astro** is a next-generation static-site generator with partial hydration. Use your favorite JS framework and ship bare-minimum JS (or none at all!).
|
**Astro** is a _fresh but familiar_ approach to building websites. Astro combines decades of proven performance best practices with the DX improvements of the component-oriented era.
|
||||||
|
|
||||||
|
With Astro, you can use your favorite JavaScript framework and automatically ship the bare-minimum amount of JavaScript—by default, it's none at all!
|
||||||
|
|
||||||
## 🔧 Setup
|
## 🔧 Setup
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# currently hidden during private beta, please don't share :)
|
# currently "hidden" during private beta
|
||||||
npm install astro@shhhhh
|
npm init astro@shhhhh ./my-astro-project
|
||||||
|
|
||||||
# NOTE: There is currently a bug in Snowpack that prevents you
|
# then... cd => install => start
|
||||||
# from using astro outside of the monorepo setup that we have here.
|
cd ./my-astro-project
|
||||||
# For now, do all development inside the `examples/` directory for this repo.
|
npm install
|
||||||
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🧞 Development
|
### 🚀 Build & Deployment
|
||||||
|
|
||||||
Add a `dev` npm script to your `/package.json` file:
|
The default Astro project has the following `scripts` in the `/package.json` file:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "astro dev ."
|
"start": "astro dev .",
|
||||||
|
"build": "astro build ."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Then run:
|
For local development, run:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm run dev
|
npm run start
|
||||||
```
|
```
|
||||||
|
|
||||||
### ⚙️ Configuration
|
To build for production, run the following command:
|
||||||
|
|
||||||
To configure Astro, add a `astro.config.mjs` file in the root of your project. All settings are optional. Here are the defaults:
|
|
||||||
|
|
||||||
```js
|
|
||||||
export default {
|
|
||||||
/** Where to resolve all URLs relative to. Useful if you have a monorepo project. */
|
|
||||||
projectRoot: '.',
|
|
||||||
/** Path to Astro components, pages, and data */
|
|
||||||
astroRoot: './src',
|
|
||||||
/** When running `astro build`, path to final static output */
|
|
||||||
dist: './dist',
|
|
||||||
/** A folder of static files Astro will copy to the root. Useful for favicons, images, and other files that don’t need processing. */
|
|
||||||
public: './public',
|
|
||||||
/** Extension-specific handlings */
|
|
||||||
extensions: {
|
|
||||||
/** Set this to "preact" or "react" to determine what *.jsx files should load */
|
|
||||||
'.jsx': 'react',
|
|
||||||
},
|
|
||||||
/** Options specific to `astro build` */
|
|
||||||
buildOptions: {
|
|
||||||
/** Your public domain, e.g.: https://my-site.dev/. Used to generate sitemaps and canonical URLs. */
|
|
||||||
site: '',
|
|
||||||
/** Generate sitemap (set to "false" to disable) */
|
|
||||||
sitemap: true,
|
|
||||||
},
|
|
||||||
/** Options for the development server run with `astro dev`. */
|
|
||||||
devOptions: {
|
|
||||||
/** The port to run the dev server on. */
|
|
||||||
port: 3000,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
```
|
```
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
To deploy your Astro site to production, upload the contents of `/dist` to your favorite static site host.
|
||||||
|
|
||||||
|
|
||||||
## 🥾 Guides
|
## 🥾 Guides
|
||||||
|
|
||||||
### 🚀 Basic Usage
|
### 🚀 Basic Usage
|
||||||
|
|
||||||
Even though nearly-everything [is configurable][config], we recommend starting out by creating an `src/` folder in your project with the following structure:
|
Even though nearly-everything [is configurable][docs-config], we recommend starting out by creating an `src/` folder in your project with the following structure:
|
||||||
|
|
||||||
```
|
```
|
||||||
├── src/
|
├── src/
|
||||||
|
@ -166,7 +145,7 @@ const localData = Astro.fetchContent('../post/*.md');
|
||||||
|
|
||||||
### 🗺️ Sitemap
|
### 🗺️ Sitemap
|
||||||
|
|
||||||
Astro will automatically create a `/sitemap.xml` for you for SEO! Be sure to set `buildOptions.site` in your [Astro config][config] so the URLs can be generated properly.
|
Astro will automatically create a `/sitemap.xml` for you for SEO! Be sure to set `buildOptions.site` in your [Astro config][docs-config] so the URLs can be generated properly.
|
||||||
|
|
||||||
⚠️ Note that Astro won’t inject this into your HTML for you! You’ll have to add the tag yourself in your `<head>` on all pages that need it:
|
⚠️ Note that Astro won’t inject this into your HTML for you! You’ll have to add the tag yourself in your `<head>` on all pages that need it:
|
||||||
|
|
||||||
|
@ -185,27 +164,10 @@ Astro will automatically create a `/sitemap.xml` for you for SEO! Be sure to set
|
||||||
|
|
||||||
👉 [**Collections API**][docs-collections]
|
👉 [**Collections API**][docs-collections]
|
||||||
|
|
||||||
### 🚀 Build & Deployment
|
|
||||||
|
|
||||||
Add a `build` npm script to your `/package.json` file:
|
## ⚙️ Config
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"scripts": {
|
|
||||||
"dev": "astro dev .",
|
|
||||||
"build": "astro build ."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Then run:
|
|
||||||
|
|
||||||
```
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
Now upload the contents of `/dist` to your favorite static site host.
|
|
||||||
|
|
||||||
|
👉 [**`astro.config.mjs` Reference**][docs-config]
|
||||||
## 📚 API
|
## 📚 API
|
||||||
|
|
||||||
👉 [**Full API Reference**][docs-api]
|
👉 [**Full API Reference**][docs-api]
|
||||||
|
@ -218,7 +180,7 @@ Now upload the contents of `/dist` to your favorite static site host.
|
||||||
|
|
||||||
👉 [**Dev Server Docs**][docs-dev]
|
👉 [**Dev Server Docs**][docs-dev]
|
||||||
|
|
||||||
[config]: #%EF%B8%8F-configuration
|
[docs-config]: ./docs/config.md
|
||||||
[docs-api]: ./docs/api.md
|
[docs-api]: ./docs/api.md
|
||||||
[docs-collections]: ./docs/collections.md
|
[docs-collections]: ./docs/collections.md
|
||||||
[docs-dev]: ./docs/dev.md
|
[docs-dev]: ./docs/dev.md
|
||||||
|
|
4
create-astro/bin.js
Executable file
4
create-astro/bin.js
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
import cli from './index.js';
|
||||||
|
|
||||||
|
cli(process.argv);
|
47
create-astro/index.js
Normal file
47
create-astro/index.js
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import { resolve } from 'path';
|
||||||
|
import decompress from 'decompress';
|
||||||
|
import { fileURLToPath, URL } from 'url';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
|
const log = (...args) => console.log(' ', ...args);
|
||||||
|
export default async function createAstro(argv) {
|
||||||
|
const [name] = argv.slice(2);
|
||||||
|
const templateRoot = fileURLToPath(new URL('../create-astro/templates', import.meta.url));
|
||||||
|
if (!name) {
|
||||||
|
log();
|
||||||
|
log(`npm init astro <dest>`);
|
||||||
|
log(`Provide a destination!`);
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
log();
|
||||||
|
const dest = resolve(process.cwd(), name);
|
||||||
|
const relDest = `./${name}`;
|
||||||
|
if (isEmpty(relDest)) {
|
||||||
|
await decompress(fs.readFileSync(join(templateRoot, 'starter.tar.gz')), dest);
|
||||||
|
log(`Your Astro project has been scaffolded at "${relDest}"`);
|
||||||
|
log();
|
||||||
|
log(`Next steps:`);
|
||||||
|
log();
|
||||||
|
log(` cd ${relDest}`);
|
||||||
|
log(` npm install`);
|
||||||
|
log(` npm run start`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isEmpty(path) {
|
||||||
|
try {
|
||||||
|
const files = fs.readdirSync(resolve(process.cwd(), path));
|
||||||
|
if (files.length > 0) {
|
||||||
|
log(`It looks like "${path}" isn't empty!`);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
log(`Scaffolding Astro project at "${path}"`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
if (err.code !== 'ENOENT') throw err;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
372
create-astro/package-lock.json
generated
Normal file
372
create-astro/package-lock.json
generated
Normal file
|
@ -0,0 +1,372 @@
|
||||||
|
{
|
||||||
|
"name": "create-astro",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"requires": true,
|
||||||
|
"dependencies": {
|
||||||
|
"base64-js": {
|
||||||
|
"version": "1.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||||
|
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||||
|
},
|
||||||
|
"bl": {
|
||||||
|
"version": "1.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz",
|
||||||
|
"integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==",
|
||||||
|
"requires": {
|
||||||
|
"readable-stream": "^2.3.5",
|
||||||
|
"safe-buffer": "^5.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"buffer": {
|
||||||
|
"version": "5.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||||
|
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||||
|
"requires": {
|
||||||
|
"base64-js": "^1.3.1",
|
||||||
|
"ieee754": "^1.1.13"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"buffer-alloc": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==",
|
||||||
|
"requires": {
|
||||||
|
"buffer-alloc-unsafe": "^1.1.0",
|
||||||
|
"buffer-fill": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"buffer-alloc-unsafe": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg=="
|
||||||
|
},
|
||||||
|
"buffer-crc32": {
|
||||||
|
"version": "0.2.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
|
||||||
|
"integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI="
|
||||||
|
},
|
||||||
|
"buffer-fill": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw="
|
||||||
|
},
|
||||||
|
"commander": {
|
||||||
|
"version": "2.20.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||||
|
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
|
||||||
|
},
|
||||||
|
"core-util-is": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
||||||
|
},
|
||||||
|
"decompress": {
|
||||||
|
"version": "4.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz",
|
||||||
|
"integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==",
|
||||||
|
"requires": {
|
||||||
|
"decompress-tar": "^4.0.0",
|
||||||
|
"decompress-tarbz2": "^4.0.0",
|
||||||
|
"decompress-targz": "^4.0.0",
|
||||||
|
"decompress-unzip": "^4.0.1",
|
||||||
|
"graceful-fs": "^4.1.10",
|
||||||
|
"make-dir": "^1.0.0",
|
||||||
|
"pify": "^2.3.0",
|
||||||
|
"strip-dirs": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decompress-tar": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==",
|
||||||
|
"requires": {
|
||||||
|
"file-type": "^5.2.0",
|
||||||
|
"is-stream": "^1.1.0",
|
||||||
|
"tar-stream": "^1.5.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decompress-tarbz2": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==",
|
||||||
|
"requires": {
|
||||||
|
"decompress-tar": "^4.1.0",
|
||||||
|
"file-type": "^6.1.0",
|
||||||
|
"is-stream": "^1.1.0",
|
||||||
|
"seek-bzip": "^1.0.5",
|
||||||
|
"unbzip2-stream": "^1.0.9"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"file-type": {
|
||||||
|
"version": "6.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz",
|
||||||
|
"integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decompress-targz": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==",
|
||||||
|
"requires": {
|
||||||
|
"decompress-tar": "^4.1.1",
|
||||||
|
"file-type": "^5.2.0",
|
||||||
|
"is-stream": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"decompress-unzip": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz",
|
||||||
|
"integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=",
|
||||||
|
"requires": {
|
||||||
|
"file-type": "^3.8.0",
|
||||||
|
"get-stream": "^2.2.0",
|
||||||
|
"pify": "^2.3.0",
|
||||||
|
"yauzl": "^2.4.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"file-type": {
|
||||||
|
"version": "3.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz",
|
||||||
|
"integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"end-of-stream": {
|
||||||
|
"version": "1.4.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||||
|
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||||
|
"requires": {
|
||||||
|
"once": "^1.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fd-slicer": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
|
||||||
|
"integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
|
||||||
|
"requires": {
|
||||||
|
"pend": "~1.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"file-type": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz",
|
||||||
|
"integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY="
|
||||||
|
},
|
||||||
|
"fs-constants": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
|
||||||
|
},
|
||||||
|
"get-stream": {
|
||||||
|
"version": "2.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz",
|
||||||
|
"integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=",
|
||||||
|
"requires": {
|
||||||
|
"object-assign": "^4.0.1",
|
||||||
|
"pinkie-promise": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"graceful-fs": {
|
||||||
|
"version": "4.2.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz",
|
||||||
|
"integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ=="
|
||||||
|
},
|
||||||
|
"ieee754": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
|
||||||
|
},
|
||||||
|
"inherits": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
|
},
|
||||||
|
"is-natural-number": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz",
|
||||||
|
"integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg="
|
||||||
|
},
|
||||||
|
"is-stream": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
|
||||||
|
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
|
||||||
|
},
|
||||||
|
"isarray": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||||
|
},
|
||||||
|
"make-dir": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==",
|
||||||
|
"requires": {
|
||||||
|
"pify": "^3.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"pify": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"object-assign": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||||
|
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
|
||||||
|
},
|
||||||
|
"once": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
|
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||||
|
"requires": {
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pend": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
||||||
|
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA="
|
||||||
|
},
|
||||||
|
"pify": {
|
||||||
|
"version": "2.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
||||||
|
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
|
||||||
|
},
|
||||||
|
"pinkie": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
|
||||||
|
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA="
|
||||||
|
},
|
||||||
|
"pinkie-promise": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
|
||||||
|
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
|
||||||
|
"requires": {
|
||||||
|
"pinkie": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"process-nextick-args": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
||||||
|
},
|
||||||
|
"readable-stream": {
|
||||||
|
"version": "2.3.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||||
|
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||||
|
"requires": {
|
||||||
|
"core-util-is": "~1.0.0",
|
||||||
|
"inherits": "~2.0.3",
|
||||||
|
"isarray": "~1.0.0",
|
||||||
|
"process-nextick-args": "~2.0.0",
|
||||||
|
"safe-buffer": "~5.1.1",
|
||||||
|
"string_decoder": "~1.1.1",
|
||||||
|
"util-deprecate": "~1.0.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": {
|
||||||
|
"version": "5.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||||
|
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"safe-buffer": {
|
||||||
|
"version": "5.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||||
|
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||||
|
},
|
||||||
|
"seek-bzip": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz",
|
||||||
|
"integrity": "sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==",
|
||||||
|
"requires": {
|
||||||
|
"commander": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"string_decoder": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||||
|
"requires": {
|
||||||
|
"safe-buffer": "~5.1.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": {
|
||||||
|
"version": "5.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||||
|
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strip-dirs": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==",
|
||||||
|
"requires": {
|
||||||
|
"is-natural-number": "^4.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tar-stream": {
|
||||||
|
"version": "1.6.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz",
|
||||||
|
"integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==",
|
||||||
|
"requires": {
|
||||||
|
"bl": "^1.0.0",
|
||||||
|
"buffer-alloc": "^1.2.0",
|
||||||
|
"end-of-stream": "^1.0.0",
|
||||||
|
"fs-constants": "^1.0.0",
|
||||||
|
"readable-stream": "^2.3.0",
|
||||||
|
"to-buffer": "^1.1.1",
|
||||||
|
"xtend": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"through": {
|
||||||
|
"version": "2.3.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||||
|
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
||||||
|
},
|
||||||
|
"to-buffer": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg=="
|
||||||
|
},
|
||||||
|
"unbzip2-stream": {
|
||||||
|
"version": "1.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz",
|
||||||
|
"integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==",
|
||||||
|
"requires": {
|
||||||
|
"buffer": "^5.2.1",
|
||||||
|
"through": "^2.3.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"util-deprecate": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||||
|
},
|
||||||
|
"wrappy": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||||
|
},
|
||||||
|
"xtend": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
|
||||||
|
},
|
||||||
|
"yauzl": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
||||||
|
"integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=",
|
||||||
|
"requires": {
|
||||||
|
"buffer-crc32": "~0.2.3",
|
||||||
|
"fd-slicer": "~1.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
create-astro/package.json
Normal file
17
create-astro/package.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"name": "create-astro",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"type": "module",
|
||||||
|
"main": "./index.js",
|
||||||
|
"files": [
|
||||||
|
"templates",
|
||||||
|
"bin.js",
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"bin": {
|
||||||
|
"create-astro": "./bin.js"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"decompress": "^4.2.1"
|
||||||
|
}
|
||||||
|
}
|
BIN
create-astro/templates/starter.tar.gz
Normal file
BIN
create-astro/templates/starter.tar.gz
Normal file
Binary file not shown.
33
docs/config.md
Normal file
33
docs/config.md
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# ⚙️ Configuration
|
||||||
|
|
||||||
|
To configure Astro, add an `astro.config.mjs` file in the root of your project. All settings are optional. Here are the defaults:
|
||||||
|
|
||||||
|
```js
|
||||||
|
export default {
|
||||||
|
/** Where to resolve all URLs relative to. Useful if you have a monorepo project. */
|
||||||
|
projectRoot: '.',
|
||||||
|
/** Path to Astro components, pages, and data */
|
||||||
|
astroRoot: './src',
|
||||||
|
/** When running `astro build`, path to final static output */
|
||||||
|
dist: './dist',
|
||||||
|
/** A folder of static files Astro will copy to the root. Useful for favicons, images, and other files that don’t need processing. */
|
||||||
|
public: './public',
|
||||||
|
/** Extension-specific handlings */
|
||||||
|
extensions: {
|
||||||
|
/** Set this to "preact" or "react" to determine what *.jsx files should load */
|
||||||
|
'.jsx': 'react',
|
||||||
|
},
|
||||||
|
/** Options specific to `astro build` */
|
||||||
|
buildOptions: {
|
||||||
|
/** Your public domain, e.g.: https://my-site.dev/. Used to generate sitemaps and canonical URLs. */
|
||||||
|
site: '',
|
||||||
|
/** Generate sitemap (set to "false" to disable) */
|
||||||
|
sitemap: true,
|
||||||
|
},
|
||||||
|
/** Options for the development server run with `astro dev`. */
|
||||||
|
devOptions: {
|
||||||
|
/** The port to run the dev server on. */
|
||||||
|
port: 3000,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
```
|
16
examples/starter/astro.config.mjs
Normal file
16
examples/starter/astro.config.mjs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
export default {
|
||||||
|
projectRoot: '.',
|
||||||
|
astroRoot: './src',
|
||||||
|
dist: './dist',
|
||||||
|
public: './public',
|
||||||
|
extensions: {
|
||||||
|
'.jsx': 'react',
|
||||||
|
},
|
||||||
|
snowpack: {
|
||||||
|
optimize: {
|
||||||
|
bundle: false,
|
||||||
|
minify: true,
|
||||||
|
target: 'es2018',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
Loading…
Reference in a new issue