@payfit/nx-core 4.23.0 → 4.23.1-ephemeral-b8a131a.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payfit/nx-core",
3
- "version": "4.23.0",
3
+ "version": "4.23.1-ephemeral-b8a131a.0",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -6,6 +6,7 @@ orbs:
6
6
  node: circleci/node@7.1
7
7
  <% if (keepContinuationJobs) { %>
8
8
  continuation: circleci/continuation@1.0.0
9
+ payfit-nx: payfit/nx@2
9
10
  <% } %>
10
11
 
11
12
  references:
@@ -25,6 +26,30 @@ references:
25
26
  error-on-no-successful-workflow: false
26
27
  main-branch-name: main
27
28
  workflow-name: build-test-release
29
+ <% if (keepContinuationJobs) { %>
30
+ only_main_and_deploy_branches: &only_main_and_deploy_branches
31
+ branches:
32
+ only:
33
+ - main
34
+ - /^deploy.*/
35
+
36
+
37
+ parameters:
38
+ affected-list:
39
+ description: Path to the file where the affected list of apps is generated
40
+ type: string
41
+ default: affected-list.txt
42
+ shared-config:
43
+ description: |
44
+ Path to the config providing shared resources
45
+ (such as prerequisite jobs and common commands)
46
+ type: string
47
+ default: .circleci/shared-config.yml
48
+ continue-config:
49
+ description: Path to the internally-used config for continuation
50
+ type: string
51
+ default: .circleci/continue-config.yml
52
+ <% } %>
28
53
 
29
54
  jobs:
30
55
  install_packages:
@@ -236,6 +261,26 @@ workflows:
236
261
  <% } %>
237
262
 
