@payfit/nx-core 4.17.3-ephemeral-docs-readme.3 → 4.18.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.17.3-ephemeral-docs-readme.3",
3
+ "version": "4.18.0",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -4,6 +4,9 @@ orbs:
4
4
  aws-cli: circleci/aws-cli@5.3.3
5
5
  github: payfit/github@0.9
6
6
  node: circleci/node@7.1
7
+ <% if (keepContinuationJobs) { %>
8
+ continuation: circleci/continuation@1.0.0
9
+ <% } %>
7
10
 
8
11
  references:
9
12
  setup_env_node: &setup_env_node
@@ -113,7 +116,7 @@ jobs:
113
116
  git config --global user.name "semver-release"
114
117
  git config --global --type bool push.autoSetupRemote true
115
118
  git fetch --tags
116
- tbot start -c .github/teleport/shared-charts.conf
119
+ tbot start -c .circleci/teleport/shared-charts.conf
117
120
  if [[ "${CIRCLE_BRANCH}" == "main" || "${CIRCLE_BRANCH}" == "master" ]]; then
118
121
  echo "Publishing release"
119
122
  npx nx release --yes
@@ -123,6 +126,42 @@ jobs:
123
126
  npx nx release publish --tag ephemeral
124
127
  fi
125
128
 
129
+ <% if (keepContinuationJobs) { %>
130
+ continuation:
131
+ <<: *setup_env_node
132
+ parameters:
133
+ parameters:
134
+ description: >-
135
+ The parameters used for the pipeline. A path to a file containing
136
+ a JSON object with parameters
137
+ type: string
138
+ default: << pipeline.parameters.parameters-file >>
139
+ continue-config:
140
+ description: Path to the internally-used config for continuation
141
+ type: string
142
+ default: << pipeline.parameters.continue-config >>
143
+ steps:
144
+ - checkout
145
+ - attach_workspace: *attach_workspace
146
+ - run:
147
+ name: skip if no affected-apps
148
+ command: |
149
+ # If `affected-apps` is unavailable, stop this job without continuation
150
+ if [ ! -f "<< parameters.continue-config >>" ] || [ ! -s "<< parameters.continue-config >>" ]
151
+ then
152
+ echo 'No affected apps, nothing to do.'
153
+ circleci-agent step halt
154
+ exit
155
+ fi
156
+ - run:
157
+ name: Setup parameters
158
+ command: |
159
+ echo "{\"workflow-id\": \"$CIRCLE_WORKFLOW_ID\"}" > parameters.json
160
+ - continuation/continue:
161
+ configuration_path: << parameters.continue-config >>
162
+ parameters: parameters.json
163
+ <% } %>
164
+
126
165
  workflows:
127
166
  build-test-deploy:
128
167
  jobs:
@@ -195,3 +234,11 @@ workflows:
195
234
  context:
196
235
  - NX_COMMON_PACKAGES # TSH config / AWS credentials / NPM token
197
236
  <% } %>
237
+
238
+ <% if (keepContinuationJobs) { %>
239
+ - continuation:
240
+ requires:
241
+ - build
242
+ context:
243
+ - NX_COMMON_PACKAGES # TSH config / AWS credentials / NPM token
244
+ <% } %>
@@ -0,0 +1,24 @@
1
+ version: v2
2
+ onboarding:
3
+ token: "nx-common-packages"
4
+ join_method: "circleci"
5
+ storage:
6
+ type: "directory"
7
+ path: "/tmp/tbot-data"
8
+ symlinks: "try-secure"
9
+ acls: "off"
10
+ outputs:
11
+ - type: "application"
12
+ destination:
13
+ type: "directory"
14
+ path: "./certs"
15
+ symlinks: "try-secure"
16
+ acls: "off"
17
+ app_name: "charts-shared"
18
+ specific_tls_naming: false
19
+ debug: false
20
+ auth_server: "payfit.teleport.sh:443"
21
+ certificate_ttl: "1h0m0s"
22
+ renewal_interval: "20m0s"
23
+ oneshot: true
24
+ fips: false
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initGenerator = initGenerator;
4
+ const fs = require("fs");
4
5
  const path = require("path");
5
6
  const devkit_1 = require("@nx/devkit");
