@accentdesign/phrase-core 0.0.0-stage → 1.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Accent Design
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,17 @@
1
- # Temporary Holding Version
1
+ # @accentdesign/phrase-core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Phrase, Accent's CMS for static Astro websites: clients change the words on their own pages, a person
4
+ approves every publish, and checks run before anything goes live.
5
+
6
+ ```sh
7
+ npx @accentdesign/phrase-core my-folder
8
+ cd my-folder
9
+ npm run dev
10
+ ```
11
+
12
+ Then open http://localhost:4400/admin. `npx @accentdesign/phrase-core@1.0.0 my-folder` picks a version;
13
+ `--no-install` skips installing.
14
+
15
+ This package is the very release Accent publishes on its hub (https://phrase-hub.1wp.site/download),
16
+ same version numbers, checked against its fingerprint before it's unpacked. Plugins come from the hub.
17
+ Needs Node.js 22.12 or newer. MIT licensed: Phrase comes as it is, with no guarantee.
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+ // npx @accentdesign/phrase-core [folder]
3
+ //
4
+ // Puts Phrase (this package's version) into a new folder and installs what it needs. The package
5
+ // carries the very zip Accent published on the hub (release.json has its fingerprint, checked here),
6
+ // so a copy from npm is byte for byte the hub's release.
7
+ //
8
+ // npx @accentdesign/phrase-core into ./phrase-core
9
+ // npx @accentdesign/phrase-core acme into ./acme
10
+ // npx @accentdesign/phrase-core acme --no-install
11
+ import { spawnSync } from 'node:child_process';
12
+ import { createHash } from 'node:crypto';
13
+ import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
14
+ import { dirname, join, resolve, sep } from 'node:path';
15
+ import { fileURLToPath } from 'node:url';
16
+ import { inflateRawSync } from 'node:zlib';
17
+
18
+ const HERE = dirname(dirname(fileURLToPath(import.meta.url)));
19
+ const args = process.argv.slice(2);
20
+ const name = args.find((a) => !a.startsWith('--')) || 'phrase-core';
21
+ const stop = (message) => {
22
+ console.error(`\n ${message}\n`);
23
+ process.exit(1);
24
+ };
25
+
26
+ const [major, minor] = process.versions.node.split('.').map(Number);
27
+ if (major < 22 || (major === 22 && minor < 12)) stop(`Phrase needs Node.js 22.12 or newer; this is ${process.versions.node}. Get the LTS version from nodejs.org.`);
28
+
29
+ const target = resolve(name);
30
+ if (existsSync(target) && readdirSync(target).length) stop(`${name} already has files in it. Choose a new folder name.`);
31
+
32
+ const release = JSON.parse(readFileSync(join(HERE, 'release.json'), 'utf8'));
33
+ const zip = readFileSync(join(HERE, 'phrase.zip'));
34
+ if (createHash('sha256').update(zip).digest('hex') !== release.sha256) stop('This copy of Phrase isn’t exactly what Accent published (its fingerprint doesn’t match), so it wasn’t used.');
35
+
36
+ // Unpacking: a zip's central directory lists each file; stored or deflated (what git archive makes).
37
+ const end = zip.lastIndexOf(Buffer.from([0x50, 0x4b, 0x05, 0x06]));
38
+ if (end < 0) stop('The zip is damaged.');
39
+ let at = zip.readUInt32LE(end + 16);
40
+ const count = zip.readUInt16LE(end + 10);
41
+ let written = 0;
42
+ for (let i = 0; i < count; i++) {
43
+ if (zip.readUInt32LE(at) !== 0x02014b50) stop('The zip is damaged.');
44
+ const method = zip.readUInt16LE(at + 10);
45
+ const size = zip.readUInt32LE(at + 20);
46
+ const nameLength = zip.readUInt16LE(at + 28);
47
+ const extraLength = zip.readUInt16LE(at + 30);
48
+ const commentLength = zip.readUInt16LE(at + 32);
49
+ const mode = zip.readUInt32LE(at + 38) >>> 16;
50
+ const local = zip.readUInt32LE(at + 42);
51
+ const path = zip.toString('utf8', at + 46, at + 46 + nameLength);
52
+ at += 46 + nameLength + extraLength + commentLength;
53
+ // Everything is inside phrase-<version>/; that folder becomes the new one.
54
+ const inner = path.split('/').slice(1).join('/');
55
+ if (!inner || inner.endsWith('/')) continue;
56
+ const out = resolve(target, inner);
57
+ if (!out.startsWith(target + sep)) stop(`The zip has a file outside its folder (${path}), so it wasn’t used.`);
58
+ const dataAt = local + 30 + zip.readUInt16LE(local + 26) + zip.readUInt16LE(local + 28);
59
+ const raw = zip.subarray(dataAt, dataAt + size);
60
+ const bytes = method === 0 ? raw : method === 8 ? inflateRawSync(raw) : stop(`The zip uses a kind of compression this can't unpack (${method}).`);
61
+ mkdirSync(dirname(out), { recursive: true });
62
+ writeFileSync(out, bytes);
63
+ if (mode & 0o111) chmodSync(out, 0o755);
64
+ written++;
65
+ }
66
+ console.log(`\n Phrase ${release.version}: ${written} files in ${name}/.`);
67
+
68
+ if (!args.includes('--no-install')) {
69
+ console.log(' Installing what it needs (a minute or two the first time)…\n');
70
+ const npm = spawnSync(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['install', '--no-audit', '--no-fund'], { cwd: target, stdio: 'inherit', shell: process.platform === 'win32' });
71
+ if (npm.status !== 0) stop(`Installing didn't finish. In ${name}/, run npm install, then npm run dev.`);
72
+ }
73
+
74
+ console.log(`
75
+ Phrase ${release.version} is ready in ${name}/.
76
+
77
+ cd ${name}
78
+ ${args.includes('--no-install') ? 'npm install\n ' : ''}npm run dev
79
+
80
+ Then open http://localhost:4400/admin and sign in: on your own computer, the sign-in email shows on
81
+ screen. It starts with a made-up demo site; README.md says how to make a client's site.
82
+ `);
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "@accentdesign/phrase-core",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "Phrase, Accent's CMS for static Astro sites: npx @accentdesign/phrase-core <folder>",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "phrase-core": "bin/phrase-core.mjs"
9
+ },
10
+ "files": [
11
+ "bin/",
12
+ "phrase.zip",
13
+ "release.json",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
17
+ "engines": {
18
+ "node": ">=22.12"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "homepage": "https://phrase-hub.1wp.site/download",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/AccentDesign/PhraseHub.git",
27
+ "directory": "npm"
28
+ }
29
+ }
package/phrase.zip ADDED
Binary file
package/release.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "version": "1.1.0",
3
+ "sha256": "470482eaf9f7ff4d94c55e23f73e46cf946805d147589bbc19d3714704a8986f",
4
+ "publishedAt": "2026-12-02T09:59:11.565Z"
5
+ }