@alauda/doom 2.8.2 → 2.9.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.
@@ -15,7 +15,7 @@ import { difference } from 'es-toolkit';
15
15
  import { glob } from 'tinyglobby';
16
16
  import { cyan } from 'yoctocolors';
17
17
  import { apiPlugin, autoSidebarPlugin, autoTocPlugin, createTransformerCallouts, directivesPlugin, globalPlugin, mermaidPlugin, permissionPlugin, replacePlugin, searchIndexPlugin, } from "../plugins/index.js";
18
- import { isExplicitlyUnversioned, normalizeSlash, UNVERSIONED, } from "../shared/index.js";
18
+ import { isExplicitlyUnversioned, Language, normalizeSlash, SUPPORTED_LANGUAGES, UNVERSIONED, } from "../shared/index.js";
19
19
  import { pathExists, pkgResolve, resolveStaticConfig } from "../utils/index.js";
20
20
  import { DEFAULT_CONFIG_NAME, DEFAULT_EXTENSIONS, I18N_FILE, SITES_FILE, YAML_EXTENSIONS, } from "./constants.js";
21
21
  import { defaultGitHubUrl, isDoc } from "./helpers.js";
@@ -94,6 +94,16 @@ const getCommonConfig = async ({ config, root, configFilePath, base, version, do
94
94
  continue;
95
95
  }
96
96
  }
97
+ // Only a language doom supports is a language. Any other directory, a
98
+ // `scripts/` or `images/` say, used to become one and get a
99
+ // `/<name>/products` page with no words to render, which failed the
100
+ // build. It is left out of the site like `shared/` instead: it stays in
101
+ // `allLanguages`, so it ends up in `unusedLanguages` and its routes are
102
+ // excluded below.
103
+ if (!Object.hasOwn(Language, name)) {
104
+ logger.warn(`Skipped \`${cyan(path.relative(process.cwd(), path.join(root, name)))}\`: not a language directory (doom builds ${SUPPORTED_LANGUAGES.join(', ')}), so no pages are built from it, like \`shared\``);
105
+ continue;
106
+ }
97
107
  locales.push({
98
108
  lang: name,
99
109
  label: name,
@@ -42,6 +42,14 @@ const issuesToListItems = (issues, lang, isMdx) => issues
42
42
  })
43
43
  .filter(Boolean);
44
44
  const { JIRA_USERNAME, JIRA_PASSWORD } = process.env;
45
+ const DEFAULT_JIRA_BASE_URL = 'https://jira.alauda.cn';
46
+ /**
47
+ * Where Jira is, without the `/rest/...` part. Unlike the credentials above,
48
+ * which are read once when this module loads, it is read for each request.
49
+ * Empty counts as unset — an unset variable often arrives that way — and a
50
+ * trailing `/` is dropped so the path appended to it is not doubled.
51
+ */
52
+ const jiraBaseUrl = () => (process.env.JIRA_BASE_URL || DEFAULT_JIRA_BASE_URL).replace(/\/+$/, '');
45
53
  let warned = false;
46
54
  const NO_ISSUE_MAPPER = {
47
55
  zh: '此次发版无相关问题。',
@@ -87,7 +95,7 @@ const resolveRelease_ = async (releaseTemplates, releaseQuery, isMdx) => {
87
95
  let issues;
88
96
  try {
89
97
  ;
90
- ({ issues } = await xfetch(`https://jira.alauda.cn/rest/api/2/search?${new URLSearchParams({ jql })}`, { headers: { Authorization } }));
98
+ ({ issues } = await xfetch(`${jiraBaseUrl()}/rest/api/2/search?${new URLSearchParams({ jql })}`, { headers: { Authorization } }));
91
99
  }
92
100
  catch (err) {
93
101
  if (err instanceof ResponseError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "2.8.2",
3
+ "version": "2.9.0",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": {