@goodfellow-cms/github 0.1.0 → 0.2.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 CHANGED
@@ -8,9 +8,9 @@ import { github } from "@goodfellow-cms/github";
8
8
  export default defineConfig({ blocks, backend: github({ repo: "your-name/your-site" }) });
9
9
  ```
10
10
 
11
- [Goodfellow](https://github.com/chartung17/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://chartung17.github.io/goodfellow-cms/) for everything else.
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://chartung17.github.io/goodfellow-cms/docs/hosts).
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, OwnerAccess, PagesDomains, SetupHost, SiteEditors, SiteUpdates, StorageLike, TokenLink, WriteOptions } from "@goodfellow-cms/core";
2
2
  //#region src/api.d.ts
3
3
  interface ApiOptions {
4
4
  apiUrl: string;
@@ -13,6 +13,8 @@ interface GitHubBackendOptions {
13
13
  branch: string;
14
14
  user: GitUser;
15
15
  onSignOut: () => void;
16
+ /** Where to create the owner token, which can change editors and GitHub Pages settings. */
17
+ ownerTokenLink: TokenLink;
16
18
  }
17
19
  /**
18
20
  * The site's files on GitHub. Reads come from the commit `revision()` last
@@ -21,6 +23,10 @@ interface GitHubBackendOptions {
21
23
  */
22
24
  export declare class GitHubBackend implements GitBackend {
23
25
  readonly user: GitUser;
26
+ readonly pages: PagesDomains;
27
+ readonly editors: SiteEditors;
28
+ readonly ownerAccess: OwnerAccess;
29
+ readonly updates: SiteUpdates;
24
30
  private readonly api;
25
31
  private readonly repo;
26
32
  private readonly branch;
@@ -34,20 +40,54 @@ export declare class GitHubBackend implements GitBackend {
34
40
  private tree;
35
41
  private currentTree;
36
42
  read(path: string): Promise<string | undefined>;
43
+ private readFrom;
37
44
  readBytes(path: string): Promise<Uint8Array | undefined>;
38
45
  list(dir: string): Promise<string[]>;
39
46
  write(changes: FileChange[], { message, expectedRevision }: WriteOptions): Promise<{
40
47
  revision: string;
41
48
  }>;
49
+ history(path: string, { page, perPage }?: HistoryOptions): Promise<FileVersion[]>;
50
+ readAt(path: string, revision: string): Promise<string | undefined>;
42
51
  changedPaths(from: string, to: string): Promise<string[]>;
43
52
  /**
44
- * Reads the deployment GitHub Pages or Vercel created for a commit. Before
45
- * one exists, the site counts as building if it has ever been deployed.
53
+ * Reads the deployment GitHub Pages or Vercel created for a commit, and for
54
+ * GitHub Actions, the workflow run that builds it: a build that fails never
55
+ * creates a deployment. Before either exists, the site counts as building
56
+ * if it has ever been deployed.
46
57
  */
47
58
  deployStatus(revision: string): Promise<DeployStatus>;
59
+ /** The site's deploy workflow run for a commit, or `undefined` if there's none or the token can't see Actions. */
60
+ private workflowRun;
61
+ /** Which step of a failed run failed. */
62
+ private runProblem;
48
63
  signOut(): void;
49
64
  }
50
65
  //#endregion
66
+ //#region src/pages.d.ts
67
+ /** The records GitHub Pages needs: its addresses for an apex domain, or an alias of the owner's github.io. */
68
+ export declare function githubPagesRecords(repo: string, domain: string, { apex, www }: ConnectDomainOptions): DnsRecord[];
69
+ //#endregion
70
+ //#region src/setup.d.ts
71
+ interface GitHubSetupOptions {
72
+ /** For GitHub Enterprise. Defaults to `https://api.github.com`. */
73
+ apiUrl?: string;
74
+ /** For GitHub Enterprise. Defaults to `https://github.com`. */
75
+ webUrl?: string;
76
+ /** For tests. */
77
+ fetch?: typeof fetch;
78
+ }
79
+ /**
80
+ * Links to GitHub's token pages with what creating a site needs: creating the
81
+ * repository (administration), writing its files and its build setup
82
+ * (contents and workflows), and turning on GitHub Pages (pages).
83
+ */
84
+ export declare function githubSetupTokenLinks(webUrl?: string): {
85
+ fineGrained: string;
86
+ classic: string;
87
+ };
88
+ /** Signing in to GitHub to create a site's repository, with GitHub Pages if wanted. */
89
+ export declare function githubSetup(options?: GitHubSetupOptions): SetupHost;
90
+ //#endregion
51
91
  //#region src/index.d.ts
52
92
  export interface GitHubOptions {
53
93
  /** The site's repository, as `owner/name`. */
@@ -73,7 +113,9 @@ export interface GitHubOptions {
73
113
  export declare function githubTokenLinks(repo: string, webUrl?: string): {
74
114
  fineGrained: string;
75
115
  classic: string;
116
+ owner: string;
76
117
  };
77
118
  /** Sign-in and storage for a site whose repository is on GitHub. */
78
119
  export declare function github(options: GitHubOptions): GitHost;
79
- //#endregion
120
+ //#endregion
121
+ export type { GitHubSetupOptions };