This commit is contained in:
Adam Matthiesen 2024-03-06 11:27:27 -08:00
parent 3a1560dcaf
commit e4c833f5be
30 changed files with 492 additions and 1 deletions

11
.changeset/config.json Normal file
View File

@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["playground"]
}

38
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

18
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,18 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
groups:
prod-dependencies:
dependency-type: "production"
dev-dependencies:
dependency-type: "development"
labels:
- "dependencies"

18
.github/workflows/auto-issue.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Auto Issue Branch
on:
issues:
types: [ opened, assigned ]
issue_comment:
types: [ created ]
pull_request:
types: [ opened, closed ]
jobs:
create_issue_branch_job:
runs-on: ubuntu-latest
steps:
- name: Create Issue Branch
uses: robvanderleek/create-issue-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -0,0 +1,17 @@
name: "Changesets: Build Changesets for Dependabot"
#on: pull_request
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
changesets:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot Changesets
uses: feelepxyz/dependabot-changesets@v1

38
.github/workflows/changeset-main.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: "Changesets: Publish Packages from main"
on:
push:
branches:
- main
permissions:
pull-requests: write
contents: write
env:
CI: true
jobs:
version:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: checkout code repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: install pnpm
run: npm i pnpm@latest -g
- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- name: install dependencies
run: pnpm install
- name: create and publish versions
uses: matthiesenxyz/changeset@v1
with:
version: pnpm ci:version
commit: "chore: update versions"
title: "Chore: Ready for Release"
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"editor.defaultFormatter": "biomejs.biome"
}

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Adam Matthiesen
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.

View File

@ -1 +1,9 @@
# monorepo-template
# PACKAGE-NAME
DESCRIPTION
To see how to get started, check out the [package README](./package/README.md)
## Licensing
[MIT Licensed](./LICENSE). Made with ❤️ by [Adam M.](https://github.com/adammatthiesen).

18
biome.json Normal file
View File

@ -0,0 +1,18 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.2/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "warn"
}
}
},
"files": {
"ignore": ["dist", ".astro"]
}
}

17
package.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "root",
"private": true,
"packageManager": "pnpm@8.14.1",
"engines": {
"node": ">=18.19.0"
},
"scripts": {
"playground:dev": "pnpm --filter playground dev",
"lint": "biome check .",
"lint:fix": "biome check --apply ."
},
"devDependencies": {
"@biomejs/biome": "1.5.3",
"@changesets/cli": "^2.27.1"
}
}

21
package/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Adam Matthiesen
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.

80
package/README.md Normal file
View File

@ -0,0 +1,80 @@
# PACKAGE-NAME
DESCRIPTION
## Installation
Install the integration **automatically** using the Astro CLI:
```bash
pnpm astro add PACKAGE-NAME
```
```bash
npm astro add PACKAGE-NAME
```
```bash
yarn astro add PACKAGE-NAME
```
Or install it **manually**:
1. Install the required dependencies
```bash
pnpm add PACKAGE-NAME
```
```bash
npm install PACKAGE-NAME
```
```bash
yarn add PACKAGE-NAME
```
2. Add the integration to your astro config
```diff
+import PACKAGE-NAME from "PACKAGE-NAME";
export default defineConfig({
integrations: [
+ PACKAGE-NAME(),
],
});
```
## Basic Usage
## Contributing
This package is structured as a monorepo:
- `playground` contains code for testing the package
- `package` contains the actual package
Install dependencies using pnpm:
```bash
pnpm i --frozen-lockfile
```
Start the playground:
```bash
pnpm playground:dev
```
You can now edit files in `package`. Please note that making changes to those files may require restarting the playground dev server.
## Licensing
[MIT Licensed](./LICENSE). Made with ❤️ by [Adam M.](https://github.com/AdamMatthiesen).
## Acknowledgements
TODO:

35
package/package.json Normal file
View File

@ -0,0 +1,35 @@
{
"name": "PACKAGE-NAME",
"version": "0.0.0",
"description": "DESCRIPTION",
"author": {
"email": "adam@matthiesen.xyz",
"name": "Adam Matthiesen",
"url": "https://matthiesen.xyz"
},
"license": "MIT",
"keywords": [
"astro-integration",
"astro-component",
"withastro",
"astro",
"commercejs"
],
"homepage": "https://github.com/adammatthiesen/astro-commercejs",
"publishConfig": {
"access": "public"
},
"sideEffects": false,
"files": ["src"],
"exports": {
".": "./src/index.ts"
},
"scripts": {},
"type": "module",
"peerDependencies": {
"astro": ">=4.4.1"
},
"dependencies": {
"astro-integration-kit": "^0.5.1"
}
}

3
package/src/index.ts Normal file
View File

@ -0,0 +1,3 @@
import integration from "./integration.js";
export default integration;

View File

@ -0,0 +1,24 @@
import {
createResolver,
defineIntegration,
} from "astro-integration-kit";
import { corePlugins } from "astro-integration-kit/plugins";
import { z } from "astro/zod";
export default defineIntegration({
name: "PACKAGE-NAME",
optionsSchema: z.object({
/** A comment */
foo: z.string().optional().default("bar"),
}),
plugins: [...corePlugins],
setup({ options }) {
const { resolve } = createResolver(import.meta.url);
return {
"astro:config:setup": ({ watchIntegration }) => {
watchIntegration(resolve())
}
}
}
})

6
package/tsconfig.json Normal file
View File

@ -0,0 +1,6 @@
{
"extends": "astro/tsconfigs/strictest",
"compilerOptions": {
"jsx": "preserve"
}
}

21
playground/.gitignore vendored Normal file
View File

@ -0,0 +1,21 @@
# 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

4
playground/.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}

11
playground/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}

3
playground/README.md Normal file
View File

@ -0,0 +1,3 @@
# Playground: Dev Environment
This is the Dev testing environment and playground.

View File

@ -0,0 +1,7 @@
import { defineConfig } from "astro/config";
import packagename from "@adammatthiesen/astro-commercejs";
// https://astro.build/config
export default defineConfig({
integrations: [packagename()],
});

22
playground/package.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "playground",
"type": "module",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"astro": "^4.3.5",
"package-name": "workspace:*"
},
"devDependencies": {
"@astrojs/check": "^0.5.1",
"@types/node": "^20.11.17",
"typescript": "^5.3.3"
}
}

View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
<path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" />
<style>
path { fill: #000; }
@media (prefers-color-scheme: dark) {
path { fill: #FFF; }
}
</style>
</svg>

After

Width:  |  Height:  |  Size: 749 B

1
playground/src/env.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference types="astro/client" />

View File

@ -0,0 +1,5 @@
---
---
<h1>Hello World!</h1>

7
playground/tsconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"jsx": "preserve"
},
"exclude": ["dist"]
}

4
pnpm-workspace.yaml Normal file
View File

@ -0,0 +1,4 @@
packages:
- package
- "packages/*"
- "playground"