Skip to content

Commit

Permalink
Add astro config files.
Browse files Browse the repository at this point in the history
  • Loading branch information
emeraldjava committed Jun 6, 2024
1 parent 2c8d89e commit 06a7b82
Show file tree
Hide file tree
Showing 11 changed files with 262 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.husky
.vscode
node_modules
public
static
new
dist
.yarn
23 changes: 23 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
env: {
node: true,
es2022: true,
browser: true,
},
extends: ["eslint:recommended", "plugin:astro/recommended"],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
overrides: [
{
files: ["*.astro"],
parser: "astro-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
extraFileExtensions: [".astro"],
},
rules: {},
},
],
};
48 changes: 44 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,47 @@
# Created by .ignore support plugin (hsz.mobi)

# build output
dist/
.output/
docs/
new/

# jetbrains
.idea/*
/*.iml

# dependencies
node_modules/
.husky

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

# environment variables
.env
.env.production

# macOS-specific files
.DS_Store

# ignore .astro directory
.astro

# ignore Jampack cache files
.jampack/

# yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.pnp.*

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
Expand Down Expand Up @@ -156,18 +199,15 @@ typings/

# gatsby files
.cache/
/public/

# Mac files
.DS_Store
/package-lock.json
/hide/
/.idea/
/public/
gatsby-starter-blog/

# hugo excludes
.hugo_build.lock
go.sum
themes/*
public/*
themes/*
4 changes: 4 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"MD033": false,
"MD013": false
}
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Ignore everything
/*

# Except these files & folders
!/src
!/publix
!/.github
!tsconfig.json
!astro.config.ts
!package.json
!.prettierrc
!.eslintrc.js
!README.md
20 changes: 20 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"arrowParens": "avoid",
"semi": true,
"tabWidth": 2,
"printWidth": 80,
"singleQuote": false,
"jsxSingleQuote": false,
"trailingComma": "es5",
"bracketSpacing": true,
"endOfLine": "lf",
"plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss"],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
}
]
}
57 changes: 57 additions & 0 deletions astro.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import react from "@astrojs/react";
import remarkToc from "remark-toc";
import remarkCollapse from "remark-collapse";
import sitemap from "@astrojs/sitemap";

// https://astro.build/config
export default defineConfig({
// https://docs.astro.build/en/reference/configuration-reference/#site
// see https://config.tips/c/astro/dynamic-astro-site-value/
site: import.meta.env.DEV ? "http://localhost:4321" : 'https://emeraldjava.github.io/',
// See https://github.com/withastro/astro/issues/5512
// https://docs.astro.build/en/guides/environment-variables/
// https://vitejs.dev/guide/env-and-mode.html#env-files
//base: import.meta.env.DEV ? "." : "/emeraldjava-astro",
//base: import.meta.env.VITE_BASE,
integrations: [
tailwind({
applyBaseStyles: true,
}),
react(),
sitemap(),
],
markdown: {
remarkPlugins: [
remarkToc,
[
remarkCollapse,
{
test: "Table of contents",
},
],
],
// shikiConfig: {
// theme: "one-dark-pro",
// wrap: true,
// },
},
vite: {
// build: {
// rollupOptions: {
// output: {
// entryFileNames: '[name]-[hash].js',
// }
// }
// },
optimizeDeps: {
exclude: ["@resvg/resvg-js"],
},
},
scopedStyleStrategy: "where",
// https://about.gitlab.com/blog/2022/10/24/publishing-an-astro-site-with-pages/
// GitLab Pages requires exposed files to be located in a folder called "public".
// So we're instructing Astro to put the static build output in a folder of that name.
outDir: './dist'
});
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3'

services:
app:
image: node:18
ports:
- 4321:4321
working_dir: /app
command: npm run dev -- --host 0.0.0.0
volumes:
- ./:/app
63 changes: 63 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "emeraldjava.github.io",
"version": "2024.6.6",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"sync": "astro sync",
"astro": "astro",
"format:check": "prettier --check . --plugin=prettier-plugin-astro",
"format": "prettier --write . --plugin=prettier-plugin-astro",
"cz": "cz",
"prepare": "husky install",
"lint": "eslint ."
},
"dependencies": {
"@astrojs/check": "^0.5.10",
"@astrojs/rss": "^4.0.2",
"@resvg/resvg-js": "^2.6.0",
"astro": "^4.2.1",
"cross-env": "^7.0.3",
"fuse.js": "^7.0.0",
"github-slugger": "^2.0.0",
"remark-collapse": "^0.1.2",
"remark-toc": "^9.0.0",
"satori": "^0.10.11",
"tailwindcss": "^3.4.1",
"typescript": "^5.4.5"
},
"devDependencies": {
"@astrojs/react": "^3.0.9",
"@astrojs/sitemap": "^3.0.5",
"@astrojs/tailwind": "^5.1.0",
"@divriots/jampack": "^0.23.2",
"@tailwindcss/typography": "^0.5.10",
"@types/github-slugger": "^1.3.0",
"@types/react": "^18.2.48",
"@typescript-eslint/parser": "^6.19.0",
"astro-eslint-parser": "^0.16.2",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.56.0",
"eslint-plugin-astro": "^0.31.3",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"prettier": "^3.2.4",
"prettier-plugin-astro": "^0.13.0",
"prettier-plugin-tailwindcss": "^0.5.11",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"lint-staged": {
"*.{js,jsx,ts,tsx,md,mdx,json,astro}": [
"prettier --write --plugin=prettier-plugin-astro"
]
}
}
17 changes: 17 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"baseUrl": "src",
"jsx": "react-jsx",
"paths": {
"@assets/*": ["assets/*"],
"@config": ["config.ts"],
"@components/*": ["components/*"],
"@content/*": ["content/*"],
"@layouts/*": ["layouts/*"],
"@pages/*": ["pages/*"],
"@styles/*": ["styles/*"],
"@utils/*": ["utils/*"],
},
},
}

0 comments on commit 06a7b82

Please sign in to comment.