From cafb9521b29cfad7923bc1ee49fe2b3fa611c3e0 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 4 Sep 2023 23:31:37 +0100 Subject: [PATCH] downloads solution --- .config/astro.config.mjs | 3 +- .eslintrc.json | 7 +- .gitignore | 7 +- content/_schemas.ts | 3 +- .../2008-04-04-aperture-file-types/index.md | 4 +- content/articles/2008-06-01-chives/index.md | 4 +- .../index.md | 4 +- .../index.md | 4 +- .../index.md | 2 +- .../2008-08-26-icy-box-icons/index.md | 4 +- .../index.md | 4 +- .../2008-10-23-coffee-cup-icon/index.md | 4 +- .../2009-02-17-out-of-whale-oil/index.md | 4 +- .../index.md | 8 +- .../2009-06-04-twitter-crisp/index.md | 4 +- .../articles/2009-06-24-adiumeetie/index.md | 4 +- content/articles/2009-09-05-delibar/index.md | 2 +- .../articles/2010-02-04-ipixelpad/index.md | 4 +- content/articles/2010-07-03-momcorp/index.md | 4 +- .../2012-08-07-projectpurple/index.md | 4 +- package-lock.json | 211 ++++++++++++++++-- package.json | 11 +- scripts/create-icons/index.ts | 5 +- scripts/move-downloads.ts | 58 +++++ src/{pages => gatsby}/thanks.tsx | 0 src/pages/thanks.astro | 0 26 files changed, 308 insertions(+), 61 deletions(-) create mode 100644 scripts/move-downloads.ts rename src/{pages => gatsby}/thanks.tsx (100%) create mode 100644 src/pages/thanks.astro diff --git a/.config/astro.config.mjs b/.config/astro.config.mjs index b6d8583f..23dbcbd3 100644 --- a/.config/astro.config.mjs +++ b/.config/astro.config.mjs @@ -4,9 +4,10 @@ import remarkToc from './src/lib/remark-toc.mjs' import react from '@astrojs/react' // https://astro.build/config -/** @type {import('astro').AstroUserConfig} */ +/** @type {import('astro/config').AstroUserConfig} */ export default defineConfig({ site: 'https://kremalicious.com', + output: 'static', markdown: { remarkPlugins: [remarkLeadParagraph, remarkToc], shikiConfig: { diff --git a/.eslintrc.json b/.eslintrc.json index 11cfdfd8..45037494 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,11 +1,5 @@ { "root": true, - "env": { - "browser": true, - "node": true, - "es2020": true, - "jest": true - }, "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": "latest", @@ -18,6 +12,7 @@ "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", + "plugin:astro/recommended", "plugin:prettier/recommended" ], "rules": { diff --git a/.gitignore b/.gitignore index 7f23391f..b9813c08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,17 @@ node_modules .yarnclean .cache -plugins/gatsby-redirect-from coverage .env .env.development .nova -src/@types/Gatsby.d.ts # build output dist/ src/images/icons/ # generated types -.astro/ \ No newline at end of file +.astro/ + +# autogenerated stuff +public/get/ \ No newline at end of file diff --git a/content/_schemas.ts b/content/_schemas.ts index 9412871d..9026beac 100644 --- a/content/_schemas.ts +++ b/content/_schemas.ts @@ -23,7 +23,8 @@ const schemaShared = { author: z.string().optional(), featured: z.boolean().optional(), style: z.string().optional(), - toc: z.boolean().optional() + toc: z.boolean().optional(), + slug: z.string().optional() } export const schemaArticles = (image: ImageFunction) => diff --git a/content/articles/2008-04-04-aperture-file-types/index.md b/content/articles/2008-04-04-aperture-file-types/index.md index 1a05adbe..c3e3be47 100644 --- a/content/articles/2008-04-04-aperture-file-types/index.md +++ b/content/articles/2008-04-04-aperture-file-types/index.md @@ -1,7 +1,7 @@ --- title: Aperture File Types image: ./Teaser-Aperture-File-Types.jpg -download: ./aperturefiletypes_by_kremalicious.zip +download: /get/aperturefiletypes_by_kremalicious.zip author: Matthias Kretschmann date: 2008-04-04T01:55:54.000Z @@ -29,7 +29,7 @@ These icons are free for your personal use and include icons for all file types Get them and have fun.

