@reldens/cms 0.3.0 → 0.4.0
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/install/css/installer.css +1 -2
- package/install/img/favicon.ico +0 -0
- package/install/img/loading.gif +0 -0
- package/install/index.html +1 -1
- package/lib/installer.js +10 -20
- package/lib/manager.js +1 -1
- package/package.json +2 -2
|
Binary file
|
|
Binary file
|
package/install/index.html
CHANGED
package/lib/installer.js
CHANGED
|
@@ -66,11 +66,9 @@ class Installer
|
|
|
66
66
|
if('' === req._parsedUrl.pathname || '/' === req._parsedUrl.pathname){
|
|
67
67
|
let installerIndexPath = FileHandler.joinPaths(this.installerPath, 'index.html');
|
|
68
68
|
if(!FileHandler.exists(installerIndexPath)){
|
|
69
|
-
return res.status(500).send('Installer template not found');
|
|
69
|
+
return res.status(500).send('Installer template not found.');
|
|
70
70
|
}
|
|
71
|
-
let content = FileHandler.readFile(installerIndexPath
|
|
72
|
-
encoding: this.encoding
|
|
73
|
-
});
|
|
71
|
+
let content = FileHandler.readFile(installerIndexPath);
|
|
74
72
|
return res.send(mustache.render(content, req.session?.templateVariables || this.fetchDefaults()));
|
|
75
73
|
}
|
|
76
74
|
next();
|
|
@@ -111,12 +109,12 @@ class Installer
|
|
|
111
109
|
return res.redirect('/?error=connection-failed');
|
|
112
110
|
}
|
|
113
111
|
if(!sc.isObjectFunction(dbDriver, 'rawQuery')){
|
|
114
|
-
Logger.error('Method "rawQuery" not found');
|
|
112
|
+
Logger.error('Method "rawQuery" not found.');
|
|
115
113
|
return res.redirect('/?error=raw-query-not-found');
|
|
116
114
|
}
|
|
117
115
|
let installSqlPath = FileHandler.joinPaths(this.migrationsPath, 'install.sql');
|
|
118
116
|
if(!FileHandler.exists(installSqlPath)){
|
|
119
|
-
Logger.error('SQL installation file not found');
|
|
117
|
+
Logger.error('SQL installation file not found.');
|
|
120
118
|
return res.redirect('/?error=sql-file-not-found');
|
|
121
119
|
}
|
|
122
120
|
await this.executeQueryFile(dbDriver, installSqlPath);
|
|
@@ -127,11 +125,7 @@ class Installer
|
|
|
127
125
|
await this.executeQueryFile(dbDriver, defaultUserSqlPath);
|
|
128
126
|
Logger.info('Created default user.');
|
|
129
127
|
}
|
|
130
|
-
|
|
131
|
-
client: dbConfig.client,
|
|
132
|
-
connection: dbConfig.config
|
|
133
|
-
};
|
|
134
|
-
await this.generateEntities(connectionData);
|
|
128
|
+
await this.generateEntities(dbDriver);
|
|
135
129
|
Logger.info('Generated entities.');
|
|
136
130
|
} catch (error) {
|
|
137
131
|
Logger.error('Installation error: '+error.message);
|
|
@@ -155,18 +149,16 @@ class Installer
|
|
|
155
149
|
|
|
156
150
|
async executeQueryFile(dbDriver, filePath)
|
|
157
151
|
{
|
|
158
|
-
let sqlContent = FileHandler.readFile(filePath
|
|
159
|
-
encoding: this.encoding
|
|
160
|
-
});
|
|
152
|
+
let sqlContent = FileHandler.readFile(filePath);
|
|
161
153
|
if(!sqlContent){
|
|
162
154
|
throw new Error('Could not read SQL file: '+filePath);
|
|
163
155
|
}
|
|
164
156
|
return await dbDriver.rawQuery(sqlContent.toString());
|
|
165
157
|
}
|
|
166
158
|
|
|
167
|
-
async generateEntities(
|
|
159
|
+
async generateEntities(server)
|
|
168
160
|
{
|
|
169
|
-
let generator = new EntitiesGenerator({
|
|
161
|
+
let generator = new EntitiesGenerator({server, projectPath: this.projectRoot});
|
|
170
162
|
let success = await generator.generate();
|
|
171
163
|
if(!success){
|
|
172
164
|
Logger.error('Entities generation failed.');
|
|
@@ -197,9 +189,7 @@ class Installer
|
|
|
197
189
|
Logger.error('ENV template not found: '+envTemplatePath);
|
|
198
190
|
return false;
|
|
199
191
|
}
|
|
200
|
-
let envTemplate = FileHandler.readFile(envTemplatePath
|
|
201
|
-
encoding: this.encoding
|
|
202
|
-
});
|
|
192
|
+
let envTemplate = FileHandler.readFile(envTemplatePath);
|
|
203
193
|
let envContent = mustache.render(envTemplate, {
|
|
204
194
|
dbClient: templateVariables['db-client'],
|
|
205
195
|
dbHost: templateVariables['db-host'],
|
|
@@ -270,7 +260,7 @@ class Installer
|
|
|
270
260
|
'app-port': process.env.RELDENS_CMS_PORT || '3000',
|
|
271
261
|
'app-admin-path': process.env.RELDENS_CMS_ADMIN_PATH || '/reldens-admin',
|
|
272
262
|
'db-storage-driver': 'prisma',
|
|
273
|
-
'db-client': process.env.RELDENS_CMS_DB_CLIENT || '
|
|
263
|
+
'db-client': process.env.RELDENS_CMS_DB_CLIENT || 'mysql',
|
|
274
264
|
'db-host': process.env.RELDENS_CMS_DB_HOST || 'localhost',
|
|
275
265
|
'db-port': process.env.RELDENS_CMS_DB_PORT || '3306',
|
|
276
266
|
'db-name': process.env.RELDENS_CMS_DB_NAME || 'reldens_cms',
|
package/lib/manager.js
CHANGED
|
@@ -44,7 +44,7 @@ class Manager
|
|
|
44
44
|
adminPath: process.env.RELDENS_CMS_ADMIN_PATH || '/reldens-admin',
|
|
45
45
|
adminSecret: process.env.RELDENS_CMS_ADMIN_SECRET || '',
|
|
46
46
|
database: {
|
|
47
|
-
client: process.env.RELDENS_CMS_DB_CLIENT || '
|
|
47
|
+
client: process.env.RELDENS_CMS_DB_CLIENT || 'mysql',
|
|
48
48
|
host: process.env.RELDENS_CMS_DB_HOST || 'localhost',
|
|
49
49
|
port: Number(process.env.RELDENS_CMS_DB_PORT || 3306),
|
|
50
50
|
name: process.env.RELDENS_CMS_DB_NAME || 'reldens_cms',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reldens/cms",
|
|
3
3
|
"scope": "@reldens",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"description": "Reldens - CMS",
|
|
6
6
|
"author": "Damian A. Pastorini",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@reldens/server-utils": "^0.16.0",
|
|
36
|
-
"@reldens/storage": "^0.
|
|
36
|
+
"@reldens/storage": "^0.37.0",
|
|
37
37
|
"@reldens/utils": "^0.47.0",
|
|
38
38
|
"dotenv": "^16.5.0",
|
|
39
39
|
"mustache": "^4.2.0"
|