@clearlydev/nx-archweave 0.6.1 → 0.7.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.
Files changed (53) hide show
  1. package/README.md +34 -3
  2. package/dist/eslint/index.js +1 -1
  3. package/dist/generators/_chunks/{chunk-MQNQJOWA.js → chunk-22FVJUNE.js} +4 -2
  4. package/dist/generators/_chunks/{chunk-CH5AF5S2.js → chunk-2ADC6RKP.js} +1 -1
  5. package/dist/generators/_chunks/{chunk-2K4JADTK.js → chunk-6PKKKQMD.js} +46 -3
  6. package/dist/generators/_chunks/chunk-72D3GWHO.js +269 -0
  7. package/dist/generators/_chunks/{chunk-2TQWFUMC.js → chunk-736LFDT4.js} +21 -1
  8. package/dist/generators/_chunks/{chunk-D7J7HTND.js → chunk-7RTT5NBN.js} +4 -4
  9. package/dist/generators/_chunks/chunk-AOKTOS3U.js +294 -0
  10. package/dist/generators/_chunks/chunk-B6RBCUIL.js +325 -0
  11. package/dist/generators/_chunks/{chunk-XZM354ZH.js → chunk-CHZPA6OE.js} +5 -3
  12. package/dist/generators/_chunks/{chunk-UAPIAMRL.js → chunk-DAXD47YO.js} +1 -1
  13. package/dist/generators/_chunks/chunk-GN76UMTK.js +28 -0
  14. package/dist/generators/_chunks/{chunk-L52OUT5T.js → chunk-J24X4EOB.js} +1 -1
  15. package/dist/generators/_chunks/{chunk-EHYC6FUR.js → chunk-JSHZ6VSW.js} +1 -1
  16. package/dist/generators/_chunks/chunk-KNVBFTH4.js +64 -0
  17. package/dist/generators/_chunks/chunk-MF75SQM6.js +98 -0
  18. package/dist/generators/_chunks/chunk-N6SPEKJB.js +106 -0
  19. package/dist/generators/_chunks/chunk-OX7W4SJ2.js +214 -0
  20. package/dist/generators/_chunks/chunk-R2VEJGNP.js +84 -0
  21. package/dist/generators/_chunks/chunk-SBOQHME6.js +140 -0
  22. package/dist/generators/_chunks/{chunk-WD2HL2RE.js → chunk-STGNMZLM.js} +1 -1
  23. package/dist/generators/_chunks/{chunk-XXXON43Z.js → chunk-SZRBDQCU.js} +4 -51
  24. package/dist/generators/_chunks/{chunk-LKXSS5E2.js → chunk-W2BBF5MS.js} +3 -86
  25. package/dist/generators/add-agent-rules/generator.js +2 -2
  26. package/dist/generators/add-backend/generator.js +2 -2
  27. package/dist/generators/add-fsd-lite/generator.js +7 -5
  28. package/dist/generators/add-github-templates/generator.js +2 -2
  29. package/dist/generators/add-integration/generator.js +2 -2
  30. package/dist/generators/add-review/generator.js +2 -2
  31. package/dist/generators/add-storybook/files/example/button/button.stories.tsx.template +13 -0
  32. package/dist/generators/add-storybook/files/example/button/button.tsx.template +7 -0
  33. package/dist/generators/add-storybook/files/example/index.ts.template +1 -0
  34. package/dist/generators/add-storybook/files/library/tailwind.css.template +2 -0
  35. package/dist/generators/add-storybook/generator.js +28 -0
  36. package/dist/generators/add-tailwind/files/next/postcss.config.mjs.template +7 -0
  37. package/dist/generators/add-tailwind/files/react-vite/index.css.template +2 -0
  38. package/dist/generators/add-tailwind/generator.js +26 -0
  39. package/dist/generators/allow-builds/generator.js +7 -207
  40. package/dist/generators/doctor/generator.js +388 -29
  41. package/dist/generators/entity/generator.js +4 -3
  42. package/dist/generators/feature/generator.js +4 -3
  43. package/dist/generators/init/generator.js +49 -10
  44. package/dist/generators/install-integration/generator.js +2 -2
  45. package/dist/generators/page/generator.js +4 -3
  46. package/dist/generators/shared/generator.js +4 -3
  47. package/dist/generators/widget/generator.js +4 -3
  48. package/dist/migrations/update-0.5.3/add-toolkit-config-lint-input.js +7 -3
  49. package/generators.json +10 -0
  50. package/package.json +1 -1
  51. package/src/generators/add-storybook/schema.json +33 -0
  52. package/src/generators/add-tailwind/schema.json +18 -0
  53. package/src/generators/init/schema.json +8 -0
