From 2f2cb1221cdcb571688767dd6674df7e2e8e3593 Mon Sep 17 00:00:00 2001 From: Philipp Melab Date: Wed, 24 Jan 2024 12:13:07 +0100 Subject: [PATCH] chore(SLB-201): use shared version of @amazeelabs/gatsby-plugin-static-dirs --- apps/website/package.json | 2 +- packages/gatsby-plugin-static-dirs/README.md | 20 ----------- .../gatsby-plugin-static-dirs/gatsby-node.js | 35 ------------------- .../gatsby-plugin-static-dirs/package.json | 20 ----------- .../gatsby-plugin-static-dirs/tsconfig.json | 5 --- pnpm-lock.yaml | 12 +++++-- 6 files changed, 11 insertions(+), 83 deletions(-) delete mode 100644 packages/gatsby-plugin-static-dirs/README.md delete mode 100644 packages/gatsby-plugin-static-dirs/gatsby-node.js delete mode 100644 packages/gatsby-plugin-static-dirs/package.json delete mode 100644 packages/gatsby-plugin-static-dirs/tsconfig.json diff --git a/apps/website/package.json b/apps/website/package.json index a2ecbd7a1..91ebb34d8 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -5,7 +5,7 @@ "@amazeelabs/bridge-gatsby": "^1.2.7", "@amazeelabs/cloudinary-responsive-image": "^1.6.15", "@amazeelabs/gatsby-plugin-operations": "^1.1.3", - "@amazeelabs/gatsby-plugin-static-dirs": "workspace:*", + "@amazeelabs/gatsby-plugin-static-dirs": "^1.0.1", "@amazeelabs/gatsby-source-silverback": "^1.13.10", "@amazeelabs/publisher": "^2.4.17", "@amazeelabs/strangler-netlify": "^1.1.9", diff --git a/packages/gatsby-plugin-static-dirs/README.md b/packages/gatsby-plugin-static-dirs/README.md deleted file mode 100644 index 310dd0185..000000000 --- a/packages/gatsby-plugin-static-dirs/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Static directories plugin - -Gatsby plugin for adding multiple static directories. It allows to map any -directory to a subdirectory of static assets. - -Configuration: - -```js -export const plugins = [ - { - resolve: '@amazeelabs/gatsby-plugin-static-dirs', - options: { - directories: { - 'some/root/assets': '/', - 'path/to/admin/app': '/admin', - }, - }, - }, -]; -``` diff --git a/packages/gatsby-plugin-static-dirs/gatsby-node.js b/packages/gatsby-plugin-static-dirs/gatsby-node.js deleted file mode 100644 index 36ee6f25b..000000000 --- a/packages/gatsby-plugin-static-dirs/gatsby-node.js +++ /dev/null @@ -1,35 +0,0 @@ -import { cpSync } from 'fs'; -import serve from 'serve-static'; - -/** - * @type {import('gatsby').GatsbyNode['pluginOptionsSchema']} - */ -export const pluginOptionsSchema = ({ Joi }) => { - return Joi.object({ - directories: Joi.object().pattern(Joi.string(), Joi.string()), - }); -}; - -/** - * @type {import('gatsby').GatsbyNode['onPreBuild']} - */ -export const onPreBuild = (_, options) => { - Object.keys(options.directories).forEach((src) => { - const dest = options.directories[src]; - cpSync(src, `public${dest}`, { - force: true, - recursive: true, - errorOnExist: false, - }); - }); -}; - -/** - * @type {import('gatsby').GatsbyNode['onCreateDevServer']} - */ -export const onCreateDevServer = ({ app }, options) => { - Object.keys(options.directories).forEach((src) => { - const dest = options.directories[src]; - app.use(dest, serve(src)); - }); -}; diff --git a/packages/gatsby-plugin-static-dirs/package.json b/packages/gatsby-plugin-static-dirs/package.json deleted file mode 100644 index 2fb16e940..000000000 --- a/packages/gatsby-plugin-static-dirs/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "@amazeelabs/gatsby-plugin-static-dirs", - "version": "1.0.0", - "description": "", - "main": "gatsby-node.js", - "type": "module", - "scripts": { - "test": "tsc --noEmit" - }, - "keywords": [], - "author": "", - "license": "ISC", - "devDependencies": { - "gatsby": "^5.13.1", - "typescript": "^5.3.3" - }, - "dependencies": { - "serve-static": "^1.15.0" - } -} diff --git a/packages/gatsby-plugin-static-dirs/tsconfig.json b/packages/gatsby-plugin-static-dirs/tsconfig.json deleted file mode 100644 index 08ac60b6c..000000000 --- a/packages/gatsby-plugin-static-dirs/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "checkJs": true - } -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f4a2b672c..ed4d5ed64 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -186,8 +186,8 @@ importers: specifier: ^1.1.3 version: 1.1.3 '@amazeelabs/gatsby-plugin-static-dirs': - specifier: workspace:* - version: link:../../packages/gatsby-plugin-static-dirs + specifier: ^1.0.1 + version: 1.0.1 '@amazeelabs/gatsby-source-silverback': specifier: ^1.13.10 version: 1.13.10(@types/node@18.19.4)(gatsby@5.13.1)(typescript@4.9.5) @@ -806,6 +806,14 @@ packages: - supports-color dev: false + /@amazeelabs/gatsby-plugin-static-dirs@1.0.1: + resolution: {integrity: sha512-G14E5Vdn6crri7Pq499gQIUd9LVlcRxMGJnGFApZy4tZxILyht/f3t5TOIF1a5L3ULwNcMLsONvfWlaQEAh1mg==} + dependencies: + serve-static: 1.15.0 + transitivePeerDependencies: + - supports-color + dev: false + /@amazeelabs/gatsby-silverback-cloudinary@1.2.7: resolution: {integrity: sha512-LUhtYau6zFZPTtE0hut0MmoTu4eFI9YUkiBNLHN02EsZlCrPrP0pdyWTqByGsL10WIvQ4bry0dPotKoqZVnx8g==} dev: false