@conformetry/nx 0.0.1

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.
@@ -0,0 +1,31 @@
1
+ import { ExecutorContext } from '@nx/devkit';
2
+
3
+ /**
4
+ * Validates one project's instances against their conformetry templates.
5
+ *
6
+ * Inferred onto every project holding at least one instance, so
7
+ * `nx run-many -t conformetry-validate` covers the workspace and
8
+ * `nx affected -t conformetry-validate` covers only what changed — which the
9
+ * single workspace-wide command it replaces could not do.
10
+ */
11
+ declare function validateExecutor(options: ValidateExecutorOptions, context: ExecutorContext): Promise<{
12
+ success: boolean;
13
+ }>;
14
+ export default validateExecutor;
15
+
16
+ /** Options accepted by the conformetry validate executor. */
17
+ declare interface ValidateExecutorOptions {
18
+ /** Where the conformetry configuration lives, workspace-root relative. */
19
+ readonly configurationPath?: string;
20
+ /** Language names to restrict the run to; every language when absent. */
21
+ readonly languages?: string[];
22
+ /**
23
+ * Lowest conformance score an instance may have, from 0 to 1.
24
+ *
25
+ * The weakest of the three levels: a generator's own threshold and an
26
+ * instance group's both override it.
27
+ */
28
+ readonly threshold?: number;
29
+ }
30
+
31
+ export { }
@@ -0,0 +1,22 @@
1
+ import { r as e } from "../../../plugin-context.utilities-CuP36-vK.js";
2
+ //#region packages/ic-suite/conformetry/conformetry-nx/src/executors/validate/executor.ts
3
+ async function t(t, n) {
4
+ let r = n.projectName;
5
+ if (r === void 0) throw Error("The conformetry validate executor must be run against a project.");
6
+ let i = n.projectsConfigurations.projects[r];
7
+ if (i === void 0) throw Error(`Unknown project: ${r}.`);
8
+ let a = await (await e()).runValidation({
9
+ ...t.languages === void 0 ? {} : { languageNames: t.languages },
10
+ options: t,
11
+ ...t.threshold === void 0 ? {} : { threshold: t.threshold },
12
+ project: {
13
+ name: r,
14
+ root: i.root,
15
+ tags: [...i.tags ?? [], `name:${r}`]
16
+ },
17
+ workspaceRoot: n.root
18
+ });
19
+ return process.stdout.write(`${a.report}\n`), { success: a.ok };
20
+ }
21
+ //#endregion
22
+ export { t as default };
@@ -0,0 +1,26 @@
1
+ import { Tree } from '@nx/devkit';
2
+
3
+ /**
4
+ * Regenerates the workspace's conformetry generator plugin.
5
+ *
6
+ * Registered as a global sync generator, so `nx sync:check` fails whenever the
7
+ * configuration declares a generator the emitted plugin does not, and `nx sync`
8
+ * fixes it. Writing through the tree rather than to disk is what makes the
9
+ * check possible: Nx compares the tree against the working copy.
10
+ */
11
+ declare function syncGenerator(tree: Tree, options?: SyncGeneratorOptions): Promise<{
12
+ outOfSyncMessage: string;
13
+ }>;
14
+ export default syncGenerator;
15
+
16
+ /** Options accepted by the conformetry sync generator. */
17
+ declare interface SyncGeneratorOptions {
18
+ /** Path to the conformetry configuration, relative to the workspace root. */
19
+ readonly configurationPath?: string;
20
+ /** Directory the generator plugin is emitted into. */
21
+ readonly outputPath?: string;
22
+ /** Package name the emitted plugin is addressed by. */
23
+ readonly packageName?: string;
24
+ }
25
+
26
+ export { }
@@ -0,0 +1,21 @@
1
+ import { d as e, i as t, n, t as r, v as i } from "../../../plugin-context.utilities-CuP36-vK.js";
2
+ //#region packages/ic-suite/conformetry/conformetry-nx/src/generators/sync/generator.ts
3
+ async function a(e, a) {
4
+ let s = await r(), c = await n(), l = await t(), u = await s.emitPlugin({
5
+ configurationPath: a?.configurationPath ?? c.resolveConfigurationPath({
6
+ exists: (t) => e.exists(t),
7
+ nxConfiguration: o(e)
8
+ }),
9
+ outputPath: a?.outputPath ?? ".conformetry/nx-generators",
10
+ packageName: a?.packageName ?? "conformetry",
11
+ projects: l.listWorkspaceProjects(e.root)
12
+ });
13
+ for (let t of u) e.write(t.filePath, t.content);
14
+ return { outOfSyncMessage: i };
15
+ }
16
+ function o(t) {
17
+ let n = t.read(e, "utf8");
18
+ if (n !== null) return JSON.parse(n);
19
+ }
20
+ //#endregion
21
+ export { a as default };