6
7
  function injectNxReleaseConfiguration(tree) {
@@ -21,7 +22,7 @@ function injectNxReleaseConfiguration(tree) {
21
22
  currentVersionResolver: 'git-tag',
22
23
  fallbackCurrentVersionResolver: 'disk',
23
24
  specifierSource: 'conventional-commits',
24
- manifestRootsToUpdate: ['{workspaceRoot}/dist/{projectRoot}'],
25
+ manifestRootsToUpdate: ['dist/{projectRoot}'],
25
26
  preserveLocalDependencyProtocols: false,
26
27
  },
27
28
  git: {
@@ -40,7 +41,7 @@ function injectNxReleaseConfiguration(tree) {
40
41
  if (!nxJson.targetDefaults['nx-release-publish']) {
41
42
  nxJson.targetDefaults['nx-release-publish'] = {
42
43
  options: {
43
- packageRoot: '{workspaceRoot}/dist/{projectRoot}',
44
+ packageRoot: 'dist/{projectRoot}',
44
45
  },
45
46
  };
46
47
  }
@@ -49,11 +50,42 @@ function injectNxReleaseConfiguration(tree) {
49
50
  }
50
51
  async function initGenerator(tree, options = {}) {
51
52
  const workspaceRoot = `.`;
53
+ // Check for each project if we can find a template.yaml or a cdk.json file
54
+ // If it's the case we should keep the continuation jobs in the .circleci/config.yml,
55
+ // the .circleci/shared-config.yml
56
+ // and keep the {projectRoot}/.circleci/config.yml file
57
+ // If not we can delete all {projectRoot}/.circleci/config.yml files and the .circleci/shared-config.yml file.
58
+ const projects = (0, devkit_1.getProjects)(tree);
59
+ let hasCdkOrTemplateFile = false;
60
+ // Check each project for template.yaml or cdk.json files
61
+ for (const [projectName, projectConfig] of projects.entries()) {
62
+ const projectRoot = projectConfig.root;
63
+ const templateYamlPath = path.join(projectRoot, 'template.yaml');
64
+ const cdkJsonPath = path.join(projectRoot, 'cdk.json');
65
+ // Check if either file exists
66
+ if (fs.existsSync(templateYamlPath) || fs.existsSync(cdkJsonPath)) {
67
+ hasCdkOrTemplateFile = true;
68
+ break; // We found at least one project with the required files, no need to check further
69
+ }
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;
77
+ const projectCircleCIPath = path.join(projectRoot, '.circleci/config.yml');
78
+ if (tree.exists(projectCircleCIPath)) {
79
+ tree.delete(projectCircleCIPath);
80
+ }
81
+ }
82
+ }
52
83
  // Delete the .circleci/config.yml file if it exists
53
84
  tree.delete(path.join(workspaceRoot, '.circleci/config.yml'));
54
85
  // Generate the .circleci/config.yml file
55
86
  (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), workspaceRoot, {
56
87
  queuing_release: options.queuing_release ?? true,
88
+ keepContinuationJobs: hasCdkOrTemplateFile,
57
89
  });
58
90
  // Patch the nx.json file with the nx release default configuration
59
91
  injectNxReleaseConfiguration(tree);
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/nx-core/src/generators/init/init.ts"],"names":[],"mappings":";;AAuDA,sCAgBC;AAvED,6BAA4B;AAE5B,uCAAyE;AAIzE,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,oCAAoC,CAAC;gBAC7D,gCAAgC,EAAE,KAAK;aACxC;YACD,GAAG,EAAE;gBACH,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,IAAI;aACV;SACF,CAAA;QACD,+CAA+C;QAC/C,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAA;QAErC,yDAAyD;QACzD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAChD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;QACxC,CAAC;QAED,+CAA+C;QAC/C,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,EAAE,CAAA;QAEnD,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,oBAAoB,CAAC,EAAE,CAAC;YACjD,MAAM,CAAC,cAAc,CAAC,oBAAoB,CAAC,GAAG;gBAC5C,OAAO,EAAE;oBACP,WAAW,EAAE,oCAAoC;iBAClD;aACF,CAAA;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAC,CAAA;AACJ,CAAC;AAEM,KAAK,UAAU,aAAa,CACjC,IAAU,EACV,UAA+B,EAAE;IAEjC,MAAM,aAAa,GAAG,GAAG,CAAA;IAEzB,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;KACjD,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":";;AA8DA,sCAqDC;AAnHD,yBAAwB;AACxB,6BAA4B;AAE5B,uCAMmB;AAInB,SAAS,4BAA4B,CAAC,IAAU;IAC9C,IAAA,mBA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