diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml new file mode 100644 index 00000000..52865912 --- /dev/null +++ b/.github/workflows/website.yml @@ -0,0 +1,53 @@ +name: Website + +on: + push: + branches: + - main + +jobs: + inject-audits: + name: Inject audits + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, '[skip ci]')" + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up node + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: yarn + - name: Install + run: yarn install --immutable + - name: Build + run: yarn build:umd + - name: Inject + run: node scripts/inject-audits-website.mjs + - name: Upload website + uses: actions/upload-pages-artifact@v1 + with: + path: website + + deploy: + name: Deploy + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, '[skip ci]')" + needs: [inject-audits] + permissions: + pages: write + id-token: write + concurrency: + group: website-deploy + cancel-in-progress: true + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up pages + uses: actions/configure-pages@v3 + - name: Deploy + id: deployment + uses: actions/deploy-pages@v1 diff --git a/scripts/inject-audits-website.mjs b/scripts/inject-audits-website.mjs new file mode 100644 index 00000000..3a216e05 --- /dev/null +++ b/scripts/inject-audits-website.mjs @@ -0,0 +1,36 @@ +import fs from 'fs/promises'; +import path from 'path'; + +async function main() { + const openMark = ''; + const closeMark = ''; + + const index = ( + await fs.readFile(path.join('website', 'index.html')) + ).toString(); + const script = ( + await fs.readFile(path.join('umd', 'graphql-http-audits.min.js')) + ).toString(); + + await fs.writeFile( + path.join('website', 'index.html'), + index.replace( + new RegExp(`${openMark}.+?${closeMark}`, 's'), + // match the expected indentation in index.html + `${openMark} + + ${closeMark}`, + ), + ); +} + +main().catch((err) => { + console.error(err); + process.exit(1); +}); diff --git a/website/favicon.ico b/website/favicon.ico new file mode 100644 index 00000000..7d8fbdce Binary files /dev/null and b/website/favicon.ico differ diff --git a/website/index.html b/website/index.html new file mode 100644 index 00000000..88ec5053 --- /dev/null +++ b/website/index.html @@ -0,0 +1,200 @@ + + + + + + + + graphql-http + + + + + + + + + +
+

+ graphql-http +

+

+ Simple, pluggable, zero-dependency, GraphQL over HTTP spec compliant + server, client and audit suite. +

+ +
+ +
+
+ + Check for + GraphQL over HTTP spec + compliance + +
+ +
+ +
+ Please make sure that + CORS + allows this origin on your server. +
+
+
+ +
+
+
+ + + +

+ 💡 Tip: Save this website and use it as a portable offline + compliance checker. +

+ + +
+ + + +