Skip to content

Commit 99ea226

Browse files
authored
Merge pull request #1 from devonfw/develop
update repository
2 parents f6c607f + ce07254 commit 99ea226

43 files changed

Lines changed: 26433 additions & 25197 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

documentation/_Footer.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<a rel="license" href="http://creativecommons.org/licenses/by-nd/4.0/"><img alt="Creative Commons License Agreement" style="border-width:0" src="http://i.creativecommons.org/l/by-nd/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">This documentation</span> is licensed under the <a rel="license" href="http://creativecommons.org/licenses/by-nd/4.0/">Creative Commons License (Attribution-NoDerivatives 4.0 International)</a>.

documentation/guides-cli.asciidoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ devon4node new -h
5454
| --dry-run | Allow to test changes before execute command.
5555
| --skip-git, -g | Allow to skip git repository initialization.
5656
| --skip-install, -s | Allow to skip package installation.
57+
| --typeorm, -t | Allow to select the type of database.
58+
| --config-module, -c | Allow to add config module or not.
59+
| --swagger, -a | Allow to add swagger module or not.
60+
| --security, -y | Allow to add security (cors + HTTP security headers) or not.
61+
| --mailer, -m | Allow to add mailer module or not.
62+
| --auth-jwt, -j | Allow to add Auth JWT module or not.
5763
| --version, -v | Show version number
5864
|========
5965

@@ -62,6 +68,7 @@ Examples:
6268
----
6369
devon4node new my-app -sg
6470
devon4node new my-app -n
71+
devon4node new my-app -n -typeorm sqlite -config-module -auth-jwt
6572
----
6673

6774
=== generate

