@solidstarters/create-solid-app 1.2.12

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.
Files changed (172) hide show
  1. package/helpers.js +216 -0
  2. package/index.js +71 -0
  3. package/optional_dependencies.testcases +30 -0
  4. package/package.json +29 -0
  5. package/setup-questions.js +208 -0
  6. package/templates/dot.templates/dot.vscode.template/launch.json +29 -0
  7. package/templates/nest-template/README.md +73 -0
  8. package/templates/nest-template/dot-templates/dot.eslintrc.template.js +25 -0
  9. package/templates/nest-template/dot-templates/dot.gitignore.template +52 -0
  10. package/templates/nest-template/dot-templates/dot.prettierrc.template +4 -0
  11. package/templates/nest-template/nest-cli.json +8 -0
  12. package/templates/nest-template/package-lock.json +15947 -0
  13. package/templates/nest-template/package.json +129 -0
  14. package/templates/nest-template/rebuild-cli-ubuntu.sh +5 -0
  15. package/templates/nest-template/rebuild-cli.sh +27 -0
  16. package/templates/nest-template/rebuild.sh +5 -0
  17. package/templates/nest-template/src/app-default-database.module.ts +93 -0
  18. package/templates/nest-template/src/app.config.ts +7 -0
  19. package/templates/nest-template/src/app.controller.spec.ts +22 -0
  20. package/templates/nest-template/src/app.module.ts +63 -0
  21. package/templates/nest-template/src/app.service.ts +32 -0
  22. package/templates/nest-template/src/main-cli.ts +38 -0
  23. package/templates/nest-template/src/main.ts +110 -0
  24. package/templates/nest-template/test/app.e2e-spec.ts +24 -0
  25. package/templates/nest-template/test/jest-e2e.json +9 -0
  26. package/templates/nest-template/tsconfig.build.json +4 -0
  27. package/templates/nest-template/tsconfig.json +22 -0
  28. package/templates/next-template/README.md +36 -0
  29. package/templates/next-template/app/GlobalProvider.tsx +19 -0
  30. package/templates/next-template/app/admin/core/[moduleName]/[modelName]/form/[id]/page.tsx +94 -0
  31. package/templates/next-template/app/admin/core/[moduleName]/[modelName]/kanban/page.tsx +23 -0
  32. package/templates/next-template/app/admin/core/[moduleName]/[modelName]/list/page.tsx +23 -0
  33. package/templates/next-template/app/admin/layout.tsx +62 -0
  34. package/templates/next-template/app/admin/loading.tsx +8 -0
  35. package/templates/next-template/app/admin/page.tsx +11 -0
  36. package/templates/next-template/app/admin/settings/page.tsx +19 -0
  37. package/templates/next-template/app/api/auth/[...nextauth]/route.ts +220 -0
  38. package/templates/next-template/app/auth/confirm-forgot-password/page.tsx +17 -0
  39. package/templates/next-template/app/auth/forgot-password/page.tsx +11 -0
  40. package/templates/next-template/app/auth/initiate-forgot-password/page.tsx +11 -0
  41. package/templates/next-template/app/auth/initiate-forgot-password-thank-you/page.tsx +46 -0
  42. package/templates/next-template/app/auth/layout.tsx +129 -0
  43. package/templates/next-template/app/auth/login/page.tsx +12 -0
  44. package/templates/next-template/app/auth/otp-verify/page.tsx +12 -0
  45. package/templates/next-template/app/auth/page.tsx +33 -0
  46. package/templates/next-template/app/auth/register/page.tsx +12 -0
  47. package/templates/next-template/app/auth/reset-password/page.tsx +13 -0
  48. package/templates/next-template/app/auth/sso/page.tsx +80 -0
  49. package/templates/next-template/app/error.tsx +30 -0
  50. package/templates/next-template/app/favicon.ico +0 -0
  51. package/templates/next-template/app/globals.css +2268 -0
  52. package/templates/next-template/app/head.tsx +17 -0
  53. package/templates/next-template/app/layout.tsx +69 -0
  54. package/templates/next-template/app/loading.tsx +10 -0
  55. package/templates/next-template/app/not-found.tsx +25 -0
  56. package/templates/next-template/app/page.module.css +229 -0
  57. package/templates/next-template/app/page.tsx +11 -0
  58. package/templates/next-template/app/solid-stylesheet.css +25 -0
  59. package/templates/next-template/dot-templates/dot.gitignore.template +41 -0
  60. package/templates/next-template/eslint.config.mjs +16 -0
  61. package/templates/next-template/middleware.ts +23 -0
  62. package/templates/next-template/next-env.d.ts +5 -0
  63. package/templates/next-template/next.config.js +55 -0
  64. package/templates/next-template/package-lock.json +7528 -0
  65. package/templates/next-template/package.json +76 -0
  66. package/templates/next-template/public/file.svg +1 -0
  67. package/templates/next-template/public/globe.svg +1 -0
  68. package/templates/next-template/public/images/AvatarDemo.png +0 -0
  69. package/templates/next-template/public/images/Footerbg.png +0 -0
  70. package/templates/next-template/public/images/LoginBanner.png +0 -0
  71. package/templates/next-template/public/images/Navigation/Level.svg +5 -0
  72. package/templates/next-template/public/images/Navigation/Presure.svg +7 -0
  73. package/templates/next-template/public/images/Navigation/Temperature.svg +13 -0
  74. package/templates/next-template/public/images/Profile/Avatar.png +0 -0
  75. package/templates/next-template/public/images/SS-Logo-1 1.png +0 -0
  76. package/templates/next-template/public/images/activity.svg +3 -0
  77. package/templates/next-template/public/images/app-builder.png +0 -0
  78. package/templates/next-template/public/images/auth/solid-left-layout-bg.png +0 -0
  79. package/templates/next-template/public/images/auth/solid-login-light.png +0 -0
  80. package/templates/next-template/public/images/auth/solid-right-layout-bg.png +0 -0
  81. package/templates/next-template/public/images/clog-wheel.png +0 -0
  82. package/templates/next-template/public/images/dark-mode.png +0 -0
  83. package/templates/next-template/public/images/dashboard/Ellipse 1.svg +10 -0
  84. package/templates/next-template/public/images/dashboard/Rectangle 17.svg +10 -0
  85. package/templates/next-template/public/images/dashboard/Rectangle 25.svg +11 -0
  86. package/templates/next-template/public/images/dashboard/image 5.svg +9 -0
  87. package/templates/next-template/public/images/eye-icon.png +0 -0
  88. package/templates/next-template/public/images/fb.svg +3 -0
  89. package/templates/next-template/public/images/fileReader/image-jpg.png +0 -0
  90. package/templates/next-template/public/images/filter-icon.png +0 -0
  91. package/templates/next-template/public/images/form/user.png +0 -0
  92. package/templates/next-template/public/images/iam.png +0 -0
  93. package/templates/next-template/public/images/icons/icon-activity.svg +3 -0
  94. package/templates/next-template/public/images/icons/icon-calender.svg +3 -0
  95. package/templates/next-template/public/images/icons/icon-graph.svg +3 -0
  96. package/templates/next-template/public/images/icons/icon-kanban.svg +3 -0
  97. package/templates/next-template/public/images/icons/icon-list.svg +3 -0
  98. package/templates/next-template/public/images/icons/icon-users.svg +3 -0
  99. package/templates/next-template/public/images/icons/jump-to-icon.png +0 -0
  100. package/templates/next-template/public/images/insta.svg +3 -0
  101. package/templates/next-template/public/images/layout/images/comfortable.png +0 -0
  102. package/templates/next-template/public/images/layout/images/compact.png +0 -0
  103. package/templates/next-template/public/images/layout/images/cozy.png +0 -0
  104. package/templates/next-template/public/images/layout/images/kanban.png +0 -0
  105. package/templates/next-template/public/images/li.svg +3 -0
  106. package/templates/next-template/public/images/loginhero.png +0 -0
  107. package/templates/next-template/public/images/logo.png +0 -0
  108. package/templates/next-template/public/images/mail-icon.png +0 -0
  109. package/templates/next-template/public/images/menu/app-builder.svg +19 -0
  110. package/templates/next-template/public/images/menu/iam.svg +14 -0
  111. package/templates/next-template/public/images/menu/logicloop-black.svg +28 -0
  112. package/templates/next-template/public/images/menu/logicloop-blue.svg +32 -0
  113. package/templates/next-template/public/images/menu/logicloop-white.svg +32 -0
  114. package/templates/next-template/public/images/menu/queues.svg +14 -0
  115. package/templates/next-template/public/images/menu/radix.svg +9 -0
  116. package/templates/next-template/public/images/menu/rl-lead-middleware.svg +19 -0
  117. package/templates/next-template/public/images/menu/solid-address-master.svg +10 -0
  118. package/templates/next-template/public/images/menu/srmd-tracker-black.svg +16 -0
  119. package/templates/next-template/public/images/menu/srmd-tracker-original.svg +32 -0
  120. package/templates/next-template/public/images/menu/srmd-tracker-white.svg +17 -0
  121. package/templates/next-template/public/images/menu/srmd-tracker.svg +16 -0
  122. package/templates/next-template/public/images/menu-icon.png +0 -0
  123. package/templates/next-template/public/images/menu-toggle.png +0 -0
  124. package/templates/next-template/public/images/password-icon.png +0 -0
  125. package/templates/next-template/public/images/profile.png +0 -0
  126. package/templates/next-template/public/images/radix-logo-white.png +0 -0
  127. package/templates/next-template/public/images/radix-logo.png +0 -0
  128. package/templates/next-template/public/images/search-icon.png +0 -0
  129. package/templates/next-template/public/images/signupBanner.png +0 -0
  130. package/templates/next-template/public/images/tw.svg +3 -0
  131. package/templates/next-template/public/images/user-icon.png +0 -0
  132. package/templates/next-template/public/next.svg +1 -0
  133. package/templates/next-template/public/styles/SF-Pro-Display-Regular.otf +0 -0
  134. package/templates/next-template/public/styles/layout/_config.scss +54 -0
  135. package/templates/next-template/public/styles/layout/_content.scss +77 -0
  136. package/templates/next-template/public/styles/layout/_footer.scss +8 -0
  137. package/templates/next-template/public/styles/layout/_main.scss +28 -0
  138. package/templates/next-template/public/styles/layout/_menu.scss +185 -0
  139. package/templates/next-template/public/styles/layout/_mixins.scss +13 -0
  140. package/templates/next-template/public/styles/layout/_responsive.scss +99 -0
  141. package/templates/next-template/public/styles/layout/_topbar.scss +149 -0
  142. package/templates/next-template/public/styles/layout/_typography.scss +63 -0
  143. package/templates/next-template/public/styles/layout/_utils.scss +27 -0
  144. package/templates/next-template/public/styles/layout/_variables.scss +3 -0
  145. package/templates/next-template/public/styles/layout/layout.scss +11 -0
  146. package/templates/next-template/public/themes/solid-dark-purple/fonts/SF-Pro-Display-Black.otf +0 -0
  147. package/templates/next-template/public/themes/solid-dark-purple/fonts/SF-Pro-Display-Bold.otf +0 -0
  148. package/templates/next-template/public/themes/solid-dark-purple/fonts/SF-Pro-Display-Heavy.otf +0 -0
  149. package/templates/next-template/public/themes/solid-dark-purple/fonts/SF-Pro-Display-Light.otf +0 -0
  150. package/templates/next-template/public/themes/solid-dark-purple/fonts/SF-Pro-Display-Medium.otf +0 -0
  151. package/templates/next-template/public/themes/solid-dark-purple/fonts/SF-Pro-Display-Regular.otf +0 -0
  152. package/templates/next-template/public/themes/solid-dark-purple/fonts/SF-Pro-Display-Semibold.otf +0 -0
  153. package/templates/next-template/public/themes/solid-dark-purple/fonts/SF-Pro-Display-Thin.otf +0 -0
  154. package/templates/next-template/public/themes/solid-dark-purple/fonts/SF-Pro-Display-Ultralight.otf +0 -0
  155. package/templates/next-template/public/themes/solid-dark-purple/theme.css +9042 -0
  156. package/templates/next-template/public/themes/solid-light-purple/fonts/SF-Pro-Display-Black.otf +0 -0
  157. package/templates/next-template/public/themes/solid-light-purple/fonts/SF-Pro-Display-Bold.otf +0 -0
  158. package/templates/next-template/public/themes/solid-light-purple/fonts/SF-Pro-Display-Heavy.otf +0 -0
  159. package/templates/next-template/public/themes/solid-light-purple/fonts/SF-Pro-Display-Light.otf +0 -0
  160. package/templates/next-template/public/themes/solid-light-purple/fonts/SF-Pro-Display-Medium.otf +0 -0
  161. package/templates/next-template/public/themes/solid-light-purple/fonts/SF-Pro-Display-Regular.otf +0 -0
  162. package/templates/next-template/public/themes/solid-light-purple/fonts/SF-Pro-Display-Semibold.otf +0 -0
  163. package/templates/next-template/public/themes/solid-light-purple/fonts/SF-Pro-Display-Thin.otf +0 -0
  164. package/templates/next-template/public/themes/solid-light-purple/fonts/SF-Pro-Display-Ultralight.otf +0 -0
  165. package/templates/next-template/public/themes/solid-light-purple/theme.css +9031 -0
  166. package/templates/next-template/public/vercel.svg +1 -0
  167. package/templates/next-template/public/window.svg +1 -0
  168. package/templates/next-template/redux/store.ts +84 -0
  169. package/templates/next-template/tsconfig.json +33 -0
  170. package/templates/next-template/types/index.d.ts +7 -0
  171. package/templates/next-template/types/layout.d.ts +94 -0
  172. package/templates/next-template/types/next.d.ts +46 -0
