|
|
@@ -1,3 +1,4 @@
|
|
|
+import { SUPER_ADMIN_USER_IDENTIFIER, SUPER_ADMIN_USER_PASSWORD } from '@vendure/common/lib/shared-constants';
|
|
|
import fs from 'fs-extra';
|
|
|
import Handlebars from 'handlebars';
|
|
|
import path from 'path';
|
|
|
@@ -69,7 +70,10 @@ export async function gatherUserResponses(root: string): Promise<UserResponses>
|
|
|
type: 'select',
|
|
|
name: 'language',
|
|
|
message: 'Which programming language will you be using?',
|
|
|
- choices: [{ title: 'TypeScript', value: 'ts' }, { title: 'JavaScript', value: 'js' }],
|
|
|
+ choices: [
|
|
|
+ { title: 'TypeScript', value: 'ts' },
|
|
|
+ { title: 'JavaScript', value: 'js' },
|
|
|
+ ],
|
|
|
initial: 0 as any,
|
|
|
},
|
|
|
{
|
|
|
@@ -80,6 +84,18 @@ export async function gatherUserResponses(root: string): Promise<UserResponses>
|
|
|
active: 'yes',
|
|
|
inactive: 'no',
|
|
|
},
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ name: 'superadminIdentifier',
|
|
|
+ message: 'What identifier do you want to use for the superadmin user?',
|
|
|
+ initial: SUPER_ADMIN_USER_IDENTIFIER,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ name: 'superadminPassword',
|
|
|
+ message: 'What password do you want to use for the superadmin user?',
|
|
|
+ initial: SUPER_ADMIN_USER_PASSWORD,
|
|
|
+ },
|
|
|
],
|
|
|
{
|
|
|
onSubmit,
|
|
|
@@ -110,6 +126,8 @@ export async function gatherUserResponses(root: string): Promise<UserResponses>
|
|
|
usingTs: answers.language === 'ts',
|
|
|
dbType: answers.dbType,
|
|
|
populateProducts: answers.populateProducts,
|
|
|
+ superadminIdentifier: answers.superadminIdentifier,
|
|
|
+ superadminPassword: answers.superadminPassword,
|
|
|
};
|
|
|
}
|
|
|
|
|
|
@@ -126,6 +144,8 @@ export async function gatherCiUserResponses(root: string): Promise<UserResponses
|
|
|
dbPassword: '',
|
|
|
language: 'ts',
|
|
|
populateProducts: true,
|
|
|
+ superadminIdentifier: SUPER_ADMIN_USER_IDENTIFIER,
|
|
|
+ superadminPassword: SUPER_ADMIN_USER_PASSWORD,
|
|
|
};
|
|
|
const {
|
|
|
indexSource,
|
|
|
@@ -143,6 +163,8 @@ export async function gatherCiUserResponses(root: string): Promise<UserResponses
|
|
|
usingTs: ciAnswers.language === 'ts',
|
|
|
dbType: ciAnswers.dbType,
|
|
|
populateProducts: ciAnswers.populateProducts,
|
|
|
+ superadminIdentifier: ciAnswers.superadminIdentifier,
|
|
|
+ superadminPassword: ciAnswers.superadminPassword,
|
|
|
};
|
|
|
}
|
|
|
|
|
|
@@ -168,9 +190,7 @@ async function generateSources(
|
|
|
isSQLite: answers.dbType === 'sqlite',
|
|
|
isSQLjs: answers.dbType === 'sqljs',
|
|
|
requiresConnection: answers.dbType !== 'sqlite' && answers.dbType !== 'sqljs',
|
|
|
- sessionSecret: Math.random()
|
|
|
- .toString(36)
|
|
|
- .substr(3),
|
|
|
+ sessionSecret: Math.random().toString(36).substr(3),
|
|
|
};
|
|
|
const configTemplate = await fs.readFile(assetPath('vendure-config.hbs'), 'utf-8');
|
|
|
const configSource = Handlebars.compile(configTemplate)(templateContext);
|