jive-abstract-app-github-pages 0.1.1 → 0.1.2-latest-darwin-arm64
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/multi-call-binary +4 -0
- package/package.json +11 -40
- package/README.md +0 -146
- package/bin/jive-app-github-pages +0 -611
- package/bin/package.json +0 -1
- package/dist/entrypoints/jive-app-github-pages.js +0 -18
- package/dist/entrypoints/jive-app-github-pages.js.map +0 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +0 -1
- package/dist/internal/commands/cicd/audit.js +0 -10
- package/dist/internal/commands/cicd/audit.js.map +0 -1
- package/dist/internal/commands/cicd/build.js +0 -8
- package/dist/internal/commands/cicd/build.js.map +0 -1
- package/dist/internal/commands/cicd/deploy-plan.js +0 -19
- package/dist/internal/commands/cicd/deploy-plan.js.map +0 -1
- package/dist/internal/commands/cicd/deploy.js +0 -8
- package/dist/internal/commands/cicd/deploy.js.map +0 -1
- package/dist/internal/commands/cicd/get-config.js +0 -9
- package/dist/internal/commands/cicd/get-config.js.map +0 -1
- package/dist/internal/commands/cicd/index.js +0 -16
- package/dist/internal/commands/cicd/index.js.map +0 -1
- package/dist/internal/commands/cicd/upload-artifacts.js +0 -6
- package/dist/internal/commands/cicd/upload-artifacts.js.map +0 -1
- package/dist/internal/commands/create.js +0 -32
- package/dist/internal/commands/create.js.map +0 -1
- package/dist/internal/commands/dev.js +0 -11
- package/dist/internal/commands/dev.js.map +0 -1
- package/dist/internal/common/command.js +0 -5
- package/dist/internal/common/command.js.map +0 -1
- package/dist/internal/common/constants.js +0 -30
- package/dist/internal/common/constants.js.map +0 -1
- package/dist/internal/common/github-token.js +0 -16
- package/dist/internal/common/github-token.js.map +0 -1
- package/dist/internal/common/layer.js +0 -14
- package/dist/internal/common/layer.js.map +0 -1
- package/dist/internal/modules/deployer/impl.js +0 -107
- package/dist/internal/modules/deployer/impl.js.map +0 -1
- package/dist/internal/modules/deployer/interface.js +0 -2
- package/dist/internal/modules/deployer/interface.js.map +0 -1
- package/dist/internal/modules/https-probe/impl.js +0 -15
- package/dist/internal/modules/https-probe/impl.js.map +0 -1
- package/dist/internal/modules/https-probe/interface.js +0 -2
- package/dist/internal/modules/https-probe/interface.js.map +0 -1
- package/dist/internal/modules/index.js +0 -13
- package/dist/internal/modules/index.js.map +0 -1
- package/dist/internal/modules/package/impl.js +0 -16
- package/dist/internal/modules/package/impl.js.map +0 -1
- package/dist/internal/modules/package/interface.js +0 -2
- package/dist/internal/modules/package/interface.js.map +0 -1
- package/dist/internal/modules/pages-api/impl.js +0 -66
- package/dist/internal/modules/pages-api/impl.js.map +0 -1
- package/dist/internal/modules/pages-api/interface.js +0 -2
- package/dist/internal/modules/pages-api/interface.js.map +0 -1
- package/dist/internal/modules/publishing-branch/impl.js +0 -83
- package/dist/internal/modules/publishing-branch/impl.js.map +0 -1
- package/dist/internal/modules/publishing-branch/interface.js +0 -2
- package/dist/internal/modules/publishing-branch/interface.js.map +0 -1
- package/dist/internal/modules/scaffold/impl.js +0 -37
- package/dist/internal/modules/scaffold/impl.js.map +0 -1
- package/dist/internal/modules/scaffold/interface.js +0 -2
- package/dist/internal/modules/scaffold/interface.js.map +0 -1
- package/dist/internal/modules/site/impl.js +0 -71
- package/dist/internal/modules/site/impl.js.map +0 -1
- package/dist/internal/modules/site/interface.js +0 -2
- package/dist/internal/modules/site/interface.js.map +0 -1
- package/dist/internal/public/manifest.js +0 -94
- package/dist/internal/public/manifest.js.map +0 -1
- package/dist/internal/public/scaffold.js +0 -62
- package/dist/internal/public/scaffold.js.map +0 -1
- package/dist/internal/public/site-url.js +0 -16
- package/dist/internal/public/site-url.js.map +0 -1
- package/install.cjs +0 -611
- package/src/entrypoints/jive-app-github-pages.ts +0 -19
- package/src/index.ts +0 -18
- package/src/internal/commands/cicd/audit.ts +0 -14
- package/src/internal/commands/cicd/build.ts +0 -12
- package/src/internal/commands/cicd/deploy-plan.ts +0 -23
- package/src/internal/commands/cicd/deploy.ts +0 -12
- package/src/internal/commands/cicd/get-config.ts +0 -13
- package/src/internal/commands/cicd/index.ts +0 -16
- package/src/internal/commands/cicd/upload-artifacts.ts +0 -10
- package/src/internal/commands/create.ts +0 -36
- package/src/internal/commands/dev.ts +0 -11
- package/src/internal/common/command.ts +0 -7
- package/src/internal/common/constants.ts +0 -34
- package/src/internal/common/github-token.ts +0 -19
- package/src/internal/common/layer.ts +0 -25
- package/src/internal/modules/deployer/impl.ts +0 -118
- package/src/internal/modules/deployer/interface.ts +0 -20
- package/src/internal/modules/https-probe/impl.ts +0 -22
- package/src/internal/modules/https-probe/interface.ts +0 -10
- package/src/internal/modules/index.ts +0 -28
- package/src/internal/modules/package/impl.ts +0 -20
- package/src/internal/modules/package/interface.ts +0 -10
- package/src/internal/modules/pages-api/impl.ts +0 -91
- package/src/internal/modules/pages-api/interface.ts +0 -46
- package/src/internal/modules/pages-api/recorded/README.md +0 -15
- package/src/internal/modules/pages-api/recorded/build-built.json +0 -1
- package/src/internal/modules/pages-api/recorded/build-errored.json +0 -1
- package/src/internal/modules/pages-api/recorded/site-legacy-gh-pages.json +0 -1
- package/src/internal/modules/pages-api/recorded/site-none.json +0 -5
- package/src/internal/modules/publishing-branch/impl.ts +0 -95
- package/src/internal/modules/publishing-branch/interface.ts +0 -32
- package/src/internal/modules/scaffold/impl.ts +0 -42
- package/src/internal/modules/scaffold/interface.ts +0 -15
- package/src/internal/modules/site/impl.ts +0 -74
- package/src/internal/modules/site/interface.ts +0 -14
- package/src/internal/public/manifest.ts +0 -116
- package/src/internal/public/scaffold.ts +0 -128
- package/src/internal/public/site-url.ts +0 -18
package/package.json
CHANGED
|
@@ -1,49 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jive-abstract-app-github-pages",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.1.2-latest-darwin-arm64",
|
|
5
4
|
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"os": [
|
|
7
|
+
"darwin"
|
|
8
|
+
],
|
|
9
|
+
"cpu": [
|
|
10
|
+
"arm64"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
"multi-call-binary"
|
|
14
|
+
],
|
|
6
15
|
"description": "Jive abstract for static sites served by GitHub Pages: builds the site, then publishes it to the repository's gh-pages branch and has GitHub Pages build it, with its custom domain",
|
|
7
16
|
"repository": {
|
|
8
17
|
"type": "git",
|
|
9
18
|
"url": "git+https://github.com/jive-sh/jive-abstract-app-github-pages.git"
|
|
10
|
-
},
|
|
11
|
-
"main": "./dist/index.js",
|
|
12
|
-
"module": "./dist/index.js",
|
|
13
|
-
"types": "./src/index.ts",
|
|
14
|
-
"exports": {
|
|
15
|
-
".": {
|
|
16
|
-
"types": "./src/index.ts",
|
|
17
|
-
"import": "./dist/index.js"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"files": [
|
|
21
|
-
"README.md",
|
|
22
|
-
"dist",
|
|
23
|
-
"src",
|
|
24
|
-
"bin",
|
|
25
|
-
"install.cjs"
|
|
26
|
-
],
|
|
27
|
-
"scripts": {
|
|
28
|
-
"postinstall": "node ./install.cjs"
|
|
29
|
-
},
|
|
30
|
-
"bin": {
|
|
31
|
-
"jive-app-github-pages": "./bin/jive-app-github-pages"
|
|
32
|
-
},
|
|
33
|
-
"optionalDependencies": {
|
|
34
|
-
"jive-abstract-app-github-pages-darwin-arm64": "npm:jive-abstract-app-github-pages@0.1.1-latest-darwin-arm64",
|
|
35
|
-
"jive-abstract-app-github-pages-darwin-x64": "npm:jive-abstract-app-github-pages@0.1.1-latest-darwin-x64",
|
|
36
|
-
"jive-abstract-app-github-pages-linux-arm64": "npm:jive-abstract-app-github-pages@0.1.1-latest-linux-arm64",
|
|
37
|
-
"jive-abstract-app-github-pages-linux-x64": "npm:jive-abstract-app-github-pages@0.1.1-latest-linux-x64",
|
|
38
|
-
"jive-abstract-app-github-pages-windows-x64": "npm:jive-abstract-app-github-pages@0.1.1-latest-windows-x64"
|
|
39
|
-
},
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"@effect/platform-bun": "^4.0.0",
|
|
42
|
-
"effective-modules": "0.3.1-effect4",
|
|
43
|
-
"jive-abstract-library": "0.13.1"
|
|
44
|
-
},
|
|
45
|
-
"peerDependencies": {
|
|
46
|
-
"effect": "^4.0.0",
|
|
47
|
-
"typescript": "^5.9.3"
|
|
48
19
|
}
|
|
49
20
|
}
|
package/README.md
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
# jive-abstract-app-github-pages
|
|
2
|
-
|
|
3
|
-
A [Jive](https://github.com/jive-sh/jive) abstract for static sites served by [GitHub Pages](https://pages.github.com).
|
|
4
|
-
A site whose `package.json` extends it gets a full CI/CD pipeline with no pipeline code of its own: every push to
|
|
5
|
-
its deploy branch builds the site with whatever generator it uses (Astro, Vite, Bun's HTML bundler, plain files),
|
|
6
|
-
publishes the result to the repository's `gh-pages` branch, and waits until GitHub Pages reports it built.
|
|
7
|
-
|
|
8
|
-
Its CLI is `jive-app-github-pages`, so the target command for a new site is `jive create app github pages`. Today
|
|
9
|
-
the same thing is `jive-app-github-pages create <directory>`.
|
|
10
|
-
|
|
11
|
-
## Vocabulary
|
|
12
|
-
|
|
13
|
-
- **Site**: the folder the package's own build script writes, `outputDir`. Its contents are exactly what GitHub
|
|
14
|
-
Pages serves.
|
|
15
|
-
- **Publishing branch**: `gh-pages`. Each deploy adds one commit to it whose tree is the site, so its history is
|
|
16
|
-
the history of deploys. GitHub Pages serves it when the repository's Pages source is "Deploy from a branch",
|
|
17
|
-
`gh-pages`, `/`
|
|
18
|
-
([publishing source](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site)).
|
|
19
|
-
- **Custom domain**: the hostname GitHub Pages serves the site at instead of `https://<owner>.github.io/<repository>/`.
|
|
20
|
-
A branch-published site's custom domain is whatever its `CNAME` file names
|
|
21
|
-
([custom domains](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site)),
|
|
22
|
-
so the build writes that file from `domain`.
|
|
23
|
-
|
|
24
|
-
## Extending it
|
|
25
|
-
|
|
26
|
-
```jsonc
|
|
27
|
-
{
|
|
28
|
-
"$schema": "./package.schema.json",
|
|
29
|
-
"name": "@acme/docs",
|
|
30
|
-
"version": "0.1.0",
|
|
31
|
-
"license": "MIT",
|
|
32
|
-
"type": "module",
|
|
33
|
-
"scripts": {
|
|
34
|
-
"jive:cicd:get-config": "jive-app-github-pages cicd get-config",
|
|
35
|
-
"jive:cicd:build": "jive-app-github-pages cicd build",
|
|
36
|
-
"jive:cicd:audit": "jive-app-github-pages cicd audit",
|
|
37
|
-
"jive:cicd:deploy:plan": "jive-app-github-pages cicd deploy-plan",
|
|
38
|
-
"jive:cicd:upload-artifacts": "jive-app-github-pages cicd upload-artifacts",
|
|
39
|
-
"jive:cicd:deploy": "jive-app-github-pages cicd deploy",
|
|
40
|
-
"build": "astro build",
|
|
41
|
-
"dev": "jive-app-github-pages dev"
|
|
42
|
-
},
|
|
43
|
-
"devDependencies": { "jive-abstract-app-github-pages": "^0.1.0" },
|
|
44
|
-
"jive": {
|
|
45
|
-
"cicd": {
|
|
46
|
-
"deploy": { "verb": "Deploy to", "branches": { "main": ["Production"] }, "previews": false, "sequentially": true },
|
|
47
|
-
"runsOnPullRequests": true,
|
|
48
|
-
"runsOn": "ubuntu-latest",
|
|
49
|
-
"requiredSecrets": ["GITHUB_TOKEN"]
|
|
50
|
-
},
|
|
51
|
-
"app-github-pages": {
|
|
52
|
-
"buildScript": "build",
|
|
53
|
-
"outputDir": "dist",
|
|
54
|
-
"domain": "docs.acme.com"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
| Field | Meaning |
|
|
61
|
-
| --- | --- |
|
|
62
|
-
| `buildScript` | The `package.json` script that writes the site into `outputDir`; the build hook runs `bun run <buildScript>`. |
|
|
63
|
-
| `outputDir` | The folder, relative to the package, holding the built site. Never the package itself, never outside it. |
|
|
64
|
-
| `domain` | A bare lowercase hostname (`docs.acme.com`, never `https://…`), or `null` for `https://<owner>.github.io/<repository>/`. |
|
|
65
|
-
|
|
66
|
-
Every field is required, so the schema shows everything you can configure. `jive-app-github-pages dev` keeps
|
|
67
|
-
`package.schema.json` current, so your editor checks the block as you type it. The hooks also enforce rules that
|
|
68
|
-
span fields:
|
|
69
|
-
|
|
70
|
-
- `cicd.deploy.previews` is false, and `cicd.deploy.branches` deploys at most one environment from one branch: a
|
|
71
|
-
repository has one GitHub Pages site, so there is nowhere else to deploy to.
|
|
72
|
-
- `cicd.requiredSecrets` includes `GITHUB_TOKEN`. It is the deploy job's own token, which GitHub puts in every
|
|
73
|
-
workflow's secrets context
|
|
74
|
-
([contexts](https://docs.github.com/en/actions/reference/workflows-and-actions/contexts)); nobody creates or
|
|
75
|
-
stores it, but the pipeline passes the hooks only the secrets listed.
|
|
76
|
-
- `buildScript` names a script in `package.json`, and not a `jive:cicd:*` hook, which would loop.
|
|
77
|
-
|
|
78
|
-
`jive-app-github-pages create <directory> [--name <package>] [--domain <hostname>] [--skip-install]` writes a package
|
|
79
|
-
in this shape, with a one-page site in `src/index.html` built by Bun's HTML bundler, its `.gitignore`, a README and
|
|
80
|
-
its `.github/workflows/pipeline.yml`.
|
|
81
|
-
|
|
82
|
-
## What each hook does
|
|
83
|
-
|
|
84
|
-
| Hook | Behavior |
|
|
85
|
-
| --- | --- |
|
|
86
|
-
| `get-config` | Prints the validated `jive` block as JSON. |
|
|
87
|
-
| `build` | Runs `bun run <buildScript>` and checks it wrote `<outputDir>/index.html`. Then writes `CNAME` naming `domain`, or removes one when `domain` is null (with a warning naming what it replaced or removed), and writes an empty `.nojekyll`, which tells GitHub Pages the branch needs no Jekyll build. Jekyll would otherwise leave out every file and folder starting with `_`, such as Astro's `_astro/` ([Jekyll](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll)). |
|
|
88
|
-
| `audit` | Checks the site has `index.html`, `.nojekyll`, and a `CNAME` exactly when `domain` is set, naming it. Replace this script to run the site's own checks as well. |
|
|
89
|
-
| `deploy:plan` | Plans a deploy (`{"deploy":true,"url":…}`) to where the site is served: `https://<domain>/` once the domain answers over https with a valid certificate, `http://<domain>/` before (GitHub Pages issues the certificate only after the domain's DNS points at it), or `https://<owner>.github.io/<repository>/` without a domain. |
|
|
90
|
-
| `upload-artifacts` | Nothing; the pipeline's artifact already carries `outputDir`. |
|
|
91
|
-
| `deploy` | Checks the site again, then publishes it to `gh-pages` as one commit on top of the branch (none when the branch already holds exactly this site), never force-pushed: a deploy that loses a race with another fails and changes nothing. Then it checks the repository's Pages source is `gh-pages` at `/`, requests a GitHub Pages build of the commit, and polls every 5 seconds until GitHub reports that commit `built` (success) or `errored` (failure, with GitHub's reason), for at most 10 minutes. A commit GitHub has already built is not requested again. |
|
|
92
|
-
|
|
93
|
-
The deploy requests the build itself because a push made with a job's token starts none: "Commits pushed by a
|
|
94
|
-
GitHub Actions workflow that uses the GITHUB_TOKEN do not trigger a GitHub Pages build"
|
|
95
|
-
([GITHUB_TOKEN](https://docs.github.com/en/actions/concepts/security/github_token)).
|
|
96
|
-
|
|
97
|
-
## The deploy job's permissions
|
|
98
|
-
|
|
99
|
-
The deploy uses the job's `GITHUB_TOKEN` for three things, each needing a permission
|
|
100
|
-
([permissions for GitHub Apps](https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps)):
|
|
101
|
-
|
|
102
|
-
| Call | Permission |
|
|
103
|
-
| --- | --- |
|
|
104
|
-
| `git push` to `gh-pages` | `contents: write` |
|
|
105
|
-
| `POST /repos/{owner}/{repo}/pages/builds` | `pages: write` |
|
|
106
|
-
| `GET /repos/{owner}/{repo}/pages` and `.../pages/builds/latest` | `pages: read` (part of `pages: write`) |
|
|
107
|
-
|
|
108
|
-
A caller workflow grants the job's token its permissions, and a reusable workflow can only reduce them. The
|
|
109
|
-
`pipeline.yml` that `create` writes grants `contents: write`, `pages: write` and `id-token: write`. **Jive's shared
|
|
110
|
-
deploy job does not yet pass them on:** [reusable-pipeline.yml](https://github.com/jive-sh/jive/blob/main/.github/workflows/reusable-pipeline.yml)
|
|
111
|
-
sets the deploy job's permissions to `contents: read` and `id-token: write` for every package, so until it changes
|
|
112
|
-
the push is refused with HTTP 403 and the deploy fails.
|
|
113
|
-
|
|
114
|
-
## Limitations and open questions
|
|
115
|
-
|
|
116
|
-
- **Pages must already be set up on the repository.** Creating a Pages site or changing its source needs the
|
|
117
|
-
repository's Administration permission, which no job token can have, so a repository without Pages, or whose
|
|
118
|
-
source is not `gh-pages` at `/`, fails its deploy with the settings page to change. The site is published first,
|
|
119
|
-
so the branch is there to choose. Provisioning it belongs to a GitHub resource connector holding that permission
|
|
120
|
-
on Jive's server, which does not exist yet.
|
|
121
|
-
- **https is not enforced.** "Enforce HTTPS" is a Pages setting needing the same Administration permission.
|
|
122
|
-
- **The DNS record is not created.** `domain` makes GitHub Pages serve the site there; the record pointing the
|
|
123
|
-
domain at GitHub Pages is yours to create at your DNS provider.
|
|
124
|
-
- **No previews.** A repository has one Pages site, so a pull request has nowhere of its own to deploy to.
|
|
125
|
-
- **One owner's site.** A repository named `<owner>.github.io` is the owner's own site and is served at its root;
|
|
126
|
-
every other repository is served under `/<repository>/`, so a site without a domain must be built for that base
|
|
127
|
-
path (Astro's `base`, Vite's `base`).
|
|
128
|
-
|
|
129
|
-
## How it is tested
|
|
130
|
-
|
|
131
|
-
This repository is a library: its own pipeline publishes it to npm and never deploys a site. `bun run
|
|
132
|
-
jive:cicd:audit` runs `tsc` and every test. Nothing in them reaches GitHub:
|
|
133
|
-
|
|
134
|
-
- Unit tests (`src/**/*.test.ts`) cover the manifest's rules, the site URLs, the scaffold (its `package.json`
|
|
135
|
-
passes every rule), the deploy's sequence against fake modules and a test clock (an already built commit, a
|
|
136
|
-
refused or failing build, a timeout, a repository without Pages or with another source), the Pages API client
|
|
137
|
-
against GitHub responses recorded from jive-sh/docs (`src/internal/modules/pages-api/recorded/`), and the
|
|
138
|
-
publishing branch with real git against a bare repository on disk: the first commit, an unchanged site, removed
|
|
139
|
-
files, a race with another deploy, and that the token travels only in the environment, never in arguments.
|
|
140
|
-
- `test/hooks.test.ts` runs `get-config`, `build`, `audit`, `deploy:plan`, `upload-artifacts` and `deploy`'s token
|
|
141
|
-
check through the CLI from source against the fixture site in `test/fixture`, and `create` followed by the new
|
|
142
|
-
package's own build and audit.
|
|
143
|
-
|
|
144
|
-
What only a consumer's pipeline can test, against its real repository: that GitHub accepts the job's token for the
|
|
145
|
-
push and the build request with the permissions above, the request's real `201` body (taken from the docs, not
|
|
146
|
-
recorded), and how long a real build takes.
|