@juristr/nx-tailwind-sync 0.0.1 → 0.0.6

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/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # tailwind-sync-plugin
1
+ # Nx Tailwind Sync
2
2
 
3
- Nx sync generator that auto-manages `@source` directives in CSS files for Tailwind v4 monorepos.
3
+ Nx [sync generator](https://nx.dev/docs/concepts/sync-generators) that auto-manages `@source` directives in CSS files for Tailwind v4 monorepos.
4
4
 
5
5
  ## Problem
6
6
 
7
- Tailwind v4 [requires to define `@source` directives](https://tailwindcss.com/docs/detecting-classes-in-source-files#explicitly-registering-sources) for dependencies that might be outside its own project configuration. Something that is common in monorepos. Manually maintaining these in a monorepo is error-prone.
7
+ Tailwind v4 [requires to define `@source` directives](https://tailwindcss.com/docs/detecting-classes-in-source-files#explicitly-registering-sources) for dependencies that might be outside its own project configuration. Something that is common in monorepos. Manually maintaining these in a monorepo is error-prone. See [this blog post](https://nx.dev/blog/setup-tailwind-4-npm-workspace) for more background.
8
8
 
9
9
  ## Solution
10
10
 
@@ -48,7 +48,7 @@ Register the sync generator on tasks that need it (e.g., `build`, `dev`):
48
48
  "nx": {
49
49
  "targets": {
50
50
  "build": {
51
- "syncGenerators": ["@aishop/tailwind-sync-plugin:update-tailwind-globs"]
51
+ "syncGenerators": ["@juristr/nx-tailwind-sync:update-tailwind-globs"]
52
52
  }
53
53
  }
54
54
  }
@@ -70,5 +70,5 @@ pnpm nx sync
70
70
  ## Building
71
71
 
72
72
  ```bash
73
- nx build tailwind-sync-plugin
73
+ nx build @juristr/nx-tailwind-sync
74
74
  ```
@@ -23,7 +23,7 @@ function findTailwindCssFile(tree, projectRoot, additionalPaths = []) {
23
23
  for (const relPath of searchPaths) {
24
24
  const fullPath = (0, path_1.join)(projectRoot, relPath);
25
25
  const content = tree.read(fullPath)?.toString();
26
- if (content?.match(/@import\s+['"]tailwindcss['"]/)) {
26
+ if (content?.match(/@import\s+['"]tailwindcss[^'"]*['"]/)) {
27
27
  return fullPath;
28
28
  }
29
29
  }
@@ -143,7 +143,7 @@ function updateSourceDirectives(tree, projectName, cssFilePath, projectGraph) {
143
143
  // Remove any existing bare @source directives (migration from old format)
144
144
  const cleanedContent = currentContent.replace(/\n@source\s+["'][^"']*packages\/[^"']+["'];/g, '');
145
145
  // Try to find @import 'tailwindcss' first
146
- const tailwindImportRegex = /@import\s+['"]tailwindcss['"];/;
146
+ const tailwindImportRegex = /@import\s+['"]tailwindcss[^'"]*['"];/;
147
147
  const tailwindImportMatch = cleanedContent.match(tailwindImportRegex);
148
148
  // If not found, look for any @import statement
149
149
  const anyImportRegex = /@import\s+['"][^'"]+['"];/;
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "@juristr/nx-tailwind-sync",
3
- "version": "0.0.1",
3
+ "version": "0.0.6",
4
+ "author": "Juri Strumpflohner",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/juristr/nx-tailwind-sync.git"
9
+ },
4
10
  "main": "./dist/index.js",
5
11
  "module": "./dist/index.js",
6
12
  "types": "./dist/index.d.ts",
@@ -14,6 +20,16 @@
14
20
  },
15
21
  "nx": {
16
22
  "targets": {
23
+ "e2e": {
24
+ "executor": "nx:run-commands",
25
+ "dependsOn": [
26
+ "build"
27
+ ],
28
+ "options": {
29
+ "command": "vitest run",
30
+ "cwd": "packages/tailwind-sync-plugin"
31
+ }
32
+ },
17
33
  "build": {
18
34
  "executor": "@nx/js:tsc",
19
35
  "outputs": [
@@ -54,4 +70,4 @@
54
70
  "publishConfig": {
55
71
  "access": "public"
56
72
  }
57
- }
73
+ }