create-aphex 0.1.0 → 0.1.3

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) 2025 Benjamin Sinidol
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
@@ -17,7 +17,7 @@ You can also invoke it through the [`aphx`](https://www.npmjs.com/package/aphx)
17
17
  CLI, which shells out to this package:
18
18
 
19
19
  ```bash
20
- npx aphx create
20
+ pnpm aphex create
21
21
  ```
22
22
 
23
23
  ## What it does
package/dist/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,40 +1,41 @@
1
1
  {
2
- "name": "create-aphex",
3
- "version": "0.1.0",
4
- "description": "Scaffold a new Aphex CMS project — invoked via `pnpm create aphex`",
5
- "publishConfig": {},
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/IcelandicIcecream/aphex.git",
9
- "directory": "packages/create-aphex"
10
- },
11
- "type": "module",
12
- "bin": {
13
- "create-aphex": "./dist/index.js"
14
- },
15
- "files": [
16
- "dist",
17
- "templates"
18
- ],
19
- "scripts": {
20
- "build": "node scripts/copy-templates.js && tsc",
21
- "prepublishOnly": "pnpm build"
22
- },
23
- "keywords": [
24
- "aphex",
25
- "cms",
26
- "cli",
27
- "scaffolding",
28
- "template"
29
- ],
30
- "author": "",
31
- "license": "MIT",
32
- "dependencies": {
33
- "@clack/prompts": "^0.11.0",
34
- "picocolors": "^1.1.1"
35
- },
36
- "devDependencies": {
37
- "@types/node": "^22.0.0",
38
- "typescript": "^5.9.3"
39
- }
40
- }
2
+ "name": "create-aphex",
3
+ "version": "0.1.3",
4
+ "description": "Scaffold a new Aphex CMS project — invoked via `pnpm create aphex`",
5
+ "publishConfig": {
6
+ "provenance": true
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/IcelandicIcecream/aphex.git",
11
+ "directory": "packages/create-aphex"
12
+ },
13
+ "type": "module",
14
+ "bin": {
15
+ "create-aphex": "./dist/index.js"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "templates"
20
+ ],
21
+ "keywords": [
22
+ "aphex",
23
+ "cms",
24
+ "cli",
25
+ "scaffolding",
26
+ "template"
27
+ ],
28
+ "author": "",
29
+ "license": "MIT",
30
+ "dependencies": {
31
+ "@clack/prompts": "^0.11.0",
32
+ "picocolors": "^1.1.1"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^22.0.0",
36
+ "typescript": "^5.9.3"
37
+ },
38
+ "scripts": {
39
+ "build": "node scripts/copy-templates.js && tsc"
40
+ }
41
+ }
@@ -1,5 +1,5 @@
1
1
  ---
2
- **Heads up:** This project was scaffolded from `@aphexcms/base` `v0.0.2`.
2
+ **Heads up:** This project was scaffolded from `@aphexcms/base` `v0.0.3`.
3
3
  When upgrading, read `CHANGELOG.md` in the template repo for notes on
4
4
  what changed upstream and which files you may want to port into your
5
5
  customized project.
@@ -18,6 +18,12 @@ tag matching the version you started from to see the exact changes.
18
18
 
19
19
  ## Unreleased
20
20
 
21
+ ## 0.0.4
22
+ - pass authorised origins from .env into better auth to handle csrf
23
+ - preload dayjs for better UX when going into a fresh studio
24
+ - disallow admins from changing themselves to owners and kicking out original owners
25
+
26
+ ## 0.0.3
21
27
  - **feat(api): move invitation email-wrap into `aphex.config.ts → api`**
22
28
  - Deleted: `src/routes/api/organizations/invitations/+server.ts` —
23
29
  the SK shim that wrapped the built-in invite handler to send email.
@@ -9,7 +9,7 @@ A clean starting point for building with Aphex CMS. No example schemas — just
9
9
  > cd my-app && pnpm install
