payload-better-auth 1.0.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 +225 -0
- package/dist/better-auth/crypto-shared.d.ts +61 -0
- package/dist/better-auth/crypto-shared.js +90 -0
- package/dist/better-auth/crypto-shared.js.map +1 -0
- package/dist/better-auth/databaseHooks.d.ts +5 -0
- package/dist/better-auth/databaseHooks.js +24 -0
- package/dist/better-auth/databaseHooks.js.map +1 -0
- package/dist/better-auth/plugin.d.ts +13 -0
- package/dist/better-auth/plugin.js +159 -0
- package/dist/better-auth/plugin.js.map +1 -0
- package/dist/better-auth/reconcile-queue.d.ts +70 -0
- package/dist/better-auth/reconcile-queue.js +311 -0
- package/dist/better-auth/reconcile-queue.js.map +1 -0
- package/dist/better-auth/sources.d.ts +35 -0
- package/dist/better-auth/sources.js +126 -0
- package/dist/better-auth/sources.js.map +1 -0
- package/dist/collections/Users/index.d.ts +5 -0
- package/dist/collections/Users/index.js +167 -0
- package/dist/collections/Users/index.js.map +1 -0
- package/dist/components/BeforeDashboardClient.d.ts +2 -0
- package/dist/components/BeforeDashboardClient.js +36 -0
- package/dist/components/BeforeDashboardClient.js.map +1 -0
- package/dist/components/BeforeDashboardServer.d.ts +3 -0
- package/dist/components/BeforeDashboardServer.js +22 -0
- package/dist/components/BeforeDashboardServer.js.map +1 -0
- package/dist/components/BeforeDashboardServer.module.css +5 -0
- package/dist/components/BetterAuthLoginServer.d.ts +5 -0
- package/dist/components/BetterAuthLoginServer.js +82 -0
- package/dist/components/BetterAuthLoginServer.js.map +1 -0
- package/dist/components/EmailPasswordFormClient.d.ts +5 -0
- package/dist/components/EmailPasswordFormClient.js +162 -0
- package/dist/components/EmailPasswordFormClient.js.map +1 -0
- package/dist/exports/client.d.ts +1 -0
- package/dist/exports/client.js +3 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +3 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/payload/plugin.d.ts +7 -0
- package/dist/payload/plugin.js +76 -0
- package/dist/payload/plugin.js.map +1 -0
- package/dist/utils/payload-reconcile.d.ts +6 -0
- package/dist/utils/payload-reconcile.js +37 -0
- package/dist/utils/payload-reconcile.js.map +1 -0
- package/package.json +96 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createUsersCollection } from '../collections/Users/index.js';
|
|
2
|
+
import { triggerFullReconcile } from '../utils/payload-reconcile.js';
|
|
3
|
+
export const betterAuthPayloadPlugin = (pluginOptions)=>(config)=>{
|
|
4
|
+
const Users = createUsersCollection({
|
|
5
|
+
authClientOptions: pluginOptions.authClientOptions
|
|
6
|
+
});
|
|
7
|
+
if (!config.collections) {
|
|
8
|
+
config.collections = [
|
|
9
|
+
Users
|
|
10
|
+
];
|
|
11
|
+
} else if (config.collections.find((col)=>col.slug === 'users')) {
|
|
12
|
+
throw new Error('Payload-better-auth plugin: Users collection already present');
|
|
13
|
+
} else {
|
|
14
|
+
config.collections.push(Users);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* If the plugin is disabled, we still want to keep added collections/fields so the database schema is consistent which is important for migrations.
|
|
18
|
+
* If your plugin heavily modifies the database schema, you may want to remove this property.
|
|
19
|
+
*/ if (pluginOptions.disabled) {
|
|
20
|
+
return config;
|
|
21
|
+
}
|
|
22
|
+
if (!config.endpoints) {
|
|
23
|
+
config.endpoints = [];
|
|
24
|
+
}
|
|
25
|
+
if (!config.admin) {
|
|
26
|
+
config.admin = {};
|
|
27
|
+
}
|
|
28
|
+
if (!config.admin.user) {
|
|
29
|
+
config.admin.user = Users.slug;
|
|
30
|
+
} else if (config.admin.user !== Users.slug) {
|
|
31
|
+
throw new Error('Payload-better-auth plugin: admin.user property already set with conflicting value.');
|
|
32
|
+
}
|
|
33
|
+
if (!config.admin.components) {
|
|
34
|
+
config.admin.components = {};
|
|
35
|
+
}
|
|
36
|
+
if (!config.admin.components.beforeLogin) {
|
|
37
|
+
config.admin.components.beforeLogin = [];
|
|
38
|
+
}
|
|
39
|
+
config.admin.components.beforeLogin.push({
|
|
40
|
+
path: `payload-better-auth/rsc#BetterAuthLoginServer`,
|
|
41
|
+
serverProps: {
|
|
42
|
+
authClientOptions: pluginOptions.authClientOptions
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (!config.admin.components.views) {
|
|
46
|
+
config.admin.components.views = {};
|
|
47
|
+
}
|
|
48
|
+
if (!config.admin.components.views.login) {
|
|
49
|
+
config.admin.components.views.login = {
|
|
50
|
+
Component: 'payload-better-auth/rsc#BetterAuthLoginServer',
|
|
51
|
+
exact: true,
|
|
52
|
+
path: '/auth'
|
|
53
|
+
};
|
|
54
|
+
} else {
|
|
55
|
+
throw new Error('Payload-better-auth plugin: admin.components.views.login property in config already set.');
|
|
56
|
+
}
|
|
57
|
+
if (!config.admin.routes) {
|
|
58
|
+
config.admin.routes = {};
|
|
59
|
+
}
|
|
60
|
+
if (!config.admin.routes.login) {
|
|
61
|
+
config.admin.routes.login = '/auth';
|
|
62
|
+
} else {
|
|
63
|
+
throw new Error('Payload-better-auth plugin: admin.routes.login property in config already set.');
|
|
64
|
+
}
|
|
65
|
+
const incomingOnInit = config.onInit;
|
|
66
|
+
config.onInit = async (payload)=>{
|
|
67
|
+
// Ensure we are executing any existing onInit functions before running our own.
|
|
68
|
+
if (incomingOnInit) {
|
|
69
|
+
await incomingOnInit(payload);
|
|
70
|
+
}
|
|
71
|
+
await triggerFullReconcile(payload);
|
|
72
|
+
};
|
|
73
|
+
return config;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/payload/plugin.ts"],"sourcesContent":["import type { createAuthClient } from 'better-auth/react'\nimport type { Config } from 'payload'\n\nimport { createUsersCollection } from '../collections/Users/index.js'\nimport { triggerFullReconcile } from '../utils/payload-reconcile.js'\n\nexport type BetterAuthPayloadPluginOptions = {\n authClientOptions: Parameters<typeof createAuthClient>['0']\n disabled?: boolean\n}\n\nexport const betterAuthPayloadPlugin =\n (pluginOptions: BetterAuthPayloadPluginOptions) =>\n (config: Config): Config => {\n const Users = createUsersCollection({ authClientOptions: pluginOptions.authClientOptions })\n if (!config.collections) {\n config.collections = [Users]\n } else if (config.collections.find((col) => col.slug === 'users')) {\n throw new Error('Payload-better-auth plugin: Users collection already present')\n } else {\n config.collections.push(Users)\n }\n\n /**\n * If the plugin is disabled, we still want to keep added collections/fields so the database schema is consistent which is important for migrations.\n * If your plugin heavily modifies the database schema, you may want to remove this property.\n */\n if (pluginOptions.disabled) {\n return config\n }\n\n if (!config.endpoints) {\n config.endpoints = []\n }\n\n if (!config.admin) {\n config.admin = {}\n }\n\n if (!config.admin.user) {\n config.admin.user = Users.slug\n } else if (config.admin.user !== Users.slug) {\n throw new Error(\n 'Payload-better-auth plugin: admin.user property already set with conflicting value.',\n )\n }\n\n if (!config.admin.components) {\n config.admin.components = {}\n }\n\n if (!config.admin.components.beforeLogin) {\n config.admin.components.beforeLogin = []\n }\n\n config.admin.components.beforeLogin.push({\n path: `payload-better-auth/rsc#BetterAuthLoginServer`,\n serverProps: { authClientOptions: pluginOptions.authClientOptions },\n })\n\n if (!config.admin.components.views) {\n config.admin.components.views = {}\n }\n\n if (!config.admin.components.views.login) {\n config.admin.components.views.login = {\n Component: 'payload-better-auth/rsc#BetterAuthLoginServer', // RSC or 'use client' component\n exact: true,\n path: '/auth',\n }\n } else {\n throw new Error(\n 'Payload-better-auth plugin: admin.components.views.login property in config already set.',\n )\n }\n\n if (!config.admin.routes) {\n config.admin.routes = {}\n }\n\n if (!config.admin.routes.login) {\n config.admin.routes.login = '/auth'\n } else {\n throw new Error(\n 'Payload-better-auth plugin: admin.routes.login property in config already set.',\n )\n }\n\n const incomingOnInit = config.onInit\n\n config.onInit = async (payload) => {\n // Ensure we are executing any existing onInit functions before running our own.\n if (incomingOnInit) {\n await incomingOnInit(payload)\n }\n await triggerFullReconcile(payload)\n }\n\n return config\n }\n"],"names":["createUsersCollection","triggerFullReconcile","betterAuthPayloadPlugin","pluginOptions","config","Users","authClientOptions","collections","find","col","slug","Error","push","disabled","endpoints","admin","user","components","beforeLogin","path","serverProps","views","login","Component","exact","routes","incomingOnInit","onInit","payload"],"mappings":"AAGA,SAASA,qBAAqB,QAAQ,gCAA+B;AACrE,SAASC,oBAAoB,QAAQ,gCAA+B;AAOpE,OAAO,MAAMC,0BACX,CAACC,gBACD,CAACC;QACC,MAAMC,QAAQL,sBAAsB;YAAEM,mBAAmBH,cAAcG,iBAAiB;QAAC;QACzF,IAAI,CAACF,OAAOG,WAAW,EAAE;YACvBH,OAAOG,WAAW,GAAG;gBAACF;aAAM;QAC9B,OAAO,IAAID,OAAOG,WAAW,CAACC,IAAI,CAAC,CAACC,MAAQA,IAAIC,IAAI,KAAK,UAAU;YACjE,MAAM,IAAIC,MAAM;QAClB,OAAO;YACLP,OAAOG,WAAW,CAACK,IAAI,CAACP;QAC1B;QAEA;;;KAGC,GACD,IAAIF,cAAcU,QAAQ,EAAE;YAC1B,OAAOT;QACT;QAEA,IAAI,CAACA,OAAOU,SAAS,EAAE;YACrBV,OAAOU,SAAS,GAAG,EAAE;QACvB;QAEA,IAAI,CAACV,OAAOW,KAAK,EAAE;YACjBX,OAAOW,KAAK,GAAG,CAAC;QAClB;QAEA,IAAI,CAACX,OAAOW,KAAK,CAACC,IAAI,EAAE;YACtBZ,OAAOW,KAAK,CAACC,IAAI,GAAGX,MAAMK,IAAI;QAChC,OAAO,IAAIN,OAAOW,KAAK,CAACC,IAAI,KAAKX,MAAMK,IAAI,EAAE;YAC3C,MAAM,IAAIC,MACR;QAEJ;QAEA,IAAI,CAACP,OAAOW,KAAK,CAACE,UAAU,EAAE;YAC5Bb,OAAOW,KAAK,CAACE,UAAU,GAAG,CAAC;QAC7B;QAEA,IAAI,CAACb,OAAOW,KAAK,CAACE,UAAU,CAACC,WAAW,EAAE;YACxCd,OAAOW,KAAK,CAACE,UAAU,CAACC,WAAW,GAAG,EAAE;QAC1C;QAEAd,OAAOW,KAAK,CAACE,UAAU,CAACC,WAAW,CAACN,IAAI,CAAC;YACvCO,MAAM,CAAC,6CAA6C,CAAC;YACrDC,aAAa;gBAAEd,mBAAmBH,cAAcG,iBAAiB;YAAC;QACpE;QAEA,IAAI,CAACF,OAAOW,KAAK,CAACE,UAAU,CAACI,KAAK,EAAE;YAClCjB,OAAOW,KAAK,CAACE,UAAU,CAACI,KAAK,GAAG,CAAC;QACnC;QAEA,IAAI,CAACjB,OAAOW,KAAK,CAACE,UAAU,CAACI,KAAK,CAACC,KAAK,EAAE;YACxClB,OAAOW,KAAK,CAACE,UAAU,CAACI,KAAK,CAACC,KAAK,GAAG;gBACpCC,WAAW;gBACXC,OAAO;gBACPL,MAAM;YACR;QACF,OAAO;YACL,MAAM,IAAIR,MACR;QAEJ;QAEA,IAAI,CAACP,OAAOW,KAAK,CAACU,MAAM,EAAE;YACxBrB,OAAOW,KAAK,CAACU,MAAM,GAAG,CAAC;QACzB;QAEA,IAAI,CAACrB,OAAOW,KAAK,CAACU,MAAM,CAACH,KAAK,EAAE;YAC9BlB,OAAOW,KAAK,CAACU,MAAM,CAACH,KAAK,GAAG;QAC9B,OAAO;YACL,MAAM,IAAIX,MACR;QAEJ;QAEA,MAAMe,iBAAiBtB,OAAOuB,MAAM;QAEpCvB,OAAOuB,MAAM,GAAG,OAAOC;YACrB,gFAAgF;YAChF,IAAIF,gBAAgB;gBAClB,MAAMA,eAAeE;YACvB;YACA,MAAM3B,qBAAqB2B;QAC7B;QAEA,OAAOxB;IACT,EAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Payload } from 'payload';
|
|
2
|
+
/**
|
|
3
|
+
* Triggers a full reconcile operation via the Better Auth reconcile API
|
|
4
|
+
* This is typically called during Payload initialization to ensure data consistency
|
|
5
|
+
*/
|
|
6
|
+
export declare function triggerFullReconcile(payload: Payload): Promise<void>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Triggers a full reconcile operation via the Better Auth reconcile API
|
|
3
|
+
* This is typically called during Payload initialization to ensure data consistency
|
|
4
|
+
*/ export async function triggerFullReconcile(payload) {
|
|
5
|
+
try {
|
|
6
|
+
const reconcileToken = process.env.RECONCILE_TOKEN;
|
|
7
|
+
if (!reconcileToken) {
|
|
8
|
+
payload.logger.warn('RECONCILE_TOKEN not set, skipping onInit reconcile trigger');
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
// Determine the better-auth server URL
|
|
12
|
+
const betterAuthUrl = process.env.BETTER_AUTH_URL || 'http://localhost:3000';
|
|
13
|
+
const reconcileUrl = `${betterAuthUrl}/api/auth/reconcile/run`;
|
|
14
|
+
payload.logger.info('Triggering full reconcile from Payload onInit...');
|
|
15
|
+
const response = await fetch(reconcileUrl, {
|
|
16
|
+
headers: {
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
'x-reconcile-token': reconcileToken
|
|
19
|
+
},
|
|
20
|
+
method: 'POST'
|
|
21
|
+
});
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
throw new Error(`Reconcile request failed: ${response.status} ${response.statusText}`);
|
|
24
|
+
}
|
|
25
|
+
const result = await response.json();
|
|
26
|
+
payload.logger.info('Full reconcile triggered successfully from Payload onInit', {
|
|
27
|
+
result
|
|
28
|
+
});
|
|
29
|
+
} catch (error) {
|
|
30
|
+
payload.logger.error('Failed to trigger full reconcile from Payload onInit', {
|
|
31
|
+
error
|
|
32
|
+
});
|
|
33
|
+
// Don't throw - we don't want to prevent Payload from starting if reconcile fails
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=payload-reconcile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/payload-reconcile.ts"],"sourcesContent":["import type { Payload } from 'payload'\n\n/**\n * Triggers a full reconcile operation via the Better Auth reconcile API\n * This is typically called during Payload initialization to ensure data consistency\n */\nexport async function triggerFullReconcile(payload: Payload): Promise<void> {\n try {\n const reconcileToken = process.env.RECONCILE_TOKEN\n if (!reconcileToken) {\n payload.logger.warn('RECONCILE_TOKEN not set, skipping onInit reconcile trigger')\n return\n }\n\n // Determine the better-auth server URL\n const betterAuthUrl = process.env.BETTER_AUTH_URL || 'http://localhost:3000'\n const reconcileUrl = `${betterAuthUrl}/api/auth/reconcile/run`\n\n payload.logger.info('Triggering full reconcile from Payload onInit...')\n\n const response = await fetch(reconcileUrl, {\n headers: {\n 'Content-Type': 'application/json',\n 'x-reconcile-token': reconcileToken,\n },\n method: 'POST',\n })\n\n if (!response.ok) {\n throw new Error(`Reconcile request failed: ${response.status} ${response.statusText}`)\n }\n\n const result = await response.json()\n payload.logger.info('Full reconcile triggered successfully from Payload onInit', { result })\n } catch (error) {\n payload.logger.error('Failed to trigger full reconcile from Payload onInit', { error })\n // Don't throw - we don't want to prevent Payload from starting if reconcile fails\n }\n}\n"],"names":["triggerFullReconcile","payload","reconcileToken","process","env","RECONCILE_TOKEN","logger","warn","betterAuthUrl","BETTER_AUTH_URL","reconcileUrl","info","response","fetch","headers","method","ok","Error","status","statusText","result","json","error"],"mappings":"AAEA;;;CAGC,GACD,OAAO,eAAeA,qBAAqBC,OAAgB;IACzD,IAAI;QACF,MAAMC,iBAAiBC,QAAQC,GAAG,CAACC,eAAe;QAClD,IAAI,CAACH,gBAAgB;YACnBD,QAAQK,MAAM,CAACC,IAAI,CAAC;YACpB;QACF;QAEA,uCAAuC;QACvC,MAAMC,gBAAgBL,QAAQC,GAAG,CAACK,eAAe,IAAI;QACrD,MAAMC,eAAe,GAAGF,cAAc,uBAAuB,CAAC;QAE9DP,QAAQK,MAAM,CAACK,IAAI,CAAC;QAEpB,MAAMC,WAAW,MAAMC,MAAMH,cAAc;YACzCI,SAAS;gBACP,gBAAgB;gBAChB,qBAAqBZ;YACvB;YACAa,QAAQ;QACV;QAEA,IAAI,CAACH,SAASI,EAAE,EAAE;YAChB,MAAM,IAAIC,MAAM,CAAC,0BAA0B,EAAEL,SAASM,MAAM,CAAC,CAAC,EAAEN,SAASO,UAAU,EAAE;QACvF;QAEA,MAAMC,SAAS,MAAMR,SAASS,IAAI;QAClCpB,QAAQK,MAAM,CAACK,IAAI,CAAC,6DAA6D;YAAES;QAAO;IAC5F,EAAE,OAAOE,OAAO;QACdrB,QAAQK,MAAM,CAACgB,KAAK,CAAC,wDAAwD;YAAEA;QAAM;IACrF,kFAAkF;IACpF;AACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "payload-better-auth",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A blank template to get started with Payload 3.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./client": {
|
|
14
|
+
"import": "./dist/exports/client.js",
|
|
15
|
+
"types": "./dist/exports/client.d.ts",
|
|
16
|
+
"default": "./dist/exports/client.js"
|
|
17
|
+
},
|
|
18
|
+
"./rsc": {
|
|
19
|
+
"import": "./dist/exports/rsc.js",
|
|
20
|
+
"types": "./dist/exports/rsc.d.ts",
|
|
21
|
+
"default": "./dist/exports/rsc.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
31
|
+
"@payloadcms/db-mongodb": "^3.57.0",
|
|
32
|
+
"@payloadcms/db-postgres": "^3.57.0",
|
|
33
|
+
"@payloadcms/db-sqlite": "^3.57.0",
|
|
34
|
+
"@payloadcms/eslint-config": "^3.28.0",
|
|
35
|
+
"@payloadcms/next": "^3.57.0",
|
|
36
|
+
"@payloadcms/richtext-lexical": "^3.57.0",
|
|
37
|
+
"@payloadcms/ui": "^3.57.0",
|
|
38
|
+
"@playwright/test": "^1.55.1",
|
|
39
|
+
"@swc-node/register": "1.10.9",
|
|
40
|
+
"@swc/cli": "0.6.0",
|
|
41
|
+
"@types/node": "^22.18.6",
|
|
42
|
+
"@types/react": "19.1.8",
|
|
43
|
+
"@types/react-dom": "19.1.6",
|
|
44
|
+
"better-sqlite3": "^12.4.1",
|
|
45
|
+
"concurrently": "^9.2.1",
|
|
46
|
+
"copyfiles": "2.4.1",
|
|
47
|
+
"cross-env": "^7.0.3",
|
|
48
|
+
"dotenv-cli": "^10.0.0",
|
|
49
|
+
"eslint": "^9.36.0",
|
|
50
|
+
"eslint-config-next": "15.4.4",
|
|
51
|
+
"execa": "^9.6.0",
|
|
52
|
+
"graphql": "^16.11.0",
|
|
53
|
+
"mongodb-memory-server": "10.1.4",
|
|
54
|
+
"next": "15.4.4",
|
|
55
|
+
"open": "^10.2.0",
|
|
56
|
+
"payload": "^3.57.0",
|
|
57
|
+
"prettier": "^3.6.2",
|
|
58
|
+
"qs-esm": "7.0.2",
|
|
59
|
+
"react": "19.1.0",
|
|
60
|
+
"react-dom": "19.1.0",
|
|
61
|
+
"rimraf": "3.0.2",
|
|
62
|
+
"sharp": "0.34.2",
|
|
63
|
+
"sort-package-json": "^2.15.1",
|
|
64
|
+
"typescript": "5.7.3",
|
|
65
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
66
|
+
"vitest": "^3.2.4"
|
|
67
|
+
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"better-auth": "^1.4.0-beta.5",
|
|
70
|
+
"payload": "^3.37.0"
|
|
71
|
+
},
|
|
72
|
+
"engines": {
|
|
73
|
+
"node": "^18.20.2 || >=20.9.0",
|
|
74
|
+
"pnpm": "^9 || ^10"
|
|
75
|
+
},
|
|
76
|
+
"registry": "https://registry.npmjs.org/",
|
|
77
|
+
"scripts": {
|
|
78
|
+
"build": "pnpm copyfiles && pnpm build:types && pnpm build:swc",
|
|
79
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
|
80
|
+
"build:types": "tsc --outDir dist --rootDir ./src",
|
|
81
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
82
|
+
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
|
|
83
|
+
"dev": "next dev dev --turbo",
|
|
84
|
+
"dev:generate-importmap": "pnpm dev:payload generate:importmap",
|
|
85
|
+
"dev:generate-types": "pnpm dev:payload generate:types",
|
|
86
|
+
"dev:payload": "dotenv -e ./dev/.env -- cross-env PAYLOAD_CONFIG_PATH=./dev/payload.config.ts payload",
|
|
87
|
+
"generate:importmap": "pnpm dev:generate-importmap",
|
|
88
|
+
"generate:types": "pnpm dev:generate-types",
|
|
89
|
+
"lint": "eslint",
|
|
90
|
+
"lint:fix": "eslint ./src --fix",
|
|
91
|
+
"test": "pnpm test:int && pnpm test:e2e",
|
|
92
|
+
"test:e2e": "playwright test",
|
|
93
|
+
"test:int": "vitest",
|
|
94
|
+
"test:int-with-wait": "pnpm exec concurrently --success first -k -n \"dev,test\" \"pnpm run dev\" \"sh -lc 'until curl -fsS http://127.0.0.1:3000/admin >/dev/null; do sleep 0.25; done; pnpm run test:int'\""
|
|
95
|
+
}
|
|
96
|
+
}
|