tailwind-hyperclay 0.1.12 → 0.1.14

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/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## [0.1.14] - 2026-01-31
4
+
5
+ ### Changed
6
+ - Add fallback module resolution from own node_modules
7
+
8
+
9
+
10
+ ## [0.1.13] - 2026-01-12
11
+
12
+ ### Changed
13
+ - Improved module resolution by determining base path dynamically
14
+ - Removed release.sh script
15
+
16
+
package/index.js CHANGED
@@ -51,16 +51,27 @@ async function compileTailwind(html) {
51
51
  @plugin "@tailwindcss/forms" { strategy: "class"; }
52
52
  `;
53
53
 
54
- // Use process.resourcesPath in Electron (production), otherwise __dirname
55
- // This ensures we don't rely on process.cwd() which is '/' when double-clicking the app
56
- const defaultBase = process.versions.electron && process.resourcesPath
57
- ? path.join(process.resourcesPath, 'app.asar.unpacked', 'node_modules')
58
- : __dirname;
54
+ // Determine base path for module resolution
55
+ // - In packaged Electron apps: use app.asar.unpacked/node_modules
56
+ // - In Electron dev mode or Node.js: use parent of __dirname (node_modules)
57
+ let defaultBase = path.join(__dirname, '..'); // Default: node_modules directory (when installed as a dep)
58
+ const ownBase = __dirname; // Fallback: resolve from own node_modules (when running from repo)
59
+
60
+ if (process.versions.electron && process.resourcesPath) {
61
+ const asarUnpackedPath = path.join(process.resourcesPath, 'app.asar.unpacked', 'node_modules');
62
+ // Only use ASAR path if it actually exists (i.e., packaged app, not dev mode)
63
+ try {
64
+ require('fs').accessSync(asarUnpackedPath);
65
+ defaultBase = asarUnpackedPath;
66
+ } catch {
67
+ // Not a packaged app or path doesn't exist, use default
68
+ }
69
+ }
59
70
 
60
71
  const compiler = await compile(inputCSS, {
61
72
  loadStylesheet: async (id, base) => {
62
73
  let resolved;
63
- const searchPaths = [base || defaultBase];
74
+ const searchPaths = [base || defaultBase, ownBase];
64
75
 
65
76
  // Try resolving as-is first (for .css files)
66
77
  try {
@@ -83,13 +94,12 @@ async function compileTailwind(html) {
83
94
  return { content, base: path.dirname(resolved) };
84
95
  },
85
96
  loadModule: async (id, base) => {
86
- const resolved = require.resolve(id, { paths: [base || defaultBase] });
97
+ const resolved = require.resolve(id, { paths: [base || defaultBase, ownBase] });
87
98
  const mod = require(resolved);
88
99
  return { module: mod.default || mod, base: path.dirname(resolved) };
89
100
  },
90
101
  loadPlugin: async (plugin) => {
91
- // Plugins need to be found in the app's node_modules
92
- const resolved = require.resolve(plugin, { paths: [defaultBase] });
102
+ const resolved = require.resolve(plugin, { paths: [defaultBase, ownBase] });
93
103
  const mod = require(resolved);
94
104
  return mod.default || mod;
95
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-hyperclay",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "On-save Tailwind CSS generator for Hyperclay",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,248 +0,0 @@
1
- #!/bin/bash
2
- set -e # Exit on error
3
-
4
- # tailwind-hyperclay Automated Release Script
5
-
6
- echo "╔════════════════════════════════════════╗"
7
- echo "║ tailwind-hyperclay Release ║"
8
- echo "╚════════════════════════════════════════╝"
9
- echo ""
10
-
11
- # Color codes
12
- RED='\033[0;31m'
13
- GREEN='\033[0;32m'
14
- YELLOW='\033[1;33m'
15
- BLUE='\033[0;34m'
16
- NC='\033[0m' # No Color
17
-
18
- # Helper functions
19
- info() { echo -e "${BLUE}ℹ${NC} $1"; }
20
- success() { echo -e "${GREEN}✓${NC} $1"; }
21
- warn() { echo -e "${YELLOW}⚠${NC} $1"; }
22
- error() { echo -e "${RED}✗${NC} $1"; }
23
-
24
- # Check if we're in the right directory
25
- if [ ! -f "package.json" ] || ! grep -q '"name": "tailwind-hyperclay"' package.json; then
26
- error "Must run from tailwind-hyperclay root directory"
27
- exit 1
28
- fi
29
-
30
- # ============================================
31
- # STEP 1: Collect Release Information
32
- # ============================================
33
-
34
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
35
- echo "Step 1: Release Information"
36
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
37
- echo ""
38
-
39
- # Get version bump type
40
- echo "Select version bump type:"
41
- echo " 1) patch (bug fixes, 1.0.0 → 1.0.1)"
42
- echo " 2) minor (new features, 1.0.0 → 1.1.0)"
43
- echo " 3) major (breaking changes, 1.0.0 → 2.0.0)"
44
- echo " 4) custom (enter version manually)"
45
- echo ""
46
- read -p "Enter choice [1-4]: " version_choice
47
-
48
- case $version_choice in
49
- 1) VERSION_TYPE="patch" ;;
50
- 2) VERSION_TYPE="minor" ;;
51
- 3) VERSION_TYPE="major" ;;
52
- 4)
53
- read -p "Enter custom version (e.g., 2.0.0-beta.1): " CUSTOM_VERSION
54
- VERSION_TYPE="custom"
55
- ;;
56
- *)
57
- error "Invalid choice"
58
- exit 1
59
- ;;
60
- esac
61
-
62
- # Publish tag (latest, beta, alpha)
63
- echo ""
64
- read -p "NPM publish tag [latest/beta/alpha] (default: latest): " NPM_TAG
65
- NPM_TAG=${NPM_TAG:-latest}
66
-
67
- # ============================================
68
- # STEP 2: Pre-Release Checks
69
- # ============================================
70
-
71
- echo ""
72
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
73
- echo "Step 2: Pre-Release Checks"
74
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
75
- echo ""
76
-
77
- # Check git status
78
- info "Checking git status..."
79
- if [ -n "$(git status --porcelain)" ]; then
80
- warn "You have uncommitted changes:"
81
- git status --short
82
- read -p "Continue anyway? [y/N]: " continue_dirty
83
- if [[ ! $continue_dirty =~ ^[Yy]$ ]]; then
84
- exit 1
85
- fi
86
- else
87
- success "Working directory clean"
88
- fi
89
-
90
- # ============================================
91
- # STEP 3: Test
92
- # ============================================
93
-
94
- echo ""
95
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
96
- echo "Step 3: Test"
97
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
98
- echo ""
99
-
100
- # Run tests
101
- info "Running tests..."
102
- if npm test; then
103
- success "All tests passed"
104
- else
105
- error "Tests failed"
106
- read -p "Continue anyway? [y/N]: " continue_tests
107
- if [[ ! $continue_tests =~ ^[Yy]$ ]]; then
108
- exit 1
109
- fi
110
- fi
111
-
112
- # ============================================
113
- # STEP 4: Version Bump
114
- # ============================================
115
-
116
- echo ""
117
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
118
- echo "Step 4: Version Bump"
119
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
120
- echo ""
121
-
122
- # Get current version
123
- CURRENT_VERSION=$(node -p "require('./package.json').version")
124
- info "Current version: $CURRENT_VERSION"
125
-
126
- # Bump version
127
- if [ "$VERSION_TYPE" = "custom" ]; then
128
- NEW_VERSION="$CUSTOM_VERSION"
129
- npm version "$NEW_VERSION" --no-git-tag-version
130
- else
131
- NEW_VERSION=$(npm version "$VERSION_TYPE" --no-git-tag-version | sed 's/^v//')
132
- fi
133
-
134
- success "Version bumped to: $NEW_VERSION"
135
-
136
- # ============================================
137
- # STEP 5: Commit and Tag
138
- # ============================================
139
-
140
- echo ""
141
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
142
- echo "Step 5: Commit and Tag"
143
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
144
- echo ""
145
-
146
- # Stage changes
147
- git add package.json package-lock.json
148
-
149
- # Commit
150
- COMMIT_MSG="chore: release v$NEW_VERSION"
151
- git commit -m "$COMMIT_MSG"
152
- success "Changes committed"
153
-
154
- # Create tag
155
- git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION"
156
- success "Tag created: v$NEW_VERSION"
157
-
158
- # ============================================
159
- # STEP 6: Dry Run
160
- # ============================================
161
-
162
- echo ""
163
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
164
- echo "Step 6: Pre-Publish Verification"
165
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
166
- echo ""
167
-
168
- info "Running npm publish --dry-run..."
169
- npm publish --dry-run --tag "$NPM_TAG"
170
-
171
- echo ""
172
- warn "Review the output above carefully!"
173
- echo ""
174
-
175
- # ============================================
176
- # STEP 7: Publish
177
- # ============================================
178
-
179
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
180
- echo "Step 7: Publish to npm"
181
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
182
- echo ""
183
-
184
- echo "Summary:"
185
- echo " Version: $CURRENT_VERSION → $NEW_VERSION"
186
- echo " Tag: $NPM_TAG"
187
- echo " Git tag: v$NEW_VERSION"
188
- echo ""
189
-
190
- read -p "Publish to npm? [y/N]: " confirm_publish
191
- if [[ ! $confirm_publish =~ ^[Yy]$ ]]; then
192
- warn "Publish cancelled"
193
- echo ""
194
- echo "To manually publish later:"
195
- echo " git push origin main"
196
- echo " git push origin --tags"
197
- echo " npm publish --tag $NPM_TAG"
198
- exit 0
199
- fi
200
-
201
- # Publish to npm
202
- info "Publishing to npm..."
203
- npm publish --tag "$NPM_TAG"
204
- success "Published to npm!"
205
-
206
- # Push to git
207
- info "Pushing to GitHub..."
208
- git push origin main
209
- git push origin --tags
210
- success "Pushed to GitHub"
211
-
212
- # ============================================
213
- # STEP 8: Verify
214
- # ============================================
215
-
216
- echo ""
217
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
218
- echo "Step 8: Verification"
219
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
220
- echo ""
221
-
222
- sleep 5 # Give npm a moment to update
223
-
224
- info "Verifying npm publication..."
225
- NPM_VERSION=$(npm view tailwind-hyperclay version 2>/dev/null || echo "unknown")
226
- if [ "$NPM_VERSION" = "$NEW_VERSION" ]; then
227
- success "npm shows version: $NPM_VERSION"
228
- else
229
- warn "npm shows version: $NPM_VERSION (expected: $NEW_VERSION)"
230
- warn "It may take a few moments for npm to update"
231
- fi
232
-
233
- # ============================================
234
- # Done!
235
- # ============================================
236
-
237
- echo ""
238
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
239
- success "Release Complete!"
240
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
241
- echo ""
242
- echo "Released: tailwind-hyperclay@$NEW_VERSION"
243
- echo "npm tag: $NPM_TAG"
244
- echo "Git tag: v$NEW_VERSION"
245
- echo ""
246
- echo "Install with:"
247
- echo " npm install tailwind-hyperclay@$NEW_VERSION"
248
- echo ""