diff --git a/.changeset/config.json b/.changeset/config.json index e927057..0fa9052 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,11 +1,14 @@ { - "$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json", - "changelog": ["@changesets/changelog-github", { "repo": "trueberryless-org/starlight-cooler-credit" }], - "commit": false, - "fixed": [], - "linked": [], - "access": "public", - "baseBranch": "main", - "updateInternalDependencies": "patch", - "ignore": [] + "$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json", + "changelog": [ + "@changesets/changelog-github", + { "repo": "trueberryless-org/starlight-cooler-credit" } + ], + "commit": false, + "fixed": [], + "linked": [], + "access": "public", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "ignore": [] } diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0169d75 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +**/node_modules/ +**/dist +**/.git +npm-debug.log +.coverage +.coverage.* +.env +.aws diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index 2881fe9..4ea980f 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -44,8 +44,6 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Setup PNPM uses: pnpm/action-setup@v3 @@ -86,8 +84,15 @@ jobs: deployment: needs: [changes, changesets, image-tag] - # Only run if there is no changeset (i.e. a release), there are changes to the docs and the commit message contains '[ci] release' or 'deploy' (workflow_dispatch supported) - if: (needs.changes.outputs.docs == 'true' && needs.changesets.outputs.hasChangesets == 'false' && (contains(github.event.head_commit.message, 'deploy') || contains(github.event.head_commit.message, '[ci] release'))) || github.event_name == 'workflow_dispatch' + if: > + ( + needs.changesets.outputs.hasChangesets == 'false' && + ( + contains(github.event.head_commit.message, 'deploy') || + contains(github.event.head_commit.message, '[ci] release') + ) + ) || + github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest permissions: contents: write @@ -174,10 +179,24 @@ jobs: tag: ${{ env.IMAGE_NAME }}-docs@${{ needs.image-tag.outputs.IMAGE_TAG }} makeLatest: true body: ${{ steps.extract-changelog.outputs.markdown }} + skipIfReleaseExists: true + + - name: Check if release was created + id: check_release + run: | + if [ -z "${{ steps.create_release.outputs.html_url }}" ]; then + echo "RELEASE_SKIPPED=true" >> $GITHUB_ENV + else + echo "RELEASE_SKIPPED=false" >> $GITHUB_ENV + fi - name: Discord notification + if: env.RELEASE_SKIPPED == 'false' env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }} uses: Ilshidur/action-discord@0.3.2 with: - args: "# ${{ env.IMAGE_NAME }}-docs@${{ needs.image-tag.outputs.IMAGE_TAG }}\n\n${{ steps.extract-changelog.outputs.markdown }}" + args: | + # ${{ env.IMAGE_NAME }}@${{ needs.image-tag.outputs.IMAGE_TAG }} + + ${{ steps.extract-changelog.outputs.markdown }} diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml new file mode 100644 index 0000000..7ade522 --- /dev/null +++ b/.github/workflows/format.yaml @@ -0,0 +1,43 @@ +name: Format + +on: + push: + branches: [main] + +jobs: + format: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + run_install: | + - recursive: false + args: [--frozen-lockfile] + - args: [--global, prettier, sort-package-json] + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + - name: Sort package.json + run: find . -name "package.json" -not -path "*/node_modules/*" -exec sort-package-json {} \; + - name: Format with Prettier + run: pnpm prettier --write . + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.PUBLIC_GITHUB_TOKEN }} + commit-message: "[ci] format" + committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> + signoff: false + branch: ci-format + delete-branch: true + title: "[ci] format" + body: "This PR was automatically created to sort package.json files in the repository using sort-package-json and to format the repository using prettier." + labels: 🤖 bot + assignees: trueberryless + draft: false diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index ba5f37c..80e560e 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -44,8 +44,6 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Setup PNPM uses: pnpm/action-setup@v3 @@ -86,8 +84,15 @@ jobs: publish: needs: [changes, changesets, image-tag] - # Only run if there is no changeset (i.e. a release), there are changes to the packages/starlight-cooler-credit and the commit message contains '[ci] release' or 'deploy' (workflow_dispatch supported) - if: (needs.changes.outputs.starlight-cooler-credit == 'true' && needs.changesets.outputs.hasChangesets == 'false' && (contains(github.event.head_commit.message, 'deploy') || contains(github.event.head_commit.message, '[ci] release'))) || github.event_name == 'workflow_dispatch' + if: > + ( + needs.changesets.outputs.hasChangesets == 'false' && + ( + contains(github.event.head_commit.message, 'deploy') || + contains(github.event.head_commit.message, '[ci] release') + ) + ) || + github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest permissions: contents: write @@ -131,14 +136,29 @@ jobs: pattern: ${{ needs.image-tag.outputs.IMAGE_TAG }} - uses: ncipollo/release-action@v1 + id: create_release with: tag: ${{ env.IMAGE_NAME }}@${{ needs.image-tag.outputs.IMAGE_TAG }} makeLatest: true body: ${{ steps.extract-changelog.outputs.markdown }} + skipIfReleaseExists: true + + - name: Check if release was created + id: check_release + run: | + if [ -z "${{ steps.create_release.outputs.html_url }}" ]; then + echo "RELEASE_SKIPPED=true" >> $GITHUB_ENV + else + echo "RELEASE_SKIPPED=false" >> $GITHUB_ENV + fi - name: Discord notification + if: env.RELEASE_SKIPPED == 'false' env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }} uses: Ilshidur/action-discord@0.3.2 with: - args: "# ${{ env.IMAGE_NAME }}@${{ needs.image-tag.outputs.IMAGE_TAG }}\n\n${{ steps.extract-changelog.outputs.markdown }}" + args: | + # ${{ env.IMAGE_NAME }}@${{ needs.image-tag.outputs.IMAGE_TAG }} + + ${{ steps.extract-changelog.outputs.markdown }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 182e1f9..bf249b5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,8 +2,7 @@ name: Release on: push: - branches: - - main + branches: [main] jobs: release: diff --git a/.gitignore b/.gitignore index 6240da8..83e44d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,131 @@ -# build output -dist/ -# generated types -.astro/ - -# dependencies -node_modules/ - -# logs +# Logs +logs +*.log npm-debug.log* yarn-debug.log* yarn-error.log* -pnpm-debug.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm +# Optional eslint cache +.eslintcache -# environment variables +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files .env -.env.production +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for (testing) VSCode extensions +.vscode +.vscode-test -# macOS-specific files -.DS_Store +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..deba411 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,37 @@ +# Dependency directories +node_modules/ +dist/ +build/ +out/ + +# Lock files +pnpm-lock.yaml +package-lock.json +yarn.lock + +# Build and generated files +*.min.* +*.bundle.* +*.map + +# Git and version control +**/.git + +# Framework-specific files +next-env.d.ts +__generated__/ + +# Test and coverage files +coverage/ +*.spec.* +*.test.* + +# Editor-specific files +.vscode/ +.idea/ +*.sublime-project +*.sublime-workspace + +# OS generated files +.DS_Store +Thumbs.db diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..2bdf5f7 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "trailingComma": "es5", + "tabWidth": 2, + "semi": true, + "singleQuote": false, + "endOfLine": "lf", + "htmlWhitespaceSensitivity": "css" +} diff --git a/LICENSE b/LICENSE index 10a5c81..380ce44 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024-present, trueberryless-org +Copyright (c) 2024-present, trueberryless Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/manifest/certificate.yaml b/manifest/certificate.yaml index 7ca3246..38c1bde 100644 --- a/manifest/certificate.yaml +++ b/manifest/certificate.yaml @@ -1,12 +1,12 @@ apiVersion: cert-manager.io/v1 kind: Certificate metadata: - name: starlight-cooler-credit - namespace: starlight-cooler-credit + name: starlight-cooler-credit + namespace: starlight-cooler-credit spec: - secretName: starlight-cooler-credit - issuerRef: - name: acme-issuer - kind: ClusterIssuer - dnsNames: - - "starlight-cooler-credit.trueberryless.org" + secretName: starlight-cooler-credit + issuerRef: + name: acme-issuer + kind: ClusterIssuer + dnsNames: + - "starlight-cooler-credit.trueberryless.org" diff --git a/manifest/deployment.yaml b/manifest/deployment.yaml index 8c689ad..fb2b17b 100644 --- a/manifest/deployment.yaml +++ b/manifest/deployment.yaml @@ -17,5 +17,5 @@ spec: spec: containers: - name: starlight-cooler-credit - image: "trueberryless/starlight-cooler-credit:0.1.9" + image: "trueberryless/starlight-cooler-credit" imagePullPolicy: Always diff --git a/manifest/ingress.yaml b/manifest/ingress.yaml index 3dbff11..cf3db36 100644 --- a/manifest/ingress.yaml +++ b/manifest/ingress.yaml @@ -1,22 +1,22 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: starlight-cooler-credit - namespace: starlight-cooler-credit + name: starlight-cooler-credit + namespace: starlight-cooler-credit spec: - rules: - - host: starlight-cooler-credit.trueberryless.org - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: starlight-cooler-credit - port: - number: 80 + rules: + - host: starlight-cooler-credit.trueberryless.org + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: starlight-cooler-credit + port: + number: 80 - tls: - - hosts: - - starlight-cooler-credit.trueberryless.org - secretName: starlight-cooler-credit + tls: + - hosts: + - starlight-cooler-credit.trueberryless.org + secretName: starlight-cooler-credit diff --git a/manifest/namespace.yaml b/manifest/namespace.yaml index b70cfc0..8990428 100644 --- a/manifest/namespace.yaml +++ b/manifest/namespace.yaml @@ -1,4 +1,4 @@ apiVersion: v1 kind: Namespace metadata: - name: starlight-cooler-credit + name: starlight-cooler-credit diff --git a/manifest/service.yaml b/manifest/service.yaml index 78f472a..ecf8552 100644 --- a/manifest/service.yaml +++ b/manifest/service.yaml @@ -1,13 +1,13 @@ apiVersion: v1 kind: Service metadata: - name: starlight-cooler-credit - namespace: starlight-cooler-credit - annotations: - cert-manager.io/issuer: acme-issuer + name: starlight-cooler-credit + namespace: starlight-cooler-credit + annotations: + cert-manager.io/issuer: acme-issuer spec: - selector: - app: starlight-cooler-credit - ports: - - name: http - port: 80 + selector: + app: starlight-cooler-credit + ports: + - name: http + port: 80 diff --git a/package.json b/package.json index e7e10de..86b9bca 100644 --- a/package.json +++ b/package.json @@ -1,26 +1,28 @@ { - "name": "starlight-cooler-credit-monorepo", - "version": "1.0.0", - "license": "MIT", - "description": "Add a nice credit to Starlight or Astro at the bottom of Table of Contents.", - "scripts": { - "version": "pnpm changeset version && pnpm i --no-frozen-lockfile" - }, - "author": "trueberryless-org", - "type": "module", - "engines": { - "node": "^18.17.1 || ^20.3.0 || >=21.0.0" - }, - "packageManager": "pnpm@9.6.0", - "private": true, - "homepage": "https://github.com/trueberryless-org/starlight-cooler-credit", - "repository": { - "type": "git", - "url": "https://github.com/trueberryless-org/starlight-cooler-credit.git" - }, - "bugs": "https://github.com/trueberryless-org/starlight-cooler-credit/issues", - "devDependencies": { - "@changesets/changelog-github": "^0.5.0", - "@changesets/cli": "^2.27.9" - } + "name": "starlight-cooler-credit-monorepo", + "version": "1.0.0", + "private": true, + "description": "Add a nice credit to Starlight or Astro at the bottom of Table of Contents.", + "homepage": "https://github.com/trueberryless-org/starlight-cooler-credit", + "bugs": { + "url": "https://github.com/trueberryless-org/starlight-cooler-credit/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/trueberryless-org/starlight-cooler-credit.git" + }, + "license": "MIT", + "author": "trueberryless (https://trueberryless.org)", + "type": "module", + "scripts": { + "version": "pnpm changeset version && pnpm i --no-frozen-lockfile" + }, + "devDependencies": { + "@changesets/changelog-github": "^0.5.0", + "@changesets/cli": "^2.27.9" + }, + "packageManager": "pnpm@9.6.0", + "engines": { + "node": "^18.17.1 || ^20.3.0 || >=21.0.0" + } } diff --git a/packages/starlight-cooler-credit/README.md b/packages/starlight-cooler-credit/README.md index 6eeb96d..7f1dc21 100644 --- a/packages/starlight-cooler-credit/README.md +++ b/packages/starlight-cooler-credit/README.md @@ -10,6 +10,6 @@ Check out the `starlight-cooler-credit` getting started guide. ## License -Licensed under the MIT License, Copyright © trueberryless-org. +Licensed under the MIT license, Copyright © trueberryless. -See [LICENSE](https://github.com/trueberryless-org/starlight-cooler-credit/blob/main/LICENSE) for more information. +See [LICENSE](/LICENSE) for more information. diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index ae0e0dc..df1d4eb 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,3 @@ packages: - - "docs/" - - "packages/*" + - "docs/" + - "packages/*"