Skip to content

Commit

Permalink
refactor: updated release script and updated shiki (nodejs#5997)
Browse files Browse the repository at this point in the history
* meta: updated shiki package version

* feat: shiki added shell languages for release posts

* chore: minimal template changes for future

* refactor: removed all deprecated versions from download table

* refactor: cleaned up release-script

* chore: failed file creation error msg

* chore: forgot one error message

* fix: shiki should not add "embeddedLangs"

* chore: change to `console` instead of `shell-session`
  • Loading branch information
ovflowd authored Oct 15, 2023
1 parent 1d4a5f9 commit dafcdaa
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 261 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"remark-gfm": "~3.0.0",
"semver": "~7.5.4",
"sharp": "0.32.6",
"shiki": "^0.14.3",
"shiki": "^0.14.5",
"tailwindcss": "^3.3.3",
"turbo": "^1.10.14",
"typescript": "~5.2.2",
Expand Down
2 changes: 1 addition & 1 deletion pages/en/blog/release/v15.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ When generating snapshots, garbage collection may be triggered and bring the hea

Generating V8 snapshots takes time and memory (both memory managed by the V8 heap and native memory outside the V8 heap). The bigger the heap is, the more resources it needs. Node.js will adjust the V8 heap to accommondate the additional V8 heap memory overhead, and try its best to avoid using up all the memory avialable to the process.

```shell-session
```console
$ node --max-old-space-size=100 --heapsnapshot-near-heap-limit=3 index.js
Wrote snapshot to Heap.20200430.100036.49580.0.001.heapsnapshot
Wrote snapshot to Heap.20200430.100037.49580.0.002.heapsnapshot
Expand Down
2 changes: 1 addition & 1 deletion pages/en/blog/release/v18.16.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ author: Danielle Adams

Compile a JavaScript file into a single executable application:

```shell-session
```console
$ echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js

$ cp $(command -v node) hello
Expand Down
118 changes: 3 additions & 115 deletions scripts/release-post/downloadsTable.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import semVer from 'semver';

const allDownloads = [
const downloadOptions = [
{
title: 'Windows 32-bit Installer',
templateUrl: 'https://nodejs.org/dist/v%version%/node-v%version%-x86.msi',
Expand Down Expand Up @@ -41,11 +41,6 @@ const allDownloads = [
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-darwin-x64.tar.gz',
},
{
title: 'Linux 32-bit Binary',
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-linux-x86.tar.xz',
},
{
title: 'Linux 64-bit Binary',
templateUrl:
Expand All @@ -56,11 +51,6 @@ const allDownloads = [
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-linux-ppc64le.tar.xz',
},
{
title: 'Linux PPC BE 64-bit Binary',
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-linux-ppc64.tar.xz',
},
{
title: 'Linux s390x 64-bit Binary',
templateUrl:
Expand All @@ -71,21 +61,6 @@ const allDownloads = [
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-aix-ppc64.tar.gz',
},
{
title: 'SmartOS 32-bit Binary',
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-sunos-x86.tar.xz',
},
{
title: 'SmartOS 64-bit Binary',
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-sunos-x64.tar.xz',
},
{
title: 'ARMv6 32-bit Binary',
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-linux-armv6l.tar.xz',
},
{
title: 'ARMv7 32-bit Binary',
templateUrl:
Expand All @@ -102,98 +77,13 @@ const allDownloads = [
},
];

// v0.x of Node.js
const legacyDownloads = [
{
title: 'Windows 32-bit Installer',
templateUrl: 'https://nodejs.org/dist/v%version%/node-v%version%-x86.msi',
},
{
title: 'Windows 64-bit Installer',
templateUrl:
'https://nodejs.org/dist/v%version%/x64/node-v%version%-x64.msi',
},
{
title: 'Windows 32-bit Binary',
templateUrl: 'https://nodejs.org/dist/v%version%/node.exe',
},
{
title: 'Windows 64-bit Binary',
templateUrl: 'https://nodejs.org/dist/v%version%/x64/node.exe',
},
{
title: 'macOS Universal Installer',
templateUrl: 'https://nodejs.org/dist/v%version%/node-v%version%.pkg',
},
{
title: 'macOS 64-bit Binary',
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-darwin-x64.tar.gz',
},
{
title: 'macOS 32-bit Binary',
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-darwin-x86.tar.gz',
},
{
title: 'Linux 32-bit Binary',
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-linux-x86.tar.gz',
},
{
title: 'Linux 64-bit Binary',
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-linux-x64.tar.gz',
},
{
title: 'SmartOS 32-bit Binary',
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-sunos-x86.tar.gz',
},
{
title: 'SmartOS 64-bit Binary',
templateUrl:
'https://nodejs.org/dist/v%version%/node-v%version%-sunos-x64.tar.gz',
},
{
title: 'Source Code',
templateUrl: 'https://nodejs.org/dist/v%version%/node-v%version%.tar.gz',
},
];

const resolveUrl = (item, version) => {
const url = item.templateUrl.replace(/%version%/g, version);
return Object.assign({ url }, item);
};

const resolveDownloads = version => {
let downloads = allDownloads;

if (semVer.satisfies(version, '< 1.0.0')) {
return legacyDownloads;
}

if (semVer.satisfies(version, '>= 8.0.0')) {
downloads = downloads.filter(
ver => ver.title !== 'Linux PPC BE 64-bit Binary'
);
}

if (semVer.satisfies(version, '>= 10.0.0')) {
downloads = downloads.filter(
ver =>
ver.title !== 'Linux 32-bit Binary' &&
ver.title !== 'SmartOS 32-bit Binary'
);
}

if (semVer.satisfies(version, '>= 12.0.0')) {
downloads = downloads.filter(ver => ver.title !== 'ARMv6 32-bit Binary');
}

if (semVer.satisfies(version, '>= 14.0.0')) {
downloads = downloads.filter(ver => ver.title !== 'SmartOS 64-bit Binary');
}
let downloads = downloadOptions;

if (semVer.satisfies(version, '< 16.0.0')) {
downloads = downloads.filter(
Expand All @@ -212,7 +102,5 @@ const resolveDownloads = version => {
return downloads;
};

const downloadsTable = version =>
export const downloadsTable = version =>
resolveDownloads(version).map(item => resolveUrl(item, version));

export default downloadsTable;
Loading

0 comments on commit dafcdaa

Please sign in to comment.