Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schematics package migration #961

Merged
merged 62 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
63b1562
build: install some dependencies and update others
jorgecastalc Jan 25, 2024
dee66a3
build: upgrade some dependencies
jorgecastalc Jan 25, 2024
56d6e57
build: upgrade dependencies
jorgecastalc Jan 25, 2024
cb91f4e
build: change schematics name and added jest globally
jorgecastalc Jan 25, 2024
8e50e65
build: added a new schematics package and new generators
jorgecastalc Jan 26, 2024
4a27a42
build: some packages copied
jorgecastalc Jan 29, 2024
5f6688e
build: all packages added and tests fixed
jorgecastalc Jan 30, 2024
7281ca0
build: some tests fixed and deleted unused files
jorgecastalc Jan 31, 2024
95ba2d3
build: fix lint errors and tests
Jan 31, 2024
0ca53e8
build: update checked service generator
Feb 1, 2024
8745259
build: controller generator updated
jorgecastalc Feb 1, 2024
02aca02
build: update packages version
Feb 1, 2024
0e8a768
Merge branch 'Schematics-package-migration' of https://github.com/dev…
jorgecastalc Feb 2, 2024
27be1cc
build: add functionality to service schematic
Feb 2, 2024
051df66
build: fix variable
Feb 2, 2024
5d9e205
build: add functionality to controller schematic
jorgecastalc Feb 2, 2024
c05bbba
build: remove unnecessary generators
Feb 5, 2024
6ec4fc7
Revert "build: remove unnecessary generators"
Feb 5, 2024
4f5ef51
Merge branch 'Schematics-package-migration' of https://github.com/dev…
Feb 5, 2024
8367ae8
build: remove not needed generators
Feb 5, 2024
b3761e7
build: adapt security generator to use Nx
Feb 5, 2024
ea23eeb
build: fix security generator test and update entity generator
Feb 5, 2024
28bfc18
build: refactor project variable name
Feb 5, 2024
598a865
build: update mailer schematics
jorgecastalc Feb 6, 2024
6ae6ddd
build: mailer schematic updated
jorgecastalc Feb 6, 2024
7fa7203
build: update swagger generator
jorgecastalc Feb 7, 2024
2a96ca7
build: update nx swagger generator main task
Feb 8, 2024
d9feb28
build: update generators
Feb 8, 2024
85cc457
build: deleted unnecessary repository generator and updated convict
jorgecastalc Feb 8, 2024
57b389e
build: update files dir
Feb 8, 2024
88f7c44
build: fix convict import error
Feb 9, 2024
de22d97
build: update init-typeorm generator
Feb 9, 2024
c8cd8ec
build: delete old spec file
Feb 9, 2024
cf425e0
build: new application generator created
jorgecastalc Feb 12, 2024
36d1556
build: rename devon4ts_node-application to application and use nx
Feb 13, 2024
30ae7ab
build: remove old application schematic generator
Feb 13, 2024
5e446e6
build: remove old application schematic generator
Feb 13, 2024
1df30de
build: update template file naming
Feb 14, 2024
6d02db3
build: update auth-jwt generator
Feb 14, 2024
e3c05ff
build: delete resource generator and update package.json
jorgecastalc Feb 15, 2024
4ce10a0
build: deleted old schematics
jorgecastalc Feb 15, 2024
a251d0e
build: change names in file packageVersion.ts
jorgecastalc Feb 15, 2024
66794fe
build: update tsconfig files & nx plugin files
Feb 15, 2024
28f851f
build: remove unnecessary packages
jorgecastalc Feb 15, 2024
b424948
build: use packagesVersion.ts in all generators
jorgecastalc Feb 15, 2024
f96bda4
Merge branch 'Schematics-package-migration' of https://github.com/dev…
jorgecastalc Feb 15, 2024
8668e49
build: fix project path in application schematic
Feb 15, 2024
93c4e9e
build: fix tests config
Feb 16, 2024
321d0b1
Merge branch 'Schematics-package-migration' of https://github.com/dev…
Feb 16, 2024
bede97c
build: fix jest to find tests
Feb 16, 2024
9d14e2d
build: fix base test
Feb 16, 2024
fe89638
build: update application generator
Feb 20, 2024
7ec4611
build: fix tests
Feb 20, 2024
a53908a
fix: tests passing
Feb 21, 2024
8e87521
build: schematics tests updated
jorgecastalc Feb 21, 2024
6ebe01b
fix: all tests pass but within 60s of threshold
Feb 21, 2024
068df31
fix: .gitignore to get schema.d.ts from application generator
Feb 21, 2024
6825dcd
test: add utils test
Feb 21, 2024
04ba506
fix: add utils method 'stopExecutionIfNotRunningAtRootFolder' to all …
Feb 21, 2024
aed77e6
build: merge from Nx-migration
Feb 21, 2024
d702580
build: update package.json
Feb 21, 2024
47a5a74
Merge branch 'Schematics-package-migration' of https://github.com/dev…
Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ testing/
**/testing*/
packages/cli
samples/todo


