@payfit/nx-core 4.12.2-beta-test-release.0 → 4.13.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/README.md CHANGED
@@ -10,6 +10,7 @@ Install the package as dev dependency of your project:
10
10
  yarn add -D @payfit/nx-core
11
11
  ```
12
12
 
13
+ This may run the init generator updating your circle files.
13
14
  ## Building
14
15
 
15
16
  Run `nx build nx-core` to build the library.
@@ -0,0 +1,203 @@
1
+ version: 2.1
2
+ orbs:
3
+ nx: nrwl/nx@1.7.0
4
+ aws-cli: circleci/aws-cli@5.3.3
5
+ github: payfit/github@0.9
6
+ node: circleci/node@7.1
7
+
8
+ references:
9
+ setup_env_node: &setup_env_node
10
+ docker:
11
+ - image: cimg/node:22.11.0
12
+ setup_env_machine: &setup_env_machine # Used for getting docker cli
13
+ machine:
14
+ image: ubuntu-2204:current
15
+ install_packages: &install_packages
16
+ check-cache: always
17
+ pkg-manager: yarn-berry
18
+
19
+ attach_workspace: &attach_workspace
20
+ at: ~/project
21
+ nx/set-shas: &nx_set_shas_option
22
+ error-on-no-successful-workflow: false
23
+ main-branch-name: main
24
+ workflow-name: build-test-release
25
+
26
+ jobs:
27
+ yarn:
28
+ <<: *setup_env_node
29
+ steps:
30
+ - checkout
31
+ - node/install-packages: *install_packages
32
+
33
+ lint:
34
+ <<: *setup_env_node
35
+ steps:
36
+ - checkout
37
+ - node/install-packages: *install_packages
38
+ - run: yarn nx report
39
+ - run: yarn lint
40
+
41
+ nx-conformance:
42
+ <<: *setup_env_node
43
+ steps:
44
+ - checkout
45
+ - node/install-packages: *install_packages
46
+ - run: yarn nx-cloud record -- yarn nx-cloud conformance:check
47
+
48
+ nx-sync:
49
+ <<: *setup_env_node
50
+ steps:
51
+ - checkout
52
+ - node/install-packages: *install_packages
53
+ - run: yarn nx-cloud record -- yarn nx sync:check
54
+
55
+ format:
56
+ <<: *setup_env_node
57
+ steps:
58
+ - checkout
59
+ - node/install-packages: *install_packages
60
+ - run: yarn nx-cloud record -- yarn nx format:check
61
+
62
+ build:
63
+ <<: *setup_env_node
64
+ steps:
65
+ - checkout
66
+ - node/install-packages: *install_packages
67
+ - nx/set-shas: *nx_set_shas_option
68
+ - run: yarn build
69
+ - persist_to_workspace:
70
+ root: '.'
71
+ paths:
72
+ - dist
73
+
74
+ test:
75
+ <<: *setup_env_node
76
+ steps:
77
+ - checkout
78
+ - node/install-packages: *install_packages
79
+ - nx/set-shas: *nx_set_shas_option
80
+ - run: yarn test
81
+ - store_test_results:
82
+ path: test-results
83
+
84
+ publish:
85
+ <<: *setup_env_machine
86
+ steps:
87
+ - checkout
88
+ - attach_workspace: *attach_workspace
89
+ - node/install:
90
+ install-yarn: true
91
+ - node/install-packages: *install_packages
92
+ - nx/set-shas: *nx_set_shas_option
93
+ - aws-cli/setup:
94
+ role_arn: ${PUBLISH_ROLE_ARN}
95
+ profile_name: 'OIDC-PROFILE'
96
+ - run:
97
+ name: 'Install Helm 3'
98
+ command: |
99
+ curl -o- get_helm.sh https://raw.githubusercontent.com/helm/helm/v3.17.3/scripts/get-helm-3 | bash
100
+ - run:
101
+ name: 'Install Tsh'
102
+ command: |
103
+ curl -O https://cdn.teleport.dev/teleport-v17.4.6-linux-amd64-bin.tar.gz
104
+ tar -xzf teleport-v17.4.6-linux-amd64-bin.tar.gz
105
+ cd teleport
106
+ sudo ./install
107
+ - run:
108
+ name: Release
109
+ command: |
110
+ export GITHUB_TOKEN="$(cat github_token)"
111
+ export GH_TOKEN="$(cat github_token)"
112
+ git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/PayFit/${CIRCLE_PROJECT_REPONAME}.git
113
+ git config --global user.email "semver-release@payfit.tech"
114
+ git config --global user.name "semver-release"
115
+ git config --global --type bool push.autoSetupRemote true
116
+ tbot start -c .github/teleport/shared-charts.conf
117
+ if [[ "${CIRCLE_BRANCH}" == "main" || "${CIRCLE_BRANCH}" == "master" ]]; then
118
+ echo "Publishing release"
119
+ yarn nx release --yes
120
+ else
121
+ echo "Publishing ephemeral"
122
+ yarn nx release prerelease --preid beta-${CIRCLE_BRANCH//[^a-zA-Z0-9]/-} --skip-publish
123
+ yarn nx release publish --tag beta
124
+ fi
125
+
126
+ workflows:
127
+ build-test-deploy:
128
+ jobs:
129
+ - github/auth:
130
+ outputFile: github_token
131
+ name: github_authenticate
132
+ context:
133
+ - GLOBAL_ORG
134
+ - yarn:
135
+ context: GLOBAL_ORG
136
+
137
+ - lint:
138
+ context: GLOBAL_ORG
139
+ requires:
140
+ - yarn
141
+
142
+ - nx-sync:
143
+ context: GLOBAL_ORG
144
+ requires:
145
+ - yarn
146
+
147
+ - format:
148
+ context: GLOBAL_ORG
149
+ requires:
150
+ - yarn
151
+
152
+ - nx-conformance:
153
+ context: GLOBAL_ORG
154
+ requires:
155
+ - yarn
156
+
157
+ - build:
158
+ context: GLOBAL_ORG
159
+ requires:
160
+ - yarn
161
+
162
+ - test:
163
+ context: GLOBAL_ORG
164
+ requires:
165
+ - yarn
166
+
167
+ <% if (queuing_release) { %>
168
+ - publish:
169
+ name: Publish Branch
170
+ filters: pipeline.git.branch != "main"
171
+ requires:
172
+ - github_authenticate
173
+ - test
174
+ - build
175
+ context:
176
+ - GLOBAL_ORG # Contains NPM token to publish to npm
177
+ - CORE-PLATFORM_SHARED_ENV #Contains the aws credentials to publish to ECR/S3
178
+ - NX_COMMON_PACKAGES # TSH config
179
+
180
+ - publish:
181
+ name: Publish Release
182
+ filters: pipeline.git.branch == "main"
183
+ requires:
184
+ - github_authenticate
185
+ - test
186
+ - build
187
+ serial-group: release
188
+ context:
189
+ - GLOBAL_ORG # Contains NPM token to publish to npm
190
+ - CORE-PLATFORM_SHARED_ENV #Contains the aws credentials to publish to ECR/S3
191
+ - NX_COMMON_PACKAGES # TSH config
192
+ <% } else { %>
193
+ - publish:
194
+ name: Publish
195
+ requires:
196
+ - github_authenticate
197
+ - test
198
+ - build
199
+ context:
200
+ - GLOBAL_ORG # Contains NPM token to publish to npm
201
+ - CORE-PLATFORM_SHARED_ENV #Contains the aws credentials to publish to ECR/S3
202
+ - NX_COMMON_PACKAGES # TSH config
203
+ <% } %>
@@ -0,0 +1,4 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { InitGeneratorSchema } from './schema';
3
+ export declare function initGenerator(tree: Tree, options?: InitGeneratorSchema): Promise<void>;
4
+ export default initGenerator;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initGenerator = initGenerator;
4
+ const path = require("path");
5
+ const devkit_1 = require("@nx/devkit");
6
+ function injectNxReleaseConfiguration(tree) {
7
+ (0, devkit_1.updateJson)(tree, 'nx.json', nxJson => {
8
+ nxJson.release = {
9
+ projectsRelationship: 'independent',
10
+ projects: ['*'],
11
+ releaseTagPattern: '{projectName}-{version}',
12
+ changelog: {
13
+ projectChangelogs: {
14
+ createRelease: 'github',
15
+ file: false,
16
+ },
17
+ automaticFromRef: true,
18
+ },
19
+ version: {
20
+ useLegacyVersioning: false,
21
+ currentVersionResolver: 'git-tag',
22
+ fallbackCurrentVersionResolver: 'disk',
23
+ specifierSource: 'conventional-commits',
24
+ },
25
+ git: {
26
+ commit: false,
27
+ tag: true,
28
+ },
29
+ };
30
+ return nxJson;
31
+ });
32
+ }
33
+ async function initGenerator(tree, options = {}) {
34
+ const workspaceRoot = `.`;
35
+ // Delete the .circleci/config.yml file if it exists
36
+ tree.delete(path.join(workspaceRoot, '.circleci/config.yml'));
37
+ // Generate the .circleci/config.yml file
38
+ (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), workspaceRoot, {
39
+ queuing_release: options.queuing_release ?? true,
40
+ });
41
+ // Patch the nx.json file with the nx release default configuration
42
+ injectNxReleaseConfiguration(tree);
43
+ await (0, devkit_1.formatFiles)(tree);
44
+ }
45
+ exports.default = initGenerator;
46
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../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@@ -0,0 +1,3 @@
1
+ export interface InitGeneratorSchema {
2
+ queuing_release?: boolean
3
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "Init",
4
+ "title": "",
5
+ "type": "object",
6
+ "properties": {
7
+ "queuing_release": {
8
+ "type": "boolean",
9
+ "description": "Whether to use serial group for the publish step to avoid concurrent running",
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)"
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "generators": {
3
+ "init": {
4
+ "factory": "./src/generators/init/init",
5
+ "schema": "./src/generators/init/schema.json",
6
+ "description": "init generator"
7
+ }
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payfit/nx-core",
3
- "version": "4.12.2-beta-test-release.0",
3
+ "version": "4.13.0",
4
4
  "type": "commonjs",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "semver": "7.7.2",
19
19
  "tinyexec": "0.3.2",
20
20
  "tslib": "^2.8.1",
21
- "yaml": "^2.7.0",
21
+ "yaml": "2.8.0",
22
22
  "zod": "^3.24.3"
23
23
  },
24
24
  "executors": "./dist/executors.json",
@@ -32,5 +32,6 @@
32
32
  ".": "./dist/src/index.js",
33
33
  "./package.json": "./package.json",
34
34
  "./versionActions": "./dist/src/scripts/version-actions.js"
35
- }
35
+ },
36
+ "generators": "./generators.json"
36
37
  }