From c3cf2f249a338ae613dd84a3320ce041e1335941 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 6 Oct 2025 12:00:00 +0100 Subject: [PATCH] Add and use build-configs.yaml --- storybook/.envrc | 1 + storybook/.gitignore | 31 ++++--------------------------- storybook/build | 11 +++++++++++ storybook/build-configs.yaml | 3 +++ storybook/clean | 5 +++++ storybook/flake.lock | 27 +++++++++++++++++++++++++++ storybook/flake.nix | 19 +++++++++++++++++++ storybook/watch | 13 +++++++++++++ 8 files changed, 83 insertions(+), 27 deletions(-) create mode 100644 storybook/.envrc create mode 100755 storybook/build create mode 100644 storybook/build-configs.yaml create mode 100755 storybook/clean create mode 100644 storybook/flake.lock create mode 100644 storybook/flake.nix create mode 100755 storybook/watch diff --git a/storybook/.envrc b/storybook/.envrc new file mode 100644 index 000000000..3550a30f2 --- /dev/null +++ b/storybook/.envrc @@ -0,0 +1 @@ +use flake diff --git a/storybook/.gitignore b/storybook/.gitignore index f52343a92..de27f7617 100644 --- a/storybook/.gitignore +++ b/storybook/.gitignore @@ -1,27 +1,4 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* - -node_modules -dist -dist-ssr -*.local - -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? - -*storybook.log -storybook-static +/.direnv/ +/*storybook.log +/node_modules/ +/storybook-static/ diff --git a/storybook/build b/storybook/build new file mode 100755 index 000000000..bf4dabb96 --- /dev/null +++ b/storybook/build @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -euo pipefail + +export PATH="$PATH:./node_modules/.bin" + +: "${NODE_ENV:=production}" + +export STORYBOOK_DISABLE_TELEMETRY=1 + +storybook build "$@" diff --git a/storybook/build-configs.yaml b/storybook/build-configs.yaml new file mode 100644 index 000000000..5661aad66 --- /dev/null +++ b/storybook/build-configs.yaml @@ -0,0 +1,3 @@ +--- +name: oliverdavies.uk-storybook +template: node-storybook diff --git a/storybook/clean b/storybook/clean new file mode 100755 index 000000000..24ab0405f --- /dev/null +++ b/storybook/clean @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -euo pipefail + +rm -rf node_modules storybook-static diff --git a/storybook/flake.lock b/storybook/flake.lock new file mode 100644 index 000000000..934192cd1 --- /dev/null +++ b/storybook/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1759381078, + "narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/storybook/flake.nix b/storybook/flake.nix new file mode 100644 index 000000000..a1ec7980e --- /dev/null +++ b/storybook/flake.nix @@ -0,0 +1,19 @@ +{ + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + outputs = inputs: + let + system = "x86_64-linux"; + pkgs = import inputs.nixpkgs { inherit system; }; + in + { + devShells.${system}.default = + with pkgs; + mkShell { + buildInputs = [ + nodejs + nodePackages.npm + ]; + }; + }; +} diff --git a/storybook/watch b/storybook/watch new file mode 100755 index 000000000..03deaf23e --- /dev/null +++ b/storybook/watch @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -euo pipefail + +export PATH="$PATH:./node_modules/.bin" + +NODE_ENV="${NODE_ENV:-development}" + +storybook dev \ + --exact-port \ + --no-open \ + --port 6006 \ + "$@"