commit 61f90b9bb1a6bf42747b0d3a31f1780f625cf58a
Author: Adam Matthiesen <30383579+Adammatthiesen@users.noreply.github.com>
Date: Mon Mar 11 02:34:55 2024 -0700
Initial commit
diff --git a/.changeset/config.json b/.changeset/config.json
new file mode 100644
index 0000000..1013eb6
--- /dev/null
+++ b/.changeset/config.json
@@ -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"]
+}
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..dd84ea7
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -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.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..bbcbbe7
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -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.
diff --git a/.github/ISSUE_TEMPLATE/new_chore.md b/.github/ISSUE_TEMPLATE/new_chore.md
new file mode 100644
index 0000000..69d30e2
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/new_chore.md
@@ -0,0 +1,18 @@
+---
+name: New Chore
+about: Used to create a new Chore for a needed task
+title: "Chore: [NAME]"
+labels: chore
+---
+
+**Is your chore 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.
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..fc6225a
--- /dev/null
+++ b/.github/dependabot.yml
@@ -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"
diff --git a/.github/issue-branch.yml b/.github/issue-branch.yml
new file mode 100644
index 0000000..3dfed8d
--- /dev/null
+++ b/.github/issue-branch.yml
@@ -0,0 +1,38 @@
+branchName: 'issue-${issue.number}-${issue.title[0,32]}'
+gitReplaceChars: '/<>'
+autoLinkIssue: true
+openDraftPR: true
+prSkipCI: true
+copyIssueDescriptionToPR: true
+copyIssueLabelsToPR: true
+copyIssueAssigneeToPR: true
+copyIssueProjectsToPR: true
+copyIssueMilestoneToPR: true
+conventionalPrTitles: true
+conventionalLabels:
+ fix:
+ bug: '🐛'
+ dependencies: '⬆️'
+ security: '🔒'
+ feat:
+ enhancement: '✨'
+ new-stuff: '🚀'
+ build:
+ build: '🔧'
+ chore:
+ chore: '♻️'
+ ci:
+ ci: '👷'
+ docs:
+ documentation: '📝'
+ style:
+ style: '💎'
+ refactor:
+ refactor: '♻️'
+ perf:
+ performance: '⚡️'
+ test:
+ test: '✅'
+ breaking:
+ breaking-change: '💥'
+ breaking change: '💥'
diff --git a/.github/workflows/auto-issue.yml b/.github/workflows/auto-issue.yml
new file mode 100644
index 0000000..cf6c191
--- /dev/null
+++ b/.github/workflows/auto-issue.yml
@@ -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 }}
diff --git a/.github/workflows/changeset-dependabot.yml b/.github/workflows/changeset-dependabot.yml
new file mode 100644
index 0000000..f26197e
--- /dev/null
+++ b/.github/workflows/changeset-dependabot.yml
@@ -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
diff --git a/.github/workflows/changeset-main.yml b/.github/workflows/changeset-main.yml
new file mode 100644
index 0000000..b233729
--- /dev/null
+++ b/.github/workflows/changeset-main.yml
@@ -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 }}
diff --git a/.github/workflows/coauthor.yml b/.github/workflows/coauthor.yml
new file mode 100644
index 0000000..c8203a3
--- /dev/null
+++ b/.github/workflows/coauthor.yml
@@ -0,0 +1,17 @@
+name: Write coauthors to a pull request
+permissions:
+ pull-requests: write
+
+on:
+ issue_comment:
+ types:
+ - created
+
+jobs:
+ generate-coauthors:
+ name: Generate Coauthor
+ if: ${{ github.event.issue.pull_request }}
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: kevinzunigacuellar/coauthor-action@v0.1.1
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b512c09
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..4f37590
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "editor.defaultFormatter": "biomejs.biome"
+}
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..2e80d5e
--- /dev/null
+++ b/LICENSE
@@ -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.
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9b074e8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,9 @@
+# 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).
diff --git a/biome.json b/biome.json
new file mode 100644
index 0000000..4e0f2b8
--- /dev/null
+++ b/biome.json
@@ -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"]
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..bbbf0ed
--- /dev/null
+++ b/package.json
@@ -0,0 +1,19 @@
+{
+ "name": "root",
+ "private": true,
+ "packageManager": "pnpm@8.14.1",
+ "engines": {
+ "node": ">=18.19.0"
+ },
+ "scripts": {
+ "dev": "pnpm --filter playground dev",
+ "lint": "biome check .",
+ "lint:fix": "biome check --apply .",
+ "ci:version": "pnpm changeset version",
+ "ci:publish": "pnpm changeset publish"
+ },
+ "devDependencies": {
+ "@biomejs/biome": "1.5.3",
+ "@changesets/cli": "^2.27.1"
+ }
+}
diff --git a/package/LICENSE b/package/LICENSE
new file mode 100644
index 0000000..2e80d5e
--- /dev/null
+++ b/package/LICENSE
@@ -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.
\ No newline at end of file
diff --git a/package/README.md b/package/README.md
new file mode 100644
index 0000000..6620c36
--- /dev/null
+++ b/package/README.md
@@ -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:
diff --git a/package/package.json b/package/package.json
new file mode 100644
index 0000000..895ae7c
--- /dev/null
+++ b/package/package.json
@@ -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"
+ }
+}
\ No newline at end of file
diff --git a/package/src/index.ts b/package/src/index.ts
new file mode 100644
index 0000000..a9164cc
--- /dev/null
+++ b/package/src/index.ts
@@ -0,0 +1,3 @@
+import integration from "./integration.js";
+
+export default integration;
\ No newline at end of file
diff --git a/package/src/integration.ts b/package/src/integration.ts
new file mode 100644
index 0000000..e44b602
--- /dev/null
+++ b/package/src/integration.ts
@@ -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())
+ }
+ }
+ }
+})
\ No newline at end of file
diff --git a/package/tsconfig.json b/package/tsconfig.json
new file mode 100644
index 0000000..8e6bde1
--- /dev/null
+++ b/package/tsconfig.json
@@ -0,0 +1,6 @@
+{
+ "extends": "astro/tsconfigs/strictest",
+ "compilerOptions": {
+ "jsx": "preserve"
+ }
+}
diff --git a/playground/.gitignore b/playground/.gitignore
new file mode 100644
index 0000000..6d4c0aa
--- /dev/null
+++ b/playground/.gitignore
@@ -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
diff --git a/playground/.vscode/extensions.json b/playground/.vscode/extensions.json
new file mode 100644
index 0000000..3a1c9ec
--- /dev/null
+++ b/playground/.vscode/extensions.json
@@ -0,0 +1,4 @@
+{
+ "recommendations": ["astro-build.astro-vscode"],
+ "unwantedRecommendations": []
+}
diff --git a/playground/.vscode/launch.json b/playground/.vscode/launch.json
new file mode 100644
index 0000000..230708d
--- /dev/null
+++ b/playground/.vscode/launch.json
@@ -0,0 +1,11 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "command": "./node_modules/.bin/astro dev",
+ "name": "Development server",
+ "request": "launch",
+ "type": "node-terminal"
+ }
+ ]
+}
diff --git a/playground/README.md b/playground/README.md
new file mode 100644
index 0000000..27f2a6b
--- /dev/null
+++ b/playground/README.md
@@ -0,0 +1,3 @@
+# Playground: Dev Environment
+
+This is the Dev testing environment and playground.
\ No newline at end of file
diff --git a/playground/astro.config.mjs b/playground/astro.config.mjs
new file mode 100644
index 0000000..6081414
--- /dev/null
+++ b/playground/astro.config.mjs
@@ -0,0 +1,7 @@
+import { defineConfig } from "astro/config";
+import packagename from "@adammatthiesen/astro-commercejs";
+
+// https://astro.build/config
+export default defineConfig({
+ integrations: [packagename()],
+});
diff --git a/playground/package.json b/playground/package.json
new file mode 100644
index 0000000..5d5befe
--- /dev/null
+++ b/playground/package.json
@@ -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"
+ }
+}
diff --git a/playground/public/favicon.svg b/playground/public/favicon.svg
new file mode 100644
index 0000000..f157bd1
--- /dev/null
+++ b/playground/public/favicon.svg
@@ -0,0 +1,9 @@
+
diff --git a/playground/src/env.d.ts b/playground/src/env.d.ts
new file mode 100644
index 0000000..f964fe0
--- /dev/null
+++ b/playground/src/env.d.ts
@@ -0,0 +1 @@
+///