@solidxai/solidctl 0.0.1
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 +98 -0
- package/dist/app.module.d.ts +2 -0
- package/dist/app.module.js +17 -0
- package/dist/app.module.js.map +1 -0
- package/dist/commands/build.command.d.ts +2 -0
- package/dist/commands/build.command.js +139 -0
- package/dist/commands/build.command.js.map +1 -0
- package/dist/commands/create-app/create-app.command.d.ts +2 -0
- package/dist/commands/create-app/create-app.command.js +71 -0
- package/dist/commands/create-app/create-app.command.js.map +1 -0
- package/dist/commands/create-app/helpers.d.ts +59 -0
- package/dist/commands/create-app/helpers.js +219 -0
- package/dist/commands/create-app/helpers.js.map +1 -0
- package/dist/commands/create-app/setup-questions.d.ts +31 -0
- package/dist/commands/create-app/setup-questions.js +70 -0
- package/dist/commands/create-app/setup-questions.js.map +1 -0
- package/dist/commands/info.command.d.ts +2 -0
- package/dist/commands/info.command.js +40 -0
- package/dist/commands/info.command.js.map +1 -0
- package/dist/commands/local-upgrade.command.d.ts +2 -0
- package/dist/commands/local-upgrade.command.js +94 -0
- package/dist/commands/local-upgrade.command.js.map +1 -0
- package/dist/commands/release.command.d.ts +2 -0
- package/dist/commands/release.command.js +181 -0
- package/dist/commands/release.command.js.map +1 -0
- package/dist/commands/seed.command.d.ts +2 -0
- package/dist/commands/seed.command.js +40 -0
- package/dist/commands/seed.command.js.map +1 -0
- package/dist/commands/test-data.command.d.ts +2 -0
- package/dist/commands/test-data.command.js +38 -0
- package/dist/commands/test-data.command.js.map +1 -0
- package/dist/commands/upgrade.command.d.ts +2 -0
- package/dist/commands/upgrade.command.js +48 -0
- package/dist/commands/upgrade.command.js.map +1 -0
- package/dist/helper.d.ts +1 -0
- package/dist/helper.js +19 -0
- package/dist/helper.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +34 -0
- package/dist/main.js.map +1 -0
- package/dist/shims/solid-shim.js +23 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +99 -0
- package/templates/dot-templates/dot.vscode.template/launch.json +35 -0
- package/templates/nest-template/README.md +73 -0
- package/templates/nest-template/bin/solid +2 -0
- package/templates/nest-template/dot-templates/dot.dockerignore.template +1 -0
- package/templates/nest-template/dot-templates/dot.eslintrc.template.js +25 -0
- package/templates/nest-template/dot-templates/dot.gitignore.template +56 -0
- package/templates/nest-template/dot-templates/dot.prettierrc.template +4 -0
- package/templates/nest-template/nest-cli.json +8 -0
- package/templates/nest-template/nodemon.json +13 -0
- package/templates/nest-template/package.json +132 -0
- package/templates/nest-template/src/app-default-database.module.ts +75 -0
- package/templates/nest-template/src/app.controller.spec.ts +22 -0
- package/templates/nest-template/src/app.module.ts +51 -0
- package/templates/nest-template/src/app.service.ts +32 -0
- package/templates/nest-template/src/database.utils.ts +18 -0
- package/templates/nest-template/src/main-cli.ts +81 -0
- package/templates/nest-template/src/main.ts +116 -0
- package/templates/nest-template/test/app.e2e-spec.ts +24 -0
- package/templates/nest-template/test/jest-e2e.json +9 -0
- package/templates/nest-template/tsconfig.build.json +4 -0
- package/templates/nest-template/tsconfig.json +22 -0
- package/templates/next-template/README.md +36 -0
- package/templates/next-template/app/GlobalProvider.tsx +23 -0
- package/templates/next-template/app/admin/core/[moduleName]/[modelName]/form/[id]/page.tsx +19 -0
- package/templates/next-template/app/admin/core/[moduleName]/[modelName]/kanban/page.tsx +18 -0
- package/templates/next-template/app/admin/core/[moduleName]/[modelName]/list/page.tsx +18 -0
- package/templates/next-template/app/admin/core/[moduleName]/home/page.tsx +15 -0
- package/templates/next-template/app/admin/core/[moduleName]/settings/[settings]/page.tsx +11 -0
- package/templates/next-template/app/admin/layout.tsx +11 -0
- package/templates/next-template/app/admin/loading.tsx +8 -0
- package/templates/next-template/app/admin/page.tsx +10 -0
- package/templates/next-template/app/api/auth/[...nextauth]/route.ts +6 -0
- package/templates/next-template/app/auth/confirm-forgot-password/page.tsx +12 -0
- package/templates/next-template/app/auth/forgot-password/page.tsx +11 -0
- package/templates/next-template/app/auth/initiate-forgot-password/page.tsx +11 -0
- package/templates/next-template/app/auth/initiate-forgot-password-thank-you/page.tsx +11 -0
- package/templates/next-template/app/auth/initiate-google-oauth/page.tsx +9 -0
- package/templates/next-template/app/auth/initiate-login/page.tsx +13 -0
- package/templates/next-template/app/auth/initiate-register/page.tsx +14 -0
- package/templates/next-template/app/auth/layout.tsx +10 -0
- package/templates/next-template/app/auth/login/page.tsx +12 -0
- package/templates/next-template/app/auth/otp-verify/page.tsx +12 -0
- package/templates/next-template/app/auth/register/page.tsx +12 -0
- package/templates/next-template/app/auth/reset-password/page.tsx +13 -0
- package/templates/next-template/app/auth/sso/page.tsx +80 -0
- package/templates/next-template/app/layout.tsx +56 -0
- package/templates/next-template/app/solid-extensions.ts +8 -0
- package/templates/next-template/dot-templates/dot.gitignore.template +44 -0
- package/templates/next-template/eslint.config.mjs +16 -0
- package/templates/next-template/middleware.ts +23 -0
- package/templates/next-template/next-env.d.ts +5 -0
- package/templates/next-template/next-solidx-run.js +18 -0
- package/templates/next-template/next.config.js +47 -0
- package/templates/next-template/package.json +79 -0
- package/templates/next-template/public/favicon.ico +0 -0
- package/templates/next-template/public/file.svg +1 -0
- package/templates/next-template/public/globe.svg +1 -0
- package/templates/next-template/public/next.svg +1 -0
- package/templates/next-template/public/themes/solid-dark-purple/theme.css +6203 -0
- package/templates/next-template/public/themes/solid-light-purple/solid-login-light.png +0 -0
- package/templates/next-template/public/themes/solid-light-purple/theme.css +6256 -0
- package/templates/next-template/public/vercel.svg +1 -0
- package/templates/next-template/public/window.svg +1 -0
- package/templates/next-template/redux/store.ts +52 -0
- package/templates/next-template/tsconfig.json +33 -0
- package/templates/next-template/types/index.d.ts +7 -0
- package/templates/next-template/types/layout.d.ts +94 -0
- package/templates/next-template/types/next.d.ts +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
|
6
|
+
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
|
7
|
+
|
|
8
|
+
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
|
11
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
|
12
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
|
13
|
+
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
|
14
|
+
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
|
15
|
+
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
|
16
|
+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
|
17
|
+
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
|
|
18
|
+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
|
19
|
+
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
|
|
20
|
+
</p>
|
|
21
|
+
<!--[](https://opencollective.com/nest#backer)
|
|
22
|
+
[](https://opencollective.com/nest#sponsor)-->
|
|
23
|
+
|
|
24
|
+
## Description
|
|
25
|
+
|
|
26
|
+
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
|
27
|
+
|
|
28
|
+
## Project setup
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
$ npm install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Compile and run the project
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# development
|
|
38
|
+
$ npm run start
|
|
39
|
+
|
|
40
|
+
# watch mode
|
|
41
|
+
$ npm run start:dev
|
|
42
|
+
|
|
43
|
+
# production mode
|
|
44
|
+
$ npm run start:prod
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Run tests
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# unit tests
|
|
51
|
+
$ npm run test
|
|
52
|
+
|
|
53
|
+
# e2e tests
|
|
54
|
+
$ npm run test:e2e
|
|
55
|
+
|
|
56
|
+
# test coverage
|
|
57
|
+
$ npm run test:cov
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Deployment
|
|
61
|
+
|
|
62
|
+
When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
|
|
63
|
+
|
|
64
|
+
If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
$ npm install -g @nestjs/mau
|
|
68
|
+
$ mau deploy
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
|
|
72
|
+
|
|
73
|
+
## Resources
|
|
74
|
+
|
|
75
|
+
Check out a few resources that may come in handy when working with NestJS:
|
|
76
|
+
|
|
77
|
+
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
|
|
78
|
+
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
|
|
79
|
+
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
|
|
80
|
+
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
|
|
81
|
+
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
|
|
82
|
+
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
|
|
83
|
+
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
|
|
84
|
+
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
|
|
85
|
+
|
|
86
|
+
## Support
|
|
87
|
+
|
|
88
|
+
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
|
89
|
+
|
|
90
|
+
## Stay in touch
|
|
91
|
+
|
|
92
|
+
- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
|
|
93
|
+
- Website - [https://nestjs.com](https://nestjs.com/)
|
|
94
|
+
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AppModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
let AppModule = class AppModule {
|
|
12
|
+
};
|
|
13
|
+
exports.AppModule = AppModule;
|
|
14
|
+
exports.AppModule = AppModule = __decorate([
|
|
15
|
+
(0, common_1.Module)({})
|
|
16
|
+
], AppModule);
|
|
17
|
+
//# sourceMappingURL=app.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AAGjC,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IADrB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,SAAS,CAAG"}
|
|
@@ -0,0 +1,139 @@
|
|
|
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.registerBuildCommand = registerBuildCommand;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const os_1 = __importDefault(require("os"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const helper_1 = require("../helper");
|
|
12
|
+
function exec(cmd, cwd) {
|
|
13
|
+
(0, child_process_1.execSync)(cmd, {
|
|
14
|
+
cwd,
|
|
15
|
+
stdio: 'inherit',
|
|
16
|
+
env: process.env,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function chmodIfExists(file) {
|
|
20
|
+
if (!fs_1.default.existsSync(file)) {
|
|
21
|
+
throw new Error(`Required file not found: ${file}`);
|
|
22
|
+
}
|
|
23
|
+
fs_1.default.chmodSync(file, 0o755);
|
|
24
|
+
}
|
|
25
|
+
function ensureSolidShim(mainCliPath) {
|
|
26
|
+
const homeDir = os_1.default.homedir();
|
|
27
|
+
const solidctlDir = path_1.default.join(homeDir, '.solidctl');
|
|
28
|
+
const solidctlBinDir = path_1.default.join(solidctlDir, 'bin');
|
|
29
|
+
fs_1.default.mkdirSync(solidctlBinDir, { recursive: true });
|
|
30
|
+
const pointerFile = path_1.default.join(solidctlDir, 'solid-current');
|
|
31
|
+
fs_1.default.writeFileSync(pointerFile, `${mainCliPath}\n`, 'utf8');
|
|
32
|
+
const shimJs = path_1.default.join(solidctlBinDir, 'solid-shim.js');
|
|
33
|
+
const shimJsSource = path_1.default.join(__dirname, '..', 'shims', 'solid-shim.js');
|
|
34
|
+
const shimJsContent = fs_1.default.readFileSync(shimJsSource, 'utf8');
|
|
35
|
+
fs_1.default.writeFileSync(shimJs, shimJsContent, 'utf8');
|
|
36
|
+
if (process.platform === 'win32') {
|
|
37
|
+
const shimCmd = path_1.default.join(solidctlBinDir, 'solid.cmd');
|
|
38
|
+
const shimCmdContent = `@echo off\r\nnode "${shimJs}" %*\r\n`;
|
|
39
|
+
fs_1.default.writeFileSync(shimCmd, shimCmdContent, 'utf8');
|
|
40
|
+
const shimPs1 = path_1.default.join(solidctlBinDir, 'solid.ps1');
|
|
41
|
+
const shimPs1Content = `#!/usr/bin/env pwsh
|
|
42
|
+
$shimPath = "${shimJs}"
|
|
43
|
+
& node $shimPath @args
|
|
44
|
+
exit $LASTEXITCODE
|
|
45
|
+
`;
|
|
46
|
+
fs_1.default.writeFileSync(shimPs1, shimPs1Content, 'utf8');
|
|
47
|
+
return { solidctlBinDir, shimCmd, shimPs1 };
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const shimPosix = path_1.default.join(solidctlBinDir, 'solid');
|
|
51
|
+
const shimPosixContent = "#!/usr/bin/env node\nrequire('./solid-shim.js');\n";
|
|
52
|
+
fs_1.default.writeFileSync(shimPosix, shimPosixContent, 'utf8');
|
|
53
|
+
fs_1.default.chmodSync(shimPosix, 0o755);
|
|
54
|
+
return { solidctlBinDir, shimPosix };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function isWritableDir(dir) {
|
|
58
|
+
try {
|
|
59
|
+
if (!fs_1.default.existsSync(dir) || !fs_1.default.statSync(dir).isDirectory()) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
fs_1.default.accessSync(dir, fs_1.default.constants.W_OK);
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function ensureGlobalSolid(shimFiles, shimDir) {
|
|
70
|
+
const pathEntries = (process.env.PATH || '').split(path_1.default.delimiter).filter(Boolean);
|
|
71
|
+
if (pathEntries.includes(shimDir)) {
|
|
72
|
+
return { linked: true, location: shimDir, viaPath: true };
|
|
73
|
+
}
|
|
74
|
+
for (const dir of pathEntries) {
|
|
75
|
+
if (!isWritableDir(dir)) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
if (process.platform === 'win32') {
|
|
80
|
+
const destCmd = path_1.default.join(dir, 'solid.cmd');
|
|
81
|
+
const destPs1 = path_1.default.join(dir, 'solid.ps1');
|
|
82
|
+
fs_1.default.rmSync(destCmd, { force: true });
|
|
83
|
+
fs_1.default.rmSync(destPs1, { force: true });
|
|
84
|
+
console.log(`▶ [WIN32] Copying ${shimFiles.shimCmd} -> ${destCmd}`);
|
|
85
|
+
fs_1.default.copyFileSync(shimFiles.shimCmd, destCmd);
|
|
86
|
+
console.log(`▶ [WIN32] Copying ${shimFiles.shimPs1} -> ${destPs1}`);
|
|
87
|
+
fs_1.default.copyFileSync(shimFiles.shimPs1, destPs1);
|
|
88
|
+
return { linked: true, location: dir, viaPath: false };
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const dest = path_1.default.join(dir, 'solid');
|
|
92
|
+
fs_1.default.rmSync(dest, { force: true });
|
|
93
|
+
console.log(`▶ [POSIX] Creating symlink ${dest} -> ${shimFiles.shimPosix}`);
|
|
94
|
+
fs_1.default.symlinkSync(shimFiles.shimPosix, dest);
|
|
95
|
+
return { linked: true, location: dir, viaPath: false };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return { linked: false, location: shimDir, viaPath: false };
|
|
103
|
+
}
|
|
104
|
+
function registerBuildCommand(program) {
|
|
105
|
+
program
|
|
106
|
+
.command('build')
|
|
107
|
+
.description('Build Solid API and set up Solid CLI')
|
|
108
|
+
.action(() => {
|
|
109
|
+
(0, helper_1.validateProjectRoot)();
|
|
110
|
+
const projectRoot = process.cwd();
|
|
111
|
+
console.log('▶ Building project');
|
|
112
|
+
exec('npm run build', `${projectRoot}/solid-api`);
|
|
113
|
+
console.log('▶ Ensuring CLI files are executable');
|
|
114
|
+
const mainCli = path_1.default.join(projectRoot, 'solid-api', 'dist', 'main-cli.js');
|
|
115
|
+
chmodIfExists(mainCli);
|
|
116
|
+
console.log('▶ Updating solid CLI shim');
|
|
117
|
+
const shimFiles = ensureSolidShim(mainCli);
|
|
118
|
+
console.log('▶ Linking solid CLI for global use');
|
|
119
|
+
const linkResult = ensureGlobalSolid(shimFiles, shimFiles.solidctlBinDir);
|
|
120
|
+
if (!linkResult.linked) {
|
|
121
|
+
console.warn(`⚠️ Add ${shimFiles.solidctlBinDir} to PATH to use "solid" globally.`);
|
|
122
|
+
}
|
|
123
|
+
console.log('▶ Adding local bin to PATH');
|
|
124
|
+
process.env.PATH = `${shimFiles.solidctlBinDir}${path_1.default.delimiter}${process.env.PATH || ''}`;
|
|
125
|
+
console.log('▶ Verifying solid CLI availability');
|
|
126
|
+
const solidCommand = process.platform === 'win32' ? 'solid.cmd' : 'solid';
|
|
127
|
+
const result = (0, child_process_1.spawnSync)(solidCommand, ['--help'], {
|
|
128
|
+
stdio: 'ignore',
|
|
129
|
+
env: process.env,
|
|
130
|
+
shell: process.platform === 'win32' ? true : false,
|
|
131
|
+
});
|
|
132
|
+
if (result.error) {
|
|
133
|
+
console.error('❌ solid CLI not found');
|
|
134
|
+
process.exit(1);
|
|
135
|
+
}
|
|
136
|
+
console.log('✔ solid CLI ready');
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=build.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.command.js","sourceRoot":"","sources":["../../src/commands/build.command.ts"],"names":[],"mappings":";;;;;AAkIA,oDAyCC;AA1KD,iDAAoD;AACpD,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AACxB,sCAAgD;AAEhD,SAAS,IAAI,CAAC,GAAW,EAAE,GAAY;IACrC,IAAA,wBAAQ,EAAC,GAAG,EAAE;QACZ,GAAG;QACH,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IACC,YAAE,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,eAAe,CAAC,WAAmB;IAC1C,MAAM,OAAO,GAAG,YAAE,CAAC,OAAO,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,cAAI,C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AAG,GAAG,SAAS,CAAC,cAAc,GAAG,cAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;QAC3F,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;QAClD,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC;QAC1E,MAAM,MAAM,GAAG,IAAA,yBAAS,EAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE;YACjD,KAAK,EAAE,QAAQ;YACf,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,KAAK,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;SACnD,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
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.registerCreateAppCommand = registerCreateAppCommand;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
9
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const setup_questions_1 = require("./setup-questions");
|
|
12
|
+
const helpers_1 = require("./helpers");
|
|
13
|
+
function kebabCase(str) {
|
|
14
|
+
return str
|
|
15
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
16
|
+
.replace(/[\s_]+/g, '-')
|
|
17
|
+
.toLowerCase();
|
|
18
|
+
}
|
|
19
|
+
function registerCreateAppCommand(program) {
|
|
20
|
+
program
|
|
21
|
+
.command('create-app')
|
|
22
|
+
.description('Scaffold a new Solid project with backend (NestJS) and frontend (Next.js)')
|
|
23
|
+
.option('--verbose', 'Show detailed logs during installation')
|
|
24
|
+
.action(async (options) => {
|
|
25
|
+
try {
|
|
26
|
+
const showLogs = options.verbose || false;
|
|
27
|
+
console.log(chalk_1.default.cyan("Hello, Let's setup your Solid project!"));
|
|
28
|
+
const answers = await inquirer_1.default.prompt(setup_questions_1.setupQuestions);
|
|
29
|
+
const projectName = kebabCase(answers.projectName.trim());
|
|
30
|
+
const targetPath = path_1.default.join(process.cwd(), projectName);
|
|
31
|
+
if (fs_extra_1.default.existsSync(targetPath)) {
|
|
32
|
+
console.log(chalk_1.default.red(`Error: Directory ${projectName} already exists.`));
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
console.log((0, helpers_1.prettyOutput)('\nStep 1', 'Setting up boilerplate for the backend'));
|
|
36
|
+
const templatesPath = (0, helpers_1.getTemplatesPath)();
|
|
37
|
+
await (0, helpers_1.copyTemplate)(templatesPath, targetPath, helpers_1.EXCLUDED_DIRS_FOR_INITIAL_COPY);
|
|
38
|
+
await (0, helpers_1.copyAndInstallTemplate)(path_1.default.join(templatesPath, helpers_1.SOURCE_TEMPLATE_FOLDER_API), path_1.default.join(targetPath, helpers_1.TARGET_FOLDER_API), showLogs);
|
|
39
|
+
console.log((0, helpers_1.prettyOutput)('Step 2', 'Setting up boilerplate for the frontend'));
|
|
40
|
+
await (0, helpers_1.copyAndInstallTemplate)(path_1.default.join(templatesPath, helpers_1.SOURCE_TEMPLATE_FOLDER_UI), path_1.default.join(targetPath, helpers_1.TARGET_FOLDER_UI), showLogs);
|
|
41
|
+
(0, helpers_1.updatePackageName)(targetPath, helpers_1.TARGET_FOLDER_UI, `@${projectName}/${helpers_1.TARGET_FOLDER_UI}`);
|
|
42
|
+
(0, helpers_1.updatePackageName)(targetPath, helpers_1.TARGET_FOLDER_API, `@${projectName}/${helpers_1.TARGET_FOLDER_API}`);
|
|
43
|
+
(0, helpers_1.updatePortInPackageJson)(targetPath, helpers_1.TARGET_FOLDER_UI, answers.solidUiPort);
|
|
44
|
+
const backendPath = path_1.default.join(targetPath, helpers_1.TARGET_FOLDER_API);
|
|
45
|
+
console.log((0, helpers_1.prettyOutput)('Step 3', `Generating .env file for the backend at ${chalk_1.default.cyan(backendPath)}`));
|
|
46
|
+
(0, helpers_1.generateEnvFileFromConfig)(backendPath, (0, helpers_1.getBackendEnvConfig)(answers));
|
|
47
|
+
const frontendPath = path_1.default.join(targetPath, helpers_1.TARGET_FOLDER_UI);
|
|
48
|
+
console.log((0, helpers_1.prettyOutput)('Step 4', `Generating .env file for the frontend at ${chalk_1.default.cyan(frontendPath)}`));
|
|
49
|
+
(0, helpers_1.generateEnvFileFromConfig)(frontendPath, (0, helpers_1.getFrontendEnvJson)(answers));
|
|
50
|
+
console.log(chalk_1.default.green(`Project ${chalk_1.default.cyan(projectName)} created successfully!`));
|
|
51
|
+
console.log(chalk_1.default.cyan('\nEnsure the database is created and connection is established correctly.'));
|
|
52
|
+
console.log(chalk_1.default.cyan('\nNext steps:'));
|
|
53
|
+
console.log((0, helpers_1.prettyOutput)(' npx @solidxai/solidctl@latest build', 'This will build the Solid project'));
|
|
54
|
+
console.log((0, helpers_1.prettyOutput)(' npx @solidxai/solidctl@latest seed', 'This will seed the database with the required metadata'));
|
|
55
|
+
console.log(chalk_1.default.cyan('\nRun the api:'));
|
|
56
|
+
console.log((0, helpers_1.prettyOutput)(`cd ${projectName}/${helpers_1.TARGET_FOLDER_API}`, 'Navigate into api directory'));
|
|
57
|
+
console.log((0, helpers_1.prettyOutput)('npm run solidx:dev', `Starts the backend in development mode with live reload on @http://localhost:${answers.solidApiPort}`));
|
|
58
|
+
console.log((0, helpers_1.prettyOutput)('npm run build && npm run start', `Builds and starts the backend in production mode on @http://localhost:${answers.solidApiPort}`));
|
|
59
|
+
console.log(chalk_1.default.cyan(`Api documentation is available on @http://localhost:${answers.solidApiPort}/docs`));
|
|
60
|
+
console.log(chalk_1.default.cyan('\nRun the frontend:'));
|
|
61
|
+
console.log((0, helpers_1.prettyOutput)(`cd ${projectName}/${helpers_1.TARGET_FOLDER_UI}`, 'Navigate into ui directory'));
|
|
62
|
+
console.log((0, helpers_1.prettyOutput)('npm run solidx:dev', `Starts the frontend in development mode with live reload on @http://localhost:${answers.solidUiPort}`));
|
|
63
|
+
console.log((0, helpers_1.prettyOutput)('npm run build && npm run start', `Builds and starts the frontend in production mode on @http://localhost:${answers.solidUiPort}`));
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
console.error('Error:', err);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=create-app.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-app.command.js","sourceRoot":"","sources":["../../../src/commands/create-app/create-app.command.ts"],"names":[],"mappings":";;;;;AA8BA,4DAgKC;AA7LD,kDAA0B;AAC1B,wDAAgC;AAChC,wDAA0B;AAC1B,gDAAwB;AACxB,uDAAiE;AACjE,uCAemB;AAEnB,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,GAAG;SACP,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,WAAW,EAAE,CAAC;AACnB,CAAC;AAED,SAAgB,wBAAwB,CAAC,OAAgB;IACvD,OAAO;SACJ,OAAO,CAAC,YAAY,CAAC;SACrB,WAAW,CACV,2EAA2E,CAC5E;SACA,MAAM,CAAC,WAAW,EAAE,wCAAwC,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C;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { SetupAnswers } from './setup-questions';
|
|
2
|
+
export declare const HIDDEN_TEMPLATES_FOLDER = "dot-templates";
|
|
3
|
+
export declare const SOURCE_TEMPLATE_FOLDER_API = "nest-template";
|
|
4
|
+
export declare const SOURCE_TEMPLATE_FOLDER_UI = "next-template";
|
|
5
|
+
export declare const TARGET_FOLDER_API = "solid-api";
|
|
6
|
+
export declare const TARGET_FOLDER_UI = "solid-ui";
|
|
7
|
+
export declare const EXCLUDED_DIRS_FOR_INITIAL_COPY: string[];
|
|
8
|
+
export declare function getTemplatesPath(): string;
|
|
9
|
+
export declare function copyAndInstallTemplate(source: string, target: string, showLogs: boolean): Promise<void>;
|
|
10
|
+
export declare function copyTemplate(source: string, target: string, excludedDirs?: string[]): Promise<void>;
|
|
11
|
+
export declare function updatePackageName(targetPath: string, subProject: string, packageName: string): void;
|
|
12
|
+
export declare function updatePortInPackageJson(targetPath: string, subProject: string, port: string): void;
|
|
13
|
+
export declare function getBackendEnvConfig(answers: SetupAnswers): {
|
|
14
|
+
General: {
|
|
15
|
+
ENV: string;
|
|
16
|
+
PORT: string;
|
|
17
|
+
SOLID_APP_NAME: string;
|
|
18
|
+
BASE_URL: string;
|
|
19
|
+
};
|
|
20
|
+
'Default DB Configuration': {
|
|
21
|
+
DEFAULT_DATABASE_USER: string;
|
|
22
|
+
DEFAULT_DATABASE_PASSWORD: string;
|
|
23
|
+
DEFAULT_DATABASE_NAME: string;
|
|
24
|
+
DEFAULT_DATABASE_PORT: string;
|
|
25
|
+
DEFAULT_DATABASE_HOST: string;
|
|
26
|
+
DEFAULT_DATABASE_SYNCHRONIZE: string;
|
|
27
|
+
DEFAULT_DATABASE_LOGGING: string;
|
|
28
|
+
};
|
|
29
|
+
'IAM Registration': {
|
|
30
|
+
IAM_PASSWORD_LESS_REGISTRATION: string;
|
|
31
|
+
IAM_PASSWORD_LESS_REGISTRATION_VALIDATE_WHAT: string;
|
|
32
|
+
IAM_ALLOW_PUBLIC_REGISTRATION: string;
|
|
33
|
+
IAM_ACTIVATE_USER_ON_REGISTRATION: string;
|
|
34
|
+
IAM_DEFAULT_ROLE: string;
|
|
35
|
+
};
|
|
36
|
+
'IAM JWT': {
|
|
37
|
+
IAM_JWT_TOKEN_AUDIENCE: string;
|
|
38
|
+
IAM_JWT_TOKEN_ISSUER: string;
|
|
39
|
+
IAM_JWT_SECRET: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare function getFrontendEnvJson(answers: SetupAnswers): {
|
|
43
|
+
General: {
|
|
44
|
+
PORT: string;
|
|
45
|
+
API_URL: string;
|
|
46
|
+
NEXTAUTH_URL: string;
|
|
47
|
+
NEXT_PUBLIC_BACKEND_API_URL: string;
|
|
48
|
+
NEXT_PUBLIC_SOLID_ENTITIES: string;
|
|
49
|
+
NEXT_PUBLIC_SOLID_APP_TITLE: string;
|
|
50
|
+
NEXT_PUBLIC_SOLID_APP_DESCRIPTION: string;
|
|
51
|
+
NEXT_PUBLIC_ENABLE_CUSTOM_HEADER_FOOTER: string;
|
|
52
|
+
NEXT_PUBLIC_DEFAULT_MENU_KEY: string;
|
|
53
|
+
NEXT_PUBLIC_SHOW_SETTINGS: string;
|
|
54
|
+
NEXT_PUBLIC_LOGIN_REDIRECT_URL: string;
|
|
55
|
+
NEXT_PUBLIC_REMOTE_PATTERNS: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export declare function generateEnvFileFromConfig(targetPath: string, envConfig: Record<string, Record<string, string>>): void;
|
|
59
|
+
export declare function prettyOutput(label: string, value: string, helpText?: string | null): string;
|
|
@@ -0,0 +1,219 @@
|
|
|
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.EXCLUDED_DIRS_FOR_INITIAL_COPY = exports.TARGET_FOLDER_UI = exports.TARGET_FOLDER_API = exports.SOURCE_TEMPLATE_FOLDER_UI = exports.SOURCE_TEMPLATE_FOLDER_API = exports.HIDDEN_TEMPLATES_FOLDER = void 0;
|
|
7
|
+
exports.getTemplatesPath = getTemplatesPath;
|
|
8
|
+
exports.copyAndInstallTemplate = copyAndInstallTemplate;
|
|
9
|
+
exports.copyTemplate = copyTemplate;
|
|
10
|
+
exports.updatePackageName = updatePackageName;
|
|
11
|
+
exports.updatePortInPackageJson = updatePortInPackageJson;
|
|
12
|
+
exports.getBackendEnvConfig = getBackendEnvConfig;
|
|
13
|
+
exports.getFrontendEnvJson = getFrontendEnvJson;
|
|
14
|
+
exports.generateEnvFileFromConfig = generateEnvFileFromConfig;
|
|
15
|
+
exports.prettyOutput = prettyOutput;
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
18
|
+
const child_process_1 = require("child_process");
|
|
19
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
20
|
+
const path_1 = __importDefault(require("path"));
|
|
21
|
+
exports.HIDDEN_TEMPLATES_FOLDER = 'dot-templates';
|
|
22
|
+
exports.SOURCE_TEMPLATE_FOLDER_API = 'nest-template';
|
|
23
|
+
exports.SOURCE_TEMPLATE_FOLDER_UI = 'next-template';
|
|
24
|
+
exports.TARGET_FOLDER_API = 'solid-api';
|
|
25
|
+
exports.TARGET_FOLDER_UI = 'solid-ui';
|
|
26
|
+
exports.EXCLUDED_DIRS_FOR_INITIAL_COPY = [
|
|
27
|
+
exports.SOURCE_TEMPLATE_FOLDER_API,
|
|
28
|
+
exports.SOURCE_TEMPLATE_FOLDER_UI,
|
|
29
|
+
];
|
|
30
|
+
function getTemplatesPath() {
|
|
31
|
+
const templatesPath = path_1.default.join(__dirname, '..', '..', '..', 'templates');
|
|
32
|
+
if (!fs_extra_1.default.existsSync(templatesPath)) {
|
|
33
|
+
const error = `Templates folder not found at ${templatesPath}`;
|
|
34
|
+
console.error(chalk_1.default.red(error));
|
|
35
|
+
throw new Error(error);
|
|
36
|
+
}
|
|
37
|
+
return templatesPath;
|
|
38
|
+
}
|
|
39
|
+
async function copyAndInstallTemplate(source, target, showLogs) {
|
|
40
|
+
try {
|
|
41
|
+
await copyTemplate(source, target);
|
|
42
|
+
return installTemplate(target, showLogs);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error(chalk_1.default.red('Error in copyAndInstallTemplate:'), error);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function installTemplate(target, showLogs) {
|
|
50
|
+
try {
|
|
51
|
+
(0, child_process_1.execSync)('npm install', {
|
|
52
|
+
stdio: showLogs ? 'inherit' : 'ignore',
|
|
53
|
+
cwd: target,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
console.error(chalk_1.default.red('Error during npm install in', target));
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function copyTemplate(source, target, excludedDirs = []) {
|
|
62
|
+
try {
|
|
63
|
+
await handleCopy(source, target, excludedDirs);
|
|
64
|
+
handleHiddenTemplateFiles(target);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
console.error(chalk_1.default.red(`Error in copyTemplate: for ${source} to ${target}`), error);
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function handleCopy(source, target, excludedDirs = []) {
|
|
72
|
+
await fs_extra_1.default.copy(source, target, {
|
|
73
|
+
filter: (src) => {
|
|
74
|
+
const relativePath = path_1.default.relative(source, src);
|
|
75
|
+
if (!relativePath)
|
|
76
|
+
return true;
|
|
77
|
+
const normalizedPath = relativePath.split(path_1.default.sep).join('/');
|
|
78
|
+
const isExcluded = excludedDirs.some((dir) => normalizedPath === dir || normalizedPath.startsWith(`${dir}/`));
|
|
79
|
+
const filename = path_1.default.basename(src);
|
|
80
|
+
if (filename === 'package-lock.json' || filename === 'node_modules') {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
return !isExcluded;
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function handleHiddenTemplateFiles(targetDir) {
|
|
88
|
+
if (!fs_extra_1.default.lstatSync(targetDir).isDirectory()) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const hiddenTemplatesPath = path_1.default.join(targetDir, exports.HIDDEN_TEMPLATES_FOLDER);
|
|
92
|
+
if (!fs_extra_1.default.existsSync(hiddenTemplatesPath)) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const files = fs_extra_1.default.readdirSync(hiddenTemplatesPath);
|
|
96
|
+
files.forEach((file) => {
|
|
97
|
+
const newFileName = file.replace('dot.', '.').replace('.template', '');
|
|
98
|
+
fs_extra_1.default.moveSync(path_1.default.join(hiddenTemplatesPath, file), path_1.default.join(targetDir, newFileName));
|
|
99
|
+
});
|
|
100
|
+
fs_extra_1.default.removeSync(hiddenTemplatesPath);
|
|
101
|
+
}
|
|
102
|
+
function updatePackageName(targetPath, subProject, packageName) {
|
|
103
|
+
try {
|
|
104
|
+
const packageJsonPath = path_1.default.join(targetPath, subProject, 'package.json');
|
|
105
|
+
if (!fs_extra_1.default.existsSync(packageJsonPath)) {
|
|
106
|
+
const error = `package.json not found at ${packageJsonPath}`;
|
|
107
|
+
console.error(chalk_1.default.red(error));
|
|
108
|
+
throw new Error(error);
|
|
109
|
+
}
|
|
110
|
+
const packageJson = fs_extra_1.default.readJsonSync(packageJsonPath);
|
|
111
|
+
packageJson.name = packageName;
|
|
112
|
+
fs_extra_1.default.writeJsonSync(packageJsonPath, packageJson, { spaces: 2 });
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
console.error(chalk_1.default.red('Error in updatePackageName:'), error);
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function updatePortInPackageJson(targetPath, subProject, port) {
|
|
120
|
+
try {
|
|
121
|
+
const packageJsonPath = path_1.default.join(targetPath, subProject, 'package.json');
|
|
122
|
+
if (!fs_extra_1.default.existsSync(packageJsonPath)) {
|
|
123
|
+
const error = `package.json not found at ${packageJsonPath}`;
|
|
124
|
+
console.error(chalk_1.default.red(error));
|
|
125
|
+
throw new Error(error);
|
|
126
|
+
}
|
|
127
|
+
const packageJson = fs_extra_1.default.readJsonSync(packageJsonPath);
|
|
128
|
+
packageJson.scripts.dev = `next dev -p ${port}`;
|
|
129
|
+
packageJson.scripts.start = `next start -p ${port}`;
|
|
130
|
+
fs_extra_1.default.writeJsonSync(packageJsonPath, packageJson, { spaces: 2 });
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
console.error(chalk_1.default.red('Error in updatePortInPackageJson:'), error);
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function getBackendEnvConfig(answers) {
|
|
138
|
+
return {
|
|
139
|
+
General: {
|
|
140
|
+
ENV: 'dev',
|
|
141
|
+
PORT: answers.solidApiPort,
|
|
142
|
+
SOLID_APP_NAME: answers.projectName,
|
|
143
|
+
BASE_URL: `http://localhost:${answers.solidApiPort}`,
|
|
144
|
+
},
|
|
145
|
+
'Default DB Configuration': {
|
|
146
|
+
DEFAULT_DATABASE_USER: answers.solidApiDatabaseUsername,
|
|
147
|
+
DEFAULT_DATABASE_PASSWORD: answers.solidApiDatabasePassword,
|
|
148
|
+
DEFAULT_DATABASE_NAME: answers.solidApiDatabaseName,
|
|
149
|
+
DEFAULT_DATABASE_PORT: answers.solidApiDatabasePort,
|
|
150
|
+
DEFAULT_DATABASE_HOST: answers.solidApiDatabaseHost,
|
|
151
|
+
DEFAULT_DATABASE_SYNCHRONIZE: answers.solidApiDatabaseSynchronize === 'Yes' ? 'true' : 'false',
|
|
152
|
+
DEFAULT_DATABASE_LOGGING: 'false',
|
|
153
|
+
},
|
|
154
|
+
'IAM Registration': {
|
|
155
|
+
IAM_PASSWORD_LESS_REGISTRATION: 'false',
|
|
156
|
+
IAM_PASSWORD_LESS_REGISTRATION_VALIDATE_WHAT: 'transactional',
|
|
157
|
+
IAM_ALLOW_PUBLIC_REGISTRATION: 'true',
|
|
158
|
+
IAM_ACTIVATE_USER_ON_REGISTRATION: 'true',
|
|
159
|
+
IAM_DEFAULT_ROLE: 'Admin',
|
|
160
|
+
},
|
|
161
|
+
'IAM JWT': {
|
|
162
|
+
IAM_JWT_TOKEN_AUDIENCE: `http://localhost:${answers.solidApiPort}`,
|
|
163
|
+
IAM_JWT_TOKEN_ISSUER: answers.projectName,
|
|
164
|
+
IAM_JWT_SECRET: generateJwtSecret(),
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function getFrontendEnvJson(answers) {
|
|
169
|
+
return {
|
|
170
|
+
General: {
|
|
171
|
+
PORT: answers.solidUiPort,
|
|
172
|
+
API_URL: `http://localhost:${answers.solidApiPort}`,
|
|
173
|
+
NEXTAUTH_URL: `http://localhost:${answers.solidUiPort}`,
|
|
174
|
+
NEXT_PUBLIC_BACKEND_API_URL: `http://localhost:${answers.solidApiPort}`,
|
|
175
|
+
NEXT_PUBLIC_SOLID_ENTITIES: '',
|
|
176
|
+
NEXT_PUBLIC_SOLID_APP_TITLE: answers.projectName,
|
|
177
|
+
NEXT_PUBLIC_SOLID_APP_DESCRIPTION: '',
|
|
178
|
+
NEXT_PUBLIC_ENABLE_CUSTOM_HEADER_FOOTER: 'false',
|
|
179
|
+
NEXT_PUBLIC_DEFAULT_MENU_KEY: `${answers.projectName}-tracker`,
|
|
180
|
+
NEXT_PUBLIC_SHOW_SETTINGS: 'false',
|
|
181
|
+
NEXT_PUBLIC_LOGIN_REDIRECT_URL: '/admin/core/solid-core/user/list',
|
|
182
|
+
NEXT_PUBLIC_REMOTE_PATTERNS: '[{"protocol":"http","hostname":"localhost","pathname":"/media-files-storage/**"}]',
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function generateEnvFileFromConfig(targetPath, envConfig) {
|
|
187
|
+
try {
|
|
188
|
+
const envPath = path_1.default.join(targetPath, '.env');
|
|
189
|
+
let envContent = '';
|
|
190
|
+
for (const group in envConfig) {
|
|
191
|
+
envContent += `\n# ${group}\n`;
|
|
192
|
+
for (const key in envConfig[group]) {
|
|
193
|
+
const value = envConfig[group][key];
|
|
194
|
+
if (value) {
|
|
195
|
+
envContent += `${key}=${value}\n`;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
fs_extra_1.default.writeFileSync(envPath, envContent);
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
console.error(chalk_1.default.red('Error in generateEnvFileFromConfig:'), error);
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function generateJwtSecret() {
|
|
207
|
+
return crypto_1.default.randomBytes(64).toString('hex');
|
|
208
|
+
}
|
|
209
|
+
function prettyOutput(label, value, helpText = null) {
|
|
210
|
+
const formattedLabel = label ? chalk_1.default.magenta(label) : '';
|
|
211
|
+
const paddedLabel = formattedLabel.padEnd(10);
|
|
212
|
+
const outputLabel = formattedLabel ? `${paddedLabel}:` : paddedLabel;
|
|
213
|
+
const formattedHelpText = helpText ? chalk_1.default.cyan(`(${helpText})`) : '';
|
|
214
|
+
const outputHelpText = formattedHelpText
|
|
215
|
+
? `\n${''.padEnd(10)} ${formattedHelpText}`
|
|
216
|
+
: '';
|
|
217
|
+
return `${outputLabel} ${chalk_1.default.green(value)}${outputHelpText}\n`;
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=helpers.js.map
|