@redpanda-data/docs-extensions-and-macros 3.5.8 → 3.5.10

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.
@@ -1,22 +1,5 @@
1
- // Fetch the latest release version from GitHub
2
- const { Octokit } = require("@octokit/rest");
3
- const { retry } = require("@octokit/plugin-retry");
4
- const OctokitWithRetries = Octokit.plugin(retry);
5
- const owner = 'redpanda-data';
6
- const repo = 'connect';
1
+ module.exports = async (github, owner, repo) => {
7
2
 
8
- let githubOptions = {
9
- userAgent: 'Redpanda Docs',
10
- baseUrl: 'https://api.github.com',
11
- };
12
-
13
- if (process.env.REDPANDA_GITHUB_TOKEN) {
14
- githubOptions.auth = process.env.REDPANDA_GITHUB_TOKEN;
15
- }
16
-
17
- const github = new OctokitWithRetries(githubOptions);
18
-
19
- module.exports = async () => {
20
3
  try {
21
4
  const release = await github.rest.repos.getLatestRelease({ owner, repo });
22
5
  tag = release.data.tag_name.replace(/^v/, '');
@@ -1,22 +1,5 @@
1
- const { Octokit } = require("@octokit/rest");
2
- const { retry } = require("@octokit/plugin-retry");
3
- const semver = require("semver");
4
- const OctokitWithRetries = Octokit.plugin(retry);
5
- const owner = 'redpanda-data';
6
- const repo = 'console';
7
-
8
- let githubOptions = {
9
- userAgent: 'Redpanda Docs',
10
- baseUrl: 'https://api.github.com',
11
- };
12
-
13
- if (process.env.REDPANDA_GITHUB_TOKEN) {
14
- githubOptions.auth = process.env.REDPANDA_GITHUB_TOKEN;
15
- }
16
-
17
- const github = new OctokitWithRetries(githubOptions);
18
-
19
- module.exports = async () => {
1
+ module.exports = async (github, owner, repo) => {
2
+ const semver = require('semver')
20
3
  try {
21
4
  const releases = await github.rest.repos.listReleases({
22
5
  owner,
@@ -1,22 +1,4 @@
1
- // Fetch the latest release version from GitHub
2
- const { Octokit } = require("@octokit/rest");
3
- const { retry } = require("@octokit/plugin-retry");
4
- const OctokitWithRetries = Octokit.plugin(retry);
5
- const owner = 'redpanda-data';
6
- const repo = 'redpanda-operator';
7
-
8
- let githubOptions = {
9
- userAgent: 'Redpanda Docs',
10
- baseUrl: 'https://api.github.com',
11
- };
12
-
13
- if (process.env.REDPANDA_GITHUB_TOKEN) {
14
- githubOptions.auth = process.env.REDPANDA_GITHUB_TOKEN;
15
- }
16
-
17
- const github = new OctokitWithRetries(githubOptions);
18
-
19
- module.exports = async () => {
1
+ module.exports = async (github, owner, repo) => {
20
2
  try {
21
3
  const release = await github.rest.repos.getLatestRelease({ owner, repo });
22
4
  latestOperatorReleaseVersion = release.data.tag_name;
@@ -1,20 +1,5 @@
1
- const { Octokit } = require("@octokit/rest");
2
- const { retry } = require("@octokit/plugin-retry");
3
- const yaml = require('js-yaml');
4
- const OctokitWithRetries = Octokit.plugin(retry);
5
-
6
- const githubOptions = {
7
- userAgent: 'Redpanda Docs',
8
- baseUrl: 'https://api.github.com',
9
- auth: process.env.REDPANDA_GITHUB_TOKEN
10
- };
11
-
12
- const github = new OctokitWithRetries(githubOptions);
13
- const owner = 'redpanda-data';
14
- const repo = 'helm-charts';
15
- const path = 'charts/redpanda/Chart.yaml';
16
-
17
- module.exports = async () => {
1
+ module.exports = async (github, owner, repo, path) => {
2
+ const yaml = require('js-yaml');
18
3
  try {
19
4
  const response = await github.repos.getContent({
20
5
  owner: owner,
@@ -1,23 +1,5 @@
1
- const { Octokit } = require("@octokit/rest");
2
- const { retry } = require("@octokit/plugin-retry");
3
- const semver = require("semver");
4
- const OctokitWithRetries = Octokit.plugin(retry);
5
-
6
- const owner = 'redpanda-data';
7
- const repo = 'redpanda';
8
-
9
- let githubOptions = {
10
- userAgent: 'Redpanda Docs',
11
- baseUrl: 'https://api.github.com',
12
- };
13
-
14
- if (process.env.REDPANDA_GITHUB_TOKEN) {
15
- githubOptions.auth = process.env.REDPANDA_GITHUB_TOKEN;
16
- }
17
-
18
- const github = new OctokitWithRetries(githubOptions);
19
-
20
- module.exports = async () => {
1
+ module.exports = async (github, owner, repo) => {
2
+ const semver = require('semver')
21
3
  try {
22
4
  // Fetch all the releases from the repository
23
5
  const releases = await github.rest.repos.listReleases({
@@ -1,25 +1,40 @@
1
- const GetLatestRedpandaVersion = require('./get-latest-redpanda-version')
2
- const GetLatestConsoleVersion = require('./get-latest-console-version')
3
- const GetLatestOperatorVersion = require('./get-latest-operator-version')
4
- const GetLatestHelmChartVersion = require('./get-latest-redpanda-helm-version')
5
- const GetLatestConnectVersion = require('./get-latest-connect')
6
- const chalk = require('chalk')
7
- const semver = require('semver')
8
-
9
1
  module.exports.register = function ({ config }) {
2
+ const GetLatestRedpandaVersion = require('./get-latest-redpanda-version')
3
+ const GetLatestConsoleVersion = require('./get-latest-console-version')
4
+ const GetLatestOperatorVersion = require('./get-latest-operator-version')
5
+ const GetLatestHelmChartVersion = require('./get-latest-redpanda-helm-version')
6
+ const GetLatestConnectVersion = require('./get-latest-connect')
7
+ const chalk = require('chalk')
10
8
  const logger = this.getLogger('set-latest-version-extension')
11
9
  if (!process.env.REDPANDA_GITHUB_TOKEN) {
12
10
  logger.warn('REDPANDA_GITHUB_TOKEN environment variable not set. Attempting unauthenticated request.')
13
11
  }
14
12
 
15
13
  this.on('contentClassified', async ({ contentCatalog }) => {
14
+ const { Octokit } = await import("@octokit/rest");
15
+ const { retry } = await import("@octokit/plugin-retry");
16
+ const semver = await import("semver");
17
+ const OctokitWithRetries = Octokit.plugin(retry);
18
+
19
+ const owner = 'redpanda-data';
20
+
21
+ let githubOptions = {
22
+ userAgent: 'Redpanda Docs',
23
+ baseUrl: 'https://api.github.com',
24
+ };
25
+
26
+ if (process.env.REDPANDA_GITHUB_TOKEN) {
27
+ githubOptions.auth = process.env.REDPANDA_GITHUB_TOKEN;
28
+ }
29
+
30
+ const github = new OctokitWithRetries(githubOptions);
16
31
  try {
17
32
  const results = await Promise.allSettled([
18
- GetLatestRedpandaVersion(),
19
- GetLatestConsoleVersion(),
20
- GetLatestOperatorVersion(),
21
- GetLatestHelmChartVersion(),
22
- GetLatestConnectVersion()
33
+ GetLatestRedpandaVersion(github, owner, 'redpanda'),
34
+ GetLatestConsoleVersion(github, owner, 'console'),
35
+ GetLatestOperatorVersion(github, owner, 'redpanda-operator'),
36
+ GetLatestHelmChartVersion(github, owner, 'helm-charts', 'charts/redpanda/Chart.yaml'),
37
+ GetLatestConnectVersion(github, owner, 'connect')
23
38
  ])
24
39
 
25
40
  const LatestRedpandaVersion = results[0].status === 'fulfilled' ? results[0].value : null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "3.5.8",
3
+ "version": "3.5.10",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",
@@ -57,8 +57,6 @@
57
57
  "url": "git+https://github.com/redpanda-data/docs-extensions-and-macros"
58
58
  },
59
59
  "dependencies": {
60
- "@octokit/plugin-retry": "~4.1.3",
61
- "@octokit/rest": "~19.0.7",
62
60
  "algoliasearch": "^4.17.0",
63
61
  "chalk": "4.1.2",
64
62
  "gulp": "^4.0.2",
@@ -72,6 +70,9 @@
72
70
  "devDependencies": {
73
71
  "@antora/cli": "3.1.4",
74
72
  "@antora/site-generator": "3.1.4",
73
+ "@octokit/core": "^6.1.2",
74
+ "@octokit/plugin-retry": "^7.1.1",
75
+ "@octokit/rest": "^21.0.1",
75
76
  "@web/dev-server": "^0.2.5"
76
77
  }
77
78
  }