@payfit/nx-core 5.29.1 → 5.29.2

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,5 @@
1
+ ## nx-core
2
+
3
+ - Release and publishing are handled by the `@payfit/nx-core` plugin, dry-run command is `npx nx run <root-nx-project>:release --dry-run`
4
+ - CI should run Nx commands only (`nx run`, `nx run-many`, `nx affected`) rather than invoking underlying tooling directly.
5
+ - Be careful when defining Nx targets: optimize `inputs`/`outputs` for Nx Cloud caching and validate with `npx nx-cloud conformance`.
@@ -0,0 +1,5 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { SyncGeneratorResult } from 'nx/src/utils/sync-generators';
3
+ export declare function syncAgents(tree: Tree): Promise<SyncGeneratorResult>;
4
+ export default syncAgents;
5
+ //# sourceMappingURL=sync-agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-agents.d.ts","sourceRoot":"","sources":["../../../../src/generators/sync/sync-agents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAoClE,wBAAsB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA4CzE;AAED,eAAe,UAAU,CAAA"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.syncAgents = syncAgents;
4
+ const node_fs_1 = require("node:fs");
5
+ const node_path_1 = require("node:path");
6
+ const AGENTS_FILE_PATH = 'AGENTS.md';
7
+ const NX_CORE_START_MARKER = '<!-- nx-core start -->';
8
+ const NX_CORE_MARKER_DESCRIPTION = '<!-- Leave the start & end comments to automatically receive updates. -->';
9
+ const NX_CORE_END_MARKER = '<!-- nx-core end -->';
10
+ const NX_CORE_RULES_REGEX = new RegExp(`${NX_CORE_START_MARKER}[\\s\\S]*?${NX_CORE_END_MARKER}`, 'm');
11
+ function getReleaseManagedArtifactsTemplate() {
12
+ return (0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, 'files', 'nx-core-agents.md.template'), 'utf-8');
13
+ }
14
+ function getWrappedReleaseDocs(content) {
15
+ const trimmedContent = content.trim();
16
+ if (!trimmedContent) {
17
+ return `${NX_CORE_START_MARKER}\n${NX_CORE_MARKER_DESCRIPTION}\n${NX_CORE_END_MARKER}`;
18
+ }
19
+ return `${NX_CORE_START_MARKER}\n${NX_CORE_MARKER_DESCRIPTION}\n\n${trimmedContent}\n\n${NX_CORE_END_MARKER}`;
20
+ }
21
+ function contentOnly(content) {
22
+ return content
23
+ .replace(NX_CORE_START_MARKER, '')
24
+ .replace(NX_CORE_MARKER_DESCRIPTION, '')
25
+ .replace(NX_CORE_END_MARKER, '')
26
+ .replace(/\s/g, '');
27
+ }
28
+ async function syncAgents(tree) {
29
+ const expectedRules = getWrappedReleaseDocs(getReleaseManagedArtifactsTemplate());
30
+ if (!tree.exists(AGENTS_FILE_PATH)) {
31
+ tree.write(AGENTS_FILE_PATH, expectedRules);
32
+ return {
33
+ outOfSyncMessage: '/AGENTS.md file needs to be created',
34
+ };
35
+ }
36
+ const existingContent = tree.read(AGENTS_FILE_PATH, 'utf-8');
37
+ if (!existingContent) {
38
+ tree.write(AGENTS_FILE_PATH, expectedRules);
39
+ return {
40
+ outOfSyncMessage: '/AGENTS.md file needs to be updated',
41
+ };
42
+ }
43
+ const existingNxCoreBlock = existingContent.match(NX_CORE_RULES_REGEX);
44
+ if (existingNxCoreBlock) {
45
+ if (contentOnly(existingNxCoreBlock[0]) === contentOnly(expectedRules)) {
46
+ return;
47
+ }
48
+ const updatedContent = existingContent.replace(NX_CORE_RULES_REGEX, expectedRules);
49
+ tree.write(AGENTS_FILE_PATH, updatedContent);
50
+ return {
51
+ outOfSyncMessage: '/AGENTS.md file needs to be updated',
52
+ };
53
+ }
54
+ const updatedContent = `${existingContent}\n\n${expectedRules}`;
55
+ tree.write(AGENTS_FILE_PATH, updatedContent);
56
+ return {
57
+ outOfSyncMessage: '/AGENTS.md file needs to be updated',
58
+ };
59
+ }
60
+ exports.default = syncAgents;
61
+ //# sourceMappingURL=sync-agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-agents.js","sourceRoot":"","sources":["../../../../src/generators/sync/sync-agents.ts"],"names":[],"mappings":";;AAwCA,gCA4CC;AApFD,qCAAsC;AACtC,yCAAgC;AAKhC,MAAM,gBAAgB,GAAG,WAAW,CAAA;AACpC,MAAM,oBAAoB,GAAG,wBAAwB,CAAA;AACrD,MAAM,0BAA0B,GAC9B,2EAA2E,CAAA;AAC7E,MAAM,kBAAkB,GAAG,sBAAsB,CAAA;AACjD,MAAM,mBAAmB,GAAG,IAAI,MAAM,CACpC,GAAG,oBAAoB,aAAa,kBAAkB,EAAE,EACxD,GAAG,CACJ,CAAA;AAED,SAAS,kCAAkC;IACzC,OAAO,IAAA,sBAAY,EACjB,IAAA,gBAAI,EAAC,SAAS,EAAE,OAAO,EAAE,4BAA4B,CAAC,EACtD,OAAO,CACR,CAAA;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,OAAe;IAC5C,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,EAAE,CAAA;IACrC,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,GAAG,oBAAoB,KAAK,0BAA0B,KAAK,kBAAkB,EAAE,CAAA;IACxF,CAAC;IAED,OAAO,GAAG,oBAAoB,KAAK,0BAA0B,OAAO,cAAc,OAAO,kBAAkB,EAAE,CAAA;AAC/G,CAAC;AAED,SAAS,WAAW,CAAC,OAAe;IAClC,OAAO,OAAO;SACX,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC;SACjC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC;SACvC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;SAC/B,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;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"factory": "./dist/src/generators/sync/sync-list-lambda-functions",
10
10
  "schema": "./dist/src/generators/sync/schema.json",
11
11
  "description": "sync-list-lambda-functions generator"
12
+ },
13
+ "sync-agents": {
14
+ "factory": "./dist/src/generators/sync/sync-agents",
15
+ "schema": "./dist/src/generators/sync/schema.json",
16
+ "description": "sync-agents generator"
12
17
  }
13
18
  }
14
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payfit/nx-core",
3
- "version": "5.29.1",
3
+ "version": "5.29.2",
4
4
  "type": "commonjs",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",