Skip to content

Commit

Permalink
Merge pull request #157 from aziontech/feat/templates/cosmic
Browse files Browse the repository at this point in the history
feat(templates): Add Comic CMS based templates
  • Loading branch information
pablodiehl authored Oct 23, 2024
2 parents f2917e7 + 0ae14ed commit 09d3065
Show file tree
Hide file tree
Showing 151 changed files with 16,920 additions and 0 deletions.
2 changes: 2 additions & 0 deletions templates/astro/cosmic-simple-astro-blog/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PUBLIC_COSMIC_BUCKET_SLUG=
PUBLIC_COSMIC_READ_KEY=
25 changes: 25 additions & 0 deletions templates/astro/cosmic-simple-astro-blog/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ['plugin:astro/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
sourceType: 'module',
ecmaVersion: 'latest'
},
overrides: [
{
files: ['*.astro'],
parser: 'astro-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro', '.tsx', '.ts', '.jsx', '.js']
},
rules: {
// override/add rules settings here, such as:
// "astro/no-set-html-directive": "error"
}
}
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Main Edge Deploy

on:
pull_request:
types:
- closed
branches:
- "main"

jobs:
deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install NPM dependencies
run: npm i

- name: Install Azion CLI
run: |
curl -o azionlinux https://downloads.azion.com/linux/x86_64/azion
sudo mv azionlinux /usr/bin/azion
sudo chmod u+x /usr/bin/azion
- name: Azion Action Deploy
run: |
azion -t ${{ secrets.AZION_PERSONAL_TOKEN }}
azion deploy
24 changes: 24 additions & 0 deletions templates/astro/cosmic-simple-astro-blog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# build output
dist/
.output/

# dependencies
node_modules/

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


# environment variables
.env.production

# macOS-specific files
.DS_Store

# azion
.edge
.vulcan

2 changes: 2 additions & 0 deletions templates/astro/cosmic-simple-astro-blog/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions templates/astro/cosmic-simple-astro-blog/.vscode/launch.json
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"
}
]
}
54 changes: 54 additions & 0 deletions templates/astro/cosmic-simple-astro-blog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Simple Astro Blog built with Astro and Cosmic

To build this app, we’re going to use the following technologies:

- [Astro](https://astro.build/) - A React framework for production that makes it easy to spin up a full-stack application.
- [Cosmic](https://www.cosmicjs.com/) - A Headless CMS enables the independence of the data (content) layer and gives us the ability to quickly manage template content.
- [Tailwind CSS](https://tailwindcss.com/) - A performant utility-first CSS framework that can be composed directly in your markup.

### Links

- [Install the template](https://www.cosmicjs.com/marketplace/templates/simple-astro-blog)
- [View the live demo](https://simple-astro-blog.vercel.app/)

## Screenshots

![Home Page](https://imgix.cosmicjs.com/e0b61790-32db-11ed-8a37-f1952c73e588-astro-cms-screenshot-4.png?w=1200&auto=format)

![Blog Page](https://cdn.cosmicjs.com/cbd90ee0-32db-11ed-8a37-f1952c73e588-astro-cms-screenshot-3.png)

## Getting started

### Environment Variables

You'll need to create an .env file in the root of the project. Log in to Cosmic and from Bucket Settings > API Access take the following values:

```
//.env
PUBLIC_COSMIC_BUCKET_SLUG=your_cosmic_slug
PUBLIC_COSMIC_READ_KEY=your_cosmic_read_key
```

Install the dependencies with

```
pnpm install
# or
yarn install
# or
npm install
```

Then run the development server:

```
pnpm run dev
# or
yarn dev
# or
npm run dev
```

Open [http://localhost:3000](http://localhost:3000/) with your browser to see the result.

You can start editing the page by modifying `src/pages/index.astro`. The page auto-updates as you edit the file.
10 changes: 10 additions & 0 deletions templates/astro/cosmic-simple-astro-blog/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'astro/config'
import react from '@astrojs/react'
import tailwind from '@astrojs/tailwind'
import robotsTxt from 'astro-robots-txt'

// https://astro.build/config
export default defineConfig({
integrations: [tailwind(), react(), robotsTxt()],
site: 'https://simple-astro-blog.vercel.app'
})
7 changes: 7 additions & 0 deletions templates/astro/cosmic-simple-astro-blog/azion.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
build: {
preset: {
name: 'astro'
}
}
}
1 change: 1 addition & 0 deletions templates/astro/cosmic-simple-astro-blog/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="astro/client" />
7 changes: 7 additions & 0 deletions templates/astro/cosmic-simple-astro-blog/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Cosmic - Simple Astro Blog",
"message": "An Astro blog template powered by Cosmic",
"preset": "astro",
"mode": "deliver",
"path": "/cosmic-simple-astro-blog"
}
39 changes: 39 additions & 0 deletions templates/astro/cosmic-simple-astro-blog/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "@example/basics",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro",
"lint": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx,astro}\" && eslint --fix \"src/**/*.{js,ts,jsx,tsx,astro}\""
},
"dependencies": {
"@astrojs/react": "^3.0.0",
"@astrojs/tailwind": "^5.0.0",
"@astrojs/ts-plugin": "^1.0.4",
"@cosmicjs/sdk": "^1.0.5",
"astro": "^3.0.8",
"date-fns": "^2.29.2",
"react-markdown": "^8.0.3",
"sharp": "^0.32.1",
"tailwindcss": "^3.3.2"
},
"devDependencies": {
"@types/node": "^18.7.15",
"@typescript-eslint/parser": "^5.59.2",
"astro-robots-txt": "^0.3.8",
"eslint": "^8.39.0",
"eslint-plugin-astro": "^0.26.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"prettier": "^2.8.8",
"prettier-config-standard": "^5.0.0",
"prettier-plugin-astro": "^0.8.0",
"prettier-plugin-tailwindcss": "^0.2.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.2.2"
}
}
Loading

0 comments on commit 09d3065

Please sign in to comment.