anhedral 0.1.8 → 0.1.9
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/dist/dependencies.js
CHANGED
|
@@ -49,17 +49,17 @@ export const CONTRACTS_DEPENDENCIES = {
|
|
|
49
49
|
};
|
|
50
50
|
export const API_CLIENT_DEPENDENCIES = {
|
|
51
51
|
dependencies: {
|
|
52
|
-
'@
|
|
53
|
-
'@
|
|
54
|
-
'@
|
|
52
|
+
'@shared/config': 'workspace:*',
|
|
53
|
+
'@shared/contracts': 'workspace:*',
|
|
54
|
+
'@shared/types': 'workspace:*',
|
|
55
55
|
zod: CONTRACTS_DEPENDENCIES.dependencies.zod,
|
|
56
56
|
},
|
|
57
57
|
...SHARED_PACKAGE_DEPENDENCIES,
|
|
58
58
|
};
|
|
59
59
|
export const BACKEND_DEPENDENCIES = {
|
|
60
60
|
dependencies: {
|
|
61
|
-
'@
|
|
62
|
-
'@
|
|
61
|
+
'@shared/contracts': 'workspace:*',
|
|
62
|
+
'@shared/db': 'workspace:*',
|
|
63
63
|
// renovate: datasource=npm depName=fastify
|
|
64
64
|
fastify: '5.6.2',
|
|
65
65
|
// renovate: datasource=npm depName=fastify-plugin
|
|
@@ -116,7 +116,7 @@ export const BACKEND_DEPENDENCIES = {
|
|
|
116
116
|
};
|
|
117
117
|
export const EXTENSION_DEPENDENCIES = {
|
|
118
118
|
dependencies: {
|
|
119
|
-
'@
|
|
119
|
+
'@shared/api-client': 'workspace:*',
|
|
120
120
|
// renovate: datasource=npm depName=@clerk/chrome-extension
|
|
121
121
|
'@clerk/chrome-extension': '3.1.25',
|
|
122
122
|
// renovate: datasource=npm depName=react
|
|
@@ -152,7 +152,7 @@ export const EXTENSION_DEPENDENCIES = {
|
|
|
152
152
|
},
|
|
153
153
|
};
|
|
154
154
|
export const FRONTEND_ADDON_DEPENDENCIES = {
|
|
155
|
-
'@
|
|
155
|
+
'@shared/api-client': 'workspace:*',
|
|
156
156
|
// renovate: datasource=npm depName=@clerk/expo
|
|
157
157
|
'@clerk/expo': '3.2.11',
|
|
158
158
|
// renovate: datasource=npm depName=react-native-purchases
|
package/dist/scaffold.js
CHANGED
|
@@ -496,7 +496,7 @@ function writeStackFile(root, stack) {
|
|
|
496
496
|
function writeSharedPackages(root) {
|
|
497
497
|
const dbRoot = path.join(root, 'packages/db');
|
|
498
498
|
writeFile(path.join(dbRoot, 'package.json'), JSON.stringify({
|
|
499
|
-
name: '@
|
|
499
|
+
name: '@shared/db',
|
|
500
500
|
version: '0.1.0',
|
|
501
501
|
private: true,
|
|
502
502
|
type: 'module',
|
|
@@ -872,7 +872,7 @@ export type StorageFileResponse = z.infer<typeof StorageFileResponseSchema>;
|
|
|
872
872
|
`],
|
|
873
873
|
['types', {
|
|
874
874
|
exports: { '.': './src/index.ts' },
|
|
875
|
-
dependencies: { '@
|
|
875
|
+
dependencies: { '@shared/contracts': 'workspace:*' },
|
|
876
876
|
}, `export type ApiEnvelope<T> = { data: T } | { error: string; message: string };
|
|
877
877
|
export type {
|
|
878
878
|
AuthMeResponse,
|
|
@@ -883,7 +883,7 @@ export type {
|
|
|
883
883
|
SignOutResponse,
|
|
884
884
|
StorageFileResponse,
|
|
885
885
|
SubscriptionEntitlements,
|
|
886
|
-
} from '@
|
|
886
|
+
} from '@shared/contracts';
|
|
887
887
|
`],
|
|
888
888
|
['config', { exports: { '.': './src/index.ts' } }, `export const DEFAULT_API_PATH_PREFIX = '/api';
|
|
889
889
|
export const DEFAULT_LOCAL_API_URL = 'http://localhost:8787';
|
|
@@ -900,7 +900,7 @@ export function joinApiUrl(baseUrl: string, path: string) {
|
|
|
900
900
|
exports: { '.': './src/index.ts' },
|
|
901
901
|
dependencies: API_CLIENT_DEPENDENCIES.dependencies,
|
|
902
902
|
}, `import type { ZodType } from 'zod';
|
|
903
|
-
import { joinApiUrl } from '@
|
|
903
|
+
import { joinApiUrl } from '@shared/config';
|
|
904
904
|
import {
|
|
905
905
|
AuthMeResponseSchema,
|
|
906
906
|
CreateUploadResponseSchema,
|
|
@@ -916,7 +916,7 @@ import {
|
|
|
916
916
|
type SignOutResponse,
|
|
917
917
|
type StorageFileResponse,
|
|
918
918
|
type SubscriptionEntitlements,
|
|
919
|
-
} from '@
|
|
919
|
+
} from '@shared/contracts';
|
|
920
920
|
|
|
921
921
|
export class APIRequestError extends Error {
|
|
922
922
|
constructor(
|
|
@@ -1025,7 +1025,7 @@ export class ApiClient {
|
|
|
1025
1025
|
for (const [name, packageFields, source] of simplePackages) {
|
|
1026
1026
|
const packageRoot = path.join(root, `packages/${name}`);
|
|
1027
1027
|
writeFile(path.join(packageRoot, 'package.json'), JSON.stringify({
|
|
1028
|
-
name: `@
|
|
1028
|
+
name: `@shared/${name}`,
|
|
1029
1029
|
version: '0.1.0',
|
|
1030
1030
|
private: true,
|
|
1031
1031
|
type: 'module',
|
|
@@ -1174,10 +1174,10 @@ function writeFullstackRootFiles(root, options) {
|
|
|
1174
1174
|
'verify:frontend': 'pnpm --filter ./Frontend exec expo install --check && pnpm --filter ./Frontend build:web',
|
|
1175
1175
|
'verify:backend': 'pnpm --filter ./Backend test && pnpm --filter ./Backend build',
|
|
1176
1176
|
'verify:extension': 'pnpm --filter ./Extension typecheck && pnpm --filter ./Extension zip',
|
|
1177
|
-
'db:generate': 'pnpm --filter @
|
|
1178
|
-
'db:migrate': 'pnpm --filter @
|
|
1179
|
-
'db:studio': 'pnpm --filter @
|
|
1180
|
-
'db:check': 'pnpm --filter @
|
|
1177
|
+
'db:generate': 'pnpm --filter @shared/db db:generate',
|
|
1178
|
+
'db:migrate': 'pnpm --filter @shared/db db:migrate',
|
|
1179
|
+
'db:studio': 'pnpm --filter @shared/db db:studio',
|
|
1180
|
+
'db:check': 'pnpm --filter @shared/db db:check',
|
|
1181
1181
|
};
|
|
1182
1182
|
scripts['dev:frontend'] = 'pnpm --filter ./Frontend dev';
|
|
1183
1183
|
scripts['dev:extension'] = 'pnpm --filter ./Extension dev';
|
|
@@ -1222,7 +1222,7 @@ async function scaffoldFullstack(root, options) {
|
|
|
1222
1222
|
writeFullstackRootFiles(root, options);
|
|
1223
1223
|
anhedralPrint.done('Root config written');
|
|
1224
1224
|
anhedralPrint.section('Shared packages');
|
|
1225
|
-
anhedralPrint.step('Writing @
|
|
1225
|
+
anhedralPrint.step('Writing @shared/db, types, config, api-client');
|
|
1226
1226
|
writeSharedPackages(root);
|
|
1227
1227
|
anhedralPrint.done('Shared packages written');
|
|
1228
1228
|
const frontendUrl = 'http://localhost:8081';
|
|
@@ -52,7 +52,7 @@ function writePackageJson(dir, projectName) {
|
|
|
52
52
|
build: 'pnpm typecheck',
|
|
53
53
|
typecheck: 'tsc --noEmit',
|
|
54
54
|
'db:generate': 'drizzle-kit generate',
|
|
55
|
-
'db:migrate': 'pnpm --filter @
|
|
55
|
+
'db:migrate': 'pnpm --filter @shared/db db:migrate',
|
|
56
56
|
'db:studio': 'drizzle-kit studio',
|
|
57
57
|
'db:check': 'drizzle-kit check',
|
|
58
58
|
'db:push': 'drizzle-kit push',
|
|
@@ -274,12 +274,12 @@ export {};
|
|
|
274
274
|
// Database
|
|
275
275
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
276
276
|
function writeDbFiles(dir) {
|
|
277
|
-
writeFile(path.join(dir, 'src/db/index.ts'), `export { db } from '@
|
|
278
|
-
export type { Database } from '@
|
|
277
|
+
writeFile(path.join(dir, 'src/db/index.ts'), `export { db } from '@shared/db';
|
|
278
|
+
export type { Database } from '@shared/db';
|
|
279
279
|
`);
|
|
280
|
-
writeFile(path.join(dir, 'src/db/schema.ts'), `export * from '@
|
|
280
|
+
writeFile(path.join(dir, 'src/db/schema.ts'), `export * from '@shared/db/schema';
|
|
281
281
|
`);
|
|
282
|
-
writeFile(path.join(dir, 'src/db/migrate.ts'), `import '@
|
|
282
|
+
writeFile(path.join(dir, 'src/db/migrate.ts'), `import '@shared/db/migrate';
|
|
283
283
|
`);
|
|
284
284
|
}
|
|
285
285
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -1843,7 +1843,7 @@ export default subscriptionRoutes;
|
|
|
1843
1843
|
`);
|
|
1844
1844
|
writeFile(path.join(dir, 'src/routes/storage.ts'), `import crypto from 'node:crypto';
|
|
1845
1845
|
import type { FastifyInstance, FastifyPluginAsync } from 'fastify';
|
|
1846
|
-
import { CreateUploadRequestSchema } from '@
|
|
1846
|
+
import { CreateUploadRequestSchema } from '@shared/contracts';
|
|
1847
1847
|
import { AuthError, ServerError, ValidationError } from '../errors/index.js';
|
|
1848
1848
|
import { createAuthHook } from '../lib/routeHelpers.js';
|
|
1849
1849
|
import { createSignedDownloadUrl, createSignedUploadUrl, deleteObjectFromR2, isR2Configured } from '../lib/r2.js';
|
|
@@ -452,7 +452,7 @@ export { WEBSITE_URL };
|
|
|
452
452
|
`);
|
|
453
453
|
}
|
|
454
454
|
function writeApiClient(dir) {
|
|
455
|
-
writeFile(path.join(dir, 'src/lib/api.ts'), `import { ApiClient } from '@
|
|
455
|
+
writeFile(path.join(dir, 'src/lib/api.ts'), `import { ApiClient } from '@shared/api-client';
|
|
456
456
|
|
|
457
457
|
export class APIClient {
|
|
458
458
|
constructor(private getToken: () => Promise<string | null>) {}
|
|
@@ -61,7 +61,7 @@ function patchFrontendPackageJson(dir) {
|
|
|
61
61
|
const packageJson = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
62
62
|
packageJson.dependencies = {
|
|
63
63
|
...(packageJson.dependencies ?? {}),
|
|
64
|
-
'@
|
|
64
|
+
'@shared/api-client': FRONTEND_ADDON_DEPENDENCIES['@shared/api-client'],
|
|
65
65
|
'@clerk/expo': FRONTEND_ADDON_DEPENDENCIES['@clerk/expo'],
|
|
66
66
|
'react-native-purchases': FRONTEND_ADDON_DEPENDENCIES['react-native-purchases'],
|
|
67
67
|
'react-native-purchases-ui': FRONTEND_ADDON_DEPENDENCIES['react-native-purchases-ui'],
|
|
@@ -113,7 +113,7 @@ function patchExpoAppConfig(dir) {
|
|
|
113
113
|
writeFile(filePath, JSON.stringify(appJson, null, 2) + '\n');
|
|
114
114
|
}
|
|
115
115
|
function writeApiClient(dir) {
|
|
116
|
-
writeFile(path.join(dir, 'api/client.ts'), `import { ApiClient, APIRequestError } from '@
|
|
116
|
+
writeFile(path.join(dir, 'api/client.ts'), `import { ApiClient, APIRequestError } from '@shared/api-client';
|
|
117
117
|
|
|
118
118
|
export class APIClient extends ApiClient {
|
|
119
119
|
constructor(baseUrl: string, getToken: () => Promise<string | null>) {
|