documentation/samples-step-by-step.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,21 +199,21 @@ export abstract class BaseEntity {
199199
----
200200
@Entity()
201201
export class Employee extends BaseEntity {
202-
@ApiModelPropertyOptional()
202+
@ApiPropertyOptional()
203203
@IsDefined({ groups: [CrudValidationGroups.CREATE] })
204204
@IsOptional({ groups: [CrudValidationGroups.UPDATE] })
205205
@MaxLength(255)
206206
@Column('varchar', { length: 255, nullable: true })
207207
name?: string;
208208
209-
@ApiModelPropertyOptional()
209+
@ApiPropertyOptional()
210210
@IsDefined({ groups: [CrudValidationGroups.CREATE] })
211211
@IsOptional({ groups: [CrudValidationGroups.UPDATE] })
212212
@MaxLength(255)
213213
@Column('varchar', { length: 255, nullable: true })
214214
surname?: string;
215215
216-
@ApiModelPropertyOptional()
216+
@ApiPropertyOptional()
217217
@IsDefined({ groups: [CrudValidationGroups.CREATE] })
218218
@IsOptional({ groups: [CrudValidationGroups.UPDATE] })
219219
@MaxLength(255)
@@ -227,7 +227,7 @@ export class Employee extends BaseEntity {
227227
+
228228
[source,typescript]
229229
----
230-
@ApiUseTags('employee')
230+
@ApiTags('employee')
231231
----
232232
+
233233
. Generate database migrations

package.json

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818
"format": "lerna run format"
1919
},
2020
"dependencies": {
21-
"@angular-devkit/core": "^9.0.5",
22-
"@angular-devkit/schematics": "^9.0.5",
23-
"@angular-devkit/schematics-cli": "^0.901.0",
24-
"@devon4node/schematics": "^1.11.0",
21+
"@angular-devkit/core": "^10.0.5",
22+
"@angular-devkit/schematics": "^10.0.5",
23+
"@angular-devkit/schematics-cli": "^0.1000.5",
2524
"@nestjs/cli": "^7.0.2",
2625
"@nestjs/schematics": "^7.0.0",
27-
"@schematics/angular": "^9.0.5",
26+
"@schematics/angular": "^10.0.5",
2827
"chalk": "^4.0.0",
2928
"fs-extra": "^9.0.0",
3029
"inquirer": "^7.0.6",
@@ -35,25 +34,25 @@
3534
"pluralize": "^8.0.0",
3635
"prettier": "^2.0.0",
3736
"rxjs": "^6.5.4",
38-
"tmp-promise": "^2.0.2",
37+
"tmp-promise": "^3.0.2",
3938
"ts-morph": "^7.0.0",
4039
"typeorm": "^0.2.24",
4140
"typescript": "^3.8.3",
4241
"yargs": "^15.1.0"
4342
},
4443
"devDependencies": {
45-
"@commitlint/cli": "^8.3.5",
46-
"@commitlint/config-conventional": "^8.3.4",
44+
"@commitlint/cli": "^9.1.1",
45+
"@commitlint/config-conventional": "^9.1.1",
4746
"@nestjs/common": "^7.0.4",
4847
"@nestjs/core": "^7.0.4",
4948
"@nestjs/platform-express": "^7.0.4",
5049
"@nestjs/testing": "^7.0.4",
51-
"@types/inquirer": "^6.5.0",
50+
"@types/inquirer": "^7.3.0",
5251
"@types/jasmine": "^3.5.2",
53-
"@types/jest": "^25.1.4",
52+
"@types/jest": "^26.0.9",
5453
"@types/js-yaml": "^3.12.2",
5554
"@types/lodash": "^4.14.149",
56-
"@types/node": "^13.9.0",
55+
"@types/node": "^14.0.27",
5756
"@types/node-fetch": "^2.5.5",
5857
"@types/nodemailer": "^6.4.0",
5958
"@types/pluralize": "^0.0.29",
@@ -62,10 +61,10 @@
6261
"@types/yargs": "^15.0.4",
6362
"@typescript-eslint/eslint-plugin": "^2.22.0",
6463
"@typescript-eslint/parser": "^2.22.0",
65-
"class-transformer": "^0.2.3",
64+
"class-transformer": "^0.3.1",
6665
"class-validator": "^0.12.0-rc.0",
6766
"commitizen": "^4.0.3",
68-
"cz-conventional-changelog": "3.1.0",
67+
"cz-conventional-changelog": "3.2.0",
6968
"eslint": "^6.8.0",
7069
"eslint-config-prettier": "^6.10.0",
7170
"eslint-plugin-import": "^2.20.1",
@@ -75,7 +74,6 @@
7574
"jasmine": "^3.5.0",
7675
"jest": "^25.2.3",
7776
"lerna": "^3.20.2",
78-
"lint-staged": "^10.0.8",
7977
"reflect-metadata": "^0.1.13",
8078
"rxjs": "^6.5.4",
8179
"ts-jest": "^25.2.1"
@@ -88,10 +86,7 @@
8886
"husky": {
8987
"hooks": {
9088
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
91-
"pre-commit": "lint-staged"
89+
"pre-commit": "lerna run lint"
9290
}
93-
},
94-
"lint-staged": {
95-
"*.ts": "eslint --cache --fix"
9691
}
9792
}

packages/cli/bin/devon4node

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
'use strict';
44

5-
const devon4node = require("../dist/devon4node");
5+
const devon4node = require('../dist/devon4node');
66

77
try {
88
devon4node.executable();

packages/cli/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devon4node/cli",
3-
"version": "2.0.3",
3+
"version": "3.0.1",
44
"description": "devon4node CLI",
55
"bin": {
66
"devon4node": "./bin/devon4node",
@@ -10,7 +10,7 @@
1010
"build": "tsc -p tsconfig.json",
1111
"build:prod": "tsc -p tsconfig.build.json",
1212
"format": "prettier --write \"src/**/*.ts\"",
13-
"lint": "eslint {src,apps,libs,test}/**/*.ts --fix",
13+
"lint": "eslint src/**/*.ts --fix",
1414
"test": "npm run build && jasmine src/**/*.spec.js",
1515
"prepublish:npm": "npm run build:prod",
1616
"publish:npm": "npm publish --access public",
@@ -38,14 +38,14 @@
3838
},
3939
"license": "Apache-2.0",
4040
"dependencies": {
41-
"@angular-devkit/schematics-cli": "^0.901.0",
42-
"@devon4node/schematics": "^2.0.3",
41+
"@angular-devkit/schematics-cli": "^0.1000.5",
42+
"@devon4node/schematics": "^3.0.1",
4343
"@nestjs/cli": "^7.0.2",
4444
"chalk": "^4.0.0",
4545
"inquirer": "^7.0.6",
4646
"node-fetch": "^2.6.0",
4747
"rxjs": "^6.5.4",
48-
"tmp-promise": "^2.0.2",
48+
"tmp-promise": "^3.0.2",
4949
"typeorm": "^0.2.24",
5050
"yargs": "^15.1.0"
5151
}

packages/cli/src/commands/new.command.ts

Lines changed: 102 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,36 @@ export function builder(args: yargs.Argv): yargs.Argv {
300300
alias: 's',
301301
describe: 'Allow to skip package installation.',
302302
type: 'boolean',
303+
})
304+
.option('typeorm', {
305+
alias: 't',
306+
describe: 'Allow to select the type of database.',
307+
type: 'string',
308+
})
309+
.option('config-module', {
310+
alias: 'c',
311+
describe: 'Allow to add config module or not.',
312+
type: 'boolean',
313+
})
314+
.option('swagger', {
315+
alias: 'a',
316+
describe: 'Allow to add swagger module or not.',
317+
type: 'boolean',
318+
})
319+
.option('security', {
320+
alias: 'y',
321+
describe: 'Allow to add security (cors + HTTP security headers) or not.',
322+
type: 'boolean',
323+
})
324+
.option('mailer', {
325+
alias: 'm',
326+
describe: 'Allow to add mailer module or not.',
327+
type: 'boolean',
328+
})
329+
.option('auth-jwt', {
330+
alias: 'j',
331+
describe: 'Allow to add Auth JWT module or not.',
332+
type: 'boolean',
303333
});
304334
}
305335

@@ -402,12 +432,80 @@ export async function generateCode(args: yargs.Arguments<any>): Promise<void> {
402432
process.exit(1);
403433
}
404434

405-
inputs.push({ name: 'name', value: name });
435+
const allInOne: ICollectionToRun[] = [];
436+
437+
allInOne.push({
438+
name: 'application',
439+
options: {
440+
name,
441+
language: 'ts',
442+
},
443+
});
444+
445+
if (args.c) {
446+
allInOne.push({
447+
name: 'config-module',
448+
options: {
449+
path: name,
450+
},
451+
});
452+
}
453+
454+
if (args.t) {
455+
allInOne.push({
456+
name: 'typeorm',
457+
options: {
458+
path: name,
459+
db: args.t,
460+
},
461+
});
462+
}
463+
464+
if (args.y) {
465+
allInOne.push({
466+
name: 'security',
467+
options: {
468+
path: name,
469+
},
470+
});
471+
}
472+
473+
if (args.m) {
474+
allInOne.push({
475+
name: 'mailer',
476+
options: {
477+
path: name,
478+
},
479+
});
480+
}
481+
482+
if (args.a) {
483+
allInOne.push({
484+
name: 'swagger',
485+
options: {
486+
path: name,
487+
},
488+
});
489+
}
490+
491+
if (args.j) {
492+
allInOne.push({
493+
name: 'auth-jwt',
494+
options: {
495+
path: name,
496+
},
497+
});
498+
}
499+
500+
const file = await tmp.file();
501+
writeFileSync(file.path, JSON.stringify(allInOne));
502+
503+
inputs.push({ name: 'path', value: '"' + file.path + '"' });
406504
if (args.d) {
407505
inputs.push({ name: 'dry-run', value: !!args.d });
408506
}
409507

410-
await generateApplicationFiles('@devon4node/schematics:application', inputs);
508+
await generateApplicationFiles('@devon4node/schematics:all-in-one', inputs);
411509

412510
if (!args.d) {
413511
if (!args.g) {
@@ -427,6 +525,8 @@ export async function generateCode(args: yargs.Arguments<any>): Promise<void> {
427525
* @param args program arguments
428526
*/
429527
export async function handler(args: yargs.Arguments): Promise<void> {
528+
args.name = strings.dasherize(args.name as string);
529+
430530
if (args.n) {
431531
await generateCode(args);
432532
} else {

packages/cli/src/utils/utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ChildProcess, spawn } from 'child_process';
66
import { writeFile } from 'fs';
77
import fetch from 'node-fetch';
88
import { join, resolve } from 'path';
9+
import { strings } from '@angular-devkit/core';
910

1011
export function mapSchematicOptions(collectionName: string, options: Input[]): string[] {
1112
return options.reduce(
@@ -86,10 +87,11 @@ export async function addGitIgnore(folder: string): Promise<void> {
8687
}
8788

8889
export async function initGit(appPath: string): Promise<void> {
90+
const path = strings.dasherize(appPath);
8991
console.log(chalk.blueBright('Initializing git repository... please wait'));
9092
const runner = new GitRunner();
91-
await runner.run('init', true, join(process.cwd(), appPath));
92-
await addGitIgnore(join(process.cwd(), appPath));
93+
await runner.run('init', true, join(process.cwd(), path));
94+
await addGitIgnore(join(process.cwd(), path));
9395
console.log(chalk.greenBright('Git initialization ends successfuly'));
9496
}
9597

packages/common/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devon4node/common",
3-
"version": "2.0.0",
3+
"version": "3.0.0",
44
"description": "devon4node common library.",
55
"main": "dist/index.js",
66
"scripts": {
@@ -11,7 +11,7 @@
1111
"publish:next": "npm publish --access public --tag next",
1212
"test": "jest",
1313
"format": "prettier --write \"**/*.ts\"",
14-
"lint": "eslint {utils,serializer}/**/*.ts --fix"
14+
"lint": "eslint serializer/**/*.ts --fix"
1515
},
1616
"keywords": [
1717
"nestjs",
@@ -31,9 +31,9 @@
3131
},
3232
"peerDependencies": {
3333
"@nestjs/common": "^7.0.4",
34-
"class-transformer": "^0.2.3",
34+
"class-transformer": "^0.3.1",
3535
"reflect-metadata": "^0.1.13",
36-
"rxjs": "^6.5.3"
36+
"rxjs": "^6.5.4"
3737
},
3838
"repository": {
3939
"type": "git",

packages/config/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devon4node/config",
3-
"version": "2.0.0",
3+
"version": "3.0.0",
44
"description": "devon4node module for easy application configuration.",
55
"main": "dist/index.js",
66
"scripts": {
@@ -10,7 +10,7 @@
1010
"prepublish:next": "npm run build",
1111
"publish:next": "npm publish --access public --tag next",
1212
"format": "prettier --write \"lib/**/*.ts\"",
13-
"lint": "eslint {src,apps,lib,test}/**/*.ts --fix",
13+
"lint": "eslint {lib,test}/**/*.ts --fix",
1414
"test": "jest",
1515
"test:watch": "jest --watch",
1616
"test:cov": "jest --coverage",
@@ -32,8 +32,8 @@
3232
"license": "Apache-2.0",
3333
"peerDependencies": {
3434
"@nestjs/common": "^7.0.4",
35-
"class-transformer": "^0.2.3",
36-
"class-validator": "^0.11.1",
35+
"class-transformer": "^0.3.1",
36+
"class-validator": "^0.12.0-rc.0",
3737
"lodash": "^4.17.15"
3838
},
3939
"repository": {

0 commit comments

Comments
 (0)