package/helpers.js ADDED
@@ -0,0 +1,216 @@
1
+ import chalk from 'chalk';
2
+ import crypto from 'crypto';
3
+ import { execa } from 'execa';
4
+ import fs from 'fs-extra';
5
+ import os from 'os';
6
+ import path, { dirname } from 'path';
7
+ import { fileURLToPath } from 'url';
8
+
9
+
10
+ // Simulate __dirname
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = dirname(__filename);
13
+
14
+ export async function copyAndInstallTemplate(source, target) {
15
+ try {
16
+ // Copy the source folder to the target folder
17
+ await copyTemplate(source, target);
18
+
19
+ // Run `npm install` in the target directory
20
+ return await installTemplate(target);
21
+ // console.log(chalk.green(`Dependencies installed in ${target}`));
22
+ } catch (error) {
23
+ console.error(chalk.red('Error in copyAndInstallTemplate:', error));
24
+ throw error;
25
+ }
26
+ }
27
+
28
+ async function installTemplate(target) {
29
+ const output = await execa('npm', ['install'], { stdio: 'inherit', cwd: target });
30
+ return output;
31
+ }
32
+
33
+ export async function copyTemplate(source, target) {
34
+ try {
35
+ await fs.copy(source, target);
36
+ // console.log(chalk.green(`Files copied from ${source} to ${target}`));
37
+ // Check if there is a dot-templates folder in the target
38
+ handleHiddenTemplateFiles(target);
39
+ }
40
+ catch (error) {
41
+ console.error(chalk.red('Error in copyTemplate:', error));
42
+ throw error;
43
+ }
44
+ }
45
+
46
+ function handleHiddenTemplateFiles(target) {
47
+ const dotTemplatesPath = path.join(target, 'dot-templates');
48
+ // move all the files from dot-templates to the target after remove .template in the file name
49
+ if (fs.existsSync(dotTemplatesPath)) {
50
+ const files = fs.readdirSync(dotTemplatesPath);
51
+ files.forEach(file => {
52
+ const newFileName = file.replace('dot.', '.').replace('.template', '');
53
+ fs.moveSync(path.join(dotTemplatesPath, file), path.join(target, newFileName));
54
+ });
55
+ fs.removeSync(dotTemplatesPath);
56
+ }
57
+ }
58
+
59
+ export function getSourceFolderPath(folder) {
60
+ const folderPath = path.join(__dirname, folder);
61
+ if (!fs.existsSync(folderPath)) {
62
+ const error = `Source folder ${folderPath} does not exist`;
63
+ console.error(chalk.red(error));
64
+ throw new Error(error);
65
+ }
66
+ return folderPath;
67
+ }
68
+
69
+ export function updatePackageName(targetPath, subProject, packageName) {
70
+ try {
71
+ const packageJsonPath = path.join(targetPath, subProject, 'package.json');
72
+
73
+ // Check if package.json exists
74
+ if (!fs.existsSync(packageJsonPath)) {
75
+ const error = `package.json not found at ${packageJsonPath}`;
76
+ console.error(chalk.red(error));
77
+ throw new Error(error);
78
+ }
79
+
80
+ // Read, modify, and write the package.json
81
+ const packageJson = fs.readJsonSync(packageJsonPath);
82
+ packageJson.name = packageName;
83
+ fs.writeJsonSync(packageJsonPath, packageJson, { spaces: 2 });
84
+ // console.log(chalk.green(`Updated package name to "${packageName}" in ${packageJsonPath}`));
85
+ } catch (error) {
86
+ console.error(chalk.red('Error in updatePackageName:', error));
87
+ throw error;
88
+ }
89
+ }
90
+
91
+ export function updatePortInPackageJson(targetPath, subProject, port) {
92
+ try {
93
+ const packageJsonPath = path.join(targetPath, subProject, 'package.json');
94
+
95
+ // Check if package.json exists
96
+ if (!fs.existsSync(packageJsonPath)) {
97
+ const error = `package.json not found at ${packageJsonPath}`;
98
+ console.error(chalk.red(error));
99
+ throw new Error(error);
100
+ }
101
+
102
+ // Read, modify, and write the package.json
103
+ const packageJson = fs.readJsonSync(packageJsonPath);
104
+ packageJson.scripts.dev = `next dev -p ${port}`;
105
+ fs.writeJsonSync(packageJsonPath, packageJson, { spaces: 2 });
106
+ packageJson.scripts.start = `next start -p ${port}`;
107
+ fs.writeJsonSync(packageJsonPath, packageJson, { spaces: 2 });
108
+ } catch (error) {
109
+ console.error(chalk.red('Error in updatePortInPackageJson:', error));
110
+ throw error;
111
+ }
112
+ }
113
+
114
+ export function getBackendEnvConfig(answers) {
115
+ const envConfig = {
116
+ "General": {
117
+ ENV: 'prod', //FIXME: preferred dev, Need to asses impact of keeping it as dev
118
+ PORT: answers.solidApiPort,
119
+ SOLID_APP_NAME: answers.projectName,
120
+ },
121
+ "Default DB Configuration": {
122
+ DEFAULT_DATABASE_USER: answers.solidApiDatabaseUsername,
123
+ DEFAULT_DATABASE_PASSWORD: answers.solidApiDatabasePassword,
124
+ DEFAULT_DATABASE_NAME: answers.solidApiDatabaseName,
125
+ DEFAULT_DATABASE_PORT: answers.solidApiDatabasePort,
126
+ DEFAULT_DATABASE_HOST: answers.solidApiDatabaseHost,
127
+ DEFAULT_DATABASE_SYNCHRONIZE: answers.solidApiDatabaseSynchronize,
128
+ DEFAULT_DATABASE_LOGGING: false,
129
+ },
130
+ "IAM Registration": {
131
+ IAM_PASSWORD_LESS_REGISTRATION: false,
132
+ IAM_PASSWORD_LESS_REGISTRATION_VALIDATE_WHAT: 'transactional',
133
+ IAM_ALLOW_PUBLIC_REGISTRATION: true,
134
+ IAM_ACTIVATE_USER_ON_REGISTRATION: true,
135
+ IAM_DEFAULT_ROLE: 'Admin',
136
+ },
137
+ "IAM JWT": {
138
+ IAM_JWT_TOKEN_AUDIENCE: `http://localhost:${answers.solidApiPort}`,
139
+ IAM_JWT_TOKEN_ISSUER: answers.projectName,
140
+ IAM_JWT_SECRET: generateJwtSecret(),
141
+ },
142
+ }
143
+ return envConfig;
144
+ }
145
+
146
+ export function getFrontendEnvJson(answers) {
147
+ const envConfig = {
148
+ "General": {
149
+ API_URL: `http://localhost:${answers.solidApiPort}`, //FIXME duplicate of NEXT_PUBLIC_BACKEND_API_URL. need to cleanup
150
+ NEXTAUTH_URL: `http://localhost:${answers.solidUiPort}`,
151
+ NEXT_PUBLIC_BACKEND_API_URL: `http://localhost:${answers.solidApiPort}`,
152
+ NEXT_PUBLIC_SOLID_ENTITIES: '',
153
+ NEXT_PUBLIC_SOLID_APP_TITLE: answers.projectName,
154
+ NEXT_PUBLIC_SOLID_APP_DESCRIPTION: '',
155
+ NEXT_PUBLIC_ENABLE_CUSTOM_HEADER_FOOTER: false,
156
+ NEXT_PUBLIC_DEFAULT_MENU_KEY: `${answers.projectName}-tracker`,
157
+ }
158
+ };
159
+ return envConfig;
160
+ }
161
+
162
+ export function generateEnvFileFromConfig(targetPath, envConfig) {
163
+ try {
164
+ const envPath = path.join(targetPath, '.env');
165
+ let envContent = '';
166
+ // Get the keys of the env groups
167
+ for (const group in envConfig) {
168
+ envContent += `\n# ${group}\n`;
169
+ // Get the keys of the env variables in the group
170
+ for (const key in envConfig[group]) {
171
+ const value = envConfig[group][key];
172
+ if (value) {
173
+ envContent += `${key}=${value}\n`;
174
+ }
175
+ }
176
+ }
177
+ fs.writeFileSync(envPath, envContent);
178
+ } catch (error) {
179
+ console.error(chalk.red('Error in generateEnvFileFromJson:', error));
180
+ throw error;
181
+ }
182
+ }
183
+
184
+ function generateJwtSecret() {
185
+ return crypto.randomBytes(64).toString('hex'); // 64 bytes => 128 characters in hexadecimal
186
+ };
187
+
188
+ export async function installSolidAsGlobalBinary(cwd) {
189
+ try {
190
+ await execa('npm', ['run', 'build'], { stdio: 'inherit', cwd });
191
+
192
+ const nodeVersion = process.version;
193
+ const homeDir = os.homedir();
194
+ const binaryPath = path.join(homeDir, `.nvm/versions/node/${nodeVersion}/bin/solid`);
195
+
196
+ try {
197
+ await execa('rm', [binaryPath], { stdio: 'inherit' });
198
+ } catch (error) {
199
+ }
200
+
201
+ await execa('npm', ['i', '-g'], { stdio: 'inherit', cwd });
202
+ } catch (error) {
203
+ console.error(chalk.red('Error during installation:', error.message));
204
+ process.exit(1);
205
+ }
206
+ }
207
+
208
+ // This function takes a label and a value and prints them to the console
209
+ export function prettyOutput(label, value, helpText = null) {
210
+ const formattedLabel = label ? chalk.magenta(label) : '';
211
+ const paddedLabel = formattedLabel.padEnd(10);
212
+ const outputLabel = formattedLabel ? `${paddedLabel}:` : paddedLabel;
213
+ const formattedHelpText = helpText ? chalk.cyan(`(${helpText})`) : '';
214
+ const outputHelpText = formattedHelpText ? `\n${''.padEnd(10)} ${formattedHelpText}` : '';
215
+ return `${outputLabel} ${chalk.green(value)}${outputHelpText}\n`;
216
+ }
package/index.js ADDED
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env node
2
+
3
+ import chalk from 'chalk';
4
+ import { copyAndInstallTemplate, generateEnvFileFromConfig, getBackendEnvConfig, getFrontendEnvJson, getSourceFolderPath, updatePackageName, installSolidAsGlobalBinary, prettyOutput, updatePortInPackageJson, copyTemplate } from './helpers.js';
5
+ import inquirer from 'inquirer';
6
+ import path from 'path';
7
+ import fs from 'fs-extra';
8
+ import { setupQuestions } from './setup-questions.js';
9
+ import _ from 'lodash';
10
+
11
+
12
+ async function main() {
13
+ try {
14
+ console.log(chalk.cyan("Hello, Let's setup your Solid project!"));
15
+
16
+ // Questions for the user to setup backend
17
+ const answers = await inquirer.prompt(setupQuestions);
18
+
19
+ const projectName = _.kebabCase(answers.projectName.trim());
20
+ const targetPath = path.join(process.cwd(), projectName);
21
+
22
+ // Step 1: Check if the folder already exists
23
+ if (fs.existsSync(targetPath)) {
24
+ console.log(chalk.red(`Error: Directory ${projectName} already exists.`));
25
+ process.exit(1);
26
+ }
27
+
28
+ // Step 2: Setup the sub projects from the templates
29
+ console.log(prettyOutput('Step 1','Setting up boilerplate for the backend'));
30
+ const templatesPath = getSourceFolderPath('templates');
31
+ // copyTemplate(path.join(templatesPath, 'dot.templates'), targetPath);
32
+
33
+ await copyAndInstallTemplate(path.join(templatesPath, 'nest-template'), path.join(targetPath, 'solid-api'));
34
+
35
+ console.log(prettyOutput('Step 2','Installing solid binary globally'));
36
+ const ignore = await installSolidAsGlobalBinary(path.join(targetPath, 'solid-api'));
37
+
38
+ console.log(prettyOutput('Step 3',`Setting up boilerplate for the frontend`));
39
+ await copyAndInstallTemplate(path.join(templatesPath, 'next-template'), path.join(targetPath, 'solid-ui'));
40
+
41
+ // Step 3: Update project package json details
42
+ updatePackageName(targetPath, 'solid-ui', `@${projectName}/solid-ui`);
43
+ updatePackageName(targetPath, 'solid-api', `@${projectName}/solid-api`);
44
+ updatePortInPackageJson(targetPath, 'solid-ui', answers.solidUiPort);
45
+
46
+ // Step 4: Generate the .env files for backend and frontend
47
+ const backendPath = path.join(targetPath, 'solid-api');
48
+ console.log(prettyOutput('Step 4',`Generating .env file for the backend at ${chalk.cyan(backendPath)}`));
49
+ generateEnvFileFromConfig(backendPath, getBackendEnvConfig(answers));
50
+ const frontendPath = path.join(targetPath, 'solid-ui');
51
+ console.log(prettyOutput('Step 5',`Generating .env file for the frontend at ${chalk.cyan(frontendPath)}`));
52
+ generateEnvFileFromConfig(frontendPath, getFrontendEnvJson(answers));
53
+
54
+ // Step 5: Notify the user
55
+ console.log(chalk.green(`Project ${chalk.cyan(projectName)} created successfully!`));
56
+ console.log(chalk.cyan(`\nEnsure the database is created and connection is established correctly.`));
57
+ console.log(chalk.cyan(`\nNext steps:`));
58
+ console.log(chalk.cyan(`Run the api:`));
59
+ console.log(prettyOutput('',`cd ${projectName}/solid-api`));
60
+ console.log(prettyOutput('','solid seed -s ModuleMetadataSeederService','This will seed the database with the required metadata'));
61
+ console.log(prettyOutput('','npm run start',`This will start the backend server @http://localhost:${answers.solidApiPort}`));
62
+ console.log(chalk.cyan(`\nRun the frontend:`));
63
+ console.log(prettyOutput('',`cd ${projectName}/solid-ui`));
64
+ console.log(prettyOutput('','npm run dev',`This will start the frontend server @http://localhost:${answers.solidUiPort}`));
65
+ }
66
+ catch (err) {
67
+ console.error('Error:', err);
68
+ }
69
+ }
70
+ main();
71
+
@@ -0,0 +1,30 @@
1
+ I.)
2
+ # If sms queues = false
3
+ # If otp url is not sent
4
+
5
+ below error is shown:
6
+ Instead there should be a check in the constructor throwing a proper error
7
+ s_provider_template_id" AS "SmsTemplate_sms_provider_template_id", "SmsTemplate"."description" AS "SmsTemplate_description", "SmsTemplate"."active" AS "SmsTemplate_active" FROM "ss_sms_template" "SmsTemplate" WHERE ( (("SmsTemplate"."name" = $1)) ) AND ( "SmsTemplate"."deleted_at" IS NULL ) LIMIT 1 Parameters: otp-on-register
8
+ node:internal/process/promises:289
9
+ triggerUncaughtException(err, true /* fromPromise */);
10
+ ^
11
+
12
+ TypeError: Invalid URL
13
+ at new URL (node:internal/url:804:36)
14
+ at dispatchHttpRequest (/Users/oswald/projects/Solid_Starters/my-solid-app/solid-api/node_modules/axios/lib/adapters/http.js:232:20)
15
+ at <anonymous> (/Users/oswald/projects/Solid_Starters/my-solid-app/solid-api/node_modules/axios/lib/adapters/http.js:152:5)
16
+ at new Promise (<anonymous>)
17
+ at wrapAsync (/Users/oswald/projects/Solid_Starters/my-solid-app/solid-api/node_modules/axios/lib/adapters/http.js:132:10)
18
+ at http (/Users/oswald/projects/Solid_Starters/my-solid-app/solid-api/node_modules/axios/lib/adapters/http.js:170:10)
19
+ at Axios.dispatchRequest (/Users/oswald/projects/Solid_Starters/my-solid-app/solid-api/node_modules/axios/lib/core/dispatchRequest.js:51:10)
20
+ at Axios._request (/Users/oswald/projects/Solid_Starters/my-solid-app/solid-api/node_modules/axios/lib/core/Axios.js:178:33)
21
+ at Axios.request (/Users/oswald/projects/Solid_Starters/my-solid-app/solid-api/node_modules/axios/lib/core/Axios.js:40:25)
22
+ at Axios.httpMethod (/Users/oswald/projects/Solid_Starters/my-solid-app/solid-api/node_modules/axios/lib/core/Axios.js:217:19)
23
+ at Axios.request (/Users/oswald/projects/Solid_Starters/my-solid-app/solid-api/node_modules/axios/lib/core/Axios.js:45:41)
24
+ at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
25
+ at Msg91OTPService.sendSMSSynchronously (/Users/oswald/projects/Solid_Starters/my-solid-app/solid-api/node_modules/@solidstarters/solid-core/src/services/sms/Msg91OTPService.ts:35:9)
26
+ at Msg91OTPService.sendSMSUsingTemplate (/Users/oswald/projects/Solid_Starters/my-solid-app/solid-api/node_modules/@solidstarters/solid-core/src/services/sms/Msg91BaseSMSService.ts:67:13) {
27
+ code: 'ERR_INVALID_URL',
28
+ input: 'undefined/otp?otp=358004&template_id=666bd246d6fc051047560595&mobile=9198201691070&authkey=undefined'
29
+
30
+ II.)
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@solidstarters/create-solid-app",
3
+ "version": "1.2.12",
4
+ "main": "index.js",
5
+ "private": false,
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "keywords": [],
13
+ "author": "",
14
+ "license": "ISC",
15
+ "description": "",
16
+ "type": "module",
17
+ "bin": {
18
+ "create-solid-app": "index.js"
19
+ },
20
+ "dependencies": {
21
+ "chalk": "^5.3.0",
22
+ "commander": "^12.1.0",
23
+ "degit": "^2.8.4",
24
+ "execa": "9.5.2",
25
+ "fs-extra": "^11.2.0",
26
+ "inquirer": "^12.2.0",
27
+ "lodash": "^4.17.21"
28
+ }
29
+ }
@@ -0,0 +1,208 @@
1
+ export const setupQuestions = [
2
+ {
3
+ type: 'input',
4
+ name: 'projectName',
5
+ message: 'What is the name of your project?',
6
+ default: 'my-solid-app', // Default value if the user skips
7
+ },
8
+ // 2. Choose your backend api port name i.e default 3000
9
+ {
10
+ type: 'input',
11
+ name: 'solidApiPort',
12
+ message: 'Choose your backend api port',
13
+ default: '3000',
14
+ },
15
+ {
16
+ type: 'list',
17
+ name: 'solidApiDatabaseClient',
18
+ message: 'Choose your default database client',
19
+ choices: ['pg', 'mysql'],
20
+ default: 'pg',
21
+ },
22
+ {
23
+ type: 'input',
24
+ name: 'solidApiDatabaseUsername',
25
+ message: 'Please provide your database username',
26
+ },
27
+ {
28
+ type: 'password',
29
+ name: 'solidApiDatabasePassword',
30
+ message: 'Please provide your database password',
31
+ },
32
+ {
33
+ type: 'input',
34
+ name: 'solidApiDatabaseName',
35
+ message: 'Please provide your database name',
36
+ },
37
+ // 6. Please provide your database host? i.e default localhost
38
+ {
39
+ type: 'input',
40
+ name: 'solidApiDatabaseHost',
41
+ message: 'Please provide your database host',
42
+ default: 'localhost',
43
+ },
44
+ // 7. Please provide your database port? i.e default 5432
45
+ {
46
+ type: 'input',
47
+ name: 'solidApiDatabasePort',
48
+ message: 'Please provide your database port',
49
+ default: '5432',
50
+ },
51
+ // 8. Do you want to keep your models and database synchronized i.e default true (highlight the risks)
52
+ {
53
+ type: 'confirm',
54
+ name: 'solidApiDatabaseSynchronize',
55
+ message: 'Do you want to keep your models and database synchronized?. This setting is not recommended for production environments.',
56
+ default: true,
57
+ },
58
+ // 6. Do you want to enable caching yes/no i.e default no ??
59
+ // - Choose your default cache provider? redis i.e default redis
60
+ // - Please provide hostname
61
+ // - Please provide port
62
+ // {
63
+ // type: 'confirm',
64
+ // name: 'solidApiEnableCaching',
65
+ // message: 'Do you want to enable caching?',
66
+ // default: false,
67
+ // },
68
+ // 7. Do you want to enable queues yes/ no i.e default no ??
69
+ // - Choose your default queue broker rabbitmq i.e default rabbitmq
70
+ // - Please provide your broker url
71
+ // {
72
+ // type: 'confirm',
73
+ // name: 'solidApiEnableQueues',
74
+ // message: 'Do you want to enable queues?',
75
+ // default: false,
76
+ // },
77
+ // 8. Do you want to enable mongodb yes / no i.e default no ??
78
+ // - Please provide your mongodb connection string
79
+ // {
80
+ // type: 'confirm',
81
+ // name: 'solidApiEnableMongo',
82
+ // message: 'Do you want to enable mongodb?',
83
+ // default: false,
84
+ // },
85
+ // 9. Do you want to enable s3 i.e default no ??
86
+ // - Please provide AWS region name?
87
+ // - Please provide AWS access key?
88
+ // - Please provide AWS secret key?
89
+ // - Please provide bucket name? i.e default radix-dev-public
90
+ // {
91
+ // type: 'confirm',
92
+ // name: 'solidApiEnableS3',
93
+ // message: 'Do you want to enable s3?',
94
+ // default: false,
95
+ // },
96
+ // 9. Choose your default Email provider type i.e SMTP/API
97
+ // - Please provide SMTP username?
98
+ // - Please provide SMTP password?
99
+ // - Please provide SMTP host?
100
+ // - Please provide SMTP port? i.e default 587
101
+ // - Please provide your default from email address
102
+ // {
103
+ // type: 'list',
104
+ // name: 'solidApiEmailProvider',
105
+ // message: 'Choose your default Email provider type',
106
+ // choices: ['SMTP', 'API'],
107
+ // default: 'SMTP',
108
+ // },
109
+ // {
110
+ // type: 'input',
111
+ // name: 'solidApiEmailUsername',
112
+ // message: 'Please provide SMTP username',
113
+ // },
114
+ // {
115
+ // type: 'password',
116
+ // name: 'solidApiEmailPassword',
117
+ // message: 'Please provide SMTP password',
118
+ // },
119
+ // {
120
+ // type: 'input',
121
+ // name: 'solidApiEmailHost',
122
+ // message: 'Please provide SMTP host',
123
+ // },
124
+ // {
125
+ // type: 'input',
126
+ // name: 'solidApiEmailPort',
127
+ // message: 'Please provide SMTP port',
128
+ // default: '587',
129
+ // },
130
+ // {
131
+ // type: 'input',
132
+ // name: 'solidApiEmailFrom',
133
+ // message: 'Please provide your default from email address',
134
+ // },
135
+ // 10. Choose your default SMS provider i.e MSG91
136
+ // - Please provide SMS API url
137
+ // - Please provide SMS API key
138
+ // {
139
+ // type: 'list',
140
+ // name: 'solidApiSmsProvider',
141
+ // message: 'Choose your default SMS provider',
142
+ // choices: ['MSG91', 'Twilio'],
143
+ // },
144
+ // {
145
+ // type: 'input',
146
+ // name: 'solidApiSmsApiUrl',
147
+ // message: 'Please provide SMS API url',
148
+ // },
149
+ // {
150
+ // type: 'input',
151
+ // name: 'solidApiSmsApiKey',
152
+ // message: 'Please provide SMS API key',
153
+ // },
154
+ // 11. Do you want to enable Whatsapp i.e default no
155
+ // - Choose your default Whatsapp provider i.e MSG91
156
+ // - Please provide your api key
157
+ // - Please provide your whatsapp integrated number
158
+ // {
159
+ // type: 'confirm',
160
+ // name: 'solidApiEnableWhatsapp',
161
+ // message: 'Do you want to enable Whatsapp?',
162
+ // default: false,
163
+ // },
164
+ // 12. Do you want to enable link shortener i.e default no
165
+ // - Choose your default link shortner service i.e tinyurl
166
+ // - Please provide your api url
167
+ // - Please provide your api key
168
+ // - Please provide your short url domain
169
+ // {
170
+ // type: 'confirm',
171
+ // name: 'solidApiEnableLinkShortener',
172
+ // message: 'Do you want to enable link shortener?',
173
+ // default: false,
174
+ // },
175
+ // 13. Do you want to enable oauth i.e default no ??
176
+ // - Choose your default oauth provider i.e google
177
+ // - Please provide your client id
178
+ // - Please provide your client secret
179
+ // {
180
+ // type: 'confirm',
181
+ // name: 'solidApiEnableOauth',
182
+ // message: 'Do you want to enable oauth?',
183
+ // default: false,
184
+ // },
185
+ // {
186
+ // type: 'list',
187
+ // name: 'solidApiOauthProvider',
188
+ // message: 'Choose your default oauth provider',
189
+ // choices: ['google', 'facebook'],
190
+ // },
191
+ // {
192
+ // type: 'input',
193
+ // name: 'solidApiOauthClientId',
194
+ // message: 'Please provide your client id',
195
+ // },
196
+ // {
197
+ // type: 'input',
198
+ // name: 'solidApiOauthClientSecret',
199
+ // message: 'Please provide your client secret',
200
+ // }
201
+ // Choose your frontend app portname
202
+ {
203
+ type: 'input',
204
+ name: 'solidUiPort',
205
+ message: 'Choose your frontend app port',
206
+ default: '3001',
207
+ }
208
+ ];
@@ -0,0 +1,29 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "type": "node",
9
+ "request": "launch",
10
+ "name": "Debug solid-api Nest Framework",
11
+ "args": [
12
+ "${workspaceFolder}/solid-api/src/main.ts"
13
+ ],
14
+ "runtimeArgs": [
15
+ "--nolazy",
16
+ "-r",
17
+ "ts-node/register",
18
+ "-r",
19
+ "tsconfig-paths/register"
20
+ ],
21
+ "sourceMaps": true,
22
+ "envFile": "${workspaceFolder}/solid-api/.env",
23
+ "cwd": "${workspaceFolder}/solid-api",
24
+ "console": "integratedTerminal",
25
+ "runtimeExecutable": "node",
26
+ "autoAttachChildProcesses": true
27
+ },
28
+ ]
29
+ }
@@ -0,0 +1,73 @@
1
+ <p align="center">
2
+ <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" 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://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
15
+ <a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
16
+ <a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
17
+ <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
18
+ <a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
19
+ <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>
20
+ <a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
21
+ </p>
22
+ <!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
23
+ [![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
24
+
25
+ ## Description
26
+
27
+ [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ $ npm install
33
+ ```
34
+
35
+ ## Running the app
36
+
37
+ ```bash
38
+ # development
39
+ $ npm run start
40
+
41
+ # watch mode
42
+ $ npm run start:dev
43
+
44
+ # production mode
45
+ $ npm run start:prod
46
+ ```
47
+
48
+ ## Test
49
+
50
+ ```bash
51
+ # unit tests
52
+ $ npm run test
53
+
54
+ # e2e tests
55
+ $ npm run test:e2e
56
+
57
+ # test coverage
58
+ $ npm run test:cov
59
+ ```
60
+
61
+ ## Support
62
+
63
+ 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).
64
+
65
+ ## Stay in touch
66
+
67
+ - Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
68
+ - Website - [https://nestjs.com](https://nestjs.com/)
69
+ - Twitter - [@nestframework](https://twitter.com/nestframework)
70
+
71
+ ## License
72
+
73
+ Nest is [MIT licensed](LICENSE).