@idealyst/cli 1.0.89 → 1.0.90
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/generators/index.js +3 -40
- package/dist/generators/index.js.map +1 -1
- package/dist/generators/init.js +273 -0
- package/dist/generators/init.js.map +1 -0
- package/dist/generators/utils.js +5 -0
- package/dist/generators/utils.js.map +1 -1
- package/dist/index.js +20 -202
- package/dist/index.js.map +1 -1
- package/dist/scripts/configure-react-native-monorepo.js +144 -0
- package/dist/scripts/configure-react-native-monorepo.js.map +1 -0
- package/dist/{templates/workspace → template}/README.md +66 -12
- package/dist/template/package.json +45 -0
- package/{templates → dist/template/packages}/api/package.json +3 -1
- package/{templates → dist/template/packages}/database/package.json +1 -1
- package/dist/{templates/native → template/packages/mobile}/babel.config.js +1 -0
- package/{templates/native → dist/template/packages/mobile}/metro.config.js +4 -4
- package/{templates/native → dist/template/packages/mobile}/package.json +5 -2
- package/{templates → dist/template/packages}/shared/package.json +2 -2
- package/{templates → dist/template/packages}/web/package.json +4 -1
- package/dist/types/generators/index.d.ts +1 -7
- package/dist/types/generators/init.d.ts +5 -0
- package/dist/types/scripts/configure-react-native-monorepo.d.ts +23 -0
- package/dist/types/types.d.ts +0 -4
- package/package.json +1 -1
- package/dist/generators/api.js +0 -31
- package/dist/generators/api.js.map +0 -1
- package/dist/generators/database.js +0 -31
- package/dist/generators/database.js.map +0 -1
- package/dist/generators/fullstack.js +0 -418
- package/dist/generators/fullstack.js.map +0 -1
- package/dist/generators/native.js +0 -112
- package/dist/generators/native.js.map +0 -1
- package/dist/generators/shared.js +0 -29
- package/dist/generators/shared.js.map +0 -1
- package/dist/generators/web.js +0 -45
- package/dist/generators/web.js.map +0 -1
- package/dist/generators/workspace.js +0 -83
- package/dist/generators/workspace.js.map +0 -1
- package/dist/templates/api/package.json +0 -54
- package/dist/templates/database/package.json +0 -49
- package/dist/templates/native/metro.config.js +0 -27
- package/dist/templates/native/package.json +0 -49
- package/dist/templates/native/src/App.tsx +0 -8
- package/dist/templates/shared/package.json +0 -62
- package/dist/templates/shared/src/components/App.tsx +0 -47
- package/dist/templates/shared/src/components/HelloWorld.tsx +0 -307
- package/dist/templates/shared/src/navigation/AppRouter.tsx +0 -98
- package/dist/templates/web/package.json +0 -66
- package/dist/templates/web/src/App.tsx +0 -14
- package/dist/templates/workspace/package.json +0 -35
- package/dist/types/generators/api.d.ts +0 -2
- package/dist/types/generators/database.d.ts +0 -2
- package/dist/types/generators/fullstack.d.ts +0 -2
- package/dist/types/generators/native.d.ts +0 -2
- package/dist/types/generators/shared.d.ts +0 -2
- package/dist/types/generators/web.d.ts +0 -2
- package/dist/types/generators/workspace.d.ts +0 -2
- package/templates/api/.env.example +0 -6
- package/templates/api/README.md +0 -274
- package/templates/api/__tests__/api.test.ts +0 -26
- package/templates/api/jest.config.js +0 -23
- package/templates/api/jest.setup.js +0 -9
- package/templates/api/src/context.ts +0 -19
- package/templates/api/src/controllers/TestController.ts +0 -0
- package/templates/api/src/index.ts +0 -9
- package/templates/api/src/lib/crud.ts +0 -150
- package/templates/api/src/lib/database.ts +0 -23
- package/templates/api/src/router/index.ts +0 -163
- package/templates/api/src/routers/test.ts +0 -59
- package/templates/api/src/routers/user.example.ts +0 -83
- package/templates/api/src/server.ts +0 -50
- package/templates/api/src/trpc.ts +0 -28
- package/templates/api/tsconfig.json +0 -43
- package/templates/database/README.md +0 -162
- package/templates/database/prisma/seed.ts +0 -64
- package/templates/database/schema.prisma +0 -107
- package/templates/database/src/index.ts +0 -15
- package/templates/database/src/validators.ts +0 -10
- package/templates/database/tsconfig.json +0 -18
- package/templates/native/README.md +0 -86
- package/templates/native/__tests__/App.test.tsx +0 -156
- package/templates/native/__tests__/components.test.tsx +0 -300
- package/templates/native/app.json +0 -5
- package/templates/native/babel.config.js +0 -10
- package/templates/native/index.js +0 -6
- package/templates/native/jest.config.js +0 -21
- package/templates/native/jest.setup.js +0 -12
- package/templates/native/src/App-with-trpc.tsx +0 -30
- package/templates/native/src/App.tsx +0 -8
- package/templates/native/src/utils/trpc.ts +0 -7
- package/templates/native/tsconfig.json +0 -28
- package/templates/shared/README.md +0 -135
- package/templates/shared/__tests__/shared.test.ts +0 -51
- package/templates/shared/jest.config.js +0 -22
- package/templates/shared/src/components/index.ts +0 -1
- package/templates/shared/src/index.ts +0 -14
- package/templates/shared/src/trpc/client.ts +0 -44
- package/templates/shared/tsconfig.json +0 -22
- package/templates/web/README.md +0 -131
- package/templates/web/__tests__/App.test.tsx +0 -342
- package/templates/web/__tests__/components.test.tsx +0 -564
- package/templates/web/index.html +0 -13
- package/templates/web/jest.config.js +0 -27
- package/templates/web/jest.setup.js +0 -24
- package/templates/web/src/App-with-trpc.tsx +0 -32
- package/templates/web/src/App.tsx +0 -14
- package/templates/web/src/components/TestDemo.tsx +0 -164
- package/templates/web/src/main.tsx +0 -25
- package/templates/web/src/utils/trpc.ts +0 -7
- package/templates/web/tsconfig.json +0 -26
- package/templates/web/vite.config.ts +0 -98
- package/templates/workspace/.devcontainer/Dockerfile +0 -26
- package/templates/workspace/.devcontainer/devcontainer.json +0 -113
- package/templates/workspace/.devcontainer/docker-compose.yml +0 -59
- package/templates/workspace/.devcontainer/figma-mcp.sh +0 -32
- package/templates/workspace/.devcontainer/setup.sh +0 -45
- package/templates/workspace/.dockerignore +0 -151
- package/templates/workspace/.env.example +0 -36
- package/templates/workspace/.env.production +0 -56
- package/templates/workspace/DOCKER.md +0 -0
- package/templates/workspace/Dockerfile +0 -111
- package/templates/workspace/README.md +0 -179
- package/templates/workspace/docker/nginx/prod.conf +0 -238
- package/templates/workspace/docker/nginx.conf +0 -131
- package/templates/workspace/docker/postgres/init.sql +0 -41
- package/templates/workspace/docker/prometheus/prometheus.yml +0 -52
- package/templates/workspace/docker-compose.prod.yml +0 -146
- package/templates/workspace/docker-compose.yml +0 -143
- package/templates/workspace/jest.config.js +0 -20
- package/templates/workspace/package.json +0 -38
- package/templates/workspace/setup.sh +0 -30
- package/templates/workspace/tsconfig.json +0 -31
- /package/dist/{templates/workspace → template}/.devcontainer/Dockerfile +0 -0
- /package/dist/{templates/workspace → template}/.devcontainer/devcontainer.json +0 -0
- /package/dist/{templates/workspace → template}/.devcontainer/docker-compose.yml +0 -0
- /package/dist/{templates/workspace → template}/.devcontainer/figma-mcp.sh +0 -0
- /package/dist/{templates/workspace → template}/.devcontainer/setup.sh +0 -0
- /package/dist/{templates/workspace → template}/.dockerignore +0 -0
- /package/dist/{templates/workspace → template}/.env.example +0 -0
- /package/dist/{templates/workspace → template}/DOCKER.md +0 -0
- /package/dist/{templates/workspace → template}/Dockerfile +0 -0
- /package/dist/{templates/workspace → template}/docker/nginx/prod.conf +0 -0
- /package/dist/{templates/workspace → template}/docker/nginx.conf +0 -0
- /package/dist/{templates/workspace → template}/docker/postgres/init.sql +0 -0
- /package/dist/{templates/workspace → template}/docker/prometheus/prometheus.yml +0 -0
- /package/dist/{templates/workspace → template}/docker-compose.prod.yml +0 -0
- /package/dist/{templates/workspace → template}/docker-compose.yml +0 -0
- /package/dist/{templates/workspace → template}/jest.config.js +0 -0
- /package/dist/{templates → template/packages}/api/.env.example +0 -0
- /package/dist/{templates → template/packages}/api/README.md +0 -0
- /package/dist/{templates → template/packages}/api/__tests__/api.test.ts +0 -0
- /package/dist/{templates → template/packages}/api/jest.config.js +0 -0
- /package/dist/{templates → template/packages}/api/jest.setup.js +0 -0
- /package/dist/{templates → template/packages}/api/src/context.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/controllers/TestController.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/index.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/lib/crud.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/lib/database.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/router/index.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/routers/test.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/routers/user.example.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/server.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/trpc.ts +0 -0
- /package/dist/{templates → template/packages}/api/tsconfig.json +0 -0
- /package/dist/{templates → template/packages}/database/README.md +0 -0
- /package/dist/{templates → template/packages}/database/prisma/seed.ts +0 -0
- /package/dist/{templates → template/packages}/database/schema.prisma +0 -0
- /package/dist/{templates → template/packages}/database/src/index.ts +0 -0
- /package/dist/{templates → template/packages}/database/src/validators.ts +0 -0
- /package/dist/{templates → template/packages}/database/tsconfig.json +0 -0
- /package/dist/{templates/native → template/packages/mobile}/README.md +0 -0
- /package/dist/{templates/native → template/packages/mobile}/__tests__/App.test.tsx +0 -0
- /package/dist/{templates/native → template/packages/mobile}/__tests__/components.test.tsx +0 -0
- /package/dist/{templates/native → template/packages/mobile}/app.json +0 -0
- /package/dist/{templates/native → template/packages/mobile}/index.js +0 -0
- /package/dist/{templates/native → template/packages/mobile}/jest.config.js +0 -0
- /package/dist/{templates/native → template/packages/mobile}/jest.setup.js +0 -0
- /package/dist/{templates/native → template/packages/mobile}/src/App-with-trpc-and-shared.tsx +0 -0
- /package/dist/{templates/native → template/packages/mobile}/src/App-with-trpc.tsx +0 -0
- /package/{templates/native/src/App-with-trpc-and-shared.tsx → dist/template/packages/mobile/src/App.tsx} +0 -0
- /package/dist/{templates/native → template/packages/mobile}/src/utils/trpc.ts +0 -0
- /package/dist/{templates/native → template/packages/mobile}/tsconfig.json +0 -0
- /package/dist/{templates → template/packages}/shared/README.md +0 -0
- /package/dist/{templates → template/packages}/shared/__tests__/shared.test.ts +0 -0
- /package/dist/{templates → template/packages}/shared/jest.config.js +0 -0
- /package/{templates → dist/template/packages}/shared/src/components/App.tsx +0 -0
- /package/{templates → dist/template/packages}/shared/src/components/HelloWorld.tsx +0 -0
- /package/dist/{templates → template/packages}/shared/src/components/index.ts +0 -0
- /package/dist/{templates → template/packages}/shared/src/index.ts +0 -0
- /package/{templates → dist/template/packages}/shared/src/navigation/AppRouter.tsx +0 -0
- /package/dist/{templates → template/packages}/shared/src/trpc/client.ts +0 -0
- /package/dist/{templates → template/packages}/shared/tsconfig.json +0 -0
- /package/dist/{templates → template/packages}/web/README.md +0 -0
- /package/dist/{templates → template/packages}/web/__tests__/App.test.tsx +0 -0
- /package/dist/{templates → template/packages}/web/__tests__/components.test.tsx +0 -0
- /package/dist/{templates → template/packages}/web/index.html +0 -0
- /package/dist/{templates → template/packages}/web/jest.config.js +0 -0
- /package/dist/{templates → template/packages}/web/jest.setup.js +0 -0
- /package/dist/{templates → template/packages}/web/src/App-with-trpc-and-shared.tsx +0 -0
- /package/dist/{templates → template/packages}/web/src/App-with-trpc.tsx +0 -0
- /package/{templates/web/src/App-with-trpc-and-shared.tsx → dist/template/packages/web/src/App.tsx} +0 -0
- /package/dist/{templates → template/packages}/web/src/components/TestDemo.tsx +0 -0
- /package/dist/{templates → template/packages}/web/src/main.tsx +0 -0
- /package/dist/{templates → template/packages}/web/src/utils/trpc.ts +0 -0
- /package/dist/{templates → template/packages}/web/tsconfig.json +0 -0
- /package/dist/{templates → template/packages}/web/vite.config.ts +0 -0
- /package/dist/{templates/workspace → template}/setup.sh +0 -0
- /package/dist/{templates/workspace → template}/tsconfig.json +0 -0
|
@@ -6,14 +6,14 @@ const { wrapWithReanimatedMetroConfig } = require('react-native-reanimated/metro
|
|
|
6
6
|
const config = {
|
|
7
7
|
projectRoot: __dirname,
|
|
8
8
|
watchFolders: [
|
|
9
|
-
// Add the workspace root to watch folders so Metro can
|
|
10
|
-
path.resolve(__dirname, '
|
|
9
|
+
// Add the workspace root to watch folders so Metro can find hoisted node_modules
|
|
10
|
+
path.resolve(__dirname, '../..'),
|
|
11
11
|
],
|
|
12
12
|
resolver: {
|
|
13
13
|
nodeModulesPaths: [
|
|
14
14
|
path.resolve(__dirname, 'node_modules'),
|
|
15
|
-
// Add the workspace root node_modules
|
|
16
|
-
path.resolve(__dirname, '
|
|
15
|
+
// Add the workspace root node_modules for hoisted packages
|
|
16
|
+
path.resolve(__dirname, '../..', 'node_modules'),
|
|
17
17
|
],
|
|
18
18
|
// Important for Idealyst to use .native extensions for React Native (eg: @idealyst/components/src/Button/Button.native.tsx)
|
|
19
19
|
sourceExts: ['native.tsx', 'native.ts', 'tsx', 'ts', 'native.jsx', 'native.js', 'jsx', 'js', 'json', 'cjs'],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{
|
|
2
|
+
"name": "@{{workspaceScope}}/mobile",
|
|
3
3
|
"version": "{{version}}",
|
|
4
4
|
"description": "{{description}}",
|
|
5
5
|
"private": true,
|
|
@@ -16,13 +16,16 @@
|
|
|
16
16
|
"@idealyst/components": "^{{idealystVersion}}",
|
|
17
17
|
"@idealyst/navigation": "^{{idealystVersion}}",
|
|
18
18
|
"@idealyst/theme": "^{{idealystVersion}}",
|
|
19
|
+
"@{{workspaceScope}}/shared": "workspace:*",
|
|
20
|
+
"@{{workspaceScope}}/database": "workspace:*",
|
|
19
21
|
"@tanstack/react-query": "^5.83.0",
|
|
20
22
|
"@trpc/client": "^11.5.1",
|
|
21
23
|
"@trpc/react-query": "^11.5.1",
|
|
22
24
|
"@trpc/server": "^11.5.1",
|
|
23
25
|
"react": "^18.2.0",
|
|
24
26
|
"react-native": "^0.73.0",
|
|
25
|
-
"react-native-svg": "^15.8.0"
|
|
27
|
+
"react-native-svg": "^15.8.0",
|
|
28
|
+
"react-native-worklets": "^0.6.1"
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
31
|
"@babel/core": "^7.20.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{
|
|
2
|
+
"name": "@{{workspaceScope}}/shared",
|
|
3
3
|
"version": "{{version}}",
|
|
4
4
|
"description": "{{description}}",
|
|
5
5
|
"main": "src/index.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@trpc/server": "^11.5.1",
|
|
29
29
|
"react": "^19.1.0",
|
|
30
30
|
"react-native": "^0.80.1",
|
|
31
|
-
"{{workspaceScope}}/api": "*"
|
|
31
|
+
"@{{workspaceScope}}/api": "*"
|
|
32
32
|
},
|
|
33
33
|
"peerDependenciesMeta": {
|
|
34
34
|
"react-native": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{
|
|
2
|
+
"name": "@{{workspaceScope}}/web",
|
|
3
3
|
"version": "{{version}}",
|
|
4
4
|
"description": "{{description}}",
|
|
5
5
|
"private": true,
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"@idealyst/components": "^{{idealystVersion}}",
|
|
17
17
|
"@idealyst/navigation": "^{{idealystVersion}}",
|
|
18
18
|
"@idealyst/theme": "^{{idealystVersion}}",
|
|
19
|
+
"@{{workspaceScope}}/shared": "workspace:*",
|
|
20
|
+
"@{{workspaceScope}}/database": "workspace:*",
|
|
21
|
+
"@{{workspaceScope}}/api": "workspace:*",
|
|
19
22
|
"@mdi/js": "^7.4.47",
|
|
20
23
|
"@mdi/react": "^1.6.1",
|
|
21
24
|
"@react-native/normalize-colors": "^0.80.1",
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import { GenerateProjectOptions } from '../types';
|
|
2
2
|
export declare function generateProject(options: GenerateProjectOptions): Promise<void>;
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './web';
|
|
5
|
-
export * from './shared';
|
|
6
|
-
export * from './workspace';
|
|
7
|
-
export * from './api';
|
|
8
|
-
export * from './database';
|
|
9
|
-
export * from './fullstack';
|
|
3
|
+
export * from './init';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configures React Native Android and iOS to work in a Yarn workspace monorepo
|
|
3
|
+
* with hoisted node_modules at the workspace root.
|
|
4
|
+
*
|
|
5
|
+
* Based on: https://www.callstack.com/blog/setting-up-react-native-monorepo-with-yarn-workspaces
|
|
6
|
+
*/
|
|
7
|
+
interface ConfigureOptions {
|
|
8
|
+
mobilePackagePath: string;
|
|
9
|
+
workspaceRoot: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Updates Android gradle files to use workspace root node_modules
|
|
13
|
+
*/
|
|
14
|
+
export declare function configureAndroid(options: ConfigureOptions): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Updates iOS Podfile to use workspace root node_modules
|
|
17
|
+
*/
|
|
18
|
+
export declare function configureIOS(options: ConfigureOptions): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Main function to configure both Android and iOS
|
|
21
|
+
*/
|
|
22
|
+
export declare function configureReactNativeMonorepo(mobilePackagePath: string, workspaceRoot: string): Promise<void>;
|
|
23
|
+
export {};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
export type ProjectType = 'native' | 'web' | 'shared' | 'workspace' | 'api' | 'database' | 'fullstack';
|
|
2
1
|
export interface GenerateProjectOptions {
|
|
3
2
|
name: string;
|
|
4
|
-
type: ProjectType;
|
|
5
3
|
directory: string;
|
|
6
4
|
skipInstall: boolean;
|
|
7
|
-
appName?: string;
|
|
8
|
-
withTrpc?: boolean;
|
|
9
5
|
figmaToken?: string;
|
|
10
6
|
}
|
|
11
7
|
export interface TemplateData {
|
package/package.json
CHANGED
package/dist/generators/api.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generateApiProject = generateApiProject;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const utils_1 = require("./utils");
|
|
9
|
-
async function generateApiProject(options) {
|
|
10
|
-
const { name, directory, skipInstall } = options;
|
|
11
|
-
if (!(0, utils_1.validateProjectName)(name)) {
|
|
12
|
-
throw new Error(`Invalid project name: ${name}`);
|
|
13
|
-
}
|
|
14
|
-
console.log(chalk_1.default.blue(`🚀 Creating API project: ${name}`));
|
|
15
|
-
const { projectPath, workspacePath, workspaceScope } = await (0, utils_1.resolveProjectPath)(name, directory);
|
|
16
|
-
const templatePath = (0, utils_1.getTemplatePath)('api');
|
|
17
|
-
const templateData = (0, utils_1.getTemplateData)(name, `API server template with tRPC and Express`, undefined, workspaceScope || undefined);
|
|
18
|
-
await (0, utils_1.copyTemplate)(templatePath, projectPath, templateData);
|
|
19
|
-
await (0, utils_1.installDependencies)(projectPath, skipInstall);
|
|
20
|
-
await (0, utils_1.updateWorkspacePackageJson)(workspacePath, directory);
|
|
21
|
-
console.log(chalk_1.default.green('✅ API project created successfully!'));
|
|
22
|
-
console.log(chalk_1.default.blue('📋 Project includes:'));
|
|
23
|
-
console.log(chalk_1.default.white(' • tRPC for type-safe APIs'));
|
|
24
|
-
console.log(chalk_1.default.white(' • Zod for schema validation'));
|
|
25
|
-
console.log(chalk_1.default.white(' • Express.js server'));
|
|
26
|
-
console.log(chalk_1.default.white(' • TypeScript configuration'));
|
|
27
|
-
console.log(chalk_1.default.white(' • CORS and middleware setup'));
|
|
28
|
-
console.log(chalk_1.default.white(' • Clean template ready for your endpoints'));
|
|
29
|
-
console.log(chalk_1.default.white(' • Example controllers and routing'));
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=api.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/generators/api.ts"],"names":[],"mappings":";;;;;AAKA,gDA2BC;AA/BD,kDAA0B;AAE1B,mCAAmK;AAE5J,KAAK,UAAU,kBAAkB,CAAC,OAA+B;IACtE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEjD,IAAI,CAAC,IAAA,2BAAmB,EAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC,CAAC;IAE5D,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,MAAM,IAAA,0BAAkB,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACjG,MAAM,YAAY,GAAG,IAAA,uBAAe,EAAC,KAAK,CAAC,CAAC;IAE5C,MAAM,YAAY,GAAG,IAAA,uBAAe,EAAC,IAAI,EAAE,2CAA2C,EAAE,SAAS,EAAE,cAAc,IAAI,SAAS,CAAC,CAAC;IAEhI,MAAM,IAAA,oBAAY,EAAC,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;IAC5D,MAAM,IAAA,2BAAmB,EAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACpD,MAAM,IAAA,kCAA0B,EAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAE3D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC,CAAC;IACxE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generateDatabaseProject = generateDatabaseProject;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const utils_1 = require("./utils");
|
|
9
|
-
async function generateDatabaseProject(options) {
|
|
10
|
-
const { name, directory, skipInstall } = options;
|
|
11
|
-
if (!(0, utils_1.validateProjectName)(name)) {
|
|
12
|
-
throw new Error(`Invalid project name: ${name}`);
|
|
13
|
-
}
|
|
14
|
-
console.log(chalk_1.default.blue(`🗄️ Creating Database project: ${name}`));
|
|
15
|
-
const { projectPath, workspacePath, workspaceScope } = await (0, utils_1.resolveProjectPath)(name, directory);
|
|
16
|
-
const templatePath = (0, utils_1.getTemplatePath)('database');
|
|
17
|
-
const templateData = (0, utils_1.getTemplateData)(name, `Database models and client library with Prisma`, undefined, workspaceScope || undefined);
|
|
18
|
-
await (0, utils_1.copyTemplate)(templatePath, projectPath, templateData);
|
|
19
|
-
await (0, utils_1.installDependencies)(projectPath, skipInstall);
|
|
20
|
-
await (0, utils_1.updateWorkspacePackageJson)(workspacePath, directory);
|
|
21
|
-
console.log(chalk_1.default.green('✅ Database project created successfully!'));
|
|
22
|
-
console.log(chalk_1.default.blue('📋 Project includes:'));
|
|
23
|
-
console.log(chalk_1.default.white(' • Prisma for database management'));
|
|
24
|
-
console.log(chalk_1.default.white(' • TypeScript configuration'));
|
|
25
|
-
console.log(chalk_1.default.white(' • Database migration scripts'));
|
|
26
|
-
console.log(chalk_1.default.white(' • Exportable client and models'));
|
|
27
|
-
console.log(chalk_1.default.white(' • Zod schemas for validation'));
|
|
28
|
-
console.log(chalk_1.default.white(' • Clean template ready for your models'));
|
|
29
|
-
console.log(chalk_1.default.white(' • Shared database types for client consumption'));
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=database.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/generators/database.ts"],"names":[],"mappings":";;;;;AAKA,0DA2BC;AA/BD,kDAA0B;AAE1B,mCAAmK;AAE5J,KAAK,UAAU,uBAAuB,CAAC,OAA+B;IAC3E,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEjD,IAAI,CAAC,IAAA,2BAAmB,EAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,kCAAkC,IAAI,EAAE,CAAC,CAAC,CAAC;IAElE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,MAAM,IAAA,0BAAkB,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACjG,MAAM,YAAY,GAAG,IAAA,uBAAe,EAAC,UAAU,CAAC,CAAC;IAEjD,MAAM,YAAY,GAAG,IAAA,uBAAe,EAAC,IAAI,EAAE,gDAAgD,EAAE,SAAS,EAAE,cAAc,IAAI,SAAS,CAAC,CAAC;IAErI,MAAM,IAAA,oBAAY,EAAC,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;IAC5D,MAAM,IAAA,2BAAmB,EAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACpD,MAAM,IAAA,kCAA0B,EAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAE3D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC;IAC/D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAC;IAC3D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAC;IAC3D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -1,418 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generateFullStackWorkspace = generateFullStackWorkspace;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
-
const child_process_1 = require("child_process");
|
|
11
|
-
const util_1 = require("util");
|
|
12
|
-
const utils_1 = require("./utils");
|
|
13
|
-
const database_1 = require("./database");
|
|
14
|
-
const api_1 = require("./api");
|
|
15
|
-
const web_1 = require("./web");
|
|
16
|
-
const native_1 = require("./native");
|
|
17
|
-
const shared_1 = require("./shared");
|
|
18
|
-
async function generateFullStackWorkspace(options) {
|
|
19
|
-
const { name, directory, skipInstall, figmaToken } = options;
|
|
20
|
-
if (!(0, utils_1.validateProjectName)(name)) {
|
|
21
|
-
throw new Error(`Invalid project name: ${name}`);
|
|
22
|
-
}
|
|
23
|
-
console.log(chalk_1.default.blue(`🚀 Creating Full-Stack Idealyst workspace: ${name}`));
|
|
24
|
-
console.log(chalk_1.default.gray(' This will generate a comhttps://open.spotify.com/track/0jVTol3hCYkU8NVVtMQjUS?si=f76828854a174463plete workspace with all packages integrated'));
|
|
25
|
-
const projectPath = path_1.default.join(directory, name);
|
|
26
|
-
const templatePath = (0, utils_1.getTemplatePath)('workspace');
|
|
27
|
-
const templateData = (0, utils_1.getTemplateData)(name, `Full-stack Idealyst Framework workspace`, undefined, name);
|
|
28
|
-
// Step 1: Create base workspace
|
|
29
|
-
console.log(chalk_1.default.blue('📦 Setting up workspace structure...'));
|
|
30
|
-
await (0, utils_1.copyTemplate)(templatePath, projectPath, templateData);
|
|
31
|
-
// Handle devcontainer setup
|
|
32
|
-
const devcontainerDir = path_1.default.join(projectPath, '.devcontainer');
|
|
33
|
-
const envPath = path_1.default.join(devcontainerDir, '.env');
|
|
34
|
-
const envContent = figmaToken
|
|
35
|
-
? `# Figma Integration\nFIGMA_ACCESS_TOKEN=${figmaToken.trim()}\n`
|
|
36
|
-
: `# Figma Integration\nFIGMA_ACCESS_TOKEN=\n`;
|
|
37
|
-
await require('fs-extra').writeFile(envPath, envContent);
|
|
38
|
-
// Step 2: Generate all packages with integration
|
|
39
|
-
console.log(chalk_1.default.blue('🗄️ Creating database package...'));
|
|
40
|
-
await (0, database_1.generateDatabaseProject)({
|
|
41
|
-
name: 'database',
|
|
42
|
-
type: 'database',
|
|
43
|
-
directory: projectPath,
|
|
44
|
-
skipInstall: true
|
|
45
|
-
});
|
|
46
|
-
console.log(chalk_1.default.blue('🚀 Creating API server...'));
|
|
47
|
-
await (0, api_1.generateApiProject)({
|
|
48
|
-
name: 'api',
|
|
49
|
-
type: 'api',
|
|
50
|
-
directory: projectPath,
|
|
51
|
-
skipInstall: true,
|
|
52
|
-
withTrpc: true
|
|
53
|
-
});
|
|
54
|
-
console.log(chalk_1.default.blue('📦 Creating shared components...'));
|
|
55
|
-
await (0, shared_1.generateSharedLibrary)({
|
|
56
|
-
name: 'shared',
|
|
57
|
-
type: 'shared',
|
|
58
|
-
directory: projectPath,
|
|
59
|
-
skipInstall: true
|
|
60
|
-
});
|
|
61
|
-
console.log(chalk_1.default.blue('🌐 Creating web application...'));
|
|
62
|
-
await (0, web_1.generateWebProject)({
|
|
63
|
-
name: 'web',
|
|
64
|
-
type: 'web',
|
|
65
|
-
directory: projectPath,
|
|
66
|
-
skipInstall: true,
|
|
67
|
-
withTrpc: true
|
|
68
|
-
});
|
|
69
|
-
console.log(chalk_1.default.blue('📱 Creating mobile application...'));
|
|
70
|
-
await (0, native_1.generateNativeProject)({
|
|
71
|
-
name: 'mobile',
|
|
72
|
-
type: 'native',
|
|
73
|
-
directory: projectPath,
|
|
74
|
-
skipInstall: true,
|
|
75
|
-
appName: templateData.appName || name,
|
|
76
|
-
withTrpc: true
|
|
77
|
-
});
|
|
78
|
-
// Step 3: Create integration files and update app files
|
|
79
|
-
console.log(chalk_1.default.blue('🔗 Setting up package integration...'));
|
|
80
|
-
await setupPackageIntegration(projectPath, templateData);
|
|
81
|
-
await updateAppFilesWithSharedComponents(projectPath, templateData);
|
|
82
|
-
// Step 4: Install dependencies
|
|
83
|
-
await (0, utils_1.installDependencies)(projectPath, skipInstall);
|
|
84
|
-
// Step 5: Generate database client
|
|
85
|
-
if (!skipInstall) {
|
|
86
|
-
console.log(chalk_1.default.blue('🗄️ Generating database client...'));
|
|
87
|
-
await generateDatabaseClient(projectPath, templateData);
|
|
88
|
-
}
|
|
89
|
-
console.log(chalk_1.default.green('✅ Full-stack workspace created successfully!'));
|
|
90
|
-
console.log(chalk_1.default.blue('📋 Your workspace includes:'));
|
|
91
|
-
console.log(chalk_1.default.white(' • 🗄️ Database package with Prisma'));
|
|
92
|
-
console.log(chalk_1.default.white(' • 🚀 API server with tRPC'));
|
|
93
|
-
console.log(chalk_1.default.white(' • 🌐 React web app'));
|
|
94
|
-
console.log(chalk_1.default.white(' • 📱 React Native mobile app'));
|
|
95
|
-
console.log(chalk_1.default.white(' • 📦 Shared component library'));
|
|
96
|
-
console.log(chalk_1.default.white(' • 🔗 All packages pre-integrated'));
|
|
97
|
-
console.log(chalk_1.default.white(' • 📊 Sample data and demo features'));
|
|
98
|
-
console.log('');
|
|
99
|
-
console.log(chalk_1.default.green('🚀 Quick start:'));
|
|
100
|
-
console.log(chalk_1.default.white(` cd ${name}`));
|
|
101
|
-
console.log(chalk_1.default.white(' yarn dev # Start all development servers'));
|
|
102
|
-
console.log(chalk_1.default.white(' yarn web # Start web app only'));
|
|
103
|
-
console.log(chalk_1.default.white(' yarn mobile # Start mobile app'));
|
|
104
|
-
console.log(chalk_1.default.white(' yarn api # Start API server only'));
|
|
105
|
-
console.log('');
|
|
106
|
-
console.log(chalk_1.default.gray('💡 Check README.md for detailed setup instructions'));
|
|
107
|
-
if (figmaToken) {
|
|
108
|
-
console.log(chalk_1.default.blue('🎨 Figma integration configured in .devcontainer/.env'));
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
console.log(chalk_1.default.gray('💡 Tip: Add Figma integration later by editing .devcontainer/.env'));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Generates the database client using Prisma
|
|
116
|
-
*/
|
|
117
|
-
async function generateDatabaseClient(projectPath, templateData) {
|
|
118
|
-
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
119
|
-
try {
|
|
120
|
-
console.log(chalk_1.default.gray(' Running db:generate to create Prisma client...'));
|
|
121
|
-
// Run the db:generate command in the project directory
|
|
122
|
-
const { stdout, stderr } = await execAsync('yarn db:generate', {
|
|
123
|
-
cwd: projectPath,
|
|
124
|
-
env: { ...process.env }
|
|
125
|
-
});
|
|
126
|
-
if (stderr && !stderr.includes('warning')) {
|
|
127
|
-
console.log(chalk_1.default.yellow(' Database generation warnings:'));
|
|
128
|
-
console.log(chalk_1.default.gray(` ${stderr.trim()}`));
|
|
129
|
-
}
|
|
130
|
-
console.log(chalk_1.default.green(' ✅ Database client generated successfully!'));
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
console.log(chalk_1.default.yellow(' ⚠️ Database client generation failed (this is normal on first setup)'));
|
|
134
|
-
console.log(chalk_1.default.gray(' You can run "yarn db:generate" manually after setting up your database'));
|
|
135
|
-
if (error.stdout) {
|
|
136
|
-
console.log(chalk_1.default.gray(` ${error.stdout.trim()}`));
|
|
137
|
-
}
|
|
138
|
-
if (error.stderr) {
|
|
139
|
-
console.log(chalk_1.default.gray(` ${error.stderr.trim()}`));
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Updates App files to use enhanced versions with shared components
|
|
145
|
-
*/
|
|
146
|
-
async function updateAppFilesWithSharedComponents(projectPath, templateData) {
|
|
147
|
-
const templateDir = (0, utils_1.getTemplatePath)('web');
|
|
148
|
-
// Update web App.tsx with enhanced version
|
|
149
|
-
const webAppSourcePath = path_1.default.join(templateDir, '..', 'web', 'src', 'App-with-trpc-and-shared.tsx');
|
|
150
|
-
const webAppTargetPath = path_1.default.join(projectPath, 'packages', 'web', 'src', 'App.tsx');
|
|
151
|
-
if (await fs_extra_1.default.pathExists(webAppSourcePath)) {
|
|
152
|
-
let webAppContent = await fs_extra_1.default.readFile(webAppSourcePath, 'utf8');
|
|
153
|
-
// Simple template variable replacement
|
|
154
|
-
webAppContent = webAppContent.replace(/\{\{workspaceScope\}\}/g, templateData.workspaceScope || templateData.projectName);
|
|
155
|
-
webAppContent = webAppContent.replace(/\{\{projectName\}\}/g, templateData.projectName);
|
|
156
|
-
webAppContent = webAppContent.replace(/\{\{appName\}\}/g, templateData.appName || templateData.projectName);
|
|
157
|
-
await fs_extra_1.default.writeFile(webAppTargetPath, webAppContent);
|
|
158
|
-
}
|
|
159
|
-
// Update API database.ts with workspace scope for client import
|
|
160
|
-
const databaseTsPath = path_1.default.join(projectPath, 'packages', 'api', 'src', 'lib', 'database.ts');
|
|
161
|
-
if (await fs_extra_1.default.pathExists(databaseTsPath)) {
|
|
162
|
-
let databaseContent = await fs_extra_1.default.readFile(databaseTsPath, 'utf8');
|
|
163
|
-
databaseContent = databaseContent.replace(/\{\{workspaceScope\}\}/g, templateData.workspaceScope || templateData.projectName);
|
|
164
|
-
await fs_extra_1.default.writeFile(databaseTsPath, databaseContent);
|
|
165
|
-
}
|
|
166
|
-
// Update web tRPC utils with workspace scope for API types
|
|
167
|
-
const webTrpcUtilsPath = path_1.default.join(projectPath, 'packages', 'web', 'src', 'utils', 'trpc.ts');
|
|
168
|
-
if (await fs_extra_1.default.pathExists(webTrpcUtilsPath)) {
|
|
169
|
-
let trpcContent = await fs_extra_1.default.readFile(webTrpcUtilsPath, 'utf8');
|
|
170
|
-
trpcContent = trpcContent.replace(/\{\{workspaceScope\}\}/g, templateData.workspaceScope || templateData.projectName);
|
|
171
|
-
await fs_extra_1.default.writeFile(webTrpcUtilsPath, trpcContent);
|
|
172
|
-
}
|
|
173
|
-
// Update mobile tRPC utils with workspace scope for API types
|
|
174
|
-
const mobileTrpcUtilsPath = path_1.default.join(projectPath, 'packages', 'mobile', 'src', 'utils', 'trpc.ts');
|
|
175
|
-
if (await fs_extra_1.default.pathExists(mobileTrpcUtilsPath)) {
|
|
176
|
-
let trpcContent = await fs_extra_1.default.readFile(mobileTrpcUtilsPath, 'utf8');
|
|
177
|
-
trpcContent = trpcContent.replace(/\{\{workspaceScope\}\}/g, templateData.workspaceScope || templateData.projectName);
|
|
178
|
-
await fs_extra_1.default.writeFile(mobileTrpcUtilsPath, trpcContent);
|
|
179
|
-
}
|
|
180
|
-
// Update package.json files to include shared dependencies
|
|
181
|
-
await updatePackageJsonWithSharedDeps(projectPath, templateData.workspaceScope || templateData.projectName);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Updates package.json files to include shared and database dependencies
|
|
185
|
-
*/
|
|
186
|
-
async function updatePackageJsonWithSharedDeps(projectPath, workspaceScope) {
|
|
187
|
-
// Update web package.json
|
|
188
|
-
const webPackageJsonPath = path_1.default.join(projectPath, 'packages', 'web', 'package.json');
|
|
189
|
-
if (await fs_extra_1.default.pathExists(webPackageJsonPath)) {
|
|
190
|
-
const webPackageJson = await fs_extra_1.default.readJSON(webPackageJsonPath);
|
|
191
|
-
webPackageJson.dependencies = {
|
|
192
|
-
...webPackageJson.dependencies,
|
|
193
|
-
[`@${workspaceScope}/shared`]: 'workspace:*',
|
|
194
|
-
[`@${workspaceScope}/database`]: 'workspace:*',
|
|
195
|
-
[`@${workspaceScope}/api`]: 'workspace:*'
|
|
196
|
-
};
|
|
197
|
-
await fs_extra_1.default.writeJSON(webPackageJsonPath, webPackageJson, { spaces: 2 });
|
|
198
|
-
}
|
|
199
|
-
// Update native package.json
|
|
200
|
-
const nativePackageJsonPath = path_1.default.join(projectPath, 'packages', 'mobile', 'package.json');
|
|
201
|
-
if (await fs_extra_1.default.pathExists(nativePackageJsonPath)) {
|
|
202
|
-
const nativePackageJson = await fs_extra_1.default.readJSON(nativePackageJsonPath);
|
|
203
|
-
nativePackageJson.dependencies = {
|
|
204
|
-
...nativePackageJson.dependencies,
|
|
205
|
-
[`@${workspaceScope}/shared`]: 'workspace:*',
|
|
206
|
-
[`@${workspaceScope}/database`]: 'workspace:*'
|
|
207
|
-
};
|
|
208
|
-
await fs_extra_1.default.writeJSON(nativePackageJsonPath, nativePackageJson, { spaces: 2 });
|
|
209
|
-
}
|
|
210
|
-
// Update API package.json
|
|
211
|
-
const apiPackageJsonPath = path_1.default.join(projectPath, 'packages', 'api', 'package.json');
|
|
212
|
-
if (await fs_extra_1.default.pathExists(apiPackageJsonPath)) {
|
|
213
|
-
const apiPackageJson = await fs_extra_1.default.readJSON(apiPackageJsonPath);
|
|
214
|
-
apiPackageJson.dependencies = {
|
|
215
|
-
...apiPackageJson.dependencies,
|
|
216
|
-
[`@${workspaceScope}/database`]: 'workspace:*',
|
|
217
|
-
[`@${workspaceScope}/shared`]: 'workspace:*'
|
|
218
|
-
};
|
|
219
|
-
await fs_extra_1.default.writeJSON(apiPackageJsonPath, apiPackageJson, { spaces: 2 });
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
async function setupPackageIntegration(workspacePath, templateData) {
|
|
223
|
-
const fs = require('fs-extra');
|
|
224
|
-
// Update workspace package.json with integrated scripts
|
|
225
|
-
const workspacePackageJsonPath = path_1.default.join(workspacePath, 'package.json');
|
|
226
|
-
const workspacePackageJson = await fs.readJSON(workspacePackageJsonPath);
|
|
227
|
-
workspacePackageJson.scripts = {
|
|
228
|
-
...workspacePackageJson.scripts,
|
|
229
|
-
"dev": "concurrently \"yarn api:dev\" \"yarn web:dev\" \"yarn mobile:start\"",
|
|
230
|
-
"build": "yarn build:packages && yarn api:build && yarn web:build",
|
|
231
|
-
"build:packages": `yarn workspace @${templateData.workspaceScope}/database build && yarn workspace @${templateData.workspaceScope}/shared build`,
|
|
232
|
-
"api:dev": `yarn workspace @${templateData.workspaceScope}/api dev`,
|
|
233
|
-
"api:build": `yarn workspace @${templateData.workspaceScope}/api build`,
|
|
234
|
-
"web:dev": `yarn workspace @${templateData.workspaceScope}/web dev`,
|
|
235
|
-
"web:build": `yarn workspace @${templateData.workspaceScope}/web build`,
|
|
236
|
-
"mobile:start": `yarn workspace @${templateData.workspaceScope}/mobile start`,
|
|
237
|
-
"mobile:android": `yarn workspace @${templateData.workspaceScope}/mobile android`,
|
|
238
|
-
"mobile:ios": `yarn workspace @${templateData.workspaceScope}/mobile ios`,
|
|
239
|
-
"db:generate": `yarn workspace @${templateData.workspaceScope}/database db:generate`,
|
|
240
|
-
"db:push": `yarn workspace @${templateData.workspaceScope}/database db:push`,
|
|
241
|
-
"db:migrate": `yarn workspace @${templateData.workspaceScope}/database db:migrate`,
|
|
242
|
-
"db:studio": `yarn workspace @${templateData.workspaceScope}/database db:studio`,
|
|
243
|
-
"test": "yarn workspaces run test",
|
|
244
|
-
"type-check": "yarn workspaces run type-check"
|
|
245
|
-
};
|
|
246
|
-
// Add development dependencies for the workspace
|
|
247
|
-
workspacePackageJson.devDependencies = {
|
|
248
|
-
...workspacePackageJson.devDependencies,
|
|
249
|
-
"concurrently": "^8.2.2"
|
|
250
|
-
};
|
|
251
|
-
await fs.writeJSON(workspacePackageJsonPath, workspacePackageJson, { spaces: 2 });
|
|
252
|
-
// Create integrated README with quick start guide
|
|
253
|
-
await createIntegratedReadme(workspacePath, templateData);
|
|
254
|
-
}
|
|
255
|
-
async function createIntegratedReadme(workspacePath, templateData) {
|
|
256
|
-
const fs = require('fs-extra');
|
|
257
|
-
const readmePath = path_1.default.join(workspacePath, 'README.md');
|
|
258
|
-
const readmeContent = `# ${templateData.projectName}
|
|
259
|
-
|
|
260
|
-
A full-stack application built with the Idealyst Framework.
|
|
261
|
-
|
|
262
|
-
## 🏗️ Architecture
|
|
263
|
-
|
|
264
|
-
This workspace contains a complete full-stack application with:
|
|
265
|
-
|
|
266
|
-
- **📱 Mobile App** (\`packages/mobile\`) - React Native app with Idealyst components
|
|
267
|
-
- **🌐 Web App** (\`packages/web\`) - React web app with Idealyst components
|
|
268
|
-
- **🚀 API Server** (\`packages/api\`) - tRPC API server with Express
|
|
269
|
-
- **🗄️ Database** (\`packages/database\`) - Prisma database layer with PostgreSQL
|
|
270
|
-
- **📦 Shared** (\`packages/shared\`) - Cross-platform shared components and utilities
|
|
271
|
-
|
|
272
|
-
All packages are pre-integrated and work together seamlessly.
|
|
273
|
-
|
|
274
|
-
## 🚀 Quick Start
|
|
275
|
-
|
|
276
|
-
### Prerequisites
|
|
277
|
-
- Node.js 18+
|
|
278
|
-
- Yarn 3+
|
|
279
|
-
- PostgreSQL (or use Docker)
|
|
280
|
-
|
|
281
|
-
### Setup
|
|
282
|
-
\`\`\`bash
|
|
283
|
-
# Install dependencies
|
|
284
|
-
yarn install
|
|
285
|
-
|
|
286
|
-
# Set up environment variables
|
|
287
|
-
cp packages/api/.env.example packages/api/.env
|
|
288
|
-
cp packages/database/.env.example packages/database/.env
|
|
289
|
-
# Edit .env files with your database URL
|
|
290
|
-
|
|
291
|
-
# Generate database client
|
|
292
|
-
yarn db:generate
|
|
293
|
-
|
|
294
|
-
# Push database schema
|
|
295
|
-
yarn db:push
|
|
296
|
-
|
|
297
|
-
# Start all development servers
|
|
298
|
-
yarn dev
|
|
299
|
-
\`\`\`
|
|
300
|
-
|
|
301
|
-
This will start:
|
|
302
|
-
- 🌐 Web app at http://localhost:5173
|
|
303
|
-
- 🚀 API server at http://localhost:3000
|
|
304
|
-
- 📱 Mobile app (Metro bundler)
|
|
305
|
-
|
|
306
|
-
### Individual Commands
|
|
307
|
-
|
|
308
|
-
\`\`\`bash
|
|
309
|
-
# Web development
|
|
310
|
-
yarn web:dev # Start web app
|
|
311
|
-
yarn web:build # Build web app
|
|
312
|
-
|
|
313
|
-
# Mobile development
|
|
314
|
-
yarn mobile:start # Start Metro bundler
|
|
315
|
-
yarn mobile:android # Run on Android
|
|
316
|
-
yarn mobile:ios # Run on iOS
|
|
317
|
-
|
|
318
|
-
# API development
|
|
319
|
-
yarn api:dev # Start API server
|
|
320
|
-
yarn api:build # Build API server
|
|
321
|
-
|
|
322
|
-
# Database management
|
|
323
|
-
yarn db:generate # Generate Prisma client
|
|
324
|
-
yarn db:push # Push schema to database
|
|
325
|
-
yarn db:migrate # Create migrations
|
|
326
|
-
yarn db:studio # Open Prisma Studio
|
|
327
|
-
|
|
328
|
-
# Build all packages
|
|
329
|
-
yarn build # Build everything
|
|
330
|
-
yarn build:packages # Build shared packages only
|
|
331
|
-
|
|
332
|
-
# Testing
|
|
333
|
-
yarn test # Run all tests
|
|
334
|
-
yarn type-check # Type check all packages
|
|
335
|
-
\`\`\`
|
|
336
|
-
|
|
337
|
-
## 📱 Demo Features
|
|
338
|
-
|
|
339
|
-
The generated application includes working demo features:
|
|
340
|
-
|
|
341
|
-
### User Management
|
|
342
|
-
- User registration and authentication
|
|
343
|
-
- User profiles with avatars
|
|
344
|
-
- User listings and search
|
|
345
|
-
|
|
346
|
-
### Real-time Features
|
|
347
|
-
- Live chat/messaging
|
|
348
|
-
- Real-time notifications
|
|
349
|
-
- Live user presence
|
|
350
|
-
|
|
351
|
-
### Data Flow
|
|
352
|
-
- **Mobile/Web** → **API** → **Database**
|
|
353
|
-
- Shared types and validation across all layers
|
|
354
|
-
- Real-time updates via tRPC subscriptions
|
|
355
|
-
|
|
356
|
-
## 🔧 Development
|
|
357
|
-
|
|
358
|
-
### Adding New Features
|
|
359
|
-
|
|
360
|
-
1. **Database Changes**: Update \`packages/database/prisma/schema.prisma\`
|
|
361
|
-
2. **API Endpoints**: Add routes in \`packages/api/src/routers/\`
|
|
362
|
-
3. **Shared Types**: Add to \`packages/shared/src/\`
|
|
363
|
-
4. **UI Components**: Update \`packages/web/src/\` and \`packages/mobile/src/\`
|
|
364
|
-
|
|
365
|
-
### Package Structure
|
|
366
|
-
|
|
367
|
-
\`\`\`
|
|
368
|
-
${templateData.projectName}/
|
|
369
|
-
├── packages/
|
|
370
|
-
│ ├── api/ # tRPC API server
|
|
371
|
-
│ ├── database/ # Prisma database layer
|
|
372
|
-
│ ├── mobile/ # React Native app
|
|
373
|
-
│ ├── shared/ # Shared components/utils
|
|
374
|
-
│ └── web/ # React web app
|
|
375
|
-
├── package.json # Workspace configuration
|
|
376
|
-
├── docker-compose.yml # Database services
|
|
377
|
-
└── README.md # This file
|
|
378
|
-
\`\`\`
|
|
379
|
-
|
|
380
|
-
## 🔗 Package Integration
|
|
381
|
-
|
|
382
|
-
All packages are properly integrated:
|
|
383
|
-
|
|
384
|
-
- **Database**: Exports typed Prisma client and schemas
|
|
385
|
-
- **API**: Imports database client, exports tRPC router
|
|
386
|
-
- **Shared**: Cross-platform components used by web/mobile
|
|
387
|
-
- **Web/Mobile**: Import shared components and API client
|
|
388
|
-
|
|
389
|
-
### Type Safety
|
|
390
|
-
|
|
391
|
-
Full end-to-end type safety:
|
|
392
|
-
- Database schema → Generated Prisma types
|
|
393
|
-
- API routes → Generated tRPC types
|
|
394
|
-
- Frontend → Typed API client calls
|
|
395
|
-
- Shared components → Typed props
|
|
396
|
-
|
|
397
|
-
## 📚 Documentation
|
|
398
|
-
|
|
399
|
-
- [Idealyst Framework](https://github.com/IdealystIO/idealyst-framework)
|
|
400
|
-
- [Prisma Docs](https://www.prisma.io/docs)
|
|
401
|
-
- [tRPC Docs](https://trpc.io)
|
|
402
|
-
- [React Native Docs](https://reactnative.dev)
|
|
403
|
-
|
|
404
|
-
## 🤝 Contributing
|
|
405
|
-
|
|
406
|
-
1. Fork the repository
|
|
407
|
-
2. Create a feature branch
|
|
408
|
-
3. Make your changes
|
|
409
|
-
4. Add tests
|
|
410
|
-
5. Submit a pull request
|
|
411
|
-
|
|
412
|
-
## 📄 License
|
|
413
|
-
|
|
414
|
-
MIT License - see LICENSE file for details.
|
|
415
|
-
`;
|
|
416
|
-
await fs.writeFile(readmePath, readmeContent);
|
|
417
|
-
}
|
|
418
|
-
//# sourceMappingURL=fullstack.js.map
|