10
10
  > ```
11
11
  >
12
- > Or scaffold via the CLI: `npx aphx create`.
12
+ > Or scaffold via the CLI: `pnpm aphex create`.
13
13
 
14
14
  ## Getting Started
15
15
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aphexcms/base",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -29,11 +29,11 @@
29
29
  "test:date": "tsx scripts/test-date-localapi.ts"
30
30
  },
31
31
  "dependencies": {
32
- "@aphexcms/cms-core": "^5.0.0",
33
- "@aphexcms/nodemailer-adapter": "^7.0.0",
34
- "@aphexcms/postgresql-adapter": "^6.0.0",
35
- "@aphexcms/resend-adapter": "^6.0.0",
36
- "@aphexcms/storage-s3": "^6.0.0",
32
+ "@aphexcms/cms-core": "^5.0.5",
33
+ "@aphexcms/nodemailer-adapter": "^7.0.5",
34
+ "@aphexcms/postgresql-adapter": "^6.0.5",
35
+ "@aphexcms/resend-adapter": "^6.0.5",
36
+ "@aphexcms/storage-s3": "^6.0.5",
37
37
  "@aphexcms/ui": "^0.4.0",
38
38
  "@better-auth/api-key": "^1.5.3",
39
39
  "@better-auth/drizzle-adapter": "^1.5.3",
@@ -16,6 +16,14 @@ import { cacheAdapter } from '../../cache';
16
16
  const authSecret = env.AUTH_SECRET || env.BETTER_AUTH_SECRET;
17
17
  const authUrl = env.AUTH_URL || env.BETTER_AUTH_URL;
18
18
 
19
+ // CSV of origins permitted for cross-origin auth requests. Better Auth uses
20
+ // this for CSRF/origin checks; without it, cookie-auth API mutations are
21
+ // reachable from any site a logged-in admin visits.
22
+ const trustedOrigins = (env.AUTH_TRUSTED_ORIGINS || authUrl || '')
23
+ .split(',')
24
+ .map((o) => o.trim())
25
+ .filter(Boolean);
26
+
19
27
  // This function creates the Better Auth instance, injecting the necessary dependencies.
20
28
  export function createAuthInstance(
21
29
  db: DatabaseAdapter,
@@ -51,6 +59,16 @@ export function createAuthInstance(
51
59
  return betterAuth({
52
60
  baseURL: authUrl,
53
61
  secret: authSecret,
62
+ trustedOrigins,
63
+ session: {
64
+ // Validates the session cookie's signature without a DB hit. Short
65
+ // maxAge keeps revocation lag tight for role/membership changes,
66
+ // which the per-request RBAC chain re-reads on top of this.
67
+ cookieCache: {
68
+ enabled: true,
69
+ maxAge: 60
70
+ }
71
+ },
54
72
  advanced: {
55
73
  backgroundTasks: {
56
74
  handler: (task) => {
@@ -1,7 +1,12 @@
1
+ import { createRequire } from 'node:module';
1
2
  import tailwindcss from '@tailwindcss/vite';
2
3
  import { sveltekit } from '@sveltejs/kit/vite';
3
4
  import { defineConfig } from 'vite';
4
5
 
6
+ const require = createRequire(import.meta.url);
7
+ const dayjsEsm = require.resolve('dayjs/esm/index.js');
8
+ const dayjsEsmPluginDir = dayjsEsm.replace(/\/index\.js$/, '/plugin');
9
+
5
10
  export default defineConfig({
6
11
  plugins: [
7
12
  tailwindcss(),
@@ -70,8 +75,8 @@ export default defineConfig({
70
75
  // to dayjs's proper ESM build so those imports work regardless of which
71
76
  // package they come from.
72
77
  alias: [
73
- { find: /^dayjs$/, replacement: 'dayjs/esm/index.js' },
74
- { find: /^dayjs\/plugin\/([^/]+?)(\.js)?$/, replacement: 'dayjs/esm/plugin/$1/index.js' }
78
+ { find: /^dayjs$/, replacement: dayjsEsm },
79
+ { find: /^dayjs\/plugin\/([^/]+?)(\.js)?$/, replacement: `${dayjsEsmPluginDir}/$1/index.js` }
75
80
  ]
76
81
  },
77
82
  server: {
@@ -102,6 +107,9 @@ export default defineConfig({
102
107
  'tailwind-merge',
103
108
  '@internationalized/date',
104
109
  'bits-ui',
110
+ 'dayjs',
111
+ 'dayjs/plugin/customParseFormat',
112
+ 'dayjs/plugin/utc',
105
113
  '@lucide/svelte',
106
114
  '@lucide/svelte/icons/panel-left',
107
115
  '@lucide/svelte/icons/minus',