- Download + Download

And don't forget to read my article about [how to change the generic image icons in Mac OS X Leopard](/changing-the-image-icons-in-mac-os-x-leopard/). diff --git a/content/articles/2008-06-01-chives/index.md b/content/articles/2008-06-01-chives/index.md index be95eb82..0e8c64c4 100644 --- a/content/articles/2008-06-01-chives/index.md +++ b/content/articles/2008-06-01-chives/index.md @@ -1,7 +1,7 @@ --- title: Chives image: ./Teaser-Chives.jpg -download: ./chives_by_kremalicious.zip +download: /get/chives_by_kremalicious.zip author: Matthias Kretschmann date: 2008-06-01 18:43:40+00:00 @@ -19,5 +19,5 @@ I have added my first wallpaper to the Goodies section on this website. It's a s You can get the wallpaper by browsing [my Goodies section](https://kremalicious.com/goodies/) and clicking on the download link for the wallpaper. The download package also includes a custom folder icon (512px as .icns, .png, .ico) with the Chives wallpaper on it.

- Download Chives Wallpaper + Download Chives Wallpaper

diff --git a/content/articles/2008-06-03-niepces-camera-obscura-and-the-history-of-the-first-photograph/index.md b/content/articles/2008-06-03-niepces-camera-obscura-and-the-history-of-the-first-photograph/index.md index 9c6deb08..e871190c 100644 --- a/content/articles/2008-06-03-niepces-camera-obscura-and-the-history-of-the-first-photograph/index.md +++ b/content/articles/2008-06-03-niepces-camera-obscura-and-the-history-of-the-first-photograph/index.md @@ -1,7 +1,7 @@ --- title: Niépce's Camera Obscura And The History Of The First Photograph image: ./Teaser-Camera-Obscura-Icons.jpg -download: ./niepces_camera_obscura_by_kremalicious.zip +download: /get/niepces_camera_obscura_by_kremalicious.zip date: 2008-06-03 14:34:03+00:00 @@ -92,7 +92,7 @@ Brief description of Daguerres role in the invention of photography process by T This icon package was exclusively announced first on [MacThemes](http://macthemes2.net) and you can download it from the [Goodies section on this website](/goodies/) or directly via this link:

- Download + Download

In addition to these icons you can download the [associated wallpapers for your desktop or your iPhone](http://www.kremalicious.com/2008/06/new-goodie-niepces-camera-obscura-wallpaper-pack/). diff --git a/content/articles/2008-06-03-niepces-camera-obscura-wallpaper-pack/index.md b/content/articles/2008-06-03-niepces-camera-obscura-wallpaper-pack/index.md index c876eede..f3edfec7 100644 --- a/content/articles/2008-06-03-niepces-camera-obscura-wallpaper-pack/index.md +++ b/content/articles/2008-06-03-niepces-camera-obscura-wallpaper-pack/index.md @@ -1,7 +1,7 @@ --- title: Niépce's Camera Obscura Wallpaper Pack image: ./Teaser-Camera-Obscura-Walls.jpg -download: ./niepces_camera_obscura_wallpaper_pack_by_kremalicious.zip +download: /get/niepces_camera_obscura_wallpaper_pack_by_kremalicious.zip author: Matthias Kretschmann date: 2008-06-03 13:32:24+00:00 @@ -19,7 +19,7 @@ In addition to my Niépce's Camera Obscura icons for Aperture and iPhoto I have All Wallpapers are using a custom designed background which imitates the look of a metal plate like it was used in Niépce's experiments although it wasn't golden. To make it more Mac style I have added a stenciled dots pattern (which is a commonly used reference to the front design of the MacPro).

- Download Niépce's Camera Obscura Wallpaper + Download Niépce's Camera Obscura Wallpaper

Here are the details: diff --git a/content/articles/2008-06-19-ubuntu-as-mac-file-server-and-time-machine-volume/index.md b/content/articles/2008-06-19-ubuntu-as-mac-file-server-and-time-machine-volume/index.md index f3763d9c..d4baf83b 100644 --- a/content/articles/2008-06-19-ubuntu-as-mac-file-server-and-time-machine-volume/index.md +++ b/content/articles/2008-06-19-ubuntu-as-mac-file-server-and-time-machine-volume/index.md @@ -376,7 +376,7 @@ Here you can see the icons included in the Server Displays icon pack: Because I've just modified Apple's standard icons these icons are just available via this blog post and they will not show up in my Goodies section. Just download the whole package directly via this link:

- Download Server Display Icons zip + Download Server Display Icons zip

### How to use the icons diff --git a/content/articles/2008-08-26-icy-box-icons/index.md b/content/articles/2008-08-26-icy-box-icons/index.md index f5e8ffc0..33d3188b 100644 --- a/content/articles/2008-08-26-icy-box-icons/index.md +++ b/content/articles/2008-08-26-icy-box-icons/index.md @@ -1,7 +1,7 @@ --- title: Icy Box Icons image: ./Teaser-Icy-Box.jpg -download: ./icybox_by_kremalicious.zip +download: /get/icybox_by_kremalicious.zip date: 2008-08-26 19:16:38+00:00 @@ -20,7 +20,7 @@ As always these desktop icons are free for you personal and non-commercial use. The whole package includes 7 icons either packed in a nice tagged iContainer for use with Candybar or in Mac + Win + Linux compatible formats. If you have such an Icy Box case grab the icons. Have fun!

- Download Icy Box Icons zip + Download Icy Box Icons zip

- Replacement icons for the silver and black Icy Box external aluminium case with USB interface diff --git a/content/articles/2008-09-23-futurama-mars-university-wallpaper/index.md b/content/articles/2008-09-23-futurama-mars-university-wallpaper/index.md index aa2ce71a..50ecf278 100644 --- a/content/articles/2008-09-23-futurama-mars-university-wallpaper/index.md +++ b/content/articles/2008-09-23-futurama-mars-university-wallpaper/index.md @@ -1,7 +1,7 @@ --- title: Futurama Mars University Wallpaper image: ./Teaser-Mars-U.jpg -download: ./mars-u-wall-by-kremalicious.zip +download: /get/mars-u-wall-by-kremalicious.zip author: Matthias Kretschmann date: 2008-09-23 23:22:16+00:00 @@ -18,5 +18,5 @@ redirect_from: Show your geeky love for extraterrestrial universities! This is a simple Futurama tribute wallpaper displaying the logo of the Mars University as seen in the first season (1ACV11/S02E02). But I've modified it a bit to get it out of the 2D. Including one high-resolution desktop version for widescreen displays (2560x1600) and one iPhone version (320x480).

- Download Futurama Mars U Wallpaper zip + Download Futurama Mars U Wallpaper zip

diff --git a/content/articles/2008-10-23-coffee-cup-icon/index.md b/content/articles/2008-10-23-coffee-cup-icon/index.md index 0139c33c..b52ef837 100644 --- a/content/articles/2008-10-23-coffee-cup-icon/index.md +++ b/content/articles/2008-10-23-coffee-cup-icon/index.md @@ -1,7 +1,7 @@ --- title: Coffee Cup Icon image: ./Teaser-Coffee-Cup-Icon.jpg -download: ./coffee_cup_by_kremalicious.zip +download: /get/coffee_cup_by_kremalicious.zip author: Matthias Kretschmann date: 2008-10-23 14:59:23+00:00 @@ -22,5 +22,5 @@ I’ve just released my own coffee cup icon, enjoy: ## Download

- Download Coffee Cup Icons + Download Coffee Cup Icons

diff --git a/content/articles/2009-02-17-out-of-whale-oil/index.md b/content/articles/2009-02-17-out-of-whale-oil/index.md index 50a826c4..4b28c993 100644 --- a/content/articles/2009-02-17-out-of-whale-oil/index.md +++ b/content/articles/2009-02-17-out-of-whale-oil/index.md @@ -1,7 +1,7 @@ --- title: We Are Out Of Whale Oil image: ./Teaser-Out-Of-Whale-Oil.jpg -download: ./out-of-whale-oil-wall-by-kremalicious.zip +download: /get/out-of-whale-oil-wall-by-kremalicious.zip date: 2009-02-17 20:11:55+00:00 @@ -29,5 +29,5 @@ Simple, high-resolution Futurama tribute wallpaper pack inspired by the latest F Seriously, the pink versions are burning my eyes but the pink is a good reference to the events in the recent movie.

- Download + Download

diff --git a/content/articles/2009-03-29-ultimate-coda-wordpress-share-link-bonanza/index.md b/content/articles/2009-03-29-ultimate-coda-wordpress-share-link-bonanza/index.md index 7c1a00fb..119a3fee 100644 --- a/content/articles/2009-03-29-ultimate-coda-wordpress-share-link-bonanza/index.md +++ b/content/articles/2009-03-29-ultimate-coda-wordpress-share-link-bonanza/index.md @@ -1,6 +1,6 @@ --- title: Ultimate Share Link Bonanza For Coda, WordPress And Everything Else -download: ./share-link-bonanza-coda-clips.zip +download: /get/share-link-bonanza-coda-clips.zip date: 2009-03-29 23:12:15+00:00 @@ -28,7 +28,7 @@ But I think you don't want to load tons of scripts on your websites if you inclu To make this a bit more straightforward I provide these links compiled within two Coda Clip files for use with [Panic's Coda](http://panic.com/coda). While the first clip group contains all the plain link snippets the second group includes those snippets for use with Wordpress. Just download and add them to your Coda Clips collection: -Download Share Links Coda Clips +Download Share Links Coda Clips Included are a **total of 40 share links per clip group** for the following social/bookmark sites. This list uses the links provided in the Coda clips so you can test them out here with this article: @@ -41,7 +41,7 @@ _ If you download the above Coda Clip files this icon is already applied on the clip files but here're just the icon files (icns, folder, iContainer, PNGs): -Download Coda Clips Icon +Download Coda Clips Icon ## 2. Usage @@ -142,7 +142,7 @@ If you want to use just icons and no text you should provide a link text anyway Sadly Coda's clips aren't in a portable format ([Panic guys](http://panic.com), consider this is a feature request!) so here's a comprehensive list for the non-Coda users of all the links included in the above Coda Clips with plain and the Wordpress version for every site. This comes as a downloadable stripped-down HTML file (meaning there's no HTML site structure included) and as a long list within in this article. First, here's the HTML file download. Just open this locally in your browser or in your favorite editor: -Download Share Links HTML File +Download Share Links HTML File And here's the huge list with all the share links in case you quickly want to grab just one of them. But be warned that this is a huge list so this is hidden by default. diff --git a/content/articles/2009-06-04-twitter-crisp/index.md b/content/articles/2009-06-04-twitter-crisp/index.md index cb93d113..bf6b3524 100644 --- a/content/articles/2009-06-04-twitter-crisp/index.md +++ b/content/articles/2009-06-04-twitter-crisp/index.md @@ -1,7 +1,7 @@ --- title: Twitter Crisp image: ./Teaser-Twitter-Crisp.jpg -download: ./twitter-crisp-by-kremalicious.zip +download: /get/twitter-crisp-by-kremalicious.zip author: Matthias Kretschmann date: 2009-06-04 00:16:40+00:00 @@ -16,7 +16,7 @@ Here's a quick twitter icon for use on your websites which is kind of a by-produ This icon comes in various formats (PNG, ICNS, iContainer) and in 4 different sizes (128px, 48px, 32px, 16px) with each icon size redrawn (of course).

- Download + Download

Use them on any web project you like and/or [convert them into a send to twitter link](http://kremalicious.com/ultimate-coda-wordpress-share-link-bonanza/). Have fun! diff --git a/content/articles/2009-06-24-adiumeetie/index.md b/content/articles/2009-06-24-adiumeetie/index.md index 409a8164..a590419a 100644 --- a/content/articles/2009-06-24-adiumeetie/index.md +++ b/content/articles/2009-06-24-adiumeetie/index.md @@ -1,7 +1,7 @@ --- title: Adiumeetie. Tweetie Style Adium Icon image: ./Teaser-Adiumeetie.jpg -download: ./adiumeetie-by-kremalicious.zip +download: /get/adiumeetie-by-kremalicious.zip date: 2009-06-24 21:00:38+00:00 @@ -26,7 +26,7 @@ The icon comes in various formats (iContainer, icns, png) in sizes from 512px-16 Just head over [to my Goodies page](http://www.kremalicious.com/goodies/) or click the following download button and grab this icon while it's hot.

- Download + Download

## Adium Icon Usage diff --git a/content/articles/2009-09-05-delibar/index.md b/content/articles/2009-09-05-delibar/index.md index 6f710f13..baee66b9 100644 --- a/content/articles/2009-09-05-delibar/index.md +++ b/content/articles/2009-09-05-delibar/index.md @@ -22,7 +22,7 @@ But the default menubar icon and the other interface icons look quite disturbing Just head over [to my Goodies page](http://www.kremalicious.com/goodies/) or click the following download button and grab these replacement icons.

- Download + Download

## Icon Usage diff --git a/content/articles/2010-02-04-ipixelpad/index.md b/content/articles/2010-02-04-ipixelpad/index.md index 22adb614..d8f61010 100644 --- a/content/articles/2010-02-04-ipixelpad/index.md +++ b/content/articles/2010-02-04-ipixelpad/index.md @@ -1,7 +1,7 @@ --- title: iPixelPad - Tongue Twisting But Crisp iPad Icons image: ./Teaser-iPixelPad.png -download: ./ipixelpad_by_kremalicious.zip +download: /get/ipixelpad_by_kremalicious.zip date: 2010-02-04 15:21:42+00:00 tags: @@ -29,7 +29,7 @@ The homescreen icons pixels in the 16px version needed all more vivid colors to The icons come in various formats: iContainer, ICNS, ICO and PNG files for each size. Just click the following download button to grab the whole pack:

- Download + Download

## License diff --git a/content/articles/2010-07-03-momcorp/index.md b/content/articles/2010-07-03-momcorp/index.md index 3cc9719d..5f790259 100644 --- a/content/articles/2010-07-03-momcorp/index.md +++ b/content/articles/2010-07-03-momcorp/index.md @@ -1,7 +1,7 @@ --- title: MomCorp Wallpaper image: ./Teaser-MomCorp-Wall.png -download: ./momcorp_wall_by_kremalicious.zip +download: /get/momcorp_wall_by_kremalicious.zip author: Matthias Kretschmann date: 2010-07-03 17:12:53+00:00 @@ -23,6 +23,6 @@ The wallpaper comes in four versions with two color variations and two text vari You can grab the full zip-package with versions for Desktop, iPad, iPhone & Android included:

- Download + Download Donate

diff --git a/content/articles/2012-08-07-projectpurple/index.md b/content/articles/2012-08-07-projectpurple/index.md index e217e770..a25c5d3a 100644 --- a/content/articles/2012-08-07-projectpurple/index.md +++ b/content/articles/2012-08-07-projectpurple/index.md @@ -1,7 +1,7 @@ --- title: Project Purple image: ./Teaser-Project-Purple.png -download: ./project-purple-kremalicious.zip +download: /get/project-purple-kremalicious.zip author: Matthias Kretschmann date: 2012-08-07 13:15:44+00:00 @@ -30,7 +30,7 @@ The full size I designed the wallpaper in is 3200x2048px. I don't know why Apple Download the whole package with all the sizes included or grab the individual ones from the list, all linked to the image files:

- Download zip + Download zip

- [Desktop/rMBP/iPad 3 (3200x2048)](./project-purple-kremalicious.png) diff --git a/package-lock.json b/package-lock.json index ea6737fa..f4555dad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,6 +48,8 @@ "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-react": "^7.33.2", "eslint-plugin-testing-library": "^6.0.1", + "front-matter": "^4.0.2", + "glob": "^10.3.4", "hast-util-to-html": "^9.0.0", "jest": "^29.6.4", "jest-environment-jsdom": "^29.6.4", @@ -1586,6 +1588,26 @@ "dev": true, "license": "MIT" }, + "node_modules/@jest/reporters/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@jest/reporters/node_modules/has-flag": { "version": "4.0.0", "dev": true, @@ -7748,14 +7770,46 @@ } } }, + "node_modules/front-matter": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/front-matter/-/front-matter-4.0.2.tgz", + "integrity": "sha512-I8ZuJ/qG92NWX8i5x1Y8qyj3vizhXS31OxjKDu3LKP+7/qBgfIKValiZIEwoVoJKUHlhWtYrktkxV1XsX+pPlg==", + "dev": true, + "dependencies": { + "js-yaml": "^3.13.1" + } + }, + "node_modules/front-matter/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/front-matter/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/fs-constants": { "version": "1.0.0", "license": "MIT" }, "node_modules/fs.realpath": { "version": "1.0.0", - "devOptional": true, - "license": "ISC" + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "devOptional": true }, "node_modules/fsevents": { "version": "2.3.2", @@ -7885,19 +7939,22 @@ "license": "ISC" }, "node_modules/glob": { - "version": "7.2.3", - "devOptional": true, - "license": "ISC", + "version": "10.3.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.4.tgz", + "integrity": "sha512-6LFElP3A+i/Q8XQKEvZjkEWEOTgAIALR9AO2rwT8bgPhDd1anmqDJDZ6lLddI4ehxxxR1S5RIqKe1uapMQfYaQ==", + "dev": true, "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/cjs/src/bin.js" }, "engines": { - "node": "*" + "node": ">=16 || 14 >=14.17" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -7914,6 +7971,30 @@ "node": ">=10.13.0" } }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/global-modules": { "version": "2.0.0", "dev": true, @@ -8659,8 +8740,9 @@ }, "node_modules/inflight": { "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "devOptional": true, - "license": "ISC", "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -9757,6 +9839,26 @@ "dev": true, "license": "MIT" }, + "node_modules/jest-config/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/jest-config/node_modules/has-flag": { "version": "4.0.0", "dev": true, @@ -10733,6 +10835,26 @@ "dev": true, "license": "MIT" }, + "node_modules/jest-runtime/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/jest-runtime/node_modules/has-flag": { "version": "4.0.0", "dev": true, @@ -13776,8 +13898,9 @@ }, "node_modules/path-is-absolute": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "devOptional": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -15540,6 +15663,26 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/rollup": { "version": "3.28.1", "license": "MIT", @@ -16619,6 +16762,26 @@ "url": "https://opencollective.com/stylus" } }, + "node_modules/stylus/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "devOptional": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/suf-log": { "version": "2.5.3", "dev": true, @@ -16808,6 +16971,26 @@ "node": ">=8" } }, + "node_modules/test-exclude/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/text-encoding-utf-8": { "version": "1.0.2" }, diff --git a/package.json b/package.json index c6947776..2c5a80f2 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,9 @@ "license": "MIT", "type": "module", "scripts": { - "start": "npm run create:icons && astro dev --config .config/astro.config.mjs", - "build": "npm run create:icons && astro build --config .config/astro.config.mjs", + "prebuild": "npm run create:icons && npm run move:downloads", + "start": "npm run prebuild && astro dev --config .config/astro.config.mjs", + "build": "npm run prebuild && astro build --config .config/astro.config.mjs", "preview": "astro preview", "astro": "astro", "test": "astro check && tsc --noEmit && npm run lint && npm run type-check && npm run jest", @@ -21,7 +22,9 @@ "type-check": "tsc --noEmit", "deploy:s3": "./scripts/deploy-s3.sh", "new": "ts-node --esm scripts/new.ts", - "create:icons": "ts-node --esm scripts/create-icons/index.ts" + "create:icons": "ts-node --esm scripts/create-icons/index.ts", + "move:downloads": "ts-node --esm scripts/move-downloads.ts", + "create:redirects": "ts-node --esm scripts/redirect-from.ts" }, "dependencies": { "@astrojs/react": "^3.0.0", @@ -63,6 +66,8 @@ "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-react": "^7.33.2", "eslint-plugin-testing-library": "^6.0.1", + "front-matter": "^4.0.2", + "glob": "^10.3.4", "hast-util-to-html": "^9.0.0", "jest": "^29.6.4", "jest-environment-jsdom": "^29.6.4", diff --git a/scripts/create-icons/index.ts b/scripts/create-icons/index.ts index 4dbac437..8170607e 100644 --- a/scripts/create-icons/index.ts +++ b/scripts/create-icons/index.ts @@ -4,6 +4,7 @@ // import fs from 'node:fs/promises' import ps from 'node:path/posix' +import ora from 'ora' import { toAstroComponent, toInnerSvg } from './svg.ts' // Current directory. @@ -21,6 +22,8 @@ const distDir = ps.resolve(currentDir, 'src/images/icons') // Data related to each icon exported by this package. const icons = [] +const spinner = ora('Create icon components').start() + // clean the distribution directory await fs.rm(distDir, { force: true, recursive: true }) await fs.mkdir(distDir, { recursive: true }) @@ -86,4 +89,4 @@ for (const src of srcDirs) { // write the main entry `index.ts` file await fs.writeFile(ps.resolve(distDir, 'index.ts'), contentOfIndexJS, 'utf8') -console.log(`✔️ Generated ${icons.length} icons into @images/icons.`) +spinner.succeed(`Generated ${icons.length} icons into @images/icons.`) diff --git a/scripts/move-downloads.ts b/scripts/move-downloads.ts new file mode 100644 index 00000000..7840fd4e --- /dev/null +++ b/scripts/move-downloads.ts @@ -0,0 +1,58 @@ +// +// Find all zip files in all article folders +// and copy them to public/get/ folder. +// +import fs from 'node:fs' +import path from 'node:path' +import { glob } from 'glob' +import ora from 'ora' + +const sourceFolder = './content/articles/' +const destinationFolder = './public/get/' +const filesGlob = '**/*.zip' + +const spinner = ora('Move downloads').start() + +function removeFolderContents(folderPath: string) { + if (fs.existsSync(folderPath)) { + fs.readdirSync(folderPath).forEach((file) => { + const filePath = path.join(folderPath, file) + if (fs.lstatSync(filePath).isDirectory()) { + removeFolderContents(filePath) + fs.rmdirSync(filePath) + } else { + fs.unlinkSync(filePath) + } + }) + } +} + +function copyZipFiles(source: string, destination: string) { + // Clean out the destination folder + removeFolderContents(destination) + + // Create the destination folder if it doesn't exist + if (!fs.existsSync(destination)) { + fs.mkdirSync(destination, { recursive: true }) + } + + // Find all files recursively in the source folder + const zipFiles = glob.sync(filesGlob, { cwd: source }) + + zipFiles.forEach((zipFile: string) => { + const sourcePath = path.join(source, zipFile) + const destinationPath = path.join(destination, path.basename(zipFile)) + + try { + // Copy the file to the destination folder + fs.copyFileSync(sourcePath, destinationPath) + } catch (error: any) { + spinner.fail(`Error copying ${zipFile}: ${(error as Error).message}`) + return + } + }) + + spinner.succeed(`Copied ${zipFiles.length} .zip files to ${destination}`) +} + +copyZipFiles(sourceFolder, destinationFolder) diff --git a/src/pages/thanks.tsx b/src/gatsby/thanks.tsx similarity index 100% rename from src/pages/thanks.tsx rename to src/gatsby/thanks.tsx diff --git a/src/pages/thanks.astro b/src/pages/thanks.astro new file mode 100644 index 00000000..e69de29b