scribe-cms 0.0.1 → 0.0.2

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
@@ -131,20 +131,4 @@ The short version:
131
131
  `{ source, destination, permanent }` rules from aliases, `redirect_to`, and
132
132
  cross-locale slugs — map them to your framework's redirect config.
133
133
 
134
- ## Publish to npm
135
-
136
- From the monorepo root (builds, tests, then publishes):
137
-
138
- ```bash
139
- npm login # once, if needed
140
- pnpm publish:npm
141
- ```
142
-
143
- From this package directory:
144
-
145
- ```bash
146
- pnpm build
147
- pnpm publish:npm # runs npm publish --access public
148
- ```
149
-
150
- Site: [scribe.genlook.app](https://scribe.genlook.app)
134
+ **Site & examples:** [scribe.genlook.app](https://scribe.genlook.app) · [Example Next.js app](https://github.com/GenlookLabs/scribe-cms/tree/main/apps/web)
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { spawnSync } from "node:child_process";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const pkgRoot = path.dirname(fileURLToPath(new URL("../package.json", import.meta.url)));
8
+ const builtCli = path.join(pkgRoot, "dist/cli/index.js");
9
+
10
+ if (fs.existsSync(builtCli)) {
11
+ process.exit(0);
12
+ }
13
+
14
+ console.log("scribe-cms: building from source…");
15
+
16
+ for (const [command, args] of [
17
+ ["pnpm", ["run", "build"]],
18
+ ["npm", ["run", "build"]],
19
+ ]) {
20
+ const result = spawnSync(command, args, {
21
+ cwd: pkgRoot,
22
+ stdio: "inherit",
23
+ shell: process.platform === "win32",
24
+ });
25
+ if (result.status === 0 && fs.existsSync(builtCli)) {
26
+ process.exit(0);
27
+ }
28
+ }
29
+
30
+ console.error("scribe-cms: failed to build dist/. Install devDependencies or run: pnpm --filter scribe-cms build");
31
+ process.exit(1);
package/bin/scribe.js ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { spawnSync } from "node:child_process";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const pkgRoot = path.dirname(fileURLToPath(new URL("../package.json", import.meta.url)));
8
+ const builtCli = path.join(pkgRoot, "dist/cli/index.js");
9
+
10
+ if (!fs.existsSync(builtCli)) {
11
+ const ensureBuilt = path.join(pkgRoot, "bin/ensure-built.mjs");
12
+ const build = spawnSync(process.execPath, [ensureBuilt], {
13
+ stdio: "inherit",
14
+ cwd: pkgRoot,
15
+ });
16
+ if (build.status !== 0 || !fs.existsSync(builtCli)) {
17
+ console.error(
18
+ "scribe-cms could not run: dist/ is missing. Reinstall dependencies or run: pnpm --filter scribe-cms build",
19
+ );
20
+ process.exit(1);
21
+ }
22
+ }
23
+
24
+ const result = spawnSync(process.execPath, [builtCli, ...process.argv.slice(2)], {
25
+ stdio: "inherit",
26
+ cwd: process.cwd(),
27
+ });
28
+
29
+ process.exit(result.status ?? 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scribe-cms",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Typed, file-based CMS for multilingual MDX sites",
5
5
  "homepage": "https://scribe.genlook.app",
6
6
  "repository": {
@@ -13,7 +13,7 @@
13
13
  "type": "module",
14
14
  "license": "MIT",
15
15
  "keywords": ["cms", "mdx", "i18n", "zod", "content", "translation"],
16
- "files": ["dist", "README.md"],
16
+ "files": ["dist", "bin", "README.md"],
17
17
  "exports": {
18
18
  ".": {
19
19
  "types": "./dist/src/index.d.ts",
@@ -34,10 +34,11 @@
34
34
  "module": "./dist/index.js",
35
35
  "types": "./dist/src/index.d.ts",
36
36
  "bin": {
37
- "scribe": "./dist/cli/index.js"
37
+ "scribe": "./bin/scribe.js"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsup && tsc -p tsconfig.dts.json",
41
+ "postinstall": "node ./bin/ensure-built.mjs",
41
42
  "dev": "tsup --watch",
42
43
  "clean": "rm -rf dist",
43
44
  "test": "pnpm build && node --import tsx --test \"src/**/*.test.ts\"",