@razorwind/nx 0.0.6 → 0.0.7
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 +10 -0
- package/dist/executors/generate/executor.d.mts +8 -4
- package/dist/executors/generate/executor.d.ts +8 -4
- package/dist/executors/generate/executor.d.ts.map +1 -1
- package/dist/executors/generate/schema.d.ts +8 -4
- package/dist/executors/generate/schema.json +26 -4
- package/dist/generators/sync/generator.d.ts.map +1 -1
- package/dist/generators/sync/generator.js +26 -10
- package/dist/generators/sync/generator.mjs +25 -9
- package/dist/generators/sync/schema.d.ts +10 -0
- package/dist/generators/sync/schema.json +7 -0
- package/dist/plugin/index.d.mts +19 -0
- package/dist/plugin/index.d.ts +19 -0
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +38 -7
- package/dist/plugin/index.mjs +37 -6
- package/docs/api/generate/schema.md +4 -4
- package/docs/api/sync/schema.md +9 -0
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Razorwind - Nx
|
|
4
4
|
|
|
5
|
+
## [0.0.7](https://github.com/storm-software/razorwind/releases/tag/nx%400.0.7) (07/31/2026)
|
|
6
|
+
|
|
7
|
+
### Miscellaneous
|
|
8
|
+
|
|
9
|
+
- **nx:** Improve Nx plugin and Sync Generator to use user provided configuration ([71ff227](https://github.com/storm-software/razorwind/commit/71ff227))
|
|
10
|
+
|
|
11
|
+
### Updated Dependencies
|
|
12
|
+
|
|
13
|
+
- Updated **core** to **v0.0.13**
|
|
14
|
+
|
|
5
15
|
## [0.0.6](https://github.com/storm-software/razorwind/releases/tag/nx%400.0.6) (07/30/2026)
|
|
6
16
|
|
|
7
17
|
### Features
|
|
@@ -19,15 +19,19 @@ interface GenerateExecutorSchema {
|
|
|
19
19
|
*/
|
|
20
20
|
mode: string;
|
|
21
21
|
/**
|
|
22
|
-
* The path to a directory containing component directories or files
|
|
22
|
+
* The path to a directory containing component directories or files, or an array of paths
|
|
23
23
|
*
|
|
24
|
+
*
|
|
25
|
+
* @oneOf [object Object],[object Object]
|
|
24
26
|
*/
|
|
25
|
-
componentsPath?: string;
|
|
27
|
+
componentsPath?: string | string[];
|
|
26
28
|
/**
|
|
27
|
-
* The path to the tokens.json file
|
|
29
|
+
* The path to the tokens.json file, or an array of paths
|
|
30
|
+
*
|
|
28
31
|
*
|
|
32
|
+
* @oneOf [object Object],[object Object]
|
|
29
33
|
*/
|
|
30
|
-
tokensPath?: string;
|
|
34
|
+
tokensPath?: string | string[];
|
|
31
35
|
}
|
|
32
36
|
//#endregion
|
|
33
37
|
//#region src/executors/generate/executor.d.ts
|
|
@@ -19,15 +19,19 @@ interface GenerateExecutorSchema {
|
|
|
19
19
|
*/
|
|
20
20
|
mode: string;
|
|
21
21
|
/**
|
|
22
|
-
* The path to a directory containing component directories or files
|
|
22
|
+
* The path to a directory containing component directories or files, or an array of paths
|
|
23
23
|
*
|
|
24
|
+
*
|
|
25
|
+
* @oneOf [object Object],[object Object]
|
|
24
26
|
*/
|
|
25
|
-
componentsPath?: string;
|
|
27
|
+
componentsPath?: string | string[];
|
|
26
28
|
/**
|
|
27
|
-
* The path to the tokens.json file
|
|
29
|
+
* The path to the tokens.json file, or an array of paths
|
|
30
|
+
*
|
|
28
31
|
*
|
|
32
|
+
* @oneOf [object Object],[object Object]
|
|
29
33
|
*/
|
|
30
|
-
tokensPath?: string;
|
|
34
|
+
tokensPath?: string | string[];
|
|
31
35
|
}
|
|
32
36
|
//#endregion
|
|
33
37
|
//#region src/executors/generate/executor.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","names":[],"sources":["../../../src/executors/generate/schema.d.ts","../../../src/executors/generate/executor.ts"],"mappings":";;;;;UAIiB;;;;;;EAMhB;;;;;;;;EASA
|
|
1
|
+
{"version":3,"file":"executor.d.ts","names":[],"sources":["../../../src/executors/generate/schema.d.ts","../../../src/executors/generate/executor.ts"],"mappings":";;;;;UAIiB;;;;;;EAMhB;;;;;;;;EASA;;;;;;;EAQA;;;;;;;EAQA;;;;iBCXc,WACb,SAAS,wBACT,SAAS,kBACR,QAAQ"}
|
|
@@ -20,15 +20,19 @@ export interface GenerateExecutorSchema {
|
|
|
20
20
|
mode: string,
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* The path to a directory containing component directories or files
|
|
23
|
+
* The path to a directory containing component directories or files, or an array of paths
|
|
24
24
|
*
|
|
25
|
+
*
|
|
26
|
+
* @oneOf [object Object],[object Object]
|
|
25
27
|
*/
|
|
26
|
-
componentsPath?: string,
|
|
28
|
+
componentsPath?: string | string[],
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
|
-
* The path to the tokens.json file
|
|
31
|
+
* The path to the tokens.json file, or an array of paths
|
|
32
|
+
*
|
|
30
33
|
*
|
|
34
|
+
* @oneOf [object Object],[object Object]
|
|
31
35
|
*/
|
|
32
|
-
tokensPath?: string,
|
|
36
|
+
tokensPath?: string | string[],
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -22,12 +22,34 @@
|
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
"componentsPath": {
|
|
25
|
-
"
|
|
26
|
-
|
|
25
|
+
"oneOf": [
|
|
26
|
+
{
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"type": "array",
|
|
31
|
+
"items": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"tsType": "string | string[]",
|
|
37
|
+
"description": "The path to a directory containing component directories or files, or an array of paths"
|
|
27
38
|
},
|
|
28
39
|
"tokensPath": {
|
|
29
|
-
"
|
|
30
|
-
|
|
40
|
+
"oneOf": [
|
|
41
|
+
{
|
|
42
|
+
"type": "string"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": {
|
|
47
|
+
"type": "string"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"tsType": "string | string[]",
|
|
52
|
+
"description": "The path to the tokens.json file, or an array of paths"
|
|
31
53
|
}
|
|
32
54
|
},
|
|
33
55
|
"additionalProperties": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","names":[],"sources":["../../../src/generators/sync/generator.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"generator.d.ts","names":[],"sources":["../../../src/generators/sync/generator.ts"],"mappings":";;;iBAuHsB,cAAc,MAAM,OAAO,QAAQ"}
|
|
@@ -20,7 +20,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
24
24
|
value: mod,
|
|
25
25
|
enumerable: true
|
|
26
26
|
}) : target, mod));
|
|
@@ -32,16 +32,31 @@ let _nx_devkit = require("@nx/devkit");
|
|
|
32
32
|
let _power_plant_noop_output = require("@power-plant/noop-output");
|
|
33
33
|
_power_plant_noop_output = __toESM(_power_plant_noop_output);
|
|
34
34
|
let node_path = require("node:path");
|
|
35
|
+
let c12 = require("c12");
|
|
35
36
|
|
|
36
|
-
//#region src/
|
|
37
|
+
//#region src/helpers/constants.ts
|
|
37
38
|
const GENERATOR_NAME = "@razorwind/nx:sync";
|
|
38
39
|
const GENERATE_EXECUTOR = "@razorwind/nx:generate";
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const CONFIG_NAME = "razorwind";
|
|
41
|
+
/**
|
|
42
|
+
* Config file base paths resolved by c12 in priority order.
|
|
43
|
+
*
|
|
44
|
+
* @see https://github.com/unjs/c12
|
|
45
|
+
*/
|
|
46
|
+
const CONFIG_FILE_BASES = [
|
|
47
|
+
`${CONFIG_NAME}.config`,
|
|
48
|
+
`.config/${CONFIG_NAME}`,
|
|
49
|
+
`.config/${CONFIG_NAME}.config`
|
|
44
50
|
];
|
|
51
|
+
/**
|
|
52
|
+
* All Razorwind config file names supported by c12.
|
|
53
|
+
*
|
|
54
|
+
* @see https://github.com/unjs/c12/blob/main/src/loader.ts
|
|
55
|
+
*/
|
|
56
|
+
const CONFIG_FILE_NAMES = c12.SUPPORTED_EXTENSIONS.flatMap((extension) => CONFIG_FILE_BASES.map((base) => `${base}${extension}`));
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/generators/sync/generator.ts
|
|
45
60
|
const DEFAULT_OUT_OF_SYNC_MESSAGE = "Razorwind generated files are out of sync. Run `nx sync` to regenerate.";
|
|
46
61
|
function resolveConfigFileToken(configFile, projectRoot) {
|
|
47
62
|
return configFile.replaceAll("{projectRoot}", projectRoot);
|
|
@@ -80,20 +95,21 @@ async function generateForProject(tree, options) {
|
|
|
80
95
|
return changed;
|
|
81
96
|
}
|
|
82
97
|
async function syncGenerator(tree) {
|
|
83
|
-
const generatorOptions = (0, _nx_devkit.readNxJson)(tree)?.sync?.generatorOptions?.[
|
|
98
|
+
const generatorOptions = (0, _nx_devkit.readNxJson)(tree)?.sync?.generatorOptions?.["@razorwind/nx:sync"] ?? {};
|
|
84
99
|
const defaultMode = generatorOptions.mode ?? "production";
|
|
100
|
+
const targetName = generatorOptions.targetName ?? "generate";
|
|
85
101
|
const outOfSyncMessage = generatorOptions.outOfSyncMessage ?? DEFAULT_OUT_OF_SYNC_MESSAGE;
|
|
86
102
|
const projectGraph = await (0, _nx_devkit.createProjectGraphAsync)();
|
|
87
103
|
const outOfSyncDetails = [];
|
|
88
104
|
const processedConfigFiles = /* @__PURE__ */ new Set();
|
|
89
105
|
for (const project of Object.values(projectGraph.nodes)) {
|
|
90
106
|
const projectRoot = project.data.root;
|
|
91
|
-
const generateTarget = project.data.targets?.generate;
|
|
107
|
+
const generateTarget = project.data.targets?.[targetName] ?? Object.values(project.data.targets ?? {}).find((target) => target.executor === "@razorwind/nx:generate");
|
|
92
108
|
let configFile;
|
|
93
109
|
let mode = defaultMode;
|
|
94
110
|
let componentsPath;
|
|
95
111
|
let tokensPath;
|
|
96
|
-
if (generateTarget?.executor ===
|
|
112
|
+
if (generateTarget?.executor === "@razorwind/nx:generate") {
|
|
97
113
|
mode = generateTarget.configurations?.[generateTarget.defaultConfiguration ?? "production"]?.mode ?? generateTarget.options?.mode ?? defaultMode;
|
|
98
114
|
componentsPath = generateTarget.options?.componentsPath;
|
|
99
115
|
tokensPath = generateTarget.options?.tokensPath;
|
|
@@ -3,16 +3,31 @@ import { generator } from "@razorwind/core";
|
|
|
3
3
|
import { createProjectGraphAsync, joinPathFragments, readNxJson } from "@nx/devkit";
|
|
4
4
|
import noop from "@power-plant/noop-output";
|
|
5
5
|
import { isAbsolute, relative } from "node:path";
|
|
6
|
+
import { SUPPORTED_EXTENSIONS } from "c12";
|
|
6
7
|
|
|
7
|
-
//#region src/
|
|
8
|
+
//#region src/helpers/constants.ts
|
|
8
9
|
const GENERATOR_NAME = "@razorwind/nx:sync";
|
|
9
10
|
const GENERATE_EXECUTOR = "@razorwind/nx:generate";
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const CONFIG_NAME = "razorwind";
|
|
12
|
+
/**
|
|
13
|
+
* Config file base paths resolved by c12 in priority order.
|
|
14
|
+
*
|
|
15
|
+
* @see https://github.com/unjs/c12
|
|
16
|
+
*/
|
|
17
|
+
const CONFIG_FILE_BASES = [
|
|
18
|
+
`${CONFIG_NAME}.config`,
|
|
19
|
+
`.config/${CONFIG_NAME}`,
|
|
20
|
+
`.config/${CONFIG_NAME}.config`
|
|
15
21
|
];
|
|
22
|
+
/**
|
|
23
|
+
* All Razorwind config file names supported by c12.
|
|
24
|
+
*
|
|
25
|
+
* @see https://github.com/unjs/c12/blob/main/src/loader.ts
|
|
26
|
+
*/
|
|
27
|
+
const CONFIG_FILE_NAMES = SUPPORTED_EXTENSIONS.flatMap((extension) => CONFIG_FILE_BASES.map((base) => `${base}${extension}`));
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/generators/sync/generator.ts
|
|
16
31
|
const DEFAULT_OUT_OF_SYNC_MESSAGE = "Razorwind generated files are out of sync. Run `nx sync` to regenerate.";
|
|
17
32
|
function resolveConfigFileToken(configFile, projectRoot) {
|
|
18
33
|
return configFile.replaceAll("{projectRoot}", projectRoot);
|
|
@@ -51,20 +66,21 @@ async function generateForProject(tree, options) {
|
|
|
51
66
|
return changed;
|
|
52
67
|
}
|
|
53
68
|
async function syncGenerator(tree) {
|
|
54
|
-
const generatorOptions = readNxJson(tree)?.sync?.generatorOptions?.[
|
|
69
|
+
const generatorOptions = readNxJson(tree)?.sync?.generatorOptions?.["@razorwind/nx:sync"] ?? {};
|
|
55
70
|
const defaultMode = generatorOptions.mode ?? "production";
|
|
71
|
+
const targetName = generatorOptions.targetName ?? "generate";
|
|
56
72
|
const outOfSyncMessage = generatorOptions.outOfSyncMessage ?? DEFAULT_OUT_OF_SYNC_MESSAGE;
|
|
57
73
|
const projectGraph = await createProjectGraphAsync();
|
|
58
74
|
const outOfSyncDetails = [];
|
|
59
75
|
const processedConfigFiles = /* @__PURE__ */ new Set();
|
|
60
76
|
for (const project of Object.values(projectGraph.nodes)) {
|
|
61
77
|
const projectRoot = project.data.root;
|
|
62
|
-
const generateTarget = project.data.targets?.generate;
|
|
78
|
+
const generateTarget = project.data.targets?.[targetName] ?? Object.values(project.data.targets ?? {}).find((target) => target.executor === "@razorwind/nx:generate");
|
|
63
79
|
let configFile;
|
|
64
80
|
let mode = defaultMode;
|
|
65
81
|
let componentsPath;
|
|
66
82
|
let tokensPath;
|
|
67
|
-
if (generateTarget?.executor ===
|
|
83
|
+
if (generateTarget?.executor === "@razorwind/nx:generate") {
|
|
68
84
|
mode = generateTarget.configurations?.[generateTarget.defaultConfiguration ?? "production"]?.mode ?? generateTarget.options?.mode ?? defaultMode;
|
|
69
85
|
componentsPath = generateTarget.options?.componentsPath;
|
|
70
86
|
tokensPath = generateTarget.options?.tokensPath;
|
|
@@ -14,6 +14,16 @@ export interface SyncGeneratorSchema {
|
|
|
14
14
|
*/
|
|
15
15
|
mode?: string,
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Target Name
|
|
19
|
+
*
|
|
20
|
+
* The name of the target to use when running Razorwind generate
|
|
21
|
+
*
|
|
22
|
+
*
|
|
23
|
+
* @$default generate
|
|
24
|
+
*/
|
|
25
|
+
targetName?: string,
|
|
26
|
+
|
|
17
27
|
/**
|
|
18
28
|
* Out of Sync Message
|
|
19
29
|
*
|
|
@@ -15,6 +15,13 @@
|
|
|
15
15
|
"id": "#mode",
|
|
16
16
|
"default": "production"
|
|
17
17
|
},
|
|
18
|
+
"targetName": {
|
|
19
|
+
"title": "Target Name",
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "The name of the target to use when running Razorwind generate",
|
|
22
|
+
"$default": "generate",
|
|
23
|
+
"id": "#targetName"
|
|
24
|
+
},
|
|
18
25
|
"outOfSyncMessage": {
|
|
19
26
|
"title": "Out of Sync Message",
|
|
20
27
|
"type": "string",
|
package/dist/plugin/index.d.mts
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
import { CreateNodes } from "@nx/devkit";
|
|
2
2
|
//#region src/plugin/index.d.ts
|
|
3
3
|
interface NxPluginOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The name of the target to use.
|
|
6
|
+
*
|
|
7
|
+
* @defaultValue `"generate"`
|
|
8
|
+
*/
|
|
9
|
+
targetName?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The path to a directory containing component directories or files, or an array of paths.
|
|
12
|
+
*/
|
|
13
|
+
componentsPath?: string | string[];
|
|
14
|
+
/**
|
|
15
|
+
* The path to the tokens.json file, or an array of paths.
|
|
16
|
+
*/
|
|
17
|
+
tokensPath?: string | string[];
|
|
18
|
+
/**
|
|
19
|
+
* Whether to output verbose logs.
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue `false`
|
|
22
|
+
*/
|
|
4
23
|
verboseOutput?: boolean;
|
|
5
24
|
}
|
|
6
25
|
declare const createNodesV2: CreateNodes<NxPluginOptions>;
|
package/dist/plugin/index.d.ts
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
import { CreateNodes } from "@nx/devkit";
|
|
2
2
|
//#region src/plugin/index.d.ts
|
|
3
3
|
interface NxPluginOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The name of the target to use.
|
|
6
|
+
*
|
|
7
|
+
* @defaultValue `"generate"`
|
|
8
|
+
*/
|
|
9
|
+
targetName?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The path to a directory containing component directories or files, or an array of paths.
|
|
12
|
+
*/
|
|
13
|
+
componentsPath?: string | string[];
|
|
14
|
+
/**
|
|
15
|
+
* The path to the tokens.json file, or an array of paths.
|
|
16
|
+
*/
|
|
17
|
+
tokensPath?: string | string[];
|
|
18
|
+
/**
|
|
19
|
+
* Whether to output verbose logs.
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue `false`
|
|
22
|
+
*/
|
|
4
23
|
verboseOutput?: boolean;
|
|
5
24
|
}
|
|
6
25
|
declare const createNodesV2: CreateNodes<NxPluginOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/plugin/index.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/plugin/index.ts"],"mappings":";;UA8CiB;;;;;;EAMf;;;;EAKA;;;;EAKA;;;;;;EAOA;;cAGW,eAAe,YAAY"}
|
package/dist/plugin/index.js
CHANGED
|
@@ -20,7 +20,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
24
24
|
value: mod,
|
|
25
25
|
enumerable: true
|
|
26
26
|
}) : target, mod));
|
|
@@ -40,7 +40,29 @@ let node_fs_promises = require("node:fs/promises");
|
|
|
40
40
|
let nx_src_config_nx_json_js = require("nx/src/config/nx-json.js");
|
|
41
41
|
let nx_src_utils_package_json_js = require("nx/src/utils/package-json.js");
|
|
42
42
|
let nx_src_utils_package_manager_js = require("nx/src/utils/package-manager.js");
|
|
43
|
+
let c12 = require("c12");
|
|
43
44
|
|
|
45
|
+
//#region src/helpers/constants.ts
|
|
46
|
+
const GENERATE_EXECUTOR = "@razorwind/nx:generate";
|
|
47
|
+
const CONFIG_NAME = "razorwind";
|
|
48
|
+
/**
|
|
49
|
+
* Config file base paths resolved by c12 in priority order.
|
|
50
|
+
*
|
|
51
|
+
* @see https://github.com/unjs/c12
|
|
52
|
+
*/
|
|
53
|
+
const CONFIG_FILE_BASES = [
|
|
54
|
+
`${CONFIG_NAME}.config`,
|
|
55
|
+
`.config/${CONFIG_NAME}`,
|
|
56
|
+
`.config/${CONFIG_NAME}.config`
|
|
57
|
+
];
|
|
58
|
+
/**
|
|
59
|
+
* All Razorwind config file names supported by c12.
|
|
60
|
+
*
|
|
61
|
+
* @see https://github.com/unjs/c12/blob/main/src/loader.ts
|
|
62
|
+
*/
|
|
63
|
+
const CONFIG_FILE_NAMES = c12.SUPPORTED_EXTENSIONS.flatMap((extension) => CONFIG_FILE_BASES.map((base) => `${base}${extension}`));
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
44
66
|
//#region src/plugin/index.ts
|
|
45
67
|
const createNodesV2 = ["**/razorwind.config.ts", async (configFiles, options, contextV2) => {
|
|
46
68
|
if (options?.verboseOutput) console.debug(`[razorwind] - ${(/* @__PURE__ */ new Date()).toISOString()} - Initializing the Razorwind plugin for the following inputs: ${configFiles.join(", ")}`);
|
|
@@ -77,22 +99,31 @@ const createNodesV2 = ["**/razorwind.config.ts", async (configFiles, options, co
|
|
|
77
99
|
}
|
|
78
100
|
const targets = (0, nx_src_utils_package_json_js.readTargetsFromPackageJson)(packageJson, nxJson, projectRoot, context.workspaceRoot, packageManagerCommand);
|
|
79
101
|
if (options?.verboseOutput) console.debug(`[razorwind] - ${(/* @__PURE__ */ new Date()).toISOString()} - Preparing Nx targets for project in root directory ${projectRoot}.`);
|
|
80
|
-
targets.generate
|
|
81
|
-
|
|
82
|
-
|
|
102
|
+
const targetName = options?.targetName || Object.keys(targets ?? {}).find((name) => targets[name]?.executor === "@razorwind/nx:generate") || "generate";
|
|
103
|
+
targets[targetName] = (0, defu.default)(targets[targetName], {
|
|
104
|
+
inputs: [
|
|
105
|
+
configFile,
|
|
106
|
+
...((0, _stryke_type_checks_is_set_string.isSetString)(options?.componentsPath) ? [options.componentsPath] : options?.componentsPath) ?? [],
|
|
107
|
+
...((0, _stryke_type_checks_is_set_string.isSetString)(options?.tokensPath) ? [options.tokensPath] : options?.tokensPath) ?? []
|
|
108
|
+
],
|
|
109
|
+
executor: GENERATE_EXECUTOR,
|
|
110
|
+
dependsOn: [`^${targetName}`],
|
|
83
111
|
defaultConfiguration: "production",
|
|
84
|
-
options: {
|
|
112
|
+
options: {
|
|
113
|
+
configFile,
|
|
114
|
+
componentsPath: options?.componentsPath,
|
|
115
|
+
tokensPath: options?.tokensPath
|
|
116
|
+
},
|
|
85
117
|
configurations: {
|
|
86
118
|
production: { mode: "production" },
|
|
87
119
|
development: { mode: "development" }
|
|
88
120
|
}
|
|
89
|
-
};
|
|
121
|
+
});
|
|
90
122
|
(0, _storm_software_workspace_tools_utils_project_tags.setDefaultProjectTags)(projectConfig, "razorwind");
|
|
91
123
|
if (options?.verboseOutput) console.debug(`[razorwind] - ${(/* @__PURE__ */ new Date()).toISOString()} - Completed preparing Nx configuration for project in root directory ${projectRoot}.`);
|
|
92
124
|
return { projects: { [root]: (0, defu.default)(projectConfig, {
|
|
93
125
|
projectType: projectConfig.projectType || "library",
|
|
94
126
|
root,
|
|
95
|
-
sourceRoot: (0, _stryke_path_join_paths.joinPaths)(root, "src"),
|
|
96
127
|
targets
|
|
97
128
|
}) } };
|
|
98
129
|
} catch (error) {
|
package/dist/plugin/index.mjs
CHANGED
|
@@ -11,7 +11,29 @@ import { readFile } from "node:fs/promises";
|
|
|
11
11
|
import { readNxJson } from "nx/src/config/nx-json.js";
|
|
12
12
|
import { readTargetsFromPackageJson } from "nx/src/utils/package-json.js";
|
|
13
13
|
import { detectPackageManager, getPackageManagerCommand } from "nx/src/utils/package-manager.js";
|
|
14
|
+
import { SUPPORTED_EXTENSIONS } from "c12";
|
|
14
15
|
|
|
16
|
+
//#region src/helpers/constants.ts
|
|
17
|
+
const GENERATE_EXECUTOR = "@razorwind/nx:generate";
|
|
18
|
+
const CONFIG_NAME = "razorwind";
|
|
19
|
+
/**
|
|
20
|
+
* Config file base paths resolved by c12 in priority order.
|
|
21
|
+
*
|
|
22
|
+
* @see https://github.com/unjs/c12
|
|
23
|
+
*/
|
|
24
|
+
const CONFIG_FILE_BASES = [
|
|
25
|
+
`${CONFIG_NAME}.config`,
|
|
26
|
+
`.config/${CONFIG_NAME}`,
|
|
27
|
+
`.config/${CONFIG_NAME}.config`
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* All Razorwind config file names supported by c12.
|
|
31
|
+
*
|
|
32
|
+
* @see https://github.com/unjs/c12/blob/main/src/loader.ts
|
|
33
|
+
*/
|
|
34
|
+
const CONFIG_FILE_NAMES = SUPPORTED_EXTENSIONS.flatMap((extension) => CONFIG_FILE_BASES.map((base) => `${base}${extension}`));
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
15
37
|
//#region src/plugin/index.ts
|
|
16
38
|
const createNodesV2 = ["**/razorwind.config.ts", async (configFiles, options, contextV2) => {
|
|
17
39
|
if (options?.verboseOutput) console.debug(`[razorwind] - ${(/* @__PURE__ */ new Date()).toISOString()} - Initializing the Razorwind plugin for the following inputs: ${configFiles.join(", ")}`);
|
|
@@ -48,22 +70,31 @@ const createNodesV2 = ["**/razorwind.config.ts", async (configFiles, options, co
|
|
|
48
70
|
}
|
|
49
71
|
const targets = readTargetsFromPackageJson(packageJson, nxJson, projectRoot, context.workspaceRoot, packageManagerCommand);
|
|
50
72
|
if (options?.verboseOutput) console.debug(`[razorwind] - ${(/* @__PURE__ */ new Date()).toISOString()} - Preparing Nx targets for project in root directory ${projectRoot}.`);
|
|
51
|
-
targets.generate
|
|
52
|
-
|
|
53
|
-
|
|
73
|
+
const targetName = options?.targetName || Object.keys(targets ?? {}).find((name) => targets[name]?.executor === "@razorwind/nx:generate") || "generate";
|
|
74
|
+
targets[targetName] = defu(targets[targetName], {
|
|
75
|
+
inputs: [
|
|
76
|
+
configFile,
|
|
77
|
+
...(isSetString(options?.componentsPath) ? [options.componentsPath] : options?.componentsPath) ?? [],
|
|
78
|
+
...(isSetString(options?.tokensPath) ? [options.tokensPath] : options?.tokensPath) ?? []
|
|
79
|
+
],
|
|
80
|
+
executor: GENERATE_EXECUTOR,
|
|
81
|
+
dependsOn: [`^${targetName}`],
|
|
54
82
|
defaultConfiguration: "production",
|
|
55
|
-
options: {
|
|
83
|
+
options: {
|
|
84
|
+
configFile,
|
|
85
|
+
componentsPath: options?.componentsPath,
|
|
86
|
+
tokensPath: options?.tokensPath
|
|
87
|
+
},
|
|
56
88
|
configurations: {
|
|
57
89
|
production: { mode: "production" },
|
|
58
90
|
development: { mode: "development" }
|
|
59
91
|
}
|
|
60
|
-
};
|
|
92
|
+
});
|
|
61
93
|
setDefaultProjectTags(projectConfig, "razorwind");
|
|
62
94
|
if (options?.verboseOutput) console.debug(`[razorwind] - ${(/* @__PURE__ */ new Date()).toISOString()} - Completed preparing Nx configuration for project in root directory ${projectRoot}.`);
|
|
63
95
|
return { projects: { [root]: defu(projectConfig, {
|
|
64
96
|
projectType: projectConfig.projectType || "library",
|
|
65
97
|
root,
|
|
66
|
-
sourceRoot: joinPaths(root, "src"),
|
|
67
98
|
targets
|
|
68
99
|
}) } };
|
|
69
100
|
} catch (error) {
|
|
@@ -21,16 +21,16 @@ The mode to use
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
## `componentsPath`
|
|
24
|
-
- **Type**: `string`
|
|
24
|
+
- **Type**: `string | string[]`
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
The path to a directory containing component directories or files
|
|
27
|
+
The path to a directory containing component directories or files, or an array of paths
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
## `tokensPath`
|
|
31
|
-
- **Type**: `string`
|
|
31
|
+
- **Type**: `string | string[]`
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
The path to the tokens.json file
|
|
34
|
+
The path to the tokens.json file, or an array of paths
|
|
35
35
|
|
|
36
36
|
|
package/docs/api/sync/schema.md
CHANGED
|
@@ -14,6 +14,15 @@
|
|
|
14
14
|
The mode to use when running Razorwind generate
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
## `targetName`
|
|
18
|
+
- **Type**: `string`
|
|
19
|
+
|
|
20
|
+
> Target Name
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
The name of the target to use when running Razorwind generate
|
|
24
|
+
|
|
25
|
+
|
|
17
26
|
## `outOfSyncMessage`
|
|
18
27
|
- **Type**: `string`
|
|
19
28
|
- **Default**: `"Razorwind generated files are out of sync. Run `nx sync` to regenerate."`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razorwind/nx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "A Nx plugin to support Razorwind development in Nx monorepos.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "github",
|
|
@@ -110,9 +110,10 @@
|
|
|
110
110
|
"module": "dist/index.mjs",
|
|
111
111
|
"typings": "dist/index.d.ts",
|
|
112
112
|
"dependencies": {
|
|
113
|
+
"c12": "^3.3.4",
|
|
113
114
|
"@nx/devkit": "23.1.0",
|
|
114
|
-
"@power-plant/core": "^0.0.
|
|
115
|
-
"@razorwind/core": "^0.0.
|
|
115
|
+
"@power-plant/core": "^0.0.55",
|
|
116
|
+
"@razorwind/core": "^0.0.13",
|
|
116
117
|
"@stryke/hash": "^0.13.52",
|
|
117
118
|
"@stryke/path": "^0.29.25",
|
|
118
119
|
"@stryke/string-format": "^0.17.40",
|
|
@@ -122,8 +123,8 @@
|
|
|
122
123
|
"untyped": "^2.0.0"
|
|
123
124
|
},
|
|
124
125
|
"devDependencies": {
|
|
125
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
126
|
-
"@powerlines/plugin-untyped": "^0.2.
|
|
126
|
+
"@powerlines/plugin-tsdown": "^0.1.577",
|
|
127
|
+
"@powerlines/plugin-untyped": "^0.2.591",
|
|
127
128
|
"@types/node": "^25.9.5",
|
|
128
129
|
"eslint-flat-config-utils": "^3.2.0",
|
|
129
130
|
"jsonc-eslint-parser": "^3.1.0"
|
|
@@ -132,5 +133,5 @@
|
|
|
132
133
|
"publishConfig": { "access": "public" },
|
|
133
134
|
"executors": "./executors.json",
|
|
134
135
|
"generators": "./generators.json",
|
|
135
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "c8809ed75332698630354cdd342daae6a4535193"
|
|
136
137
|
}
|