@goodfellow-cms/gitlab 0.1.0 → 0.3.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.
- package/README.md +2 -2
- package/dist/index.d.ts +49 -2
- package/dist/index.js +778 -7
- package/dist/testing.d.ts +100 -1
- package/dist/testing.js +528 -10
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@ import { gitlab } from "@goodfellow-cms/gitlab";
|
|
|
8
8
|
export default defineConfig({ blocks, backend: gitlab({ project: "your-name/your-site" }) });
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
[Goodfellow](https://github.com/
|
|
11
|
+
[Goodfellow](https://github.com/goodfellow-cms/goodfellow-cms) is a website builder for people who aren't developers, with no server or database: pages are files in your own GitHub or GitLab repository, edited in a visual editor built on [Puck](https://puckeditor.com). To start a new site, run `npm create goodfellow@latest my-site`. See the [documentation](https://goodfellow-cms.github.io/goodfellow-cms/) for everything else.
|
|
12
12
|
|
|
13
|
-
More in the docs: [Hosts and business sites](https://
|
|
13
|
+
More in the docs: [Hosts and business sites](https://goodfellow-cms.github.io/goodfellow-cms/docs/hosts).
|
|
14
14
|
|
|
15
15
|
## License
|
|
16
16
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeployStatus, FileChange, GitBackend, GitHost, GitUser, StorageLike, WriteOptions } from "@goodfellow-cms/core";
|
|
1
|
+
import { ConnectDomainOptions, DeployStatus, DnsRecord, FileChange, FileVersion, GitBackend, GitHost, GitUser, HistoryOptions, PagesDomains, SetupHost, SiteDrafts, SiteEditors, SiteUpdates, StorageLike, WriteOptions } from "@goodfellow-cms/core";
|
|
2
2
|
//#region src/api.d.ts
|
|
3
3
|
interface ApiOptions {
|
|
4
4
|
/** The API root, such as `https://gitlab.com/api/v4`. */
|
|
@@ -27,6 +27,11 @@ interface GitLabBackendOptions {
|
|
|
27
27
|
*/
|
|
28
28
|
export declare class GitLabBackend implements GitBackend {
|
|
29
29
|
readonly user: GitUser;
|
|
30
|
+
readonly pages: PagesDomains;
|
|
31
|
+
readonly editors: SiteEditors;
|
|
32
|
+
readonly updates: SiteUpdates;
|
|
33
|
+
readonly drafts: SiteDrafts;
|
|
34
|
+
private readonly options;
|
|
30
35
|
private readonly api;
|
|
31
36
|
private readonly project;
|
|
32
37
|
private readonly branch;
|
|
@@ -35,6 +40,8 @@ export declare class GitLabBackend implements GitBackend {
|
|
|
35
40
|
private readonly trees;
|
|
36
41
|
private readonly blobs;
|
|
37
42
|
constructor(options: GitLabBackendOptions);
|
|
43
|
+
/** Drafts on branches of the project, with merge requests for review. */
|
|
44
|
+
private draftHost;
|
|
38
45
|
private repo;
|
|
39
46
|
revision(): Promise<string>;
|
|
40
47
|
/** Every file in one folder at a commit, page by page. */
|
|
@@ -43,18 +50,26 @@ export declare class GitLabBackend implements GitBackend {
|
|
|
43
50
|
private tree;
|
|
44
51
|
private currentTree;
|
|
45
52
|
read(path: string): Promise<string | undefined>;
|
|
53
|
+
/** Reads many text files in a few GraphQL requests rather than one request each. */
|
|
54
|
+
readFiles(paths: string[]): Promise<Map<string, string>>;
|
|
46
55
|
readBytes(path: string): Promise<Uint8Array | undefined>;
|
|
47
56
|
list(dir: string): Promise<string[]>;
|
|
57
|
+
/** GitLab's tree doesn't say how large files are, so they're asked for with GraphQL, in batches. */
|
|
58
|
+
fileSizes(dir: string): Promise<Map<string, number>>;
|
|
48
59
|
private lastCommitFor;
|
|
49
60
|
write(changes: FileChange[], { message, expectedRevision }: WriteOptions): Promise<{
|
|
50
61
|
revision: string;
|
|
51
62
|
}>;
|
|
63
|
+
history(path: string, { page, perPage }?: HistoryOptions): Promise<FileVersion[]>;
|
|
64
|
+
readAt(path: string, revision: string): Promise<string | undefined>;
|
|
52
65
|
changedPaths(from: string, to: string): Promise<string[]>;
|
|
53
66
|
/**
|
|
54
67
|
* Reads the commit's pipeline and external statuses (GitLab Pages jobs, or
|
|
55
68
|
* Vercel). Before any exist, the site counts as building if it has pipelines.
|
|
56
69
|
*/
|
|
57
70
|
deployStatus(revision: string): Promise<DeployStatus>;
|
|
71
|
+
/** Why a commit's pipeline failed: the failed job's reason, and its log for which command failed and why. */
|
|
72
|
+
private jobProblem;
|
|
58
73
|
signOut(): void;
|
|
59
74
|
}
|
|
60
75
|
//#endregion
|
|
@@ -62,6 +77,37 @@ export declare class GitLabBackend implements GitBackend {
|
|
|
62
77
|
/** The admin panel's address, with a trailing slash so it always matches the redirect URI registered with GitLab. */
|
|
63
78
|
export declare function redirectUri(href: string): string;
|
|
64
79
|
//#endregion
|
|
80
|
+
//#region src/pages.d.ts
|
|
81
|
+
/**
|
|
82
|
+
* The records GitLab Pages needs: its address for an apex domain, or an alias
|
|
83
|
+
* of the namespace's gitlab.io otherwise, and a TXT record per domain that
|
|
84
|
+
* proves it's the owner's, with the codes GitLab gave.
|
|
85
|
+
*/
|
|
86
|
+
export declare function gitlabPagesRecords(project: string, domain: string, options: ConnectDomainOptions, codes: Record<string, string>): DnsRecord[];
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/setup.d.ts
|
|
89
|
+
interface GitLabSetupOptions {
|
|
90
|
+
/** For self-managed GitLab. Defaults to `https://gitlab.com`. */
|
|
91
|
+
url?: string;
|
|
92
|
+
/**
|
|
93
|
+
* The Application ID of an OAuth application for the setup page (not
|
|
94
|
+
* confidential, scope `api`, redirect URI the page's address). Enables
|
|
95
|
+
* "Sign in with GitLab". Without it, people sign in with a token.
|
|
96
|
+
*/
|
|
97
|
+
clientId?: string;
|
|
98
|
+
/** For tests. */
|
|
99
|
+
fetch?: typeof fetch;
|
|
100
|
+
/** For tests. */
|
|
101
|
+
storage?: {
|
|
102
|
+
local?: StorageLike;
|
|
103
|
+
session?: StorageLike;
|
|
104
|
+
};
|
|
105
|
+
/** For tests. */
|
|
106
|
+
location?: BrowserLocation;
|
|
107
|
+
}
|
|
108
|
+
/** Signing in to GitLab to create a site's project, with GitLab Pages if wanted. */
|
|
109
|
+
export declare function gitlabSetup(options?: GitLabSetupOptions): SetupHost;
|
|
110
|
+
//#endregion
|
|
65
111
|
//#region src/index.d.ts
|
|
66
112
|
/** The page's address and how to change it. Replaceable in tests. */
|
|
67
113
|
export interface BrowserLocation {
|
|
@@ -96,4 +142,5 @@ export interface GitLabOptions {
|
|
|
96
142
|
}
|
|
97
143
|
/** Sign-in and storage for a site whose repository is on GitLab. */
|
|
98
144
|
export declare function gitlab(options: GitLabOptions): GitHost;
|
|
99
|
-
//#endregion
|
|
145
|
+
//#endregion
|
|
146
|
+
export type { GitLabSetupOptions };
|