or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

configuration.mddatabase.mdgeneration.mdindex.mdtemplates.md

configuration.mddocs/

0

# Options and Configuration

1

2

Comprehensive configuration options and validation utilities for customizing Strapi application generation.

3

4

## Capabilities

5

6

### New Options Interface

7

8

Complete configuration interface for application generation options.

9

10

```typescript { .api }

11

/**

12

* Configuration options for creating a new Strapi application

13

*/

14

interface NewOptions {

15

/** Force use of npm instead of yarn even if yarn is available */

16

useNpm: boolean;

17

/** Whether to run the application after creation (default: true) */

18

run: boolean;

19

/** Enable debug mode with additional logging */

20

debug: boolean;

21

/** Use quickstart mode with SQLite (skip database prompts) */

22

quickstart: boolean;

23

/** Template URL or npm package name for custom project template */

24

template: string;

25

/** Starter configuration name */

26

starter: string;

27

/** Generate TypeScript project instead of JavaScript */

28

typescript: boolean;

29

/** Force database configuration without connection testing */

30

dbforce: boolean;

31

/** Database SSL configuration */

32

dbssl: string;

33

/** Database client type (mysql, postgres, sqlite) */

34

dbclient: string;

35

/** Database host address */

36

dbhost: string;

37

/** Database port number */

38

dbport: string;

39

/** Database name */

40

dbname: string;

41

/** Database username */

42

dbusername: string;

43

/** Database password */

44

dbpassword: string;

45

/** SQLite database file path */

46

dbfile: string;

47

}

48

```

49

50

### Scope Configuration

51

52

Internal configuration object that contains all generation parameters and derived settings.

53

54

```typescript { .api }

55

/**

56

* Complete configuration scope for project generation

57

*/

58

interface Scope {

59

/** Project name (derived from directory name) */

60

name?: string;

61

/** Absolute path to project root directory */

62

rootPath: string;

63

/** Template URL or package name */

64

template?: string;

65

/** Strapi version to install */

66

strapiVersion: string;

67

/** Core Strapi dependencies to install */

68

strapiDependencies: Array<string>;

69

/** Whether to install dependencies automatically */

70

installDependencies?: boolean;

71

/** Additional dependencies (React, etc.) */

72

additionalsDependencies: Record<string, string>;

73

/** Whether running in Docker environment */

74

docker: boolean;

75

/** Whether to use Yarn package manager */

76

useYarn: boolean;

77

/** Whether to generate TypeScript project */

78

useTypescript: boolean;

79

/** Whether to run app after quickstart creation */

80

runQuickstartApp: boolean;

81

/** Whether in quickstart mode */

82

quick?: boolean;

83

/** Unique project identifier */

84

uuid?: string;

85

/** Machine identifier for telemetry */

86

deviceId?: string;

87

/** Force database configuration */

88

dbforce?: boolean;

89

/** Database configuration */

90

database?: DatabaseInfo;

91

/** Debug mode enabled */

92

debug?: boolean;

93

/** Temporary directory path */

94

tmpPath: string;

95

/** Package.json Strapi-specific configuration */

96

packageJsonStrapi: Record<string, unknown>;

97

}

98

```

99

100

### Installation Path Validation

101

102

Validates that the target directory is suitable for creating a new Strapi application.

103

104

```typescript { .api }

105

/**

106

* Validates that target directory exists and is empty

107

* @param rootPath - Absolute path to target directory

108

* @throws Error if path is not a directory or not empty

109

*/

110

function checkInstallPath(rootPath: string): Promise<void>;

111

```

112

113

**Validation Rules:**

114

- Path must exist or be creatable

115

- If path exists, it must be a directory

116

- Directory must be empty (max 1 file allowed)

117

- Provides clear error messages for validation failures

118

119

**Usage Examples:**

120

121

```typescript

122

import { checkInstallPath } from "@strapi/generate-new";

123

124

// Validate before generation

125

try {

126

await checkInstallPath("./my-new-app");

127

console.log("Path is valid for Strapi app creation");

128

} catch (error) {

129

console.error("Invalid path:", error.message);

130

}

131

```

132

133

### System Requirements Validation

134

135

Internal system requirements checking functionality.

136

137

```typescript { .api }

138

/**

139

* Validates system requirements for Strapi generation

140

* Checks Node.js version and other system prerequisites

141

*/

142

function checkRequirements(): void;

143

```

144

145

### Package Manager Detection

146

147

Automatic detection of available package managers.

148

149

```typescript { .api }

150

/**

151

* Detects if Yarn is available on the system

152

* @returns true if yarn command is available

153

*/

154

function hasYarn(): boolean;

155

```

156

157

### Database Argument Parsing

158

159

Parses and validates database configuration from command-line arguments.

160

161

```typescript { .api }

162

/**

163

* Parses database arguments from options and populates scope

164

* @param params - Object containing scope and command-line args

165

*/

166

function parseDatabaseArguments(params: {

167

scope: Scope;

168

args: Partial<NewOptions>;

169

}): void;

170

```

171

172

## Default Configuration Values

173

174

The generator includes sensible defaults:

175

176

```typescript

177

// Default Strapi dependencies

178

const defaultStrapiDependencies = [

179

'@strapi/strapi',

180

'@strapi/plugin-users-permissions',

181

'@strapi/plugin-i18n',

182

'@strapi/plugin-cloud'

183

];

184

185

// Default additional dependencies

186

const defaultAdditionalDependencies = {

187

'react': '^18.0.0',

188

'react-dom': '^18.0.0',

189

'react-router-dom': '5.3.4',

190

'styled-components': '5.3.3'

191

};

192

193

// Default database configuration (SQLite)

194

const defaultDatabase = {

195

client: 'sqlite',

196

connection: {

197

filename: '.tmp/data.db'

198

},

199

useNullAsDefault: true

200

};

201

```

202

203

## Environment Detection

204

205

The generator automatically detects and configures for various environments:

206

207

```typescript

208

// Docker detection

209

const isDocker = process.env.DOCKER === 'true';

210

211

// Package manager preference

212

const useYarn = !options.useNpm && hasYarn();

213

214

// UUID prefix support

215

const uuid = (process.env.STRAPI_UUID_PREFIX || '') + crypto.randomUUID();

216

```

217

218

## Error Handling Configuration

219

220

Configuration includes comprehensive error tracking setup:

221

222

```typescript

223

// Sentry configuration for error tracking

224

sentry.init({

225

dsn: 'https://841d2b2c9b4d4b43a4cde92794cb705a@sentry.io/1762059'

226

});

227

228

// Telemetry tags

229

const telemetryTags = {

230

os: os.type(),

231

osPlatform: os.platform(),

232

osArch: os.arch(),

233

osRelease: os.release(),

234

version: scope.strapiVersion,

235

nodeVersion: process.versions.node,

236

docker: scope.docker

237

};

238

```