.nx/cache


.nx/cache

dist/
33 changes: 18 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,36 @@
"@swc/helpers": "~0.5.2",
"fs-extra": "^11.2.0",
"lodash": "^4.17.21",
"prettier": "^2.7.1",
"passport-jwt": "^4.0.1",
"prettier": "^2.8.8",
"triple-beam": "^1.4.1",
"tslib": "^2.3.0",
"typescript": "^4.8.3"
"tslib": "^2.6.2",
"type-fest": "^4.10.2",
"typescript": "^5.3.3"
},
"devDependencies": {
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@nestjs/common": "^9.1.2",
"@nestjs/core": "^9.1.2",
"@nestjs/testing": "^9.1.2",
"@nestjs/common": "^10.3.3",
"@nestjs/core": "^10.3.3",
"@nestjs/testing": "^10.3.3",
"@nx/jest": "17.2.8",
"@nx/js": "17.2.8",
"@nx/nest": "^17.2.8",
"@swc-node/register": "~1.6.7",
"@swc/cli": "~0.1.62",
"@swc/core": "~1.3.85",
"@types/jest": "^29.4.0",
"@types/js-yaml": "^4.0.5",
"@types/lodash": "^4.14.185",
"@types/node": "18.16.9",
"@types/js-yaml": "^4.0.9",
"@types/lodash": "^4.14.202",
"@types/node": "20.11.19",
"@types/nodemailer": "^6.4.6",
"@types/pluralize": "^0.0.33",
"@types/prettier": "^2.7.1",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@types/prettier": "^2.7.3",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.38.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"class-validator": "^0.14.1",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "3.3.0",
"eslint": "^8.24.0",
Expand All @@ -59,11 +62,11 @@
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"lerna": "^5.5.2",
"nx": "17.2.6",
"nx": "~17.2.8",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.7",
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",
"ts-jest": "^29.1.2",
"ts-node": "10.9.2",
"typeorm": "^0.3.10",
"zx": "^7.0.8"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/schematics/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
src/lib/**/files/**/*
**/src/lib/**/files/**/*
src/generators/**/files/**/*
**/src/generators/**/files/**/*
*.d.ts
**/*.d.ts
32 changes: 32 additions & 0 deletions packages/schematics/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"extends": ["../../.eslintrc.js"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
},
{
"files": ["./package.json", "./generators.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/nx-plugin-checks": "error"
}
}
]
}
1 change: 1 addition & 0 deletions packages/schematics/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ src/**/*.js
!src/**/.eslintrc.js
src/**/*.js.map
src/**/*.d.ts
!src/generators/**/schema.d.ts

# IDEs
.idea/
Expand Down
47 changes: 47 additions & 0 deletions packages/schematics/generators.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"$schema": "http://json-schema.org/schema",
"name": "@devon4ts_node/schematics",
"version": "6.0.0",
"generators": {
"typeorm": {
"description": "Initialice typeorm into your current project in a correct way.",
"factory": "./src/generators/init-typeorm/generator",
"schema": "./src/generators/init-typeorm/schema.json"
},
"entity": {
"description": "Add a TypeOrm entity to your project",
"factory": "./src/generators/entity/generator",
"schema": "./src/generators/entity/schema.json"
},
"convict": {
"description": "Initialize convict to manage the configuration into the project.",
"factory": "./src/generators/convict/generator",
"schema": "./src/generators/convict/schema.json"
},
"mailer": {
"description": "Add @devon4ts_node/mailer module to project.",
"factory": "./src/generators/mailer/generator",
"schema": "./src/generators/mailer/schema.json"
},
"swagger": {
"description": "Add swagger module to project.",
"factory": "./src/generators/swagger/generator",
"schema": "./src/generators/swagger/schema.json"
},
"auth-jwt": {
"description": "Add the auth JWT module to the project.",
"factory": "./src/generators/auth-jwt/generator",
"schema": "./src/generators/auth-jwt/schema.json"
},
"security": {
"description": "Add cors and helmet to your project.",
"factory": "./src/generators/security/generator",
"schema": "./src/generators/security/schema.json"
},
"application": {
"description": "Generates a basic NestJS application using Devonfw Architecture",
"factory": "./src/generators/application/generator",
"schema": "./src/generators/application/schema.json"
}
}
}
10 changes: 10 additions & 0 deletions packages/schematics/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable */
export default {
displayName: 'schematics',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/schematics',
};
32 changes: 7 additions & 25 deletions packages/schematics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,14 @@
"license": "Apache-2.0",
"schematics": "./src/collection.json",
"dependencies": {
"@angular-devkit/core": "^14.0.2",
"@angular-devkit/schematics": "^14.0.2",
"@nestjs/schematics": "^9.0.0",
"@schematics/angular": "^14.0.2",
"js-yaml": "^4.1.0",
"@nx/devkit": "17.2.8",
"@nx/nest": "17.2.8",
"@nestjs/schematics": "^10.1.1",
"lodash": "^4.17.21",
"pluralize": "^8.0.0",
"prettier": "^2.7.1",
"ts-morph": "^15.1.0",
"typescript": "^4.7.4"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"roots": [
"src"
],
"testRegex": "_spec.ts$",
"transform": {
"^.+\\.ts$": "ts-jest"
},
"coverageDirectory": "./coverage",
"testEnvironment": "node"
"prettier": "^3.2.5",
"ts-morph": "^21.0.1",
"typescript": "^5.3.3"
},
"gitHead": "1f351bcc0fbad70f9c25fa73a398a538ca0c8e55"
}
}
52 changes: 52 additions & 0 deletions packages/schematics/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "schematics",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/schematics/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/schematics",
"main": "packages/schematics/src/index.ts",
"tsConfig": "packages/schematics/tsconfig.lib.json",
"assets": [
"packages/schematics/*.md",
{
"input": "./packages/schematics/src",
"glob": "**/!(*.ts)",
"output": "./src"
},
{
"input": "./packages/schematics/src",
"glob": "**/*.d.ts",
"output": "./src"
},
{
"input": "./packages/schematics",
"glob": "generators.json",
"output": "."
},
{
"input": "./packages/schematics",
"glob": "executors.json",
"output": "."
}
]
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/schematics/jest.config.ts"
}
}
},
"tags": []
}
94 changes: 21 additions & 73 deletions packages/schematics/src/collection.json
Original file line number Diff line number Diff line change
@@ -1,96 +1,44 @@
{
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
"extends": "@nestjs/schematics",
"schematics": {
"application": {
"description": "Create a devon4ts_node application.",
"factory": "./lib/devon4ts_node-application/devon4ts_node-application.factory#devon4ts_nodeApplication",
"schema": "./lib/devon4ts_node-application/schema.json"
},
"generators": {
"typeorm": {
"description": "Initialice typeorm into your current project in a correct way.",
"factory": "./lib/init-typeorm/init-typeorm.factory#initTypeorm",
"schema": "./lib/init-typeorm/schema.json"
"factory": "./generators/init-typeorm/generator",
"schema": "./generators/init-typeorm/schema.json"
},
"entity": {
"description": "Add a TypeOrm entity to your project",
"factory": "./lib/entity/entity.factory#main",
"schema": "./lib/entity/schema.json"
"factory": "./generators/entity/generator",
"schema": "./generators/entity/schema.json"
},
"convict": {
"description": "Initialize convict to manage the configuration into the project.",
"factory": "./lib/convict/convict.factory#initConvict",
"schema": "./lib/convict/schema.json"
"description": "Initialize convict to manage the configuration into the project.",
"factory": "./generators/convict/generator",
"schema": "./generators/convict/schema.json"
},
"mailer": {
"description": "Add @devon4ts_node/mailer module to project.",
"factory": "./lib/mailer/mailer.factory#mailer",
"schema": "./lib/mailer/schema.json"
"factory": "./generators/mailer/generator",
"schema": "./generators/mailer/schema.json"
},
"swagger": {
"description": "Add swagger module to project.",
"factory": "./lib/swagger/swagger.factory#swagger",
"schema": "./lib/swagger/schema.json"
"factory": "./generators/swagger/generator",
"schema": "./generators/swagger/schema.json"
},
"auth-jwt": {
"description": "Add the auth JWT module to the project.",
"factory": "./lib/auth-jwt/auth.factory#authJWT",
"schema": "./lib/auth-jwt/schema.json"
"factory": "./generators/auth-jwt/generator",
"schema": "./generators/auth-jwt/schema.json"
},
"security": {
"description": "Add cors and helmet to your project.",
"factory": "./lib/security/security.factory#security",
"schema": "./lib/security/schema.json"
},
"repository": {
"factory": "./lib/repository/repository.factory#main",
"description": "Create a TypeORM custom repository.",
"schema": "./lib/repository/schema.json"
},
"controller": {
"factory": "./lib/controller/controller.factory#main",
"description": "Create a Nest controller.",
"schema": "./lib/controller/schema.json"
},
"module": {
"factory": "./lib/module/module.factory#main",
"description": "Create a Nest module.",
"schema": "./lib/module/schema.json"
},
"service": {
"factory": "./lib/service/service.factory#main",
"description": "Create a Nest service.",
"schema": "./lib/service/schema.json"
"factory": "./generators/security/generator",
"schema": "./generators/security/schema.json"
},
"filter": {
"factory": "./lib/filter/filter.factory#main",
"description": "Create a Nest filter.",
"schema": "./lib/filter/schema.json"
},
"guard": {
"factory": "./lib/guard/guard.factory#main",
"description": "Create a Nest guard.",
"schema": "./lib/guard/schema.json"
},
"interceptor": {
"factory": "./lib/interceptor/interceptor.factory#main",
"description": "Create a Nest interceptor.",
"schema": "./lib/interceptor/schema.json"
},
"middleware": {
"factory": "./lib/middleware/middleware.factory#main",
"description": "Create a Nest middleware.",
"schema": "./lib/middleware/schema.json"
},
"pipe": {
"factory": "./lib/pipe/pipe.factory#main",
"description": "Create a Nest pipe.",
"schema": "./lib/pipe/schema.json"
},
"resource": {
"factory": "./lib/resource/resource.factory#main",
"description": "Create a Nest resource.",
"schema": "./lib/resource/schema.json"
"application": {
"factory": "./src/generators/application/generator",
"schema": "./src/generators/application/schema.json",
"description": "Generates a basic NestJS application using Devonfw Architecture"
}
}
}
}
Loading
Loading