238
263
  <% if (keepContinuationJobs) { %>
264
+ - payfit-nx/affected-apps:
265
+ name: affected-apps
266
+ output-file: << pipeline.parameters.affected-list >>
267
+ main-branch-name: main
268
+ allow-on-hold-workflow: true
269
+ nx-ci-execution-id: $CIRCLE_WORKFLOW_ID
270
+ context: GLOBAL_ORG
271
+ requires:
272
+ - install_packages
273
+ filters: *only_main_and_deploy_branches
274
+
275
+ - payfit-nx/merge-circle-config:
276
+ name: merge-configs
277
+ shared-config-file: << pipeline.parameters.shared-config >>
278
+ affected-list-file: << pipeline.parameters.affected-list >>
279
+ config-output: << pipeline.parameters.continue-config >>
280
+ requires:
281
+ - affected-apps
282
+ filters: *only_main_and_deploy_branches
283
+
239
284
  - continuation:
240
285
  requires:
241
286
  - build
@@ -4,6 +4,7 @@ exports.initGenerator = initGenerator;
4
4
  const fs = require("fs");
5
5
  const path = require("path");
6
6
  const devkit_1 = require("@nx/devkit");
7
+ const logger_1 = require("../../utils/logger");
7
8
  function injectNxReleaseConfiguration(tree) {
8
9
  (0, devkit_1.updateJson)(tree, 'nx.json', nxJson => {
9
10
  nxJson.release = {
@@ -48,6 +49,23 @@ function injectNxReleaseConfiguration(tree) {
48
49
  return nxJson;
49
50
  });
50
51
  }
52
+ // For each project, we need to remove the github, version
53
+ // We should also remove the lint and test targets as they should be infered
54
+ // if there is a eslint.json or jest.config.js/vite config file
55
+ function removeInferedNxProjectConfiguration(tree, projectRoot) {
56
+ const nxJsonPath = path.join(projectRoot, 'nx.json');
57
+ if (tree.exists(nxJsonPath)) {
58
+ (0, devkit_1.updateJson)(tree, nxJsonPath, nxJson => {
59
+ const inferedTargets = ['lint', 'test', 'github', 'version'];
60
+ inferedTargets.forEach(target => {
61
+ if (nxJson.targets?.[target]) {
62
+ delete nxJson.targets[target];
63
+ }
64
+ });
65
+ return nxJson;
66
+ });
67
+ }
68
+ }
51
69
  async function initGenerator(tree, options = {}) {
52
70
  const workspaceRoot = `.`;
53
71
  // Check for each project if we can find a template.yaml or a cdk.json file
@@ -62,24 +80,27 @@ async function initGenerator(tree, options = {}) {
62
80
  const projectRoot = projectConfig.root;
63
81
  const templateYamlPath = path.join(projectRoot, 'template.yaml');
64
82
  const cdkJsonPath = path.join(projectRoot, 'cdk.json');
65
- // Check if either file exists
83
+ // Check if either file exists, this may need to be adjusted based on serverless autodiscover pattern
66
84
  if (fs.existsSync(templateYamlPath) || fs.existsSync(cdkJsonPath)) {
67
85
  hasCdkOrTemplateFile = true;
68
- break; // We found at least one project with the required files, no need to check further
86
+ logger_1.consola.info(`Project ${projectName} has a template.yaml or cdk.json file, keeping continuation jobs.`);
69
87
  }
70
- }
71
- // If no project has template.yaml or cdk.json files, delete all project-specific CircleCI config files
72
- if (!hasCdkOrTemplateFile) {
73
- // We don't delete the shared-config.yml file anymore as it should already exist in the project
74
- // Delete all project-specific CircleCI config files
75
- for (const [projectName, projectConfig] of projects.entries()) {
76
- const projectRoot = projectConfig.root;
88
+ else {
77
89
  const projectCircleCIPath = path.join(projectRoot, '.circleci/config.yml');
78
90
  if (tree.exists(projectCircleCIPath)) {
79
91
  tree.delete(projectCircleCIPath);
80
92
  }
81
93
  }
82
94
  }
95
+ // If there is no project with a template.yaml or cdk.json file,
96
+ // we can delete the .circleci/shared-config.yml file
97
+ if (!hasCdkOrTemplateFile) {
98
+ logger_1.consola.info('No project with a template.yaml or cdk.json file found, deleting .circleci/shared-config.yml');
99
+ const sharedConfigPath = path.join(workspaceRoot, '.circleci/shared-config.yml');
100
+ if (tree.exists(sharedConfigPath)) {
101
+ tree.delete(sharedConfigPath);
102
+ }
103
+ }
83
104
  // Delete the .circleci/config.yml file if it exists
84
105
  tree.delete(path.join(workspaceRoot, '.circleci/config.yml'));
85
106
  // Generate the .circleci/config.yml file
@@ -89,6 +110,13 @@ async function initGenerator(tree, options = {}) {
89
110
  });
90
111
  // Patch the nx.json file with the nx release default configuration
91
112
  injectNxReleaseConfiguration(tree);
113
+ // For each project, remove the infered targets
114
+ if (options.remove_infered_targets) {
115
+ for (const [projectName, projectConfig] of projects.entries()) {
116
+ const projectRoot = projectConfig.root;
117
+ removeInferedNxProjectConfiguration(tree, projectRoot);
118
+ }
119
+ }
92
120
  await (0, devkit_1.formatFiles)(tree);
93
121
  }
94
122
  exports.default = initGenerator;
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/nx-core/src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AE,CAAC;gBACrC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAA;YAClC,CAAC;QACH,CAAC;IACH,CAAC;IAED,oDAAoD;IACpD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC,CAAA;IAC7D,yCAAyC;IACzC,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,aAAa,EAAE;QAChE,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,IAAI;QAChD,oBAAoB,EAAE,oBAAoB;KAC3C,CAAC,CAAA;IAEF,mEAAmE;IACnE,4BAA4B,CAAC,IAAI,CAAC,CAAA;IAClC,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAA;AACzB,CAAC;AAED,kBAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/nx-core/src/generators/init/init.ts"],"names":[],"mappings":";;AAkFA,sCAmEC;AArJD,yBAAwB;AACxB,6BAA4B;AAE5B,uCAMmB;AAEnB,+CAA4C;AAG5C,SAAS,4BAA4B,CAAC,IAAU;IAC9C,IAAA,mBAAU,EAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE;QACnC,MAAM,CAAC,OAAO,GAAG;YACf,oBAAoB,EAAE,aAAa;YACnC,QAAQ,EAAE,CAAC,GAAG,CAAC;YACf,iBAAiB,EAAE,yBAAyB;YAC5C,SAAS,EAAE;gBACT,iBAAiB,EAAE;oBACjB,aAAa,EAAE,QAAQ;oBACvB,IAAI,EAAE,KAAK;iBACZ;gBACD,gBAAgB,EAAE,IAAI;aACvB;YACD,OAAO,EAAE;gBACP,mBAAmB,EAAE,KAAK;gBAC1B,sBAAsB,EAAE,SAAS;gBACjC,8BAA8B,EAAE,MAAM;gBACtC,eAAe,EAAE,sBAAsB;gBACvC,qBAAqB,EAAE,CAAC,oCAAo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,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC1B,gBAAO,CAAC,IAAI,CACV,8FAA8F,CAC/F,CAAA;QACD,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAChC,aAAa,EACb,6BAA6B,CAC9B,CAAA;QACD,IAAI,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC;IAED,oDAAoD;IACpD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC,CAAA;IAC7D,yCAAyC;IACzC,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,aAAa,EAAE;QAChE,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,IAAI;QAChD,oBAAoB,EAAE,oBAAoB;KAC3C,CAAC,CAAA;IAEF,mEAAmE;IACnE,4BAA4B,CAAC,IAAI,CAAC,CAAA;IAClC,+CAA+C;IAC/C,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;QACnC,KAAK,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;YAC9D,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAA;YACtC,mCAAmC,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;QACxD,CAAC;IACH,CAAC;IACD,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAA;AACzB,CAAC;AAED,kBAAe,aAAa,CAAA"}
@@ -1,3 +1,4 @@
1
1
  export interface InitGeneratorSchema {
2
2
  queuing_release?: boolean
3
+ remove_infered_targets?: boolean
3
4
  }
@@ -8,7 +8,13 @@
8
8
  "type": "boolean",
9
9
  "description": "Whether to use serial group for the publish step to avoid concurrent running",
10
10
  "default": true,
11
- "x-prompt": "Would you like to run your main branch release steps concurrentially (using https://circleci.com/docs/configuration-reference/#serial-group)? (Y/n)"
11
+ "x-prompt": "Would you like to run your main branch release steps concurrentially (using https://circleci.com/docs/configuration-reference/#serial-group)?"
12
+ },
13
+ "remove_infered_targets": {
14
+ "type": "boolean",
15
+ "description": "Whether to remove the infered targets from the project.json files",
16
+ "default": true,
17
+ "x-prompt": "Would you like to remove the infered targets from the project.json files?"
12
18
  }
13
19
  }
14
20
  }