@kirchdev/duxt 0.1.1-dev.16-c752db1 → 0.1.1-dev.17-509021b
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/package.json +1 -1
- package/sources-git.ts +8 -1
- package/sources-resolve.ts +13 -9
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://www.schemastore.org/package.json",
|
|
3
3
|
"name": "@kirchdev/duxt",
|
|
4
|
-
"version": "0.1.1-dev.
|
|
4
|
+
"version": "0.1.1-dev.17-509021b",
|
|
5
5
|
"description": "Nuxt documentation layer on Content v3 — multi-repo, versioned docs from one compact source list.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"content-v3",
|
package/sources-git.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { execFileSync } from 'node:child_process';
|
|
2
2
|
import type { DuxtSource } from './sources-resolve';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
expandSources,
|
|
5
|
+
isLatestRef,
|
|
6
|
+
newestTag,
|
|
7
|
+
repoUrl
|
|
8
|
+
} from './sources-resolve';
|
|
4
9
|
|
|
5
10
|
/**
|
|
6
11
|
* Resolve the `latest` shorthand into the tag it means.
|
|
@@ -81,6 +86,8 @@ function tagsOf(repo: string | undefined): string[] {
|
|
|
81
86
|
* resolver itself stays pure and testable — it never learns that git exists.
|
|
82
87
|
*/
|
|
83
88
|
export function resolveLatestRefs(sources: DuxtSource[]): DuxtSource[] {
|
|
89
|
+
// Reject local refs before a missing tag can hide the configuration error.
|
|
90
|
+
expandSources(sources);
|
|
84
91
|
return sources.map((source) => {
|
|
85
92
|
if (!source.refs?.some(isLatestRef)) return source;
|
|
86
93
|
|
package/sources-resolve.ts
CHANGED
|
@@ -12,10 +12,10 @@ import type {
|
|
|
12
12
|
export interface DuxtSource {
|
|
13
13
|
/** Folder holding the Markdown, relative to the repository root. */
|
|
14
14
|
path?: string;
|
|
15
|
-
/** `owner/name` or a full git URL. Omitted
|
|
15
|
+
/** `owner/name` or a full git URL. Omitted reads the local checkout. */
|
|
16
16
|
repo?: string;
|
|
17
17
|
/**
|
|
18
|
-
* Refs to publish as versions.
|
|
18
|
+
* Refs to publish as versions. Requires an explicit source or locale repo.
|
|
19
19
|
*
|
|
20
20
|
* A bare string is a branch. A tag has to say so — git keeps the two in
|
|
21
21
|
* separate namespaces, and asking for a tag under refs/heads fails the
|
|
@@ -166,7 +166,7 @@ export type DuxtSourceLocale =
|
|
|
166
166
|
path?: string;
|
|
167
167
|
/** A repository of its own — `owner/name` or a git URL. */
|
|
168
168
|
repo?: string;
|
|
169
|
-
/** A ref of its own
|
|
169
|
+
/** A ref of its own; requires an explicit source or locale repo. */
|
|
170
170
|
ref?: DuxtRef;
|
|
171
171
|
};
|
|
172
172
|
|
|
@@ -488,12 +488,16 @@ export function expandSources(
|
|
|
488
488
|
|
|
489
489
|
return sources.flatMap((source) =>
|
|
490
490
|
(source.refs?.length ? source.refs : [undefined]).flatMap((ref) =>
|
|
491
|
-
localesOf(source, ref).map((locale) =>
|
|
492
|
-
source,
|
|
493
|
-
ref
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
491
|
+
localesOf(source, ref).map((locale) => {
|
|
492
|
+
const effective = localeEntry(source, locale, defaultLocale);
|
|
493
|
+
if (!effective.repo && (effective.ref ?? ref)) {
|
|
494
|
+
throw new Error(
|
|
495
|
+
`duxt: source "${source.path ?? 'docs'}" reads the local checkout and cannot select a ref. ` +
|
|
496
|
+
'Set an explicit repo to publish Git refs, or use version folders without refs.'
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
return { source, ref, locale, effective };
|
|
500
|
+
})
|
|
497
501
|
)
|
|
498
502
|
);
|
|
499
503
|
}
|