-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
49 changed files
with
10,511 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.git | ||
node_modules | ||
build | ||
public/build | ||
api/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# build output | ||
dist/ | ||
|
||
# generated types | ||
.astro/ | ||
|
||
# dependencies | ||
node_modules/ | ||
|
||
# logs | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
|
||
# environment variables | ||
.env | ||
.env.production | ||
|
||
# macOS-specific files | ||
.DS_Store | ||
|
||
# jetbrains setting folder | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"recommendations": ["astro-build.astro-vscode"], | ||
"unwantedRecommendations": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"command": "./node_modules/.bin/astro dev", | ||
"name": "Development server", | ||
"request": "launch", | ||
"type": "node-terminal" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Astro Starter Kit: Basics | ||
|
||
```sh | ||
npm create astro@latest -- --template basics | ||
``` | ||
|
||
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics) | ||
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/basics) | ||
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/basics/devcontainer.json) | ||
|
||
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun! | ||
![just-the-basics](https://github.com/withastro/astro/assets/2244813/a0a5533c-a856-4198-8470-2d67b1d7c554) | ||
|
||
## 🚀 Project Structure | ||
|
||
Inside of your Astro project, you'll see the following folders and files: | ||
|
||
```text | ||
/ | ||
├── public/ | ||
│ └── favicon.svg | ||
├── src/ | ||
│ ├── components/ | ||
│ │ └── Card.astro | ||
│ ├── layouts/ | ||
│ │ └── Layout.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 dev` | Starts local dev server at `localhost:4321` | | ||
| `npm run build` | Build your production site to `./dist/` | | ||
| `npm run preview` | Preview your build locally, before deploying | | ||
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | | ||
| `npm run astro -- --help` | Get help using the Astro CLI | | ||
|
||
## 👀 Want to learn more? | ||
|
||
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json", | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "single", | ||
"jsxQuoteStyle": "single", | ||
"semicolons": "asNeeded" | ||
}, | ||
"globals": ["__DEV__"] | ||
}, | ||
"formatter": { | ||
"enabled": true, | ||
"formatWithErrors": true, | ||
"indentStyle": "tab", | ||
"indentWidth": 4, | ||
"lineWidth": 120 | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true, | ||
"suspicious": { | ||
"noExplicitAny": "warn" | ||
} | ||
} | ||
}, | ||
"files": { | ||
"ignore": ["dist", ".astro"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import eslint from '@eslint/js' | ||
import eslintPluginAstro from 'eslint-plugin-astro' | ||
import simpleImportSort from 'eslint-plugin-simple-import-sort' | ||
import unusedImports from 'eslint-plugin-unused-imports' | ||
import tseslint from 'typescript-eslint' | ||
|
||
export default [ | ||
eslint.configs.recommended, | ||
...tseslint.configs.recommended, | ||
...eslintPluginAstro.configs.recommended, | ||
{ | ||
plugins: { | ||
'simple-import-sort': simpleImportSort, | ||
'unused-imports': unusedImports, | ||
}, | ||
rules: { | ||
quotes: ['error', 'single'], | ||
'simple-import-sort/imports': [ | ||
'error', | ||
{ | ||
groups: [['.*\\u0000$'], ['^\\u0000'], ['^@?\\w'], ['^'], ['^\\.']], | ||
}, | ||
], | ||
'simple-import-sort/exports': 'error', | ||
//'import/first': 'error', | ||
//'import/newline-after-import': 'error', | ||
//'import/no-duplicates': 'error', | ||
'unused-imports/no-unused-imports': 'error', | ||
'no-multiple-empty-lines': 'error', | ||
'no-extra-semi': 'error', | ||
'no-trailing-spaces': 'error', | ||
'no-multi-spaces': 'error', | ||
'linebreak-style': ['error', 'unix'], | ||
semi: ['error', 'never'], | ||
'padding-line-between-statements': [ | ||
'error', | ||
{ blankLine: 'always', prev: 'function', next: '*' }, | ||
{ blankLine: 'always', prev: 'export', next: '*' }, | ||
{ blankLine: 'always', prev: 'multiline-var', next: '*' }, | ||
{ blankLine: 'always', prev: 'multiline-let', next: '*' }, | ||
{ blankLine: 'always', prev: 'multiline-const', next: '*' }, | ||
{ blankLine: 'always', prev: 'class', next: '*' }, | ||
{ blankLine: 'always', prev: 'function', next: '*' }, | ||
], | ||
'comma-spacing': 'error', | ||
'key-spacing': 'error', | ||
'eol-last': ['error', 'always'], | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-empty-interface': 'off', | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/indent': [ | ||
'error', | ||
'tab', | ||
{ | ||
ignoredNodes: ['TSTypeParameterInstantiation'], | ||
}, | ||
], | ||
}, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"private": true, | ||
"type": "module", | ||
"workspaces": ["packages/*"], | ||
"scripts": { | ||
"dev": "pnpm --stream -r -parallel /^dev:/", | ||
"release": "node scripts/release.mjs", | ||
"lint": "biome check .", | ||
"lint:fix": "biome check --apply ." | ||
}, | ||
"engines": { | ||
"node": "^18.17.1 || ^20.3.0 || >=21.0.0", | ||
"pnpm": ">=9.0.0" | ||
}, | ||
"devDependencies": { | ||
"@biomejs/biome": "^1.9.2", | ||
"prettier": "^3.3.3", | ||
"prettier-plugin-astro": "^0.14.1", | ||
"tsup": "^8.3.0", | ||
"typescript": "^5.6.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="astro/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "astro-hook", | ||
"version": "0.0.1", | ||
"description": "TODO:", | ||
"author": { | ||
"email": "TODO:", | ||
"name": "TODO:", | ||
"url": "TODO:" | ||
}, | ||
"license": "MIT", | ||
"keywords": ["astro-integration", "astro-component", "withastro", "astro", "TODO:"], | ||
"homepage": "TODO:", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
}, | ||
"files": ["dist"], | ||
"scripts": { | ||
"dev": "pnpm run /^dev:/", | ||
"dev:build": "tsup --watch", | ||
"build": "tsup" | ||
}, | ||
"type": "module", | ||
"peerDependencies": { | ||
"astro": "^4.9.2" | ||
}, | ||
"dependencies": { | ||
"astro-integration-kit": "^0.13.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { z } from 'astro/zod' | ||
|
||
import { defineIntegration } from 'astro-integration-kit' | ||
import type { AstroConfig, AstroIntegrationMiddleware } from 'astro' | ||
|
||
export const optionsSchema = z | ||
.object({ | ||
setup: z.custom<(a: AstroConfig, b: (c: AstroIntegrationMiddleware) => void) => void>().optional(), | ||
done: z.custom<() => void>().optional(), | ||
}) | ||
.default({}) | ||
|
||
export default defineIntegration({ | ||
name: 'astro-hook', | ||
optionsSchema, | ||
setup({ options }) { | ||
return { | ||
hooks: { | ||
'astro:config:setup': ({ config, addMiddleware }) => { | ||
if (options.setup) options.setup(config, addMiddleware) | ||
}, | ||
'astro:server:done': () => { | ||
if (options.done) options.done() | ||
}, | ||
}, | ||
} | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineIntegration } from "astro-integration-kit"; | ||
|
||
export const integration = defineIntegration({ | ||
name: "package-name", | ||
setup() { | ||
return { | ||
hooks: {}, | ||
}; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": ["astro/tsconfigs/strict", "../../tsconfig.base.json"], | ||
"compilerOptions": { | ||
"jsx": "preserve" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { defineConfig } from 'tsup' | ||
import { peerDependencies } from './package.json' | ||
|
||
export default defineConfig((options) => { | ||
const dev = !!options.watch | ||
return { | ||
entry: ['src/**/*.(ts|js)'], | ||
format: ['esm'], | ||
target: 'node18', | ||
bundle: true, | ||
dts: true, | ||
sourcemap: true, | ||
clean: true, | ||
splitting: false, | ||
minify: !dev, | ||
external: [...Object.keys(peerDependencies)], | ||
tsconfig: 'tsconfig.json', | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Lit libraries are required to be hoisted due to dependency issues. | ||
public-hoist-pattern[]=*lit* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"baseLocale": "cn", | ||
"esmImports": true, | ||
"adapter": "node", | ||
"$schema": "https://unpkg.com/[email protected]/schema/typesafe-i18n.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import node from '@astrojs/node' | ||
import { defineConfig } from 'astro/config' | ||
import UnoCSS from 'unocss/astro' | ||
import lit from '@astrojs/lit' | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
output: 'server', | ||
adapter: node({ | ||
mode: 'standalone', | ||
}), | ||
i18n: { | ||
defaultLocale: 'en', | ||
locales: ['es', 'zh-CN', 'en', 'fr'], | ||
}, | ||
integrations: [ | ||
UnoCSS({ | ||
injectReset: true, | ||
}), | ||
lit(), | ||
], | ||
vite: { | ||
optimizeDeps: { | ||
exclude: ['oslo'], | ||
}, | ||
}, | ||
}) |
Oops, something went wrong.