@solidstarters/create-solid-app 1.2.40 → 1.2.42
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/helpers.js +1 -0
- package/package.json +1 -1
- package/templates/nest-template/src/app-default-database.module.ts +10 -28
- package/templates/nest-template/src/app.module.ts +3 -20
- package/templates/nest-template/src/main.ts +2 -3
- package/templates/next-template/next-solidx-run.js +18 -0
- package/templates/next-template/next.config.js +5 -0
- package/templates/next-template/package.json +3 -2
- package/templates/nest-template/src/app.config.ts +0 -7
package/helpers.js
CHANGED
|
@@ -194,6 +194,7 @@ export function getBackendEnvConfig(answers) {
|
|
|
194
194
|
export function getFrontendEnvJson(answers) {
|
|
195
195
|
const envConfig = {
|
|
196
196
|
"General": {
|
|
197
|
+
PORT: answers.solidUiPort,
|
|
197
198
|
API_URL: `http://localhost:${answers.solidApiPort}`, //FIXME duplicate of NEXT_PUBLIC_BACKEND_API_URL. need to cleanup
|
|
198
199
|
NEXTAUTH_URL: `http://localhost:${answers.solidUiPort}`,
|
|
199
200
|
NEXT_PUBLIC_BACKEND_API_URL: `http://localhost:${answers.solidApiPort}`,
|
package/package.json
CHANGED
|
@@ -27,36 +27,11 @@ const coreEntities = getEntitiesFromExports(SolidCoreModuleExports);
|
|
|
27
27
|
|
|
28
28
|
const entities = [
|
|
29
29
|
...coreEntities,
|
|
30
|
-
// ...coreModules.map(module =>
|
|
31
|
-
// join(__dirname, `./${module}/entities/*.entity.{ts,js}`)
|
|
32
|
-
// ),
|
|
33
|
-
// join(__dirname, './app-builder/entities/*.entity.{ts,js}'),
|
|
34
|
-
// join(__dirname, './common/entities/*.entity.{ts,js}'),
|
|
35
|
-
// join(__dirname, './iam/entities/*.entity.{ts,js}'),
|
|
36
|
-
// join(__dirname, './queues/entities/*.entity.{ts,js}'),
|
|
37
30
|
...dynamicModules.map(module =>
|
|
38
31
|
join(__dirname, `./${module}/entities/*.entity.{ts,js}`)
|
|
39
32
|
),
|
|
40
33
|
];
|
|
41
34
|
|
|
42
|
-
// DO NOT REMOVE BELOW COMMENT
|
|
43
|
-
// We no longer register subscribers on the TypeORM datasource.
|
|
44
|
-
// instead we register them directly as NestJS providers, and they register themselves as subscribers on the data source during service instantiation in their respective constructor.
|
|
45
|
-
// check ModelSubscriber for a reference.
|
|
46
|
-
// Steps are
|
|
47
|
-
// 1. Create the subscriber like a NestJS injectable service.
|
|
48
|
-
// 2. Register the subscriber in the respective module like you would any other NestJS service.
|
|
49
|
-
// 3. Make sure to not provide the subscribers array below.
|
|
50
|
-
// const subscribers = [
|
|
51
|
-
// join(__dirname, './app-builder/subscribers/*.subscriber.{ts,js}'),
|
|
52
|
-
// join(__dirname, './common/subscribers/*.subscriber.{ts,js}'),
|
|
53
|
-
// join(__dirname, './iam/subscribers/*.subscriber.{ts,js}'),
|
|
54
|
-
// join(__dirname, './queues/subscribers/*.subscriber.{ts,js}'),
|
|
55
|
-
// ...enabledModules.map(module =>
|
|
56
|
-
// join(__dirname, `./${module}/subscribers/*.subscriber.{ts,js}`)
|
|
57
|
-
// ),
|
|
58
|
-
// ];
|
|
59
|
-
|
|
60
35
|
return {
|
|
61
36
|
// type of our database.
|
|
62
37
|
type: 'postgres',
|
|
@@ -66,15 +41,22 @@ const coreEntities = getEntitiesFromExports(SolidCoreModuleExports);
|
|
|
66
41
|
password: process.env.DEFAULT_DATABASE_PASSWORD,
|
|
67
42
|
// name of our database
|
|
68
43
|
database: process.env.DEFAULT_DATABASE_NAME,
|
|
69
|
-
// models will be loaded automatically
|
|
70
|
-
// autoLoadEntities: true,
|
|
71
44
|
entities: entities,
|
|
72
45
|
// your entities will be synced with the database (recommended: disable in prod)
|
|
73
46
|
synchronize: parseBooleanEnv('DEFAULT_DATABASE_SYNCHRONIZE'),
|
|
74
47
|
logging: parseBooleanEnv('DEFAULT_DATABASE_LOGGING'),
|
|
75
48
|
logger: parseBooleanEnv('DEFAULT_DATABASE_LOGGING') ? new WinstonTypeORMLogger(logger) : undefined, // Pass in the custom WinstonLogger
|
|
76
49
|
namingStrategy: new SnakeNamingStrategy(),
|
|
77
|
-
|
|
50
|
+
maxQueryExecutionTime: 500,
|
|
51
|
+
extra: {
|
|
52
|
+
max: Number(process.env.DEFAULT_DATABASE_POOL_MAX ?? 20),
|
|
53
|
+
connectionTimeoutMillis: 30000,
|
|
54
|
+
idleTimeoutMillis: 30000,
|
|
55
|
+
statement_timeout: 15000,
|
|
56
|
+
idle_in_transaction_session_timeout: 60000,
|
|
57
|
+
},
|
|
58
|
+
retryAttempts: Number(process.env.DEFAULT_DATABASE_RETRY_ATTEMPTS ?? 0),
|
|
59
|
+
retryDelay: Number(process.env.DEFAULT_DATABASE_RETRY_DELAY_MS ?? 0),
|
|
78
60
|
}
|
|
79
61
|
},
|
|
80
62
|
inject: [WINSTON_MODULE_PROVIDER]
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import * as Joi from '@hapi/joi';
|
|
2
1
|
import { DynamicModule, Module } from '@nestjs/common';
|
|
3
2
|
import { ConfigModule } from '@nestjs/config';
|
|
4
|
-
import { SolidCoreModule } from '@solidstarters/solid-core';
|
|
5
|
-
import appConfig from './app.config';
|
|
6
|
-
import { AppService } from './app.service';
|
|
7
3
|
import { EventEmitterModule } from '@nestjs/event-emitter';
|
|
8
|
-
import {
|
|
4
|
+
import { SolidCoreModule, WinstonLoggerConfig } from '@solidstarters/solid-core';
|
|
9
5
|
import { WinstonModule } from 'nest-winston';
|
|
10
|
-
import { WinstonLoggerConfig } from '@solidstarters/solid-core';
|
|
11
6
|
import { ClsModule } from 'nestjs-cls';
|
|
7
|
+
import { DefaultDBModule } from './app-default-database.module';
|
|
8
|
+
import { AppService } from './app.service';
|
|
12
9
|
|
|
13
10
|
|
|
14
11
|
@Module({
|
|
@@ -18,20 +15,6 @@ import { ClsModule } from 'nestjs-cls';
|
|
|
18
15
|
|
|
19
16
|
ConfigModule.forRoot({
|
|
20
17
|
isGlobal: true,
|
|
21
|
-
// Here we are specifying the path of the environment file.
|
|
22
|
-
// If not specified then it assumes a file named .env
|
|
23
|
-
// envFilePath: '.environment'
|
|
24
|
-
|
|
25
|
-
// This we do in live environments, where these variables should ideally come
|
|
26
|
-
// from the OS provided environment.
|
|
27
|
-
// ignoreEnvFile: true
|
|
28
|
-
|
|
29
|
-
validationSchema: Joi.object({
|
|
30
|
-
DEFAULT_DATABASE_HOST: Joi.required(),
|
|
31
|
-
DEFAULT_DATABASE_PORT: Joi.number().default(5432),
|
|
32
|
-
}),
|
|
33
|
-
|
|
34
|
-
load: [appConfig],
|
|
35
18
|
}),
|
|
36
19
|
|
|
37
20
|
DefaultDBModule,
|
|
@@ -49,8 +49,7 @@ async function bootstrap() {
|
|
|
49
49
|
app.useLogger(app.get(WINSTON_MODULE_NEST_PROVIDER));
|
|
50
50
|
|
|
51
51
|
// Making the port dynamic
|
|
52
|
-
const
|
|
53
|
-
const port = configService.get<number>('PORT') || 3000;
|
|
52
|
+
const port = process.env.PORT || 3000;
|
|
54
53
|
|
|
55
54
|
app.setGlobalPrefix('api');
|
|
56
55
|
// Middleware to parse deeply nested queries
|
|
@@ -109,7 +108,7 @@ async function bootstrap() {
|
|
|
109
108
|
new WrapResponseInterceptor(),
|
|
110
109
|
);
|
|
111
110
|
|
|
112
|
-
app.enableCors(buildDefaultCorsOptions(
|
|
111
|
+
app.enableCors(buildDefaultCorsOptions());
|
|
113
112
|
|
|
114
113
|
// https://github.com/typeorm/typeorm/issues/8583
|
|
115
114
|
const types = require('pg').types;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawn } = require("child_process");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
// Load .env (and .env.local if you use it)
|
|
6
|
+
require("dotenv").config({ path: path.resolve(process.cwd(), ".env") });
|
|
7
|
+
|
|
8
|
+
const port = process.env.PORT || "3001";
|
|
9
|
+
|
|
10
|
+
const mode = process.argv[2]; // "dev" or "start"
|
|
11
|
+
const args =
|
|
12
|
+
mode === "dev"
|
|
13
|
+
? ["dev", "-p", port]
|
|
14
|
+
: ["start", "-p", port];
|
|
15
|
+
|
|
16
|
+
const child = spawn("next", args, { stdio: "inherit", shell: true });
|
|
17
|
+
|
|
18
|
+
child.on("exit", (code) => process.exit(code ?? 0));
|
|
@@ -26,6 +26,11 @@ const nextConfig = {
|
|
|
26
26
|
images: {
|
|
27
27
|
remotePatterns: getRemotePatterns(),
|
|
28
28
|
},
|
|
29
|
+
productionBrowserSourceMaps: true,
|
|
30
|
+
transpilePackages: ['@solidstarters/solid-core-ui'],
|
|
31
|
+
experimental: {
|
|
32
|
+
externalDir: true,
|
|
33
|
+
},
|
|
29
34
|
};
|
|
30
35
|
|
|
31
36
|
function getRemotePatterns(){
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "copyfiles -u 5 \"node_modules/@solidstarters/solid-core-ui/dist/resources/themes/**/*\" public",
|
|
7
|
-
"dev": "next dev",
|
|
8
7
|
"build": "next build",
|
|
9
|
-
"start": "next start",
|
|
10
8
|
"lint": "next lint",
|
|
11
9
|
"seeder": "tsc seeder/seeder.ts --outDir .temp && node .temp/seeder/seeder.js && rm -rf .temp",
|
|
10
|
+
"dev": "node next-solidx-run.js dev",
|
|
11
|
+
"start": "node next-solidx-run.js start",
|
|
12
12
|
"solidx:dev": "rm -rf .next && npm run dev"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"chart.js": "^4.4.3",
|
|
26
26
|
"cloudinary": "^1.40.0",
|
|
27
27
|
"codemirror": "^6.0.1",
|
|
28
|
+
"dotenv": "^17.2.3",
|
|
28
29
|
"formik": "^2.4.6",
|
|
29
30
|
"html2canvas": "^1.4.1",
|
|
30
31
|
"jspdf": "^2.5.1",
|