agave-generator 0.1.28 → 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
@@ -2,13 +2,42 @@
2
2
 
3
3
  Minimal markdown to HTML for static sites with pretty URLs.
4
4
 
5
- ## ☀️ Install
5
+ Written in [ReasonML](https://reasonml.github.io/) with native OCaml toolchain (opam + dune).
6
6
 
7
+ ## Install
8
+
9
+ ### Via npm
10
+
11
+ ```
12
+ npm install -g agave-generator
13
+ ```
14
+
15
+ ### Build from source
16
+
17
+ Requires [opam](https://opam.ocaml.org/) and OCaml 5.1+.
18
+
19
+ ```console
20
+ opam install . --deps-only -y
21
+ dune build
22
+ dune install
7
23
  ```
8
- yarn global add agave-generator
24
+
25
+ ### Link locally for development
26
+
27
+ ```console
28
+ opam install . --deps-only -y
29
+ dune build
30
+ cp _build/default/bin/Agave.exe bin/agave-native
31
+ npm link --ignore-scripts
32
+ ```
33
+
34
+ Now `agave` is available globally. To unlink:
35
+
36
+ ```console
37
+ npm unlink -g agave-generator
9
38
  ```
10
39
 
11
- ## 🍯 Use
40
+ ## Use
12
41
 
13
42
  ```console
14
43
  mkdir blog
@@ -25,7 +54,7 @@ For the full list of options run `help`.
25
54
  agave --help
26
55
  ```
27
56
 
28
- ## 🏜 Themes
57
+ ## Themes
29
58
 
30
59
  Simply pass the -t argument and the theme name
31
60
 
@@ -33,7 +62,7 @@ Simply pass the -t argument and the theme name
33
62
  agave -t desert
34
63
  ```
35
64
 
36
- ## 🌿 Full Customization
65
+ ## Full Customization
37
66
 
38
67
  If you didn't find a theme for you you can add any base HTML and CSS you would like.
39
68
 
@@ -56,7 +85,7 @@ Here is an example of using custom `base.html`.
56
85
 
57
86
  [Repo](https://github.com/jottenlips/jottenlips.github.io)
58
87
 
59
- ## 📂 File structure
88
+ ## File structure
60
89
 
61
90
  ```
62
91
  ./markdown
@@ -83,7 +112,7 @@ results in
83
112
  └──2021-1-1/index.html
84
113
  ```
85
114
 
86
- ## 🧗‍♀️ Deploy your site
115
+ ## Deploy your site
87
116
 
88
117
  Github Pages
89
118
 
@@ -95,21 +124,40 @@ git push
95
124
  ```
96
125
 
97
126
  Setup your repo to look at the docs folder on your main branch in the repo settings.
98
- g
99
127
 
100
- ## 🧪 Run your site locally
128
+ ## Run your site locally
101
129
 
102
130
  ```console
103
131
  agave -s
104
- # 🏃‍♀️ Running on localhost:8080
132
+ # Server running at http://localhost:8080/
105
133
  ```
106
134
 
107
- 🐛 TODO: fix CSP so remote images and fonts will show up when running locally.
135
+ You can also serve any existing directory without generating:
108
136
 
109
- Want to support this project?
137
+ ```console
138
+ agave -p ./docs -s
139
+ ```
110
140
 
111
- [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)
141
+ ## Release
142
+
143
+ 1. Commit and tag:
144
+
145
+ ```console
146
+ git add -A && git commit -m "v0.2.0: description"
147
+ git tag v0.2.0
148
+ git push origin main --tags
149
+ ```
150
+
151
+ 2. GitHub Actions builds native binaries for `linux-x64`, `darwin-x64`, and `darwin-arm64` and attaches them to a GitHub Release.
112
152
 
113
- [![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/K3K01P2WT)
153
+ 3. Publish to npm:
114
154
 
115
- /* let _resp = Response.add_header(~name="content-security-policy", ~value="default-src 'self' style-src 'self' 'unsafe-inline';") */
155
+ ```console
156
+ npm publish
157
+ ```
158
+
159
+ ## Support
160
+
161
+ Want to support this project?
162
+
163
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync } = require("child_process");
4
+ const path = require("path");
5
+
6
+ const binary = path.join(__dirname, "agave-native");
7
+
8
+ try {
9
+ execFileSync(binary, process.argv.slice(2), { stdio: "inherit", cwd: process.cwd() });
10
+ } catch (err) {
11
+ if (err.status !== undefined) {
12
+ process.exit(err.status);
13
+ }
14
+ console.error("Failed to run agave:", err.message);
15
+ process.exit(1);
16
+ }
package/package.json CHANGED
@@ -1,8 +1,22 @@
1
1
  {
2
- "description": "Simple static site generator",
3
- "license": "The Hippocratic License 2.1",
4
2
  "name": "agave-generator",
5
- "version": "0.1.28",
6
- "scripts": { "postinstall": "node ./esyInstallRelease.js" },
7
- "bin": { "Agave": "bin/Agave" }
8
- }
3
+ "version": "0.2.0",
4
+ "description": "Minimal markdown to HTML static site generator",
5
+ "license": "Hippocratic-2.1",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/jottenlips/agave.git"
9
+ },
10
+ "bin": {
11
+ "agave": "./bin/agave-wrapper.js"
12
+ },
13
+ "scripts": {
14
+ "postinstall": "node postinstall.js"
15
+ },
16
+ "files": [
17
+ "bin/agave-wrapper.js",
18
+ "postinstall.js",
19
+ "README.md",
20
+ "LICENSE"
21
+ ]
22
+ }
package/postinstall.js ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+
3
+ const https = require("https");
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const { execSync } = require("child_process");
7
+
8
+ const VERSION = require("./package.json").version;
9
+ const REPO = "jottenlips/agave";
10
+
11
+ function getPlatformBinaryName() {
12
+ const platform = process.platform;
13
+ const arch = process.arch;
14
+
15
+ if (platform === "linux" && arch === "x64") return "agave-linux-x64";
16
+ if (platform === "darwin" && arch === "arm64") return "agave-darwin-arm64";
17
+
18
+ console.error(
19
+ `Unsupported platform: ${platform}-${arch}. You can build from source with opam + dune.`
20
+ );
21
+ process.exit(1);
22
+ }
23
+
24
+ function download(url, dest) {
25
+ return new Promise((resolve, reject) => {
26
+ const request = (url) => {
27
+ https
28
+ .get(url, (res) => {
29
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
30
+ request(res.headers.location);
31
+ return;
32
+ }
33
+ if (res.statusCode !== 200) {
34
+ reject(new Error(`Download failed with status ${res.statusCode}: ${url}`));
35
+ return;
36
+ }
37
+ const file = fs.createWriteStream(dest);
38
+ res.pipe(file);
39
+ file.on("finish", () => {
40
+ file.close();
41
+ resolve();
42
+ });
43
+ })
44
+ .on("error", reject);
45
+ };
46
+ request(url);
47
+ });
48
+ }
49
+
50
+ async function main() {
51
+ const binaryName = getPlatformBinaryName();
52
+ const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${binaryName}`;
53
+ const dest = path.join(__dirname, "bin", "agave-native");
54
+
55
+ fs.mkdirSync(path.join(__dirname, "bin"), { recursive: true });
56
+
57
+ console.log(`Downloading agave binary for ${process.platform}-${process.arch}...`);
58
+
59
+ try {
60
+ await download(url, dest);
61
+ fs.chmodSync(dest, 0o755);
62
+ console.log("agave binary installed successfully.");
63
+ } catch (err) {
64
+ console.error(`Failed to download binary: ${err.message}`);
65
+ console.error("You can build from source with: opam install . --deps-only && dune build");
66
+ process.exit(1);
67
+ }
68
+ }
69
+
70
+ main();
package/bin/Agave DELETED
Binary file
package/bin/_storePath DELETED
@@ -1 +0,0 @@
1
- ______________________________________________________________________________________