@@ -1,3 +1,10 @@
1
+ import {
2
+ allowPackageBuilds,
3
+ isPlainPackageName,
4
+ missingFromLockfile,
5
+ pnpmMajorFromModulesManifest,
6
+ yamlPackageKey
7
+ } from "../_chunks/chunk-OX7W4SJ2.js";
1
8
  import {
2
9
  spawnableCommand
3
10
  } from "../_chunks/chunk-34V6HAJT.js";
@@ -11,213 +18,6 @@ import {
11
18
  // src/generators/allow-builds/generator.ts
12
19
  import { spawnSync } from "node:child_process";
13
20
 
14
- // ../template-engine/dist/pnpm/allow-builds.js
15
- var PENDING_PLACEHOLDER = "set this to true or false";
16
- function isPlainPackageName(name) {
17
- return /^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/i.test(name);
18
- }
19
- function allowPackageBuilds(yamlText, names, options = {}) {
20
- const bom = yamlText.startsWith("\uFEFF") ? "\uFEFF" : "";
21
- const body = yamlText.slice(bom.length);
22
- const eol = body.includes("\r\n") ? "\r\n" : "\n";
23
- const unique = [...new Set(names)];
24
- const listIsRead = options.pnpmMajor === void 0 || options.pnpmMajor < 11;
25
- const result = edit(body.split(/\r?\n/), eol, unique, listIsRead);
26
- return result.status === "updated" ? { ...result, text: `${bom}${result.text}` } : result;
27
- }
28
- function pnpmMajorFromModulesManifest(modulesYamlText) {
29
- const match = /^\s*["']?packageManager["']?\s*:\s*["']?pnpm@(\d+)\./m.exec(modulesYamlText);
30
- return match ? Number(match[1]) : void 0;
31
- }
32
- function edit(original, eol, names, listIsRead) {
33
- const shape = checkDocumentShape(original);
34
- if (shape !== void 0)
35
- return { status: "unrecognized", reason: shape };
36
- const lines = expandFlow(original, "allowBuilds");
37
- if (typeof lines === "string")
38
- return { status: "unrecognized", reason: lines };
39
- const allowBuilds = findBlock(lines, "allowBuilds");
40
- if (typeof allowBuilds === "string")
41
- return { status: "unrecognized", reason: allowBuilds };
42
- if (allowBuilds)
43
- return editAllowBuilds(lines, eol, allowBuilds, names);
44
- if (!listIsRead)
45
- return appendAllowBuilds(original, eol, names);
46
- const listLines = expandFlow(original, "onlyBuiltDependencies");
47
- if (typeof listLines === "string")
48
- return { status: "unrecognized", reason: listLines };
49
- const onlyBuilt = findBlock(listLines, "onlyBuiltDependencies");
50
- if (typeof onlyBuilt === "string")
51
- return { status: "unrecognized", reason: onlyBuilt };
52
- if (onlyBuilt)
53
- return editOnlyBuilt(listLines, eol, onlyBuilt, names);
54
- return appendAllowBuilds(original, eol, names);
55
- }
56
- function appendAllowBuilds(original, eol, names) {
57
- const changes = names.map((name) => ({ name, previous: "absent" }));
58
- const entries = names.map((name) => ` ${yamlPackageKey(name)}: true`);
59
- const head = original[original.length - 1] === "" ? original.slice(0, -1) : original;
60
- return { status: "updated", target: "allowBuilds", changes, text: [...head, "allowBuilds:", ...entries, ""].join(eol) };
61
- }
62
- function editAllowBuilds(lines, eol, block, names) {
63
- const entries = [];
64
- for (const index of block.entries) {
65
- const match = /^(\s+)('([^']*)'|"([^"]*)"|([^\s'"#-]\S*?)):(?:\s+(.*))?$/.exec(lines[index]);
66
- if (!match)
67
- return { status: "unrecognized", reason: 'allowBuilds holds something other than "<package>: <value>" entries' };
68
- entries.push({ index, indent: match[1], rawKey: match[2], key: match[3] ?? match[4] ?? match[5], ...splitValue(match[6] ?? "") });
69
- }
70
- const indent = entries[0]?.indent ?? " ";
71
- for (const name of names) {
72
- if (entries.filter((entry) => entry.key === name).length > 1)
73
- return { status: "unrecognized", reason: `allowBuilds lists ${name} more than once` };
74
- const versioned = entries.find((entry) => entry.key.startsWith(`${name}@`) && classify(entry.value) !== "allowed");
75
- if (versioned)
76
- return { status: "unrecognized", reason: `allowBuilds has a version-specific entry for ${name} (${versioned.key}) that is not true` };
77
- }
78
- const next = [...lines];
79
- const appended = [];
80
- const changes = names.map((name) => {
81
- const entry = entries.find((candidate) => candidate.key === name);
82
- if (!entry) {
83
- appended.push(`${indent}${yamlPackageKey(name)}: true`);
84
- return { name, previous: "absent" };
85
- }
86
- const previous = classify(entry.value);
87
- if (previous !== "allowed")
88
- next[entry.index] = `${entry.indent}${entry.rawKey}: true${entry.comment ? ` ${entry.comment}` : ""}`;
89
- return { name, previous };
90
- });
91
- if (changes.every((change) => change.previous === "allowed"))
92
- return { status: "unchanged", target: "allowBuilds", changes };
93
- next.splice(insertionPoint(block), 0, ...appended);
94
- return { status: "updated", target: "allowBuilds", changes, text: next.join(eol) };
95
- }
96
- function editOnlyBuilt(lines, eol, block, names) {
97
- const listed = /* @__PURE__ */ new Set();
98
- for (const index of block.entries) {
99
- const item = /^\s+-\s+(?:'([^']*)'|"([^"]*)"|([^\s#'"][^#]*?))\s*(?:#.*)?$/.exec(lines[index]);
100
- const value = item ? item[1] ?? item[2] ?? item[3] : void 0;
101
- if (value === void 0 || item?.[3] !== void 0 && /:(\s|$)/.test(value)) {
102
- return { status: "unrecognized", reason: 'onlyBuiltDependencies holds something other than "- <package>" items' };
103
- }
104
- listed.add(value);
105
- }
106
- const indent = block.entries.length > 0 ? leadingSpace(lines[block.entries[0]]) : " ";
107
- const changes = names.map((name) => ({ name, previous: listed.has(name) ? "allowed" : "absent" }));
108
- if (changes.every((change) => change.previous === "allowed")) {
109
- return { status: "unchanged", target: "onlyBuiltDependencies", changes };
110
- }
111
- const next = [...lines];
112
- const appended = changes.filter((change) => change.previous === "absent").map((change) => `${indent}- ${yamlPackageKey(change.name)}`);
113
- next.splice(insertionPoint(block), 0, ...appended);
114
- return { status: "updated", target: "onlyBuiltDependencies", changes, text: next.join(eol) };
115
- }
116
- function checkDocumentShape(lines) {
117
- const content = lines.filter((line) => line.trim() !== "" && !/^\s*#/.test(line));
118
- if (content.some((line) => /^(---|\.\.\.)(\s|$)/.test(line)))
119
- return "the file has YAML document markers (--- / ...)";
120
- const first = content[0];
121
- if (first !== void 0 && !/^(?:'[^']*'|"[^"]*"|[^\s#'"?{[\]-][^:]*?)\s*:(?:\s|$)/.test(first)) {
122
- return "the file is not a plain mapping with its keys at column 0";
123
- }
124
- return void 0;
125
- }
126
- function expandFlow(lines, key) {
127
- const keyLine = topLevelKeyLine(key);
128
- const index = lines.findIndex((line) => keyLine.test(line));
129
- if (index === -1)
130
- return lines;
131
- const match = /^(.*?:)\s*([{[])(.*)([}\]])\s*(#.*)?$/.exec(lines[index]);
132
- if (!match)
133
- return lines;
134
- const [, head, open, inner, close, comment] = match;
135
- const isMap = key === "allowBuilds";
136
- if (isMap && (open !== "{" || close !== "}") || !isMap && (open !== "[" || close !== "]")) {
137
- return `${key} is a flow collection of the wrong kind`;
138
- }
139
- const items = inner.trim() === "" ? [] : inner.split(",").map((item) => item.trim());
140
- const valid = isMap ? (item) => /^(?:'[^']*'|"[^"]*"|[^\s'"#-]\S*?):\s+[^{}[\],]+$/.test(item) : (item) => /^(?:'[^']*'|"[^"]*"|[^\s'"#{}[\],:-][^{}[\],:]*)$/.test(item);
141
- if (items.some((item) => !valid(item)))
142
- return `${key} is a flow collection this parser does not split`;
143
- const block = items.map((item) => isMap ? ` ${item}` : ` - ${item}`);
144
- return [...lines.slice(0, index), `${head}${comment ? ` ${comment}` : ""}`, ...block, ...lines.slice(index + 1)];
145
- }
146
- function topLevelKeyLine(key) {
147
- return new RegExp(`^(['"]?)${key}\\1\\s*:(.*)$`);
148
- }
149
- function findBlock(lines, key) {
150
- const keyLine = topLevelKeyLine(key);
151
- const keyIndices = lines.flatMap((line, index) => keyLine.test(line) ? [index] : []);
152
- const mentions = lines.filter((line) => !/^\s*#/.test(line) && new RegExp(`\\b${key}\\b`).test(line));
153
- if (mentions.length > keyIndices.length)
154
- return `${key} appears somewhere other than a top-level key`;
155
- if (keyIndices.length === 0)
156
- return void 0;
157
- if (keyIndices.length > 1)
158
- return `${key} appears more than once at the top level`;
159
- const keyIndex = keyIndices[0];
160
- const rest = (keyLine.exec(lines[keyIndex])?.[2] ?? "").replace(/\s+#.*$/, "").trim();
161
- if (rest !== "")
162
- return `${key} is not a block (found "${key}: ${rest}")`;
163
- const entries = [];
164
- for (let index = keyIndex + 1; index < lines.length; index++) {
165
- const line = lines[index];
166
- if (line.trim() === "" || /^\s*#/.test(line))
167
- continue;
168
- if (/^\S/.test(line)) {
169
- if (line.startsWith("-"))
170
- return `${key} uses a column-0 list`;
171
- break;
172
- }
173
- entries.push(index);
174
- }
175
- if (entries.length > 0) {
176
- const indent = leadingSpace(lines[entries[0]]);
177
- if (entries.some((index) => leadingSpace(lines[index]) !== indent))
178
- return `${key} has entries at more than one indentation`;
179
- }
180
- return { keyIndex, entries };
181
- }
182
- function insertionPoint(block) {
183
- return (block.entries.length > 0 ? block.entries[block.entries.length - 1] : block.keyIndex) + 1;
184
- }
185
- function splitValue(raw) {
186
- const match = /^('[^']*'|"[^"]*"|[^#]*?)\s*(#.*)?$/.exec(raw.trim());
187
- return { value: match?.[1] ?? raw.trim(), comment: match?.[2] ?? "" };
188
- }
189
- function classify(value) {
190
- if (/^(true|True|TRUE)$/.test(value))
191
- return "allowed";
192
- if (/^(false|False|FALSE)$/.test(value))
193
- return "denied";
194
- const unquoted = /^(['"])(.*)\1$/.exec(value)?.[2] ?? value;
195
- if (unquoted === PENDING_PLACEHOLDER)
196
- return "pending";
197
- return "other";
198
- }
199
- function yamlPackageKey(name) {
200
- return /^[a-z][a-z0-9._~-]*$/i.test(name) && !/^(true|false|null|yes|no|on|off|y|n)$/i.test(name) ? name : `'${name}'`;
201
- }
202
- function leadingSpace(line) {
203
- return /^(\s*)/.exec(line)?.[1] ?? "";
204
- }
205
- function escapeRegExp(text) {
206
- return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
207
- }
208
- function missingFromLockfile(lockfileText, names) {
209
- const installed = [];
210
- let section = "";
211
- for (const line of lockfileText.split(/\r?\n/)) {
212
- if (/^\S/.test(line))
213
- section = /^([A-Za-z]+):/.exec(line)?.[1] ?? "";
214
- else if (section === "packages" || section === "snapshots")
215
- installed.push(line);
216
- }
217
- const text = installed.join("\n");
218
- return names.filter((name) => !new RegExp(`^ {2}(['"]?)/?${escapeRegExp(name)}@`, "m").test(text));
219
- }
220
-
221
21
  // src/generators/allow-builds/render.ts
222
22
  var ALLOW_BUILDS_LABEL = {
223
23
  allowed: "already true",