zibri-cli 1.0.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/LICENSE +21 -0
- package/README.md +1 -0
- package/assets/public/assets.svg +1 -0
- package/assets/public/favicon.ico +0 -0
- package/assets/public/favicon.png +0 -0
- package/assets/public/logo.jpg +0 -0
- package/assets/public/open-api/custom.css +72 -0
- package/assets/public/open-api/swagger-ui-bundle.js +2 -0
- package/assets/public/open-api/swagger-ui-standalone-preset.js +2 -0
- package/assets/public/open-api/swagger-ui.css +3 -0
- package/assets/public/open-api/swagger.png +0 -0
- package/assets/public/style.css +123 -0
- package/dist/commands/base-command.model.js +61 -0
- package/dist/commands/base-command.model.js.map +1 -0
- package/dist/commands/command.enum.js +16 -0
- package/dist/commands/command.enum.js.map +1 -0
- package/dist/commands/help/help.command.js +23 -0
- package/dist/commands/help/help.command.js.map +1 -0
- package/dist/commands/help/index.js +5 -0
- package/dist/commands/help/index.js.map +1 -0
- package/dist/commands/index.js +9 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/is-command.function.js +13 -0
- package/dist/commands/is-command.function.js.map +1 -0
- package/dist/commands/new/index.js +5 -0
- package/dist/commands/new/index.js.map +1 -0
- package/dist/commands/new/new.command.js +344 -0
- package/dist/commands/new/new.command.js.map +1 -0
- package/dist/commands/resolve-command.function.js +22 -0
- package/dist/commands/resolve-command.function.js.map +1 -0
- package/dist/commands/version/index.js +5 -0
- package/dist/commands/version/index.js.map +1 -0
- package/dist/commands/version/version.command.js +25 -0
- package/dist/commands/version/version.command.js.map +1 -0
- package/dist/constants.js +14 -0
- package/dist/constants.js.map +1 -0
- package/dist/encapsulation/chalk.utilities.js +54 -0
- package/dist/encapsulation/chalk.utilities.js.map +1 -0
- package/dist/encapsulation/cp.utilities.js +42 -0
- package/dist/encapsulation/cp.utilities.js.map +1 -0
- package/dist/encapsulation/death.utilities.js +19 -0
- package/dist/encapsulation/death.utilities.js.map +1 -0
- package/dist/encapsulation/figlet.utilities.js +20 -0
- package/dist/encapsulation/figlet.utilities.js.map +1 -0
- package/dist/encapsulation/fs.utilities.js +238 -0
- package/dist/encapsulation/fs.utilities.js.map +1 -0
- package/dist/encapsulation/index.js +10 -0
- package/dist/encapsulation/index.js.map +1 -0
- package/dist/encapsulation/inquirer.utilities.js +54 -0
- package/dist/encapsulation/inquirer.utilities.js.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/utilities/exit-gracefully.function.js +22 -0
- package/dist/utilities/exit-gracefully.function.js.map +1 -0
- package/dist/utilities/exit-with-error.function.js +19 -0
- package/dist/utilities/exit-with-error.function.js.map +1 -0
- package/dist/utilities/exit-with-interrupt.function.js +15 -0
- package/dist/utilities/exit-with-interrupt.function.js.map +1 -0
- package/dist/utilities/get-path.function.js +26 -0
- package/dist/utilities/get-path.function.js.map +1 -0
- package/dist/utilities/index.js +10 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/is-error-with-signal.function.js +13 -0
- package/dist/utilities/is-error-with-signal.function.js.map +1 -0
- package/dist/utilities/is-exit-prompt-error.function.js +12 -0
- package/dist/utilities/is-exit-prompt-error.function.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isCommand = isCommand;
|
|
4
|
+
const command_enum_1 = require("./command.enum");
|
|
5
|
+
/**
|
|
6
|
+
* Whether or not the given string is a command.
|
|
7
|
+
* @param value - The value to check.
|
|
8
|
+
* @returns True when it is included in the Command enum, false otherwise.
|
|
9
|
+
*/
|
|
10
|
+
function isCommand(value) {
|
|
11
|
+
return Object.values(command_enum_1.Command).includes(value);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=is-command.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-command.function.js","sourceRoot":"","sources":["../../src/commands/is-command.function.ts"],"names":[],"mappings":";;AAOA,8BAEC;AATD,iDAAyC;AAEzC;;;;GAIG;AACH,SAAgB,SAAS,CAAC,KAAa;IACnC,OAAO,MAAM,CAAC,MAAM,CAAC,sBAAO,CAAC,CAAC,QAAQ,CAAC,KAAgB,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/new/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B"}
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NewCommand = void 0;
|
|
4
|
+
/* eslint-disable no-console */
|
|
5
|
+
const encapsulation_1 = require("../../encapsulation");
|
|
6
|
+
const utilities_1 = require("../../utilities");
|
|
7
|
+
const base_command_model_1 = require("../base-command.model");
|
|
8
|
+
const newConfigurationQuestions = {
|
|
9
|
+
name: {
|
|
10
|
+
type: 'input',
|
|
11
|
+
message: 'name'
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new Zibri application.
|
|
16
|
+
*/
|
|
17
|
+
class NewCommand extends base_command_model_1.BaseCommand {
|
|
18
|
+
maxLength = 2;
|
|
19
|
+
async run(configuration) {
|
|
20
|
+
console.log('creates a new zibri application', configuration.name);
|
|
21
|
+
const appPath = (0, utilities_1.getPath)(configuration.name);
|
|
22
|
+
if (await encapsulation_1.FsUtilities.exists(appPath)) {
|
|
23
|
+
await (0, utilities_1.exitWithError)(`Could not create folder "${appPath}": It already exists`);
|
|
24
|
+
}
|
|
25
|
+
await encapsulation_1.FsUtilities.mkdir(appPath);
|
|
26
|
+
await encapsulation_1.CPUtilities.exec(`cd ${appPath} && npm init -y`);
|
|
27
|
+
// eslint-disable-next-line stylistic/max-len
|
|
28
|
+
await encapsulation_1.CPUtilities.exec(`cd ${appPath} && npm i -D copy-webpack-plugin@^13.0.0 source-map-loader@^5.0.0 ts-loader@^9.5.2 handlebars-loader@^1.7.3 typescript@^5.8.3 webpack@^5.99.8 webpack-cli@^6.0.1`);
|
|
29
|
+
await encapsulation_1.CPUtilities.exec(`cd ${appPath} && npm i zibri`);
|
|
30
|
+
await encapsulation_1.FsUtilities.replaceInFile((0, utilities_1.getPath)(appPath, 'package.json'), 'index.js', './dist/index.js');
|
|
31
|
+
await encapsulation_1.FsUtilities.replaceInFile((0, utilities_1.getPath)(appPath, 'package.json'), ' "test": "echo \\"Error: no test specified\\" && exit 1"', ' "start": "webpack --watch",\n "build": "webpack"');
|
|
32
|
+
await this.createTsConfig(appPath);
|
|
33
|
+
await this.createWebpackConfig(appPath);
|
|
34
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'index.ts'), [
|
|
35
|
+
'import { EmailConfigInput, inject, isVersion, LoggerInterface, ZIBRI_DI_TOKENS, ZibriApplication } from \'zibri\';',
|
|
36
|
+
'import { DbDataSource } from \'./data-sources\';',
|
|
37
|
+
'import { version } from \'../package.json\';',
|
|
38
|
+
'import { UserRepository } from \'./repositories\';',
|
|
39
|
+
'',
|
|
40
|
+
'export let logger: LoggerInterface;',
|
|
41
|
+
'',
|
|
42
|
+
'async function start(): Promise<void> {',
|
|
43
|
+
'',
|
|
44
|
+
'if (!isVersion(version)) {',
|
|
45
|
+
' throw new Error(\'The version of the package.json is not valid.\');',
|
|
46
|
+
'}',
|
|
47
|
+
'',
|
|
48
|
+
' const app = new ZibriApplication({',
|
|
49
|
+
` name: '${configuration.name}',`,
|
|
50
|
+
' version,',
|
|
51
|
+
' baseUrl: \'http://localhost:3000\',',
|
|
52
|
+
' controllers: [],',
|
|
53
|
+
' dataSources: [DbDataSource],',
|
|
54
|
+
' providers: [',
|
|
55
|
+
' { token: UserRepository, useClass: UserRepository},',
|
|
56
|
+
' {',
|
|
57
|
+
' token: ZIBRI_DI_TOKENS.JWT_ACCESS_TOKEN_SECRET,',
|
|
58
|
+
' useFactory: () => \'test\'',
|
|
59
|
+
' },',
|
|
60
|
+
' {',
|
|
61
|
+
' token: ZIBRI_DI_TOKENS.JWT_REFRESH_TOKEN_SECRET,',
|
|
62
|
+
' useFactory: () => \'test\'',
|
|
63
|
+
' },',
|
|
64
|
+
' {',
|
|
65
|
+
' token: ZIBRI_DI_TOKENS.EMAIL_CONFIG,',
|
|
66
|
+
' useFactory: (): EmailConfigInput => {',
|
|
67
|
+
' return {',
|
|
68
|
+
' maxEmailsPerHour: 0,',
|
|
69
|
+
' defaultSender: \'\',',
|
|
70
|
+
' host: \'\',',
|
|
71
|
+
' port: 0,',
|
|
72
|
+
' auth: {',
|
|
73
|
+
' user: \'\',',
|
|
74
|
+
' pass: \'\'',
|
|
75
|
+
' }',
|
|
76
|
+
' };',
|
|
77
|
+
' }',
|
|
78
|
+
' },',
|
|
79
|
+
' {',
|
|
80
|
+
' token: ZIBRI_DI_TOKENS.JWT_CONFIRM_PASSWORD_RESET_URL,',
|
|
81
|
+
' useFactory: () => \'http://localhost:4200/confirm-password-reset\'',
|
|
82
|
+
' }',
|
|
83
|
+
' ]',
|
|
84
|
+
' });',
|
|
85
|
+
' await app.init();',
|
|
86
|
+
'',
|
|
87
|
+
' logger = inject(ZIBRI_DI_TOKENS.LOGGER);',
|
|
88
|
+
'',
|
|
89
|
+
' app.start(3000);',
|
|
90
|
+
'}',
|
|
91
|
+
'',
|
|
92
|
+
'void start();'
|
|
93
|
+
]);
|
|
94
|
+
await this.createDataSource(appPath);
|
|
95
|
+
await this.createRepositories(appPath);
|
|
96
|
+
await this.createModels(appPath);
|
|
97
|
+
await encapsulation_1.FsUtilities.copyDirectoryContent((0, utilities_1.getPath)(__dirname, '..', '..', '..', 'assets'), (0, utilities_1.getPath)(appPath, 'assets'));
|
|
98
|
+
await encapsulation_1.FsUtilities.copyDirectoryContent((0, utilities_1.getPath)(__dirname, '..', '..', '..', 'templates'), (0, utilities_1.getPath)(appPath, 'src', 'templates'));
|
|
99
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'controllers', 'index.ts'), '');
|
|
100
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'cron', 'index.ts'), '');
|
|
101
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'services', 'index.ts'), '');
|
|
102
|
+
}
|
|
103
|
+
async createModels(appPath) {
|
|
104
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'models', 'index.ts'), [
|
|
105
|
+
'export * from \'./user.model\';',
|
|
106
|
+
'export * from \'./roles.enum\';'
|
|
107
|
+
]);
|
|
108
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'models', 'roles.enum.ts'), [
|
|
109
|
+
'export enum Roles {',
|
|
110
|
+
' USER = \'user\',',
|
|
111
|
+
' ADMIN = \'admin\'',
|
|
112
|
+
'}'
|
|
113
|
+
]);
|
|
114
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'models', 'user.model.ts'), [
|
|
115
|
+
'import { BaseUser, Entity, CombinedType, JwtCredentials, OmitType, Property } from \'zibri\';',
|
|
116
|
+
'',
|
|
117
|
+
'import { Roles } from \'./roles.enum\';',
|
|
118
|
+
'',
|
|
119
|
+
'@Entity()',
|
|
120
|
+
'export class User implements BaseUser<Roles> {',
|
|
121
|
+
' @Property.string({ primary: true })',
|
|
122
|
+
' id!: string;',
|
|
123
|
+
'',
|
|
124
|
+
' @Property.string({ unique: true, format: \'email\' })',
|
|
125
|
+
' email!: string;',
|
|
126
|
+
'',
|
|
127
|
+
' @Property.array({ items: { type: \'string\', enum: Roles } })',
|
|
128
|
+
' roles!: Roles[];',
|
|
129
|
+
'}',
|
|
130
|
+
'',
|
|
131
|
+
'export class UserCreateDto extends CombinedType(',
|
|
132
|
+
' OmitType(User, [\'id\', \'roles\']),',
|
|
133
|
+
' OmitType(JwtCredentials, [\'id\', \'userId\', \'email\'])',
|
|
134
|
+
') {}',
|
|
135
|
+
'',
|
|
136
|
+
'export type UserCreateData = Omit<User, \'id\'>;'
|
|
137
|
+
]);
|
|
138
|
+
}
|
|
139
|
+
async createRepositories(appPath) {
|
|
140
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'repositories', 'index.ts'), 'export * from \'./user.repository\';');
|
|
141
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'repositories', 'user.repository.ts'), [
|
|
142
|
+
// eslint-disable-next-line stylistic/max-len
|
|
143
|
+
'import { inject, InjectRepository, JwtCredentials, Repository, repositoryTokenFor, UserRepo, UserRepositoryInterface } from \'zibri\';',
|
|
144
|
+
'',
|
|
145
|
+
'import { Roles, User, UserCreateData } from \'../models\';',
|
|
146
|
+
'',
|
|
147
|
+
'@UserRepo()',
|
|
148
|
+
'export class UserRepository extends Repository<User, UserCreateData>',
|
|
149
|
+
' implements UserRepositoryInterface<Roles, User, JwtCredentials> {',
|
|
150
|
+
'',
|
|
151
|
+
' constructor(',
|
|
152
|
+
' @InjectRepository(User)',
|
|
153
|
+
' repo: Repository<User>',
|
|
154
|
+
' ) {',
|
|
155
|
+
' super(User, repo);',
|
|
156
|
+
' }',
|
|
157
|
+
'',
|
|
158
|
+
' async findByEmail(email: string): Promise<User> {',
|
|
159
|
+
' return await this.findOne({ where: { email } });',
|
|
160
|
+
' }',
|
|
161
|
+
'',
|
|
162
|
+
' async resolveCredentialsFor(user: User): Promise<JwtCredentials> {',
|
|
163
|
+
' const repo: Repository<JwtCredentials> = inject(repositoryTokenFor(JwtCredentials));',
|
|
164
|
+
' return repo.findOne({ where: { userId: user.id } });',
|
|
165
|
+
' }',
|
|
166
|
+
'}'
|
|
167
|
+
]);
|
|
168
|
+
}
|
|
169
|
+
async createDataSource(appPath) {
|
|
170
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'data-sources', 'db', 'db.data-source.ts'), [
|
|
171
|
+
// eslint-disable-next-line stylistic/max-len
|
|
172
|
+
'import { BaseDataSource, BaseEntity, DataSource, Newable, DataSourceOptions, MigrationEntity, MailingListSubscriptionConfirmationToken, JwtRefreshToken, JwtCredentials, PasswordResetToken } from "zibri";',
|
|
173
|
+
'',
|
|
174
|
+
'import { User } from \'../../models\';',
|
|
175
|
+
'',
|
|
176
|
+
'@DataSource()',
|
|
177
|
+
'export class DbDataSource extends BaseDataSource {',
|
|
178
|
+
' options: DataSourceOptions = {',
|
|
179
|
+
' type: \'postgres\',',
|
|
180
|
+
' host: \'localhost\',',
|
|
181
|
+
' port: 5432,',
|
|
182
|
+
' username: \'postgres\',',
|
|
183
|
+
' password: \'password\',',
|
|
184
|
+
' database: \'db\',',
|
|
185
|
+
' synchronize: true',
|
|
186
|
+
' };',
|
|
187
|
+
' entities: Newable<BaseEntity>[] = [',
|
|
188
|
+
' MigrationEntity,',
|
|
189
|
+
' User,',
|
|
190
|
+
' JwtRefreshToken,',
|
|
191
|
+
' JwtCredentials,',
|
|
192
|
+
' PasswordResetToken,',
|
|
193
|
+
' MailingList,',
|
|
194
|
+
' MailingListSubscriber,',
|
|
195
|
+
' MailingListSubscriptionConfirmationToken',
|
|
196
|
+
' ];',
|
|
197
|
+
'}'
|
|
198
|
+
]);
|
|
199
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'data-sources', 'db', 'migrations', 'index.ts'), '');
|
|
200
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'data-sources', 'db', 'index.ts'), 'export * from \'./db.data-source\';');
|
|
201
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'src', 'data-sources', 'index.ts'), 'export * from \'./db\';');
|
|
202
|
+
}
|
|
203
|
+
async createWebpackConfig(appPath) {
|
|
204
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'webpack.config.js'), [
|
|
205
|
+
'const path = require(\'path\');',
|
|
206
|
+
'const { spawn } = require(\'child_process\');',
|
|
207
|
+
'const CopyPlugin = require(\'copy-webpack-plugin\');',
|
|
208
|
+
'const { IgnorePlugin } = require(\'webpack\');',
|
|
209
|
+
'const { generateHandlebarTypeFiles } = require(\'zibri\');',
|
|
210
|
+
'',
|
|
211
|
+
'class OnBuildSuccessPlugin {',
|
|
212
|
+
' /** @type {import(\'webpack\').WebpackPluginFunction } */',
|
|
213
|
+
' apply(compiler) {',
|
|
214
|
+
' compiler.hooks.done.tap(\'OnBuildSuccessPlugin\', stats => {',
|
|
215
|
+
' if (stats.hasErrors() || compiler.watchMode === false) {',
|
|
216
|
+
' return;',
|
|
217
|
+
' }',
|
|
218
|
+
'',
|
|
219
|
+
' if (this.serverProcess) {',
|
|
220
|
+
' this.serverProcess.kill();',
|
|
221
|
+
' }',
|
|
222
|
+
' this.serverProcess = spawn(\'node\', [\'--enable-source-maps\', \'dist/bundle.js\'], {',
|
|
223
|
+
' stdio: \'inherit\',',
|
|
224
|
+
' shell: true',
|
|
225
|
+
' });',
|
|
226
|
+
' });',
|
|
227
|
+
' }',
|
|
228
|
+
'}',
|
|
229
|
+
'',
|
|
230
|
+
'class HandlebarsTypegenPlugin {',
|
|
231
|
+
' /** @type {import(\'webpack\').WebpackPluginFunction } */',
|
|
232
|
+
' apply(compiler) {',
|
|
233
|
+
' compiler.hooks.beforeCompile.tapPromise(',
|
|
234
|
+
' \'HandlebarsTypegenPlugin\',',
|
|
235
|
+
' () => generateHandlebarTypeFiles()',
|
|
236
|
+
' );',
|
|
237
|
+
' }',
|
|
238
|
+
'}',
|
|
239
|
+
'',
|
|
240
|
+
'/** @type {import(\'webpack\').Configuration} */',
|
|
241
|
+
'module.exports = {',
|
|
242
|
+
' target: \'node\',',
|
|
243
|
+
' mode: \'none\',',
|
|
244
|
+
' entry: \'./src/index.ts\',',
|
|
245
|
+
' output: {',
|
|
246
|
+
' path: path.resolve(__dirname, \'dist\'),',
|
|
247
|
+
' filename: \'bundle.js\',',
|
|
248
|
+
' devtoolModuleFilenameTemplate: info => {',
|
|
249
|
+
' // info.resourcePath is the original filename (e.g. \'./src/controllers/test.controller.ts\')',
|
|
250
|
+
' // We strip leading \'./\' and make it absolute for editors to link',
|
|
251
|
+
' const relPath = info.resourcePath.replace(/^\\.\\//, \'\');',
|
|
252
|
+
' return `file://${path.resolve(process.cwd(), relPath).replace(/\\\\/g, \'/\')}`;',
|
|
253
|
+
' },',
|
|
254
|
+
' clean: true',
|
|
255
|
+
' },',
|
|
256
|
+
' devtool: \'source-map\',',
|
|
257
|
+
' externals: [],',
|
|
258
|
+
' resolve: {',
|
|
259
|
+
' extensions: [\'.ts\', \'.js\'],',
|
|
260
|
+
' },',
|
|
261
|
+
' module: {',
|
|
262
|
+
' rules: [',
|
|
263
|
+
' {',
|
|
264
|
+
' test: /\.tsx?$/,',
|
|
265
|
+
' use: \'ts-loader\'',
|
|
266
|
+
' },',
|
|
267
|
+
' {',
|
|
268
|
+
' test: /\.js$/,',
|
|
269
|
+
' enforce: \'pre\',',
|
|
270
|
+
' use: \'source-map-loader\',',
|
|
271
|
+
' exclude: [/node_modules[\\/\\\\]node-cron/]',
|
|
272
|
+
' },',
|
|
273
|
+
' {',
|
|
274
|
+
' test: /\.hbs$/,',
|
|
275
|
+
' use: [',
|
|
276
|
+
' {',
|
|
277
|
+
' loader: \'handlebars-loader\',',
|
|
278
|
+
' options: {',
|
|
279
|
+
' runtime: \'handlebars/runtime\',',
|
|
280
|
+
' knownHelpersOnly: false',
|
|
281
|
+
' }',
|
|
282
|
+
' }',
|
|
283
|
+
' ]',
|
|
284
|
+
' }',
|
|
285
|
+
' ],',
|
|
286
|
+
' },',
|
|
287
|
+
' plugins: [',
|
|
288
|
+
' new HandlebarsTypegenPlugin(),',
|
|
289
|
+
' new OnBuildSuccessPlugin(),',
|
|
290
|
+
' new CopyPlugin({',
|
|
291
|
+
' patterns: [',
|
|
292
|
+
' {',
|
|
293
|
+
' from: path.resolve(__dirname, \'assets\'),',
|
|
294
|
+
' to: path.resolve(__dirname, \'dist\', \'assets\'),',
|
|
295
|
+
' noErrorOnMissing: true,',
|
|
296
|
+
' },',
|
|
297
|
+
' {',
|
|
298
|
+
' from: path.resolve(__dirname, \'src\', \'templates\'),',
|
|
299
|
+
' to: path.resolve(__dirname, \'dist\', \'assets\', \'templates\'),',
|
|
300
|
+
' noErrorOnMissing: true',
|
|
301
|
+
' }',
|
|
302
|
+
' ],',
|
|
303
|
+
' }),',
|
|
304
|
+
' new IgnorePlugin({',
|
|
305
|
+
' // eslint-disable-next-line stylistic/max-len',
|
|
306
|
+
// eslint-disable-next-line stylistic/max-len
|
|
307
|
+
' resourceRegExp: /^pg-native$|^cloudflare:sockets$|^react-native-sqlite-storage$|^@google-cloud\\/spanner$|^mssql$|^sql.js$|^redis$|^pg-query-stream$|^typeorm-aurora-data-api-driver$|^oracledb$|^mysql$|^hdb-pool$|^better-sqlite3$|^ioredis$|^mysql2$|^mongodb$|^@sap\\/hana-client$|^@sap\\/hana-client\\/extension\\/Stream$/',
|
|
308
|
+
' })',
|
|
309
|
+
' ]',
|
|
310
|
+
'};'
|
|
311
|
+
]);
|
|
312
|
+
}
|
|
313
|
+
async createTsConfig(appPath) {
|
|
314
|
+
await encapsulation_1.FsUtilities.createFile((0, utilities_1.getPath)(appPath, 'tsconfig.json'), [
|
|
315
|
+
'{',
|
|
316
|
+
' "compilerOptions": {',
|
|
317
|
+
' "target": "ES2022",',
|
|
318
|
+
' "module": "NodeNext",',
|
|
319
|
+
' "moduleResolution": "NodeNext",',
|
|
320
|
+
' "outDir": "dist",',
|
|
321
|
+
' "rootDir": "src",',
|
|
322
|
+
' "strict": true,',
|
|
323
|
+
' "esModuleInterop": true,',
|
|
324
|
+
' "skipLibCheck": true,',
|
|
325
|
+
' "experimentalDecorators": true,',
|
|
326
|
+
' "emitDecoratorMetadata": true,',
|
|
327
|
+
' "sourceMap": true,',
|
|
328
|
+
' "resolveJsonModule": true',
|
|
329
|
+
' },',
|
|
330
|
+
' "include": ["src"]',
|
|
331
|
+
'}'
|
|
332
|
+
]);
|
|
333
|
+
}
|
|
334
|
+
async resolveInput(args) {
|
|
335
|
+
if (args.length === 2) {
|
|
336
|
+
return {
|
|
337
|
+
name: args[1]
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
return await encapsulation_1.InquirerUtilities.prompt(newConfigurationQuestions);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
exports.NewCommand = NewCommand;
|
|
344
|
+
//# sourceMappingURL=new.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new.command.js","sourceRoot":"","sources":["../../../src/commands/new/new.command.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,uDAAgG;AAChG,+CAA+D;AAC/D,8DAAoD;AAYpD,MAAM,yBAAyB,GAAmC;IAC9D,IAAI,EAAE;QACF,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,MAAM;KAClB;CACJ,CAAC;AAEF;;GAEG;AACH,MAAa,UAAW,SAAQ,gCAA6B;IACtC,SAAS,GAAuB,CAAC,CAAC;IAElC,KAAK,CAAC,GAAG,CAAC,aAA+B;QACxD,OAAO,CAAC,GAAG,CAAC,iCAAiC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QACnE,MAAM,OAAO,GAAS,IAAA,mBAAO,EAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,MAAM,2BAAW,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YACpC,MAAM,IAAA,yBAAa,EAAC,4BAA4B,OAAO,sBAAsB,CAAC,CAAC;QACnF,CAAC;QACD,MAAM,2BAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,2BAAW,CAAC,IAAI,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;QACvD,6CAA6C;QAC7C,MAAM,2BAAW,C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YAChE,wEAAwE;YACxE,6CAA6C;YAC7C,oBAAoB;YACpB,mBAAmB;YACnB,4EAA4E;YAC5E,uFAAuF;YACvF,4CAA4C;YAC5C,mBAAmB;YACnB,gBAAgB;YAChB,aAAa;YACb,4BAA4B;YAC5B,2DAA2D;YAC3D,6CAA6C;YAC7C,+UAA+U;YAC/U,YAAY;YACZ,OAAO;YACP,IAAI;SACP,CAAC,CAAC;IACP,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,OAAa;QACtC,MAAM,2BAAW,CAAC,UAAU,CAAC,IAAA,mBAAO,EAAC,OAAO,EAAE,eAAe,CAAC,EAAE;YAC5D,GAAG;YACH,0BAA0B;YAC1B,6BAA6B;YAC7B,+BAA+B;YAC/B,yCAAyC;YACzC,2BAA2B;YAC3B,2BAA2B;YAC3B,yBAAyB;YACzB,kCAAkC;YAClC,+BAA+B;YAC/B,yCAAyC;YACzC,wCAAwC;YACxC,4BAA4B;YAC5B,mCAAmC;YACnC,QAAQ;YACR,wBAAwB;YACxB,GAAG;SACN,CAAC,CAAC;IACP,CAAC;IAEkB,KAAK,CAAC,YAAY,CAAC,IAAc;QAChD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpB,OAAO;gBACH,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;aAChB,CAAC;QACN,CAAC;QACD,OAAO,MAAM,iCAAiB,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;IACrE,CAAC;CACJ;AA9VD,gCA8VC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveCommand = resolveCommand;
|
|
4
|
+
const utilities_1 = require("../utilities");
|
|
5
|
+
const is_command_function_1 = require("./is-command.function");
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the command from the given args.
|
|
8
|
+
* @param args - The args provided by the cli.
|
|
9
|
+
* @returns The resolved command.
|
|
10
|
+
*/
|
|
11
|
+
async function resolveCommand(args) {
|
|
12
|
+
if (args.length < 1) {
|
|
13
|
+
await (0, utilities_1.exitWithError)('Error: You need to specify a command.');
|
|
14
|
+
}
|
|
15
|
+
const command = args[0];
|
|
16
|
+
if (!(0, is_command_function_1.isCommand)(command)) {
|
|
17
|
+
await (0, utilities_1.exitWithError)(`Error: Unknown command ${command}.`);
|
|
18
|
+
return 'error';
|
|
19
|
+
}
|
|
20
|
+
return command;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=resolve-command.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-command.function.js","sourceRoot":"","sources":["../../src/commands/resolve-command.function.ts"],"names":[],"mappings":";;AASA,wCAaC;AAtBD,4CAA6C;AAE7C,+DAAkD;AAElD;;;;GAIG;AACI,KAAK,UAAU,cAAc,CAAC,IAAc;IAC/C,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClB,MAAM,IAAA,yBAAa,EAAC,uCAAuC,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,OAAO,GAAW,IAAI,CAAC,CAAC,CAAC,CAAC;IAEhC,IAAI,CAAC,IAAA,+BAAS,EAAC,OAAO,CAAC,EAAE,CAAC;QACtB,MAAM,IAAA,yBAAa,EAAC,0BAA0B,OAAO,GAAG,CAAC,CAAC;QAC1D,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/version/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VersionCommand = void 0;
|
|
4
|
+
/* eslint-disable no-console */
|
|
5
|
+
const encapsulation_1 = require("../../encapsulation");
|
|
6
|
+
const utilities_1 = require("../../utilities");
|
|
7
|
+
const base_command_model_1 = require("../base-command.model");
|
|
8
|
+
/**
|
|
9
|
+
* Prints out the currently used version of Zibri.
|
|
10
|
+
*/
|
|
11
|
+
class VersionCommand extends base_command_model_1.BaseCommand {
|
|
12
|
+
async run() {
|
|
13
|
+
const packageJsonPath = (0, utilities_1.getPath)(__dirname, '..', '..', '..', 'package.json');
|
|
14
|
+
const packageJsonContent = await encapsulation_1.FsUtilities.readFile(packageJsonPath);
|
|
15
|
+
// eslint-disable-next-line typescript/no-unsafe-assignment, jsdoc/require-jsdoc
|
|
16
|
+
const pkg = JSON.parse(packageJsonContent);
|
|
17
|
+
if (!pkg.version) {
|
|
18
|
+
return await (0, utilities_1.exitWithError)('Could not determine the currently running version of zibri-cli');
|
|
19
|
+
}
|
|
20
|
+
console.log(encapsulation_1.ChalkUtilities.boldUnderline('Version:'));
|
|
21
|
+
console.log(encapsulation_1.ChalkUtilities.secondary(pkg.version));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.VersionCommand = VersionCommand;
|
|
25
|
+
//# sourceMappingURL=version.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.command.js","sourceRoot":"","sources":["../../../src/commands/version/version.command.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,uDAAkE;AAClE,+CAA+D;AAC/D,8DAAoD;AAEpD;;GAEG;AACH,MAAa,cAAe,SAAQ,gCAAW;IACxB,KAAK,CAAC,GAAG;QACxB,MAAM,eAAe,GAAS,IAAA,mBAAO,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QACnF,MAAM,kBAAkB,GAAW,MAAM,2BAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC/E,gFAAgF;QAChF,MAAM,GAAG,GAAwB,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAChE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACf,OAAO,MAAM,IAAA,yBAAa,EAAC,gEAAgE,CAAC,CAAC;QACjG,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,8BAAc,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,8BAAc,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,CAAC;CACJ;AAZD,wCAYC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MORE_INFORMATION_MESSAGE = exports.CLI_BASE_COMMAND = void 0;
|
|
4
|
+
const commands_1 = require("./commands");
|
|
5
|
+
const encapsulation_1 = require("./encapsulation");
|
|
6
|
+
/**
|
|
7
|
+
* The base command of the cli.
|
|
8
|
+
*/
|
|
9
|
+
exports.CLI_BASE_COMMAND = 'zi';
|
|
10
|
+
/**
|
|
11
|
+
* The message to notify the user of the help command.
|
|
12
|
+
*/
|
|
13
|
+
exports.MORE_INFORMATION_MESSAGE = `run ${encapsulation_1.ChalkUtilities.secondary(`${exports.CLI_BASE_COMMAND} ${commands_1.Command.HELP}`)} for more information.`;
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,mDAAiD;AAEjD;;GAEG;AACU,QAAA,gBAAgB,GAAW,IAAI,CAAC;AAE7C;;GAEG;AACU,QAAA,wBAAwB,GAAW,OAAO,8BAAc,CAAC,SAAS,CAC3E,GAAG,wBAAgB,IAAI,kBAAO,CAAC,IAAI,EAAE,CACxC,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChalkUtilities = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const COLOR_PRIMARY = '#37517e';
|
|
7
|
+
const COLOR_SECONDARY = '#47b2e4';
|
|
8
|
+
/**
|
|
9
|
+
* Encapsulates functionality of the chalk package.
|
|
10
|
+
*/
|
|
11
|
+
class ChalkUtilities {
|
|
12
|
+
/**
|
|
13
|
+
* Used to log something in the primary color.
|
|
14
|
+
* @param value - The value that should be logged in the primary color.
|
|
15
|
+
* @returns The string to log.
|
|
16
|
+
*/
|
|
17
|
+
static primary(...value) {
|
|
18
|
+
return chalk_1.default.hex(COLOR_PRIMARY)(value);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Used to log something in the secondary color.
|
|
22
|
+
* @param value - The value that should be logged in the secondary color.
|
|
23
|
+
* @returns The string to log.
|
|
24
|
+
*/
|
|
25
|
+
static secondary(...value) {
|
|
26
|
+
return chalk_1.default.hex(COLOR_SECONDARY)(value);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Used to log errors in red.
|
|
30
|
+
* @param value - The value that should be logged as an error.
|
|
31
|
+
* @returns The string to log.
|
|
32
|
+
*/
|
|
33
|
+
static error(...value) {
|
|
34
|
+
return chalk_1.default.red(value);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Used to log success in green.
|
|
38
|
+
* @param value - The value that should be logged as a success message.
|
|
39
|
+
* @returns The string to log.
|
|
40
|
+
*/
|
|
41
|
+
static success(...value) {
|
|
42
|
+
return chalk_1.default.green(value);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Used to log something in bold and underlined.
|
|
46
|
+
* @param value - The value that should be logged bold and underlined.
|
|
47
|
+
* @returns The string to log.
|
|
48
|
+
*/
|
|
49
|
+
static boldUnderline(...value) {
|
|
50
|
+
return chalk_1.default.underline.bold(value);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ChalkUtilities = ChalkUtilities;
|
|
54
|
+
//# sourceMappingURL=chalk.utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chalk.utilities.js","sourceRoot":"","sources":["../../src/encapsulation/chalk.utilities.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,MAAM,aAAa,GAAW,SAAS,CAAC;AACxC,MAAM,eAAe,GAAW,SAAS,CAAC;AAE1C;;GAEG;AACH,MAAsB,cAAc;IAEhC;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,KAAe;QAC7B,OAAO,eAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,KAAe;QAC/B,OAAO,eAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,KAAe;QAC3B,OAAO,eAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,KAAe;QAC7B,OAAO,eAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAAC,GAAG,KAAe;QACnC,OAAO,eAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;CACJ;AA9CD,wCA8CC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CPUtilities = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const chalk_utilities_1 = require("./chalk.utilities");
|
|
6
|
+
const utilities_1 = require("../utilities");
|
|
7
|
+
/**
|
|
8
|
+
* Encapsulates functionality of the child_process package.
|
|
9
|
+
*/
|
|
10
|
+
class CPUtilities {
|
|
11
|
+
/**
|
|
12
|
+
* Used only for testing/mocking.
|
|
13
|
+
*/
|
|
14
|
+
// eslint-disable-next-line typescript/prefer-readonly
|
|
15
|
+
static cwd;
|
|
16
|
+
/**
|
|
17
|
+
* Executes a command and waits for its execution.
|
|
18
|
+
* @param command - The command to run.
|
|
19
|
+
* @param output - Whether or not the output of the command should be passed to the console.
|
|
20
|
+
* @throws When there was an error during execution.
|
|
21
|
+
*/
|
|
22
|
+
static async exec(command, output = true) {
|
|
23
|
+
const options = {
|
|
24
|
+
stdio: output ? 'inherit' : undefined,
|
|
25
|
+
killSignal: 'SIGINT',
|
|
26
|
+
cwd: this.cwd
|
|
27
|
+
};
|
|
28
|
+
try {
|
|
29
|
+
(0, child_process_1.execSync)(command, options);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if ((0, utilities_1.isExitPromptError)(error) || ((0, utilities_1.isErrorWithSignal)(error) && error.signal === 'SIGINT')) {
|
|
33
|
+
await (0, utilities_1.exitWithInterrupt)();
|
|
34
|
+
}
|
|
35
|
+
// eslint-disable-next-line no-console
|
|
36
|
+
console.error(chalk_utilities_1.ChalkUtilities.error(`Command failed: ${command}`));
|
|
37
|
+
await (0, utilities_1.exitGracefully)(1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.CPUtilities = CPUtilities;
|
|
42
|
+
//# sourceMappingURL=cp.utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cp.utilities.js","sourceRoot":"","sources":["../../src/encapsulation/cp.utilities.ts"],"names":[],"mappings":";;;AAAA,iDAA0D;AAE1D,uDAAmD;AACnD,4CAAuG;AAEvG;;GAEG;AACH,MAAsB,WAAW;IAE7B;;OAEG;IACH,sDAAsD;IAC9C,MAAM,CAAC,GAAG,CAAU;IAE5B;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAe,EAAE,SAAkB,IAAI;QACrD,MAAM,OAAO,GAAoB;YAC7B,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YACrC,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,IAAI,CAAC,GAAG;SAChB,CAAC;QACF,IAAI,CAAC;YACD,IAAA,wBAAQ,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/B,CAAC;QACD,OAAO,KAAK,EAAE,CAAC;YACX,IAAI,IAAA,6BAAiB,EAAC,KAAK,CAAC,IAAI,CAAC,IAAA,6BAAiB,EAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,EAAE,CAAC;gBACtF,MAAM,IAAA,6BAAiB,GAAE,CAAC;YAC9B,CAAC;YACD,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,gCAAc,CAAC,KAAK,CAAC,mBAAmB,OAAO,EAAE,CAAC,CAAC,CAAC;YAClE,MAAM,IAAA,0BAAc,EAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;IACL,CAAC;CACJ;AAhCD,kCAgCC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeathUtilities = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const death_1 = tslib_1.__importDefault(require("death"));
|
|
6
|
+
/**
|
|
7
|
+
* Encapsulates functionality of the death package.
|
|
8
|
+
*/
|
|
9
|
+
class DeathUtilities {
|
|
10
|
+
/**
|
|
11
|
+
* Kills the program when the process stops.
|
|
12
|
+
* @returns The return of calling death.
|
|
13
|
+
*/
|
|
14
|
+
static death() {
|
|
15
|
+
return (0, death_1.default)(() => { });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.DeathUtilities = DeathUtilities;
|
|
19
|
+
//# sourceMappingURL=death.utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"death.utilities.js","sourceRoot":"","sources":["../../src/encapsulation/death.utilities.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B;;GAEG;AACH,MAAsB,cAAc;IAChC;;;OAGG;IACH,MAAM,CAAC,KAAK;QACR,OAAO,IAAA,eAAK,EAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC3B,CAAC;CACJ;AARD,wCAQC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FigletUtilities = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/* eslint-disable no-console */
|
|
6
|
+
const figlet_1 = tslib_1.__importDefault(require("figlet"));
|
|
7
|
+
const _1 = require(".");
|
|
8
|
+
/**
|
|
9
|
+
* Encapsulates functionality of the figlet package.
|
|
10
|
+
*/
|
|
11
|
+
class FigletUtilities {
|
|
12
|
+
/**
|
|
13
|
+
* Displays the logo "Monorepo" in full width.
|
|
14
|
+
*/
|
|
15
|
+
static displayLogo() {
|
|
16
|
+
console.log(_1.ChalkUtilities.primary(figlet_1.default.textSync('Zibri', { horizontalLayout: 'full' })));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.FigletUtilities = FigletUtilities;
|
|
20
|
+
//# sourceMappingURL=figlet.utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figlet.utilities.js","sourceRoot":"","sources":["../../src/encapsulation/figlet.utilities.ts"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,4DAA4B;AAE5B,wBAAmC;AAEnC;;GAEG;AACH,MAAsB,eAAe;IACjC;;OAEG;IACH,MAAM,CAAC,WAAW;QACd,OAAO,CAAC,GAAG,CACP,iBAAc,CAAC,OAAO,CAClB,gBAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC,CACzD,CACJ,CAAC;IACN,CAAC;CACJ;AAXD,0CAWC"}
|