Skip to content

Commit

Permalink
feat: update generator to support Node policy #431
Browse files Browse the repository at this point in the history
This commit updates the generator to not only use the current Node
version setting in the package.json to populate the template files with
the appropriate node version, but update to support the next LTS
version using the new `abstractNodeVersionNext` variable.

The updated template files are done to reflect thispolicy
https://auro.alaskaair.com/node-support

Changes to be committed:
modified:   .github/settings.yml
modified:   .github/workflows/testPublish.yml
modified:   bin/generate.js
modified:   template/.github/settings.yml
modified:   template/.github/workflows/testPublish.yml
modified:   template/package.json
  • Loading branch information
blackfalcon authored and jason-capsule42 committed Nov 16, 2023
1 parent 4a488a1 commit 9b2d3dc
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ branches:
# Required. Require branches to be up to date before merging.
strict: true
# Required. The list of status checks to require in order to merge into this branch
contexts: ["test (18.x)", "license/cla"]
contexts: ["test (18.x)", "test (20.x)", "license/cla"]
# Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
enforce_admins: false
# Required. Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable.
Expand All @@ -82,7 +82,7 @@ branches:
# Required. Require branches to be up to date before merging.
strict: true
# Required. The list of status checks to require in order to merge into this branch
contexts: ["test (18.x)", "license/cla"]
contexts: ["test (18.x)", "test (20.x)", "license/cla"]
# Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
enforce_admins: false
# Required. Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/testPublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v3
Expand All @@ -37,7 +37,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20.x
- run: npm ci
- run: npm run build:docs
- uses: cycjimmy/semantic-release-action@v3
Expand Down
4 changes: 3 additions & 1 deletion bin/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ const getReplacements = async ({ name, namespace, npm }) => {
// Retrieve Node version defined in package.json
const minNodeVersion = pjson.engines.node.replace(/[^0-9,.]+/g,'');
const abstractNodeVersion = minNodeVersion.split('.')[0] + '.x';
const abstractNodeVersionNext = Number(minNodeVersion.split('.')[0]) + 2 + '.x';

const nameReplacements = [
{ regex: /\[genVersion\]/g, value: pjson.version },
Expand All @@ -271,7 +272,8 @@ const getReplacements = async ({ name, namespace, npm }) => {
{ regex: /\[designTokens\]/g, value: versionData['@aurodesignsystem/design-tokens'] },
{ regex: /\[wcss\]/g, value: versionData['@aurodesignsystem/webcorestylesheets'] },
{ regex: /\[nodeVersion\]/g, value: minNodeVersion },
{ regex: /\[abstractNodeVersion\]/g, value: abstractNodeVersion }
{ regex: /\[abstractNodeVersion\]/g, value: abstractNodeVersion },
{ regex: /\[abstractNodeVersionNext\]/g, value: abstractNodeVersionNext }
];

return nameReplacements.concat(pkgReplacements);
Expand Down
2 changes: 1 addition & 1 deletion template/.github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ branches:
# Required. Require branches to be up to date before merging.
strict: true
# Required. The list of status checks to require in order to merge into this branch
contexts: ["test ([abstractNodeVersion])", "license/cla"]
contexts: ["test ([abstractNodeVersion])","test ([abstractNodeVersionNext])", "license/cla"]
# Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
enforce_admins: false
# Required. Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable.
Expand Down
4 changes: 2 additions & 2 deletions template/.github/workflows/testPublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [ [abstractNodeVersion] ]
node-version: [ [abstractNodeVersion], [abstractNodeVersionNext] ]

steps:
- uses: actions/checkout@v3
Expand All @@ -37,7 +37,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version: [abstractNodeVersion]
node-version: [abstractNodeVersionNext]
- run: npm ci
- run: npm run build
- uses: cycjimmy/semantic-release-action@v3
Expand Down
2 changes: 1 addition & 1 deletion template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"main": "index.js",
"license": "Apache-2.0",
"engines": {
"node": ">=[nodeVersion]"
"node": "^[abstractNodeVersion] || ^[abstractNodeVersionNext] "
},
"dependencies": {
"chalk": "",
Expand Down

0 comments on commit 9b2d3dc

Please sign in to comment.