From e99aa522ca0805ce844223f1dde2dcff4fbb4a4b Mon Sep 17 00:00:00 2001 From: nichoth Date: Thu, 17 Oct 2024 11:52:18 -0700 Subject: [PATCH] switch to gh pages --- .github/workflows/gh-pages.yml | 54 ++++++++++++++++++++++++++++++++++ .gitignore | 1 + README.md | 10 ++++++- package.json | 6 ++-- 4 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/gh-pages.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000..88574b2 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,54 @@ +# Sample workflow for building and deploying a Jekyll site to GitHub Pages +name: GitHub Pages deploy + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run +# in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production +# deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Install + run: npm install + - name: Build + run: npm run build-example + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: public/ + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index 15a6620..a6dfe57 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ dist example/node_modules example/100-*.jpg package-lock.json +example/public diff --git a/README.md b/README.md index 95132ae..958950a 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,20 @@ ![tests](https://github.com/bicycle-codes/image/actions/workflows/nodejs.yml/badge.svg) [![types](https://img.shields.io/npm/types/@bicycle-codes/image)](README.md) [![module](https://img.shields.io/badge/module-ESM%2FCJS-blue)](README.md) +[![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&style=flat-square)](https://semver.org/) +[![Common Changelog](https://nichoth.github.io/badge/common-changelog.svg)](./CHANGELOG.md) +[![install size](https://packagephobia.com/badge?p=@bicycle-codes/image)](https://packagephobia.com/result?p=@bicycle-codes/image) [![license](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE) Create responsive image tags. +

Contents

+ +
+ ## install -``` + +```sh npm i -S @bicycle-codes/image ``` diff --git a/package.json b/package.json index 16e27f8..8403978 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ }, "scripts": { "start": "npm run build && ./bin/resize.js ./example/100.jpg -o ./example && cd example && rm -rf ./node_modules && npm i && npm start", - "build-example": "npm run build && ./bin/resize.js ./example/100.jpg -o ./example && cd example && rm -rf ./node_modules && npm i && npx vite build && cp ./100* ./dist", + "build-example": "npm run build && ./bin/resize.js ./example/100.jpg -o ./example && cd example && rm -rf ./node_modules && npm ci && VITE_DEBUG_MODE=staging vite build --mode staging --base=\"/image\" && mkdir -p ./public && cp ./100* ./public", "lint": "eslint \"./**/*.{ts,js}\"", "test": "npm run lint && node test/cli.js | tap-spec && npm run test-html", "test-html": "npm run lint && node test/index.js | tap-spec", @@ -19,8 +19,9 @@ "build": "mkdir -p ./dist && rm -rf ./dist/* && npm run build-cjs && tsc --project tsconfig.build.json && npm run cp-css && npm run build-tonic && npm run build-bin", "build-tonic": "cp ./src/cloudinary/tonic.js ./dist/cloudinary && cp ./src/tonic.js ./dist", "cp-css": "cp ./src/*.css ./dist", + "toc": "markdown-toc --maxdepth 3 -i README.md", "preversion": "npm run lint", - "version": "auto-changelog -p --template keepachangelog --breaking-pattern 'BREAKING CHANGE:' && git add CHANGELOG.md", + "version": "npm run toc && auto-changelog -p --template keepachangelog --breaking-pattern 'BREAKING CHANGE:' && git add CHANGELOG.md README.md", "postversion": "git push && git push --tags && npm publish", "prepublishOnly": "npm run build" }, @@ -47,6 +48,7 @@ "eslint": "^8.57.0", "eslint-config-standard": "^17.1.0", "htm": "^3.1.1", + "markdown-toc": "^1.2.0", "postcss-import": "^16.1.0", "postcss-nesting": "^13.0.0", "tap-spec": "^5.0.0",