zauberflote 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.env ADDED
@@ -0,0 +1 @@
1
+ TOKEN=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
package/.env.example ADDED
@@ -0,0 +1,4 @@
1
+ # NPM Credentials
2
+ # To publish publicly, you need an NPM token.
3
+ # Generate one at npmjs.com and paste it here.
4
+ NPM_TOKEN=your_npm_token_here
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # @book/ui
2
+
3
+ Formal UI library for the working examples book.
4
+
5
+ ## Local Use
6
+
7
+ To publish locally (increments version and creates a package):
8
+ ```bash
9
+ ./publish_local.sh --bump
10
+ ```
11
+
12
+ To use in another project:
13
+ ```bash
14
+ npm install ../path/to/libraries/ui
15
+ ```
16
+
17
+ ## Public Publication
18
+
19
+ 1. Copy `.env.example` to `.env` and add your `NPM_TOKEN`.
20
+ 2. Run the publication script:
21
+ ```bash
22
+ ./publish_public.sh
23
+ ```
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "zauberflote",
3
+ "version": "1.0.0",
4
+ "description": "Shared UI components for the working examples book.",
5
+ "type": "module",
6
+ "main": "src/ui.js",
7
+ "scripts": {
8
+ "publish:local": "./publish_local.sh",
9
+ "publish:public": "./publish_public.sh",
10
+ "test": "echo \"No tests yet\" && exit 0"
11
+ },
12
+ "author": "",
13
+ "license": "ISC"
14
+ }
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ VERSION=$(grep "version": package.json | cut -d '"' -f 4)
5
+ echo "📦 Current version: $VERSION"
6
+
7
+ if [[ "${1:-}" == "--bump" ]]; then
8
+ # Basic version bump (increments patch)
9
+ NEW_VERSION=$(echo $VERSION | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
10
+ sed -i '' "s/"version": "$VERSION"/"version": "$NEW_VERSION"/" package.json
11
+ VERSION=$NEW_VERSION
12
+ echo "🚀 Bumped to version: $VERSION"
13
+ fi
14
+
15
+ # In JS, "publishing locally" can mean creating a tarball
16
+ echo "🔨 Packaging..."
17
+ npm pack
18
+
19
+ echo "✅ UI Library is ready for local use."
20
+ echo "To use it in an app, you can install the tarball or link the directory:"
21
+ echo "npm install ../path/to/libraries/ui"
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ if [ ! -f .env ]; then
5
+ echo "❌ Error: .env file missing."
6
+ exit 1
7
+ fi
8
+
9
+ # Load variables from .env
10
+ export $(grep -v '^#' .env | xargs)
11
+
12
+ # Use TOKEN if NPM_TOKEN is not set (supporting the user's specific .env format)
13
+ AUTH_TOKEN=${NPM_TOKEN:-${TOKEN:-}}
14
+
15
+ if [ -z "$AUTH_TOKEN" ]; then
16
+ echo "❌ Error: Neither NPM_TOKEN nor TOKEN set in .env"
17
+ exit 1
18
+ fi
19
+
20
+ echo "📦 Preparing to publish 'zauberflote'..."
21
+
22
+ # Create a temporary .npmrc to avoid messing with global settings
23
+ NPMRC=$(mktemp)
24
+ echo "//registry.npmjs.org/:_authToken=$AUTH_TOKEN" > "$NPMRC"
25
+
26
+ echo "🚀 Publishing to NPM registry..."
27
+ npm_config_userconfig="$NPMRC" npm publish --access public
28
+
29
+ rm "$NPMRC"
30
+ echo "✅ Published successfully!"