create-alkemist 1.0.0-beta.1
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/CHANGELOG.md +5 -0
- package/LICENSE +201 -0
- package/README.md +11 -0
- package/bin/create-alkemist.mjs +13 -0
- package/lib/create-alkemist.mjs +96 -0
- package/package.json +44 -0
- package/template/.env.example +6 -0
- package/template/.node-version +1 -0
- package/template/AGENTS.md +11 -0
- package/template/README.md +25 -0
- package/template/astro.config.ts +16 -0
- package/template/gitignore +9 -0
- package/template/hosting/cloudflare.md +13 -0
- package/template/hosting/custom.md +11 -0
- package/template/hosting/gitlab-ci.yml +30 -0
- package/template/hosting/gitlab-preview.yml +15 -0
- package/template/hosting/gitlab.md +23 -0
- package/template/package.json +32 -0
- package/template/public/data/oscillation.csv +42 -0
- package/template/public/favicon.svg +1 -0
- package/template/public/models/tetrahedron.gltf +73 -0
- package/template/scripts/check-build.mjs +58 -0
- package/template/scripts/deployment.mjs +61 -0
- package/template/src/content/blog/first-experiment.mdx +28 -0
- package/template/src/content.config.ts +14 -0
- package/template/src/layouts/SiteLayout.astro +24 -0
- package/template/src/lib/site.ts +12 -0
- package/template/src/pages/404.astro +10 -0
- package/template/src/pages/blog/[...id].astro +27 -0
- package/template/src/pages/blog/index.astro +25 -0
- package/template/src/pages/build.json.ts +28 -0
- package/template/src/pages/index.astro +37 -0
- package/template/src/pages/info/index.astro +17 -0
- package/template/src/pages/labs/index.astro +13 -0
- package/template/src/pages/labs/oscillator.astro +45 -0
- package/template/src/pages/robots.txt.ts +9 -0
- package/template/src/pages/test.astro +50 -0
- package/template/src/styles/site.css +34 -0
- package/template/tsconfig.json +6 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# create-alkemist
|
|
2
|
+
|
|
3
|
+
Create a versioned Alkemist site without cloning the source repository:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm create alkemist@beta -- my-lab --provider cloudflare
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
The command writes files only. In the new directory, run `npm install` and
|
|
10
|
+
`npm run verify` when ready. It does not initialize Git, install dependencies,
|
|
11
|
+
or create a hosting account or deployment.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { createAlkemist, parseArguments } from '../lib/create-alkemist.mjs';
|
|
4
|
+
|
|
5
|
+
try {
|
|
6
|
+
const result = await createAlkemist(parseArguments(process.argv.slice(2)));
|
|
7
|
+
console.log(
|
|
8
|
+
`Created ${result.destination}\nProvider: ${result.provider}\nNext: open that directory, run npm install, npm run verify, then npm run dev.\nRead HOSTING.md before publishing. No project dependencies, Git repository, account, or deployment were created.`,
|
|
9
|
+
);
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error(error.message);
|
|
12
|
+
process.exitCode = 1;
|
|
13
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cp,
|
|
3
|
+
mkdir,
|
|
4
|
+
readFile,
|
|
5
|
+
readdir,
|
|
6
|
+
rename,
|
|
7
|
+
writeFile,
|
|
8
|
+
} from 'node:fs/promises';
|
|
9
|
+
import { dirname, join, resolve } from 'node:path';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
|
|
12
|
+
const packageRoot = fileURLToPath(new URL('../', import.meta.url));
|
|
13
|
+
const template = join(packageRoot, 'template');
|
|
14
|
+
const providers = new Set(['cloudflare', 'gitlab', 'custom']);
|
|
15
|
+
export const packages = [
|
|
16
|
+
'@alkemdotdev/alkemist-astro',
|
|
17
|
+
'@alkemdotdev/alkemist-components',
|
|
18
|
+
'@alkemdotdev/alkemist-theme',
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
async function readJson(file) {
|
|
22
|
+
return JSON.parse(await readFile(file, 'utf8'));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function writeJson(file, data) {
|
|
26
|
+
await writeFile(file, `${JSON.stringify(data, null, 2)}\n`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const ownManifest = await readJson(join(packageRoot, 'package.json'));
|
|
30
|
+
if (typeof ownManifest.version !== 'string' || !ownManifest.version)
|
|
31
|
+
throw new Error('create-alkemist package.json must contain a version.');
|
|
32
|
+
export const releaseVersion = ownManifest.version;
|
|
33
|
+
|
|
34
|
+
/** Generate a site from the template shipped in this npm package. */
|
|
35
|
+
export async function createAlkemist({ destination, provider = 'custom' }) {
|
|
36
|
+
if (!providers.has(provider))
|
|
37
|
+
throw new Error('Provider must be cloudflare, gitlab, or custom.');
|
|
38
|
+
const target = resolve(destination);
|
|
39
|
+
let entries = [];
|
|
40
|
+
try {
|
|
41
|
+
entries = await readdir(target);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
if (error.code !== 'ENOENT') throw error;
|
|
44
|
+
}
|
|
45
|
+
if (entries.length)
|
|
46
|
+
throw new Error('Destination is not empty. Choose an empty directory.');
|
|
47
|
+
|
|
48
|
+
await mkdir(dirname(target), { recursive: true });
|
|
49
|
+
await cp(template, target, { recursive: true, errorOnExist: true });
|
|
50
|
+
await rename(join(target, 'gitignore'), join(target, '.gitignore'));
|
|
51
|
+
await cp(
|
|
52
|
+
join(target, 'hosting', `${provider}.md`),
|
|
53
|
+
join(target, 'HOSTING.md'),
|
|
54
|
+
);
|
|
55
|
+
if (provider === 'gitlab')
|
|
56
|
+
await cp(
|
|
57
|
+
join(target, 'hosting', 'gitlab-ci.yml'),
|
|
58
|
+
join(target, '.gitlab-ci.yml'),
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const manifest = await readJson(join(target, 'package.json'));
|
|
62
|
+
manifest.dependencies ??= {};
|
|
63
|
+
for (const name of packages) manifest.dependencies[name] = releaseVersion;
|
|
64
|
+
await writeJson(join(target, 'package.json'), manifest);
|
|
65
|
+
await writeJson(join(target, 'alkemist.starter.json'), {
|
|
66
|
+
schemaVersion: 2,
|
|
67
|
+
generator: 'create-alkemist',
|
|
68
|
+
generatorVersion: releaseVersion,
|
|
69
|
+
provider,
|
|
70
|
+
generatedAt: new Date().toISOString(),
|
|
71
|
+
packages: packages.map((name) => ({ name, version: releaseVersion })),
|
|
72
|
+
});
|
|
73
|
+
return { destination: target, provider };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function parseArguments(args) {
|
|
77
|
+
let destination;
|
|
78
|
+
let provider = 'custom';
|
|
79
|
+
for (let index = 0; index < args.length; index++) {
|
|
80
|
+
const argument = args[index];
|
|
81
|
+
if (argument === '--provider') {
|
|
82
|
+
provider = args[++index];
|
|
83
|
+
if (!providers.has(provider))
|
|
84
|
+
throw new Error('--provider requires cloudflare, gitlab, or custom.');
|
|
85
|
+
} else if (argument.startsWith('-') || destination) {
|
|
86
|
+
throw new Error(`Unexpected argument: ${argument}`);
|
|
87
|
+
} else {
|
|
88
|
+
destination = argument;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (!destination)
|
|
92
|
+
throw new Error(
|
|
93
|
+
'Usage: npm create alkemist@beta -- <directory> [--provider cloudflare|gitlab|custom]',
|
|
94
|
+
);
|
|
95
|
+
return { destination, provider };
|
|
96
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-alkemist",
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
|
+
"description": "Create a versioned Alkemist publishing site.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/alkemdotdev/alkemist.git",
|
|
9
|
+
"directory": "packages/create-alkemist"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://alkemist.alkem.dev",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/alkemdotdev/alkemist/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"create-astro",
|
|
17
|
+
"astro",
|
|
18
|
+
"technical-publishing",
|
|
19
|
+
"scientific-publishing"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"bin": {
|
|
23
|
+
"create-alkemist": "./bin/create-alkemist.mjs"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"bin",
|
|
27
|
+
"lib",
|
|
28
|
+
"template",
|
|
29
|
+
"README.md",
|
|
30
|
+
"CHANGELOG.md"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "node ./scripts/prepare-template.mjs",
|
|
34
|
+
"prepare-template": "node ./scripts/prepare-template.mjs",
|
|
35
|
+
"prepack": "node ./scripts/prepare-template.mjs"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=22.12.0"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public",
|
|
42
|
+
"tag": "beta"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Canonical production origin. Set this in your provider's build environment.
|
|
2
|
+
SITE_URL=https://example.org
|
|
3
|
+
# A root deployment uses /. A project deployment might use /my-lab/.
|
|
4
|
+
BASE_PATH=/
|
|
5
|
+
# Set on a custom provider's preview builds. Cloudflare/GitLab are detected.
|
|
6
|
+
# ALK_PREVIEW=true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
24
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This site belongs to its author
|
|
2
|
+
|
|
3
|
+
- Read README.md and HOSTING.md before changing setup. `src/`, `public/`, and site configuration are user-owned. Alkemist's reusable behavior lives in the installed `@alkemdotdev/alkemist-*` packages.
|
|
4
|
+
- Run `npm run verify`. Exercise changed pages in a browser at phone and desktop widths. Check chart controls, model controls, and browser errors when changing a lab.
|
|
5
|
+
- Main navigation is Blog, Labs, Info. More contains the Test page. Documentation is optional; add it only when this project needs it.
|
|
6
|
+
- Use `withBase()` from `src/lib/site.ts` for site-local links and public assets. `./file.csv` does not currently resolve relative to an MDX source file.
|
|
7
|
+
- Never describe proposed components or metadata schemas as implemented. Charts currently need explicit type/axes/title/description; models support uncompressed glTF 2.0.
|
|
8
|
+
- Read the selected provider instructions before deploying. Verify repository, account, domain, branch, build command, output directory, and credentials without printing secrets. Do not reuse the Alkemist demo's infrastructure identifiers.
|
|
9
|
+
- Do not initialize Git, create a remote, push, publish, change DNS, or incur charges without the user's authorization. Once authorized, complete setup and verify the live commit and assets.
|
|
10
|
+
- Keep one deployment owner. Cloudflare native Git builds and GitLab Pages CI are alternatives, not simultaneous publishers of the same site.
|
|
11
|
+
- Commit package-lock.json. Package upgrades do not replace this site's content or styles; inspect and test changes before accepting an update.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Your Alkemist site
|
|
2
|
+
|
|
3
|
+
This is an independent Astro project. Its content, navigation, styles, and hosting configuration belong to you. Alkemist is installed from versioned npm packages pinned in `package.json`.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install
|
|
7
|
+
npm run verify
|
|
8
|
+
npm run dev
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Edit `src/lib/site.ts` to change the name and tagline. Edit `src/styles/site.css` for theme overrides, `src/content/blog/` for posts, and `src/pages/labs/` for interactive apps. This starter contains Blog, Labs, Info, and a small Test page; documentation is optional.
|
|
12
|
+
|
|
13
|
+
The oscillator data is synthetic. The tetrahedron is an original, small glTF fixture. Replace them with your own evidence and record units, provenance, and license terms. Math and fenced code in MDX work through the installed integration. Charts and models load their rendering engines when visible.
|
|
14
|
+
|
|
15
|
+
## Hosting
|
|
16
|
+
|
|
17
|
+
Follow HOSTING.md for the provider selected when generating this site. Set `SITE_URL` to your production origin and `BASE_PATH` to `/` or your project path. Copy `.env.example` to `.env` for local overrides. CI variables override values in `.env`. Never commit tokens.
|
|
18
|
+
|
|
19
|
+
`npm run verify` checks Astro types, builds `dist/`, verifies local page links and assets, and checks preview metadata. It does not prove an external deployment succeeded. After publication, open the live site, inspect its labs, and compare `/build.json` with the intended commit.
|
|
20
|
+
|
|
21
|
+
## Updating the installed packages
|
|
22
|
+
|
|
23
|
+
Choose a newer documented Alkemist release, update the three `@alkemdotdev/alkemist-*` versions together in `package.json`, then run `npm install` and `npm run verify`. Inspect the dependency diff and changed pages before committing the package manifest and lockfile.
|
|
24
|
+
|
|
25
|
+
The packages do not replace your content, styles, navigation, or provider setup. Read release migration notes before changing a package's major version. This workflow does not automatically migrate your site's Astro version.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'astro/config';
|
|
2
|
+
import alkemist from '@alkemdotdev/alkemist-astro';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import { loadEnvFile } from 'node:process';
|
|
5
|
+
import { resolveDeployment } from './scripts/deployment.mjs';
|
|
6
|
+
|
|
7
|
+
if (existsSync('.env')) loadEnvFile('.env');
|
|
8
|
+
const deployment = resolveDeployment(process.env);
|
|
9
|
+
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
site: deployment.origin,
|
|
12
|
+
base: deployment.base,
|
|
13
|
+
output: 'static',
|
|
14
|
+
trailingSlash: 'always',
|
|
15
|
+
integrations: [alkemist()],
|
|
16
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Cloudflare Pages · native Git integration
|
|
2
|
+
|
|
3
|
+
1. Run `npm install` and `npm run verify` locally. Commit this site's source, `vendor/*.tgz`, and `package-lock.json` to your own GitHub or GitLab repository.
|
|
4
|
+
2. In your own Cloudflare account, create a Pages project connected to that repository. Choose production branch `main` (or set `PRODUCTION_BRANCH` to your chosen branch).
|
|
5
|
+
3. Set root directory to the repository root, build command to `npm ci && npm run verify`, output directory to `dist`, and `NODE_VERSION` to `24`. No deploy token is needed in repository secrets for native Git builds.
|
|
6
|
+
4. Set production `SITE_URL` to your canonical origin and `BASE_PATH` to `/`. Set the same values in preview builds so preview pages retain production canonical URLs; previews receive noindex metadata automatically from `CF_PAGES_BRANCH`. Enable previews for your desired non-production branches.
|
|
7
|
+
5. Add the custom domain through the Pages project before adjusting DNS as instructed by Cloudflare. Verify HTTPS, the rendered page and labs, and `/build.json` against the intended commit. Push a test branch and verify its separate preview URL and noindex tag.
|
|
8
|
+
|
|
9
|
+
For an apex domain, the zone must be on Cloudflare. A subdomain can use external DNS with a CNAME after associating it with the Pages project. Provider connection, DNS, and publication require the site owner's authorization. No Cloudflare account IDs, tokens, or Alkemist demo domain are copied into this starter.
|
|
10
|
+
|
|
11
|
+
Do not add a second CI deploy command alongside native Git publishing. This generator does not create the remote repository or configure a Cloudflare account.
|
|
12
|
+
|
|
13
|
+
Sources: [Git integration](https://developers.cloudflare.com/pages/configuration/git-integration/), [build configuration](https://developers.cloudflare.com/pages/configuration/build-configuration/), [custom domains](https://developers.cloudflare.com/pages/configuration/custom-domains/).
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Custom static hosting
|
|
2
|
+
|
|
3
|
+
Alkemist produces ordinary static files. Choose one provider or your own server; no Cloudflare runtime or account is required.
|
|
4
|
+
|
|
5
|
+
1. Run `npm install` once, then commit `package-lock.json` and `vendor/*.tgz` alongside the site's source.
|
|
6
|
+
2. Configure Node 24 and the build command `npm ci && npm run verify` in your provider or CI. Set `SITE_URL` to the canonical HTTP(S) origin, and `BASE_PATH` to `/` or the deployed path such as `/my-lab/`. A local check is `SITE_URL=https://example.org BASE_PATH=/my-lab/ npm run verify`.
|
|
7
|
+
3. Publish the contents of `dist/` at that path. Serve directory requests such as `/blog/` from `blog/index.html`; preserve file types and serve `404.html` with a 404 status for missing pages. This is a static site, so it needs no SPA catch-all rewrite.
|
|
8
|
+
4. Keep production and preview outputs separate. On previews, set `ALK_PREVIEW=true`, and provide `COMMIT_SHA` for build provenance. Use the correct preview base if it differs. This marks pages noindex and emits a restrictive robots.txt; it does not make the preview private.
|
|
9
|
+
5. Configure HTTPS, DNS, and publish only within the owner's authorization. Verify the live HTML, data/model requests, routes under the configured base, and `build.json` against the intended commit.
|
|
10
|
+
|
|
11
|
+
The provider's upload command and secret storage are deliberately yours to choose. Do not put credentials in source or generated HTML. Keep one authoritative deployment workflow and document its rollback mechanism.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
image: node:24
|
|
2
|
+
|
|
3
|
+
stages:
|
|
4
|
+
- verify
|
|
5
|
+
- deploy
|
|
6
|
+
|
|
7
|
+
workflow:
|
|
8
|
+
rules:
|
|
9
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
10
|
+
- if: '$CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
|
|
11
|
+
when: never
|
|
12
|
+
- if: '$CI_COMMIT_BRANCH'
|
|
13
|
+
|
|
14
|
+
validate:
|
|
15
|
+
stage: verify
|
|
16
|
+
script:
|
|
17
|
+
- npm ci
|
|
18
|
+
- npm run verify
|
|
19
|
+
rules:
|
|
20
|
+
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
|
21
|
+
|
|
22
|
+
publish-pages:
|
|
23
|
+
stage: deploy
|
|
24
|
+
script:
|
|
25
|
+
- npm ci
|
|
26
|
+
- npm run verify
|
|
27
|
+
pages:
|
|
28
|
+
publish: dist
|
|
29
|
+
rules:
|
|
30
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Opt in only on GitLab Premium/Ultimate with parallel deployment slots.
|
|
2
|
+
preview-pages:
|
|
3
|
+
stage: deploy
|
|
4
|
+
script:
|
|
5
|
+
- npm ci
|
|
6
|
+
- npm run verify
|
|
7
|
+
pages:
|
|
8
|
+
publish: dist
|
|
9
|
+
path_prefix: 'mr-$CI_MERGE_REQUEST_IID'
|
|
10
|
+
expire_in: 1 week
|
|
11
|
+
environment:
|
|
12
|
+
name: 'review/mr-$CI_MERGE_REQUEST_IID'
|
|
13
|
+
url: $CI_PAGES_URL
|
|
14
|
+
rules:
|
|
15
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# GitLab Pages
|
|
2
|
+
|
|
3
|
+
The generated `.gitlab-ci.yml` targets GitLab 17.10+ and works on the Free tier: the default branch publishes Pages, and other branches and merge requests validate the site without replacing production.
|
|
4
|
+
|
|
5
|
+
1. Run `npm install` and `npm run verify` locally. Create your own GitLab repository and commit the source, `vendor/*.tgz`, and `package-lock.json`.
|
|
6
|
+
2. Enable an eligible CI runner and Pages for the project. The pipeline uses `node:24`, runs `npm ci && npm run verify`, and publishes `dist/` through `pages.publish`.
|
|
7
|
+
3. By default, the build derives origin and base path from the job's `CI_PAGES_URL`. This supports both unique Pages domains and traditional `/project/` paths. For a production custom domain, set `SITE_URL` to its origin and `BASE_PATH` to its path, normally `/`.
|
|
8
|
+
4. Configure the domain under the project's Pages settings and complete its DNS verification/TLS steps. Inspect the live page, labs, and `build.json` under the deployed base path.
|
|
9
|
+
|
|
10
|
+
## Optional parallel previews · Premium or Ultimate
|
|
11
|
+
|
|
12
|
+
Parallel Pages deployments require Premium/Ultimate and available namespace deployment slots. The starter includes `hosting/gitlab-preview.yml` as an opt-in job template. After confirming eligibility, add it as a local include in `.gitlab-ci.yml`:
|
|
13
|
+
|
|
14
|
+
```yaml
|
|
15
|
+
include:
|
|
16
|
+
- local: '/hosting/gitlab-preview.yml'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
It publishes merge-request previews at the distinct `mr-<iid>` prefix for one week. Opening an MR from a branch provides its preview; ordinary branch pipelines remain validation-only. Production is unchanged. `CI_PAGES_URL` already includes that prefix, so the build derives the preview base from it rather than appending the prefix again. Preview HTML and robots.txt request no indexing.
|
|
20
|
+
|
|
21
|
+
Do not enable the parallel job on an unsupported plan. GitLab's Free tier does not provide these parallel hosted previews; validation artifacts and a separate preview provider are alternatives that need explicit setup.
|
|
22
|
+
|
|
23
|
+
Sources: [Pages YAML](https://docs.gitlab.com/ci/yaml/#pagespublish), [predefined variables](https://docs.gitlab.com/ci/variables/predefined_variables/), [parallel deployments and tier requirements](https://docs.gitlab.com/user/project/pages/parallel_deployments/).
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-alkemist-site",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22.12.0"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "astro dev",
|
|
11
|
+
"build": "astro build",
|
|
12
|
+
"check": "astro check",
|
|
13
|
+
"verify": "npm run check && npm run build && node scripts/check-build.mjs",
|
|
14
|
+
"preview": "astro preview"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@alkemdotdev/alkemist-astro": "1.0.0-beta.1",
|
|
18
|
+
"@alkemdotdev/alkemist-components": "1.0.0-beta.1",
|
|
19
|
+
"@alkemdotdev/alkemist-theme": "1.0.0-beta.1",
|
|
20
|
+
"astro": "7.3.2"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@astrojs/check": "0.9.10",
|
|
24
|
+
"@types/node": "24.13.3",
|
|
25
|
+
"typescript": "6.0.3"
|
|
26
|
+
},
|
|
27
|
+
"overrides": {
|
|
28
|
+
"rehype-katex": {
|
|
29
|
+
"katex": "0.18.7"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
time,position
|
|
2
|
+
0.000,1.000000
|
|
3
|
+
0.025,0.987688
|
|
4
|
+
0.050,0.951057
|
|
5
|
+
0.075,0.891007
|
|
6
|
+
0.100,0.809017
|
|
7
|
+
0.125,0.707107
|
|
8
|
+
0.150,0.587785
|
|
9
|
+
0.175,0.453990
|
|
10
|
+
0.200,0.309017
|
|
11
|
+
0.225,0.156434
|
|
12
|
+
0.250,0.000000
|
|
13
|
+
0.275,-0.156434
|
|
14
|
+
0.300,-0.309017
|
|
15
|
+
0.325,-0.453990
|
|
16
|
+
0.350,-0.587785
|
|
17
|
+
0.375,-0.707107
|
|
18
|
+
0.400,-0.809017
|
|
19
|
+
0.425,-0.891007
|
|
20
|
+
0.450,-0.951057
|
|
21
|
+
0.475,-0.987688
|
|
22
|
+
0.500,-1.000000
|
|
23
|
+
0.525,-0.987688
|
|
24
|
+
0.550,-0.951057
|
|
25
|
+
0.575,-0.891007
|
|
26
|
+
0.600,-0.809017
|
|
27
|
+
0.625,-0.707107
|
|
28
|
+
0.650,-0.587785
|
|
29
|
+
0.675,-0.453990
|
|
30
|
+
0.700,-0.309017
|
|
31
|
+
0.725,-0.156434
|
|
32
|
+
0.750,-0.000000
|
|
33
|
+
0.775,0.156434
|
|
34
|
+
0.800,0.309017
|
|
35
|
+
0.825,0.453990
|
|
36
|
+
0.850,0.587785
|
|
37
|
+
0.875,0.707107
|
|
38
|
+
0.900,0.809017
|
|
39
|
+
0.925,0.891007
|
|
40
|
+
0.950,0.951057
|
|
41
|
+
0.975,0.987688
|
|
42
|
+
1.000,1.000000
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="12" fill="#111"/><path d="M25 12h14M28 12v19L15 50q-2 4 3 4h28q5 0 3-4L36 31V12M23 40h18" fill="none" stroke="#eee" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"asset": {
|
|
3
|
+
"version": "2.0",
|
|
4
|
+
"generator": "Alkemist starter; original tetrahedron fixture"
|
|
5
|
+
},
|
|
6
|
+
"scene": 0,
|
|
7
|
+
"scenes": [
|
|
8
|
+
{
|
|
9
|
+
"nodes": [0]
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"nodes": [
|
|
13
|
+
{
|
|
14
|
+
"mesh": 0
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"meshes": [
|
|
18
|
+
{
|
|
19
|
+
"primitives": [
|
|
20
|
+
{
|
|
21
|
+
"attributes": {
|
|
22
|
+
"POSITION": 0,
|
|
23
|
+
"NORMAL": 1
|
|
24
|
+
},
|
|
25
|
+
"material": 0
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"materials": [
|
|
31
|
+
{
|
|
32
|
+
"pbrMetallicRoughness": {
|
|
33
|
+
"baseColorFactor": [0.01, 0.22, 0.89, 1],
|
|
34
|
+
"metallicFactor": 0.05,
|
|
35
|
+
"roughnessFactor": 0.6
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"buffers": [
|
|
40
|
+
{
|
|
41
|
+
"byteLength": 288,
|
|
42
|
+
"uri": "data:application/octet-stream;base64,AACAPwAAgD8AAIA/AACAvwAAgD8AAIC/AACAvwAAgL8AAIA/AACAPwAAgD8AAIA/AACAvwAAgL8AAIA/AACAPwAAgL8AAIC/AACAPwAAgD8AAIA/AACAPwAAgL8AAIC/AACAvwAAgD8AAIC/AACAvwAAgL8AAIA/AACAvwAAgD8AAIC/AACAPwAAgL8AAIC/Os0TvzrNEz86zRM/Os0TvzrNEz86zRM/Os0TvzrNEz86zRM/Os0TPzrNE786zRM/Os0TPzrNE786zRM/Os0TPzrNE786zRM/Os0TPzrNEz86zRO/Os0TPzrNEz86zRO/Os0TPzrNEz86zRO/Os0TvzrNE786zRO/Os0TvzrNE786zRO/Os0TvzrNE786zRO/"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"bufferViews": [
|
|
46
|
+
{
|
|
47
|
+
"buffer": 0,
|
|
48
|
+
"byteOffset": 0,
|
|
49
|
+
"byteLength": 144
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"buffer": 0,
|
|
53
|
+
"byteOffset": 144,
|
|
54
|
+
"byteLength": 144
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"accessors": [
|
|
58
|
+
{
|
|
59
|
+
"bufferView": 0,
|
|
60
|
+
"componentType": 5126,
|
|
61
|
+
"count": 12,
|
|
62
|
+
"type": "VEC3",
|
|
63
|
+
"min": [-1, -1, -1],
|
|
64
|
+
"max": [1, 1, 1]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"bufferView": 1,
|
|
68
|
+
"componentType": 5126,
|
|
69
|
+
"count": 12,
|
|
70
|
+
"type": "VEC3"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { readFile, readdir, stat } from 'node:fs/promises';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { loadEnvFile } from 'node:process';
|
|
4
|
+
import { join, resolve, sep } from 'node:path';
|
|
5
|
+
import { resolveDeployment } from './deployment.mjs';
|
|
6
|
+
|
|
7
|
+
const root = resolve('dist');
|
|
8
|
+
if (existsSync('.env')) loadEnvFile('.env');
|
|
9
|
+
const metadata = JSON.parse(await readFile(join(root, 'build.json'), 'utf8'));
|
|
10
|
+
const { base, environment } = metadata;
|
|
11
|
+
const expected = resolveDeployment(process.env);
|
|
12
|
+
if (base !== expected.base || environment !== expected.environment) {
|
|
13
|
+
throw new Error('Build metadata does not match the requested deployment.');
|
|
14
|
+
}
|
|
15
|
+
async function files(directory) {
|
|
16
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
17
|
+
const nested = await Promise.all(
|
|
18
|
+
entries.map((entry) =>
|
|
19
|
+
entry.isDirectory()
|
|
20
|
+
? files(join(directory, entry.name))
|
|
21
|
+
: join(directory, entry.name),
|
|
22
|
+
),
|
|
23
|
+
);
|
|
24
|
+
return nested.flat();
|
|
25
|
+
}
|
|
26
|
+
const htmlFiles = (await files(root)).filter((file) => file.endsWith('.html'));
|
|
27
|
+
const failures = [];
|
|
28
|
+
for (const file of htmlFiles) {
|
|
29
|
+
const html = await readFile(file, 'utf8');
|
|
30
|
+
if (environment === 'preview' && !html.includes('noindex, nofollow'))
|
|
31
|
+
failures.push(`${file}: missing preview noindex`);
|
|
32
|
+
for (const match of html.matchAll(/(?:href|src)="(\/[^"\s]*)"/g)) {
|
|
33
|
+
const url = match[1].split(/[?#]/)[0];
|
|
34
|
+
if (url.startsWith('//')) continue;
|
|
35
|
+
if (!url.startsWith(base)) {
|
|
36
|
+
failures.push(`${file}: URL ${url} escapes base ${base}`);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const local = decodeURIComponent(url.slice(base.length));
|
|
40
|
+
const candidate = resolve(
|
|
41
|
+
root,
|
|
42
|
+
local.endsWith('/') || !local ? `${local}index.html` : local,
|
|
43
|
+
);
|
|
44
|
+
if (!candidate.startsWith(`${root}${sep}`)) {
|
|
45
|
+
failures.push(`${file}: invalid local URL ${url}`);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
if (!(await stat(candidate)).isFile()) throw new Error();
|
|
50
|
+
} catch {
|
|
51
|
+
failures.push(`${file}: missing ${url}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (failures.length) throw new Error(failures.join('\n'));
|
|
56
|
+
console.log(
|
|
57
|
+
`Checked ${htmlFiles.length} pages, local links/assets, ${base} base, and ${environment} build metadata.`,
|
|
58
|
+
);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** @param {Record<string, string | undefined>} env */
|
|
2
|
+
export function resolveDeployment(env) {
|
|
3
|
+
const branch = env.CF_PAGES_BRANCH ?? env.CI_COMMIT_REF_NAME ?? 'local';
|
|
4
|
+
const defaultBranch =
|
|
5
|
+
env.PRODUCTION_BRANCH ?? env.CI_DEFAULT_BRANCH ?? 'main';
|
|
6
|
+
const inferredPreview = Boolean(
|
|
7
|
+
env.CI_MERGE_REQUEST_IID ||
|
|
8
|
+
(branch !== 'local' && branch !== defaultBranch),
|
|
9
|
+
);
|
|
10
|
+
if (env.ALK_PREVIEW && !['true', 'false'].includes(env.ALK_PREVIEW)) {
|
|
11
|
+
throw new Error('ALK_PREVIEW must be true or false.');
|
|
12
|
+
}
|
|
13
|
+
const preview = env.ALK_PREVIEW
|
|
14
|
+
? env.ALK_PREVIEW === 'true'
|
|
15
|
+
: inferredPreview;
|
|
16
|
+
// GitLab includes the parallel deployment prefix in CI_PAGES_URL (17.9+).
|
|
17
|
+
// Preview routes must follow that URL, even when production has a custom domain.
|
|
18
|
+
const pages = env.CI_PAGES_URL ? new URL(env.CI_PAGES_URL) : undefined;
|
|
19
|
+
const origin =
|
|
20
|
+
preview && pages
|
|
21
|
+
? pages.origin
|
|
22
|
+
: (env.SITE_URL ?? pages?.origin ?? 'http://localhost:4321');
|
|
23
|
+
const site = new URL(origin);
|
|
24
|
+
if (
|
|
25
|
+
!['http:', 'https:'].includes(site.protocol) ||
|
|
26
|
+
site.pathname !== '/' ||
|
|
27
|
+
site.search ||
|
|
28
|
+
site.hash
|
|
29
|
+
) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
'SITE_URL must be an HTTP(S) origin. Put the path in BASE_PATH.',
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
const rawBase =
|
|
35
|
+
preview && pages
|
|
36
|
+
? pages.pathname
|
|
37
|
+
: (env.BASE_PATH ?? pages?.pathname ?? '/');
|
|
38
|
+
if (
|
|
39
|
+
!rawBase.startsWith('/') ||
|
|
40
|
+
/[?#\\]/.test(rawBase) ||
|
|
41
|
+
rawBase.includes('..') ||
|
|
42
|
+
rawBase.includes('//')
|
|
43
|
+
) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
'BASE_PATH must be an absolute URL path such as / or /my-lab/.',
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
const base = `${rawBase.replace(/\/$/, '')}/`;
|
|
49
|
+
return {
|
|
50
|
+
origin: site.origin,
|
|
51
|
+
base,
|
|
52
|
+
branch,
|
|
53
|
+
preview,
|
|
54
|
+
environment: preview
|
|
55
|
+
? 'preview'
|
|
56
|
+
: branch === 'local'
|
|
57
|
+
? 'local'
|
|
58
|
+
: 'production',
|
|
59
|
+
commit: env.CF_PAGES_COMMIT_SHA ?? env.CI_COMMIT_SHA ?? env.COMMIT_SHA,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: A first experiment
|
|
3
|
+
description: Start with a question, preserve the data, and show the working.
|
|
4
|
+
published: '2026-09-08'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This is your first article. Replace it with a research note, project update, or something you want to explain.
|
|
8
|
+
|
|
9
|
+
## Show your working
|
|
10
|
+
|
|
11
|
+
A simple harmonic oscillator gives us a useful starting point:
|
|
12
|
+
|
|
13
|
+
$$
|
|
14
|
+
\ddot{x} + \omega^2 x = 0, \qquad x(t) = A\cos(\omega t).
|
|
15
|
+
$$
|
|
16
|
+
|
|
17
|
+
The starter includes a small **synthetic** displacement dataset and an interactive chart in Labs. It is a demonstration, not a measured result.
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from math import cos, pi
|
|
21
|
+
|
|
22
|
+
def displacement(t: float, amplitude: float = 1.0) -> float:
|
|
23
|
+
return amplitude * cos(2 * pi * t)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Keep the evidence nearby
|
|
27
|
+
|
|
28
|
+
Describe how your data was produced, state its units, and distinguish observed results from assumptions. The files in `public/data/` are ordinary CSV files; your article remains ordinary Markdown or MDX.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineCollection, z } from 'astro:content';
|
|
2
|
+
import { glob } from 'astro/loaders';
|
|
3
|
+
|
|
4
|
+
export const collections = {
|
|
5
|
+
blog: defineCollection({
|
|
6
|
+
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/blog' }),
|
|
7
|
+
schema: z.object({
|
|
8
|
+
title: z.string(),
|
|
9
|
+
description: z.string(),
|
|
10
|
+
published: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
11
|
+
draft: z.boolean().default(false),
|
|
12
|
+
}),
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
import AlkLayout from '@alkemdotdev/alkemist-components/AlkLayout.astro';
|
|
3
|
+
import { siteName, tagline, navigation, withBase } from '../lib/site';
|
|
4
|
+
import { resolveDeployment } from '../../scripts/deployment.mjs';
|
|
5
|
+
import '../styles/site.css';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
section?: string;
|
|
11
|
+
}
|
|
12
|
+
const { preview } = resolveDeployment(process.env);
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<AlkLayout
|
|
16
|
+
{...Astro.props}
|
|
17
|
+
siteName={siteName}
|
|
18
|
+
tagline={tagline}
|
|
19
|
+
navigation={navigation}
|
|
20
|
+
moreNavigation={[{ label: 'Test page', href: withBase('test/') }]}
|
|
21
|
+
preview={preview}
|
|
22
|
+
>
|
|
23
|
+
<slot />
|
|
24
|
+
</AlkLayout>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const siteName = 'My Lab';
|
|
2
|
+
export const tagline = 'Ideas, experiments, and work in progress';
|
|
3
|
+
|
|
4
|
+
/** Site-local paths must include Astro's deployment base. */
|
|
5
|
+
export const withBase = (path: string) =>
|
|
6
|
+
`${import.meta.env.BASE_URL}${path.replace(/^\//, '')}`;
|
|
7
|
+
|
|
8
|
+
export const navigation = [
|
|
9
|
+
{ label: 'Blog', href: withBase('blog/') },
|
|
10
|
+
{ label: 'Labs', href: withBase('labs/') },
|
|
11
|
+
{ label: 'Info', href: withBase('info/') },
|
|
12
|
+
];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getCollection, render } from 'astro:content';
|
|
3
|
+
import type { CollectionEntry } from 'astro:content';
|
|
4
|
+
import SiteLayout from '../../layouts/SiteLayout.astro';
|
|
5
|
+
export async function getStaticPaths() {
|
|
6
|
+
return (await getCollection('blog', ({ data }) => !data.draft)).map(
|
|
7
|
+
(entry) => ({ params: { id: entry.id }, props: { entry } }),
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
interface Props {
|
|
11
|
+
entry: CollectionEntry<'blog'>;
|
|
12
|
+
}
|
|
13
|
+
const { entry } = Astro.props;
|
|
14
|
+
const { Content } = await render(entry);
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<SiteLayout
|
|
18
|
+
title={entry.data.title}
|
|
19
|
+
description={entry.data.description}
|
|
20
|
+
section="Blog"
|
|
21
|
+
>
|
|
22
|
+
<article class="lab-reading">
|
|
23
|
+
<p class="alk-eyebrow">{entry.data.published}</p><h1>
|
|
24
|
+
{entry.data.title}
|
|
25
|
+
</h1><p>{entry.data.description}</p><Content />
|
|
26
|
+
</article>
|
|
27
|
+
</SiteLayout>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getCollection } from 'astro:content';
|
|
3
|
+
import SiteLayout from '../../layouts/SiteLayout.astro';
|
|
4
|
+
import { withBase } from '../../lib/site';
|
|
5
|
+
const posts = (await getCollection('blog', ({ data }) => !data.draft)).sort(
|
|
6
|
+
(a, b) => b.data.published.localeCompare(a.data.published),
|
|
7
|
+
);
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<SiteLayout title="Blog" description="Notes, news, and work in progress.">
|
|
11
|
+
<h1>Blog</h1>
|
|
12
|
+
{
|
|
13
|
+
posts.map((post) => (
|
|
14
|
+
<article class="lab-card lab-section">
|
|
15
|
+
<>
|
|
16
|
+
<p class="alk-eyebrow">{post.data.published}</p>
|
|
17
|
+
<h2>
|
|
18
|
+
<a href={withBase(`blog/${post.id}/`)}>{post.data.title}</a>
|
|
19
|
+
</h2>
|
|
20
|
+
<p>{post.data.description}</p>
|
|
21
|
+
</>
|
|
22
|
+
</article>
|
|
23
|
+
))
|
|
24
|
+
}
|
|
25
|
+
</SiteLayout>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { APIRoute } from 'astro';
|
|
2
|
+
import { execFileSync } from 'node:child_process';
|
|
3
|
+
import { resolveDeployment } from '../../scripts/deployment.mjs';
|
|
4
|
+
import { siteName } from '../lib/site';
|
|
5
|
+
const deployment = resolveDeployment(process.env);
|
|
6
|
+
function revision() {
|
|
7
|
+
if (deployment.commit) return deployment.commit;
|
|
8
|
+
try {
|
|
9
|
+
return execFileSync('git', ['rev-parse', 'HEAD'], {
|
|
10
|
+
encoding: 'utf8',
|
|
11
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
12
|
+
}).trim();
|
|
13
|
+
} catch {
|
|
14
|
+
return 'uncommitted';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export const GET: APIRoute = () =>
|
|
18
|
+
new Response(
|
|
19
|
+
JSON.stringify({
|
|
20
|
+
project: siteName,
|
|
21
|
+
commit: revision(),
|
|
22
|
+
branch: deployment.branch,
|
|
23
|
+
environment: deployment.environment,
|
|
24
|
+
base: deployment.base,
|
|
25
|
+
builtAt: new Date().toISOString(),
|
|
26
|
+
}),
|
|
27
|
+
{ headers: { 'Content-Type': 'application/json' } },
|
|
28
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
import SiteLayout from '../layouts/SiteLayout.astro';
|
|
3
|
+
import { siteName, tagline, withBase } from '../lib/site';
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<SiteLayout title={siteName} description={tagline}>
|
|
7
|
+
<div class="lab-intro">
|
|
8
|
+
<p class="alk-eyebrow">An open research notebook</p>
|
|
9
|
+
<h1>Make an idea something you can explore.</h1>
|
|
10
|
+
<p>
|
|
11
|
+
{tagline}. This is your site: write about the work, share a usable
|
|
12
|
+
experiment, and introduce the people behind it.
|
|
13
|
+
</p>
|
|
14
|
+
<p class="lab-note">Start with a question. Leave the working in.</p>
|
|
15
|
+
<div class="lab-links">
|
|
16
|
+
<a href={withBase('labs/oscillator/')}>Explore the first lab →</a>
|
|
17
|
+
<a href={withBase('blog/first-experiment/')}>Read the first experiment</a>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<section class="lab-grid lab-section" aria-label="Explore the site">
|
|
21
|
+
<article class="lab-card">
|
|
22
|
+
<h2>Blog</h2><p>Research notes, news, and the story behind the work.</p><a
|
|
23
|
+
href={withBase('blog/')}>Read the blog →</a
|
|
24
|
+
>
|
|
25
|
+
</article>
|
|
26
|
+
<article class="lab-card">
|
|
27
|
+
<h2>Labs</h2><p>Small, working tools and interactive experiments.</p><a
|
|
28
|
+
href={withBase('labs/')}>Open the labs →</a
|
|
29
|
+
>
|
|
30
|
+
</article>
|
|
31
|
+
<article class="lab-card">
|
|
32
|
+
<h2>Info</h2><p>
|
|
33
|
+
The people, purpose, and questions behind this project.
|
|
34
|
+
</p><a href={withBase('info/')}>Meet the project →</a>
|
|
35
|
+
</article>
|
|
36
|
+
</section>
|
|
37
|
+
</SiteLayout>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
import SiteLayout from '../../layouts/SiteLayout.astro';
|
|
3
|
+
import { siteName } from '../../lib/site';
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<SiteLayout title="Info" description={`About ${siteName}.`}>
|
|
7
|
+
<h1>About {siteName}</h1><div class="lab-reading">
|
|
8
|
+
<p>
|
|
9
|
+
This is a place for the questions we are asking and the things we are
|
|
10
|
+
building.
|
|
11
|
+
</p><h2>People and purpose</h2><p>
|
|
12
|
+
Introduce your team, your research interests, and how others can
|
|
13
|
+
participate. Add individual bios beneath <code>/info/</code> as your project
|
|
14
|
+
grows.
|
|
15
|
+
</p>
|
|
16
|
+
</div>
|
|
17
|
+
</SiteLayout>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
import SiteLayout from '../../layouts/SiteLayout.astro';
|
|
3
|
+
import { withBase } from '../../lib/site';
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<SiteLayout title="Labs" description="Interactive experiments you can explore.">
|
|
7
|
+
<h1>Labs</h1><p>Small tools, working examples, and ideas you can touch.</p>
|
|
8
|
+
<article class="lab-card lab-section">
|
|
9
|
+
<h2><a href={withBase('labs/oscillator/')}>The oscillator bench</a></h2><p>
|
|
10
|
+
Inspect synthetic motion data and orbit a small 3D model.
|
|
11
|
+
</p>
|
|
12
|
+
</article>
|
|
13
|
+
</SiteLayout>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
import SiteLayout from '../../layouts/SiteLayout.astro';
|
|
3
|
+
import AlkChart from '@alkemdotdev/alkemist-components/AlkChart.astro';
|
|
4
|
+
import AlkModel from '@alkemdotdev/alkemist-components/AlkModel.astro';
|
|
5
|
+
import AlkMath from '@alkemdotdev/alkemist-components/AlkMath.astro';
|
|
6
|
+
import { withBase } from '../../lib/site';
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<SiteLayout
|
|
10
|
+
title="The oscillator bench"
|
|
11
|
+
description="Explore a synthetic signal and an original tetrahedron mesh."
|
|
12
|
+
section="Labs"
|
|
13
|
+
>
|
|
14
|
+
<h1>The oscillator bench</h1><p class="lab-intro">
|
|
15
|
+
An equation, a data file, and a shape. This is a small working starting
|
|
16
|
+
point for your own experiment.
|
|
17
|
+
</p>
|
|
18
|
+
<section class="lab-section" id="signal">
|
|
19
|
+
<h2>A synthetic signal</h2>
|
|
20
|
+
<AlkMath
|
|
21
|
+
tex={String.raw`x(t) = \cos(2\pi t)`}
|
|
22
|
+
label="Normalized harmonic motion"
|
|
23
|
+
/>
|
|
24
|
+
<AlkChart
|
|
25
|
+
src={withBase('data/oscillation.csv')}
|
|
26
|
+
type="line"
|
|
27
|
+
x="time"
|
|
28
|
+
y="position"
|
|
29
|
+
title="One oscillation"
|
|
30
|
+
description="Synthetic displacement sampled over one second. Time in seconds; position in meters."
|
|
31
|
+
xLabel="Time (s)"
|
|
32
|
+
yLabel="Position (m)"
|
|
33
|
+
sample={true}
|
|
34
|
+
grid={true}
|
|
35
|
+
/>
|
|
36
|
+
</section>
|
|
37
|
+
<section class="lab-section" id="model">
|
|
38
|
+
<h2>A shape to inspect</h2>
|
|
39
|
+
<AlkModel
|
|
40
|
+
src={withBase('models/tetrahedron.gltf')}
|
|
41
|
+
title="An original tetrahedron"
|
|
42
|
+
description="A small, uncompressed glTF fixture with four triangular faces. Drag to orbit or use the camera controls."
|
|
43
|
+
/>
|
|
44
|
+
</section>
|
|
45
|
+
</SiteLayout>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { APIRoute } from 'astro';
|
|
2
|
+
import { resolveDeployment } from '../../scripts/deployment.mjs';
|
|
3
|
+
export const GET: APIRoute = () =>
|
|
4
|
+
new Response(
|
|
5
|
+
resolveDeployment(process.env).preview
|
|
6
|
+
? 'User-agent: *\nDisallow: /\n'
|
|
7
|
+
: 'User-agent: *\nAllow: /\n',
|
|
8
|
+
{ headers: { 'Content-Type': 'text/plain' } },
|
|
9
|
+
);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
import SiteLayout from '../layouts/SiteLayout.astro';
|
|
3
|
+
import AlkCode from '@alkemdotdev/alkemist-components/AlkCode.astro';
|
|
4
|
+
import AlkMath from '@alkemdotdev/alkemist-components/AlkMath.astro';
|
|
5
|
+
import { withBase } from '../lib/site';
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<SiteLayout
|
|
9
|
+
title="Test page"
|
|
10
|
+
description="A compact check of this site's reusable styles."
|
|
11
|
+
>
|
|
12
|
+
<h1>One page. Many specimens.</h1><p>
|
|
13
|
+
Use this page to check your theme overrides on a phone and a desktop.
|
|
14
|
+
</p>
|
|
15
|
+
<section class="lab-section">
|
|
16
|
+
<h2>Type and ink</h2><p>
|
|
17
|
+
Ordinary text, <strong>strong text</strong>, <em>emphasis</em>, <code
|
|
18
|
+
>inline code</code
|
|
19
|
+
>, and <a href={withBase('labs/oscillator/')}>a useful link</a>.
|
|
20
|
+
</p><p class="lab-note">
|
|
21
|
+
Keep a little room for handwritten thinking.
|
|
22
|
+
</p><blockquote>
|
|
23
|
+
A good experiment makes the next question clearer.
|
|
24
|
+
</blockquote>
|
|
25
|
+
</section>
|
|
26
|
+
<section class="lab-section">
|
|
27
|
+
<h2>Math and code</h2><AlkMath
|
|
28
|
+
tex={String.raw`E = \frac{1}{2}m\dot{x}^2 + \frac{1}{2}kx^2`}
|
|
29
|
+
label="Oscillator energy"
|
|
30
|
+
/><AlkCode
|
|
31
|
+
code={'const energy = (m * v ** 2 + k * x ** 2) / 2;'}
|
|
32
|
+
lang="typescript"
|
|
33
|
+
title="energy.ts"
|
|
34
|
+
lineNumbers={true}
|
|
35
|
+
/>
|
|
36
|
+
</section>
|
|
37
|
+
<section class="lab-section">
|
|
38
|
+
<h2>Details and controls</h2><details>
|
|
39
|
+
<summary>Open an annotation</summary><p>
|
|
40
|
+
State the assumption behind the result.
|
|
41
|
+
</p>
|
|
42
|
+
</details><p>
|
|
43
|
+
<label
|
|
44
|
+
><input type="checkbox" /> Include uncertainty in the next experiment</label
|
|
45
|
+
>
|
|
46
|
+
</p><a href={withBase('labs/oscillator/')}
|
|
47
|
+
>Test the interactive chart and model →</a
|
|
48
|
+
>
|
|
49
|
+
</section>
|
|
50
|
+
</SiteLayout>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* Your overrides live here and are preserved when Alkemist packages update. */
|
|
2
|
+
.lab-intro {
|
|
3
|
+
max-width: 44rem;
|
|
4
|
+
}
|
|
5
|
+
.lab-note {
|
|
6
|
+
font-family: var(--alk-hand);
|
|
7
|
+
font-size: 1.65rem;
|
|
8
|
+
color: var(--alk-ink-cobalt);
|
|
9
|
+
}
|
|
10
|
+
.lab-links {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-wrap: wrap;
|
|
13
|
+
gap: 1rem 2rem;
|
|
14
|
+
margin-block: 2rem;
|
|
15
|
+
}
|
|
16
|
+
.lab-section {
|
|
17
|
+
margin-block: 4rem;
|
|
18
|
+
scroll-margin-top: 2rem;
|
|
19
|
+
}
|
|
20
|
+
.lab-grid {
|
|
21
|
+
display: grid;
|
|
22
|
+
grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
|
|
23
|
+
gap: 2rem;
|
|
24
|
+
}
|
|
25
|
+
.lab-card {
|
|
26
|
+
border-top: 1px solid var(--alk-rule);
|
|
27
|
+
padding-top: 1.5rem;
|
|
28
|
+
}
|
|
29
|
+
.lab-reading {
|
|
30
|
+
max-width: 48rem;
|
|
31
|
+
}
|
|
32
|
+
.lab-reading h2 {
|
|
33
|
+
margin-top: 2.5rem;
|
|
34
|
+
}
|