@shivay_18/ng-crud 0.1.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.
Files changed (30) hide show
  1. package/README.docx +0 -0
  2. package/README.md +142 -0
  3. package/dist/collection.json +10 -0
  4. package/dist/crud/files/module/components/__name@dasherize__-form/__name@dasherize__-form.component.html.template +48 -0
  5. package/dist/crud/files/module/components/__name@dasherize__-form/__name@dasherize__-form.component.scss.template +46 -0
  6. package/dist/crud/files/module/components/__name@dasherize__-form/__name@dasherize__-form.component.ts.template +121 -0
  7. package/dist/crud/files/module/components/__name@dasherize__-list/__name@dasherize__-delete-dialog.component.ts.template +27 -0
  8. package/dist/crud/files/module/components/__name@dasherize__-list/__name@dasherize__-list.component.html.template +75 -0
  9. package/dist/crud/files/module/components/__name@dasherize__-list/__name@dasherize__-list.component.scss.template +40 -0
  10. package/dist/crud/files/module/components/__name@dasherize__-list/__name@dasherize__-list.component.ts.template +95 -0
  11. package/dist/crud/files/module/components/__name@dasherize__-list/__name@dasherize__.module.ts.template +73 -0
  12. package/dist/crud/files/module/models/__name@dasherize__.model.ts.template +4 -0
  13. package/dist/crud/files/module/services/__name@dasherize__.service.ts.template +42 -0
  14. package/dist/crud/files/standalone/components/__name@dasherize__-form/__name@dasherize__-form.component.html.template +48 -0
  15. package/dist/crud/files/standalone/components/__name@dasherize__-form/__name@dasherize__-form.component.scss.template +46 -0
  16. package/dist/crud/files/standalone/components/__name@dasherize__-form/__name@dasherize__-form.component.ts.template +142 -0
  17. package/dist/crud/files/standalone/components/__name@dasherize__-list/__name@dasherize__-delete-dialog.component.ts.template +30 -0
  18. package/dist/crud/files/standalone/components/__name@dasherize__-list/__name@dasherize__-list.component.html.template +75 -0
  19. package/dist/crud/files/standalone/components/__name@dasherize__-list/__name@dasherize__-list.component.scss.template +40 -0
  20. package/dist/crud/files/standalone/components/__name@dasherize__-list/__name@dasherize__-list.component.ts.template +121 -0
  21. package/dist/crud/files/standalone/models/__name@dasherize__.model.ts.template +4 -0
  22. package/dist/crud/files/standalone/services/__name@dasherize__.service.ts.template +42 -0
  23. package/dist/crud/index.d.ts +3 -0
  24. package/dist/crud/index.js +141 -0
  25. package/dist/crud/index.js.map +1 -0
  26. package/dist/crud/schema.d.ts +7 -0
  27. package/dist/crud/schema.js +3 -0
  28. package/dist/crud/schema.js.map +1 -0
  29. package/dist/crud/schema.json +34 -0
  30. package/package.json +33 -0
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.crud = crud;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const core_1 = require("@angular-devkit/core");
6
+ function parseFields(raw) {
7
+ return raw.split(',').map((entry) => {
8
+ const [namePart, type = 'string'] = entry.trim().split(':');
9
+ const name = namePart.replace('*', '').trim();
10
+ const required = namePart.includes('*');
11
+ const control = type === 'boolean' ? 'checkbox' : type === 'number' ? 'number' : 'text';
12
+ const label = name.replace(/([A-Z])/g, ' $1').replace(/^./, (s) => s.toUpperCase());
13
+ return { name, type, label, control, required };
14
+ });
15
+ }
16
+ function detectAngularVersion(tree) {
17
+ const pkgPath = '/package.json';
18
+ if (!tree.exists(pkgPath))
19
+ return 14;
20
+ const pkg = JSON.parse(tree.read(pkgPath).toString('utf-8'));
21
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
22
+ const version = deps['@angular/core'];
23
+ if (!version)
24
+ return 14;
25
+ const major = parseInt(version.replace(/[^0-9]/, ''), 10);
26
+ return isNaN(major) ? 14 : major;
27
+ }
28
+ function getTemplateContext(name, fields, apiUrl, isStandalone, angularVersion) {
29
+ return {
30
+ ...core_1.strings,
31
+ name,
32
+ fields,
33
+ apiUrl,
34
+ isStandalone,
35
+ angularVersion,
36
+ classify: core_1.strings.classify,
37
+ dasherize: core_1.strings.dasherize,
38
+ camelize: core_1.strings.camelize,
39
+ };
40
+ }
41
+ function addToAppRoutes(name, isStandalone, path) {
42
+ return (tree) => {
43
+ const routesPath = '/src/app/app.routes.ts';
44
+ if (!isStandalone || !tree.exists(routesPath))
45
+ return tree;
46
+ const content = tree.read(routesPath).toString('utf-8');
47
+ const routeName = core_1.strings.dasherize(name);
48
+ if (content.includes(`path: '${routeName}'`))
49
+ return tree;
50
+ const listComponentName = `${core_1.strings.classify(name)}ListComponent`;
51
+ const formComponentName = `${core_1.strings.classify(name)}FormComponent`;
52
+ const basePath = path ? `${path}/` : '';
53
+ const listImportPath = `./${basePath}${routeName}-list/${routeName}-list.component`;
54
+ const formImportPath = `./${basePath}${routeName}-form/${routeName}-form.component`;
55
+ const listImportLine = `import { ${listComponentName} } from '${listImportPath}';\n`;
56
+ const formImportLine = `import { ${formComponentName} } from '${formImportPath}';\n`;
57
+ const routeEntry = ` {
58
+ path: '${routeName}',
59
+ children: [
60
+ { path: '', component: ${listComponentName}, title: '${core_1.strings.classify(name)} List' },
61
+ { path: 'new', component: ${formComponentName}, title: 'New ${core_1.strings.classify(name)}' },
62
+ { path: ':id/edit', component: ${formComponentName}, title: 'Edit ${core_1.strings.classify(name)}' }
63
+ ]
64
+ },\n`;
65
+ const updated = content
66
+ .replace(/(import.*from '@angular\/router';\n)/, `$1${listImportLine}${formImportLine}`)
67
+ .replace(/(export const routes: Routes = \[)/, `$1\n${routeEntry}`);
68
+ tree.overwrite(routesPath, updated);
69
+ return tree;
70
+ };
71
+ }
72
+ function addToAppModule(name, path) {
73
+ return (tree) => {
74
+ const appModulePath = '/src/app/app.module.ts';
75
+ if (!tree.exists(appModulePath))
76
+ return tree;
77
+ const content = tree.read(appModulePath).toString('utf-8');
78
+ const moduleName = `${core_1.strings.classify(name)}Module`;
79
+ if (content.includes(moduleName))
80
+ return tree;
81
+ const routeName = core_1.strings.dasherize(name);
82
+ const basePath = path ? `${path}/` : '';
83
+ const importPath = `./${basePath}${routeName}-list/${routeName}.module`;
84
+ const importLine = `import { ${moduleName} } from '${importPath}';\n`;
85
+ // Add module to imports array
86
+ const updated = content
87
+ .replace(/(import.*from '@angular\/core';\n)/, `$1${importLine}`)
88
+ .replace(/(imports:\s*\[)/, `$1\n ${moduleName},`);
89
+ tree.overwrite(appModulePath, updated);
90
+ return tree;
91
+ };
92
+ }
93
+ function crud(options) {
94
+ return (tree, context) => {
95
+ const angularVersion = detectAngularVersion(tree);
96
+ const isStandalone = options.standalone || angularVersion >= 17;
97
+ const fields = parseFields(options.fields || 'name:string');
98
+ const apiUrl = options.apiUrl || 'http://localhost:3000';
99
+ const name = options.name;
100
+ const dasherizedName = core_1.strings.dasherize(name);
101
+ const targetPath = options.path ? `src/app/${options.path}` : 'src/app';
102
+ const templateCtx = getTemplateContext(name, fields, apiUrl, isStandalone, angularVersion);
103
+ const templateFolder = isStandalone ? './files/standalone' : './files/module';
104
+ context.logger.info(`Generating CRUD for "${name}" in "${targetPath}" (Angular ${angularVersion}, ${isStandalone ? 'Standalone' : 'Module-based'})`);
105
+ // components go into specified path or src/app
106
+ const componentsSource = (0, schematics_1.apply)((0, schematics_1.url)(`${templateFolder}/components`), [
107
+ (0, schematics_1.applyTemplates)(templateCtx),
108
+ (0, schematics_1.move)(`${targetPath}`),
109
+ ]);
110
+ // model goes into models/ — skip if already exists
111
+ const modelPath = `${targetPath}/models/${dasherizedName}.model.ts`;
112
+ const modelSource = (0, schematics_1.apply)((0, schematics_1.url)(`${templateFolder}/models`), [
113
+ (0, schematics_1.applyTemplates)(templateCtx),
114
+ (0, schematics_1.move)(`${targetPath}/models`),
115
+ ]);
116
+ // service goes into services/ — skip if already exists
117
+ const servicePath = `${targetPath}/services/${dasherizedName}.service.ts`;
118
+ const serviceSource = (0, schematics_1.apply)((0, schematics_1.url)(`${templateFolder}/services`), [
119
+ (0, schematics_1.applyTemplates)(templateCtx),
120
+ (0, schematics_1.move)(`${targetPath}/services`),
121
+ ]);
122
+ const rules = [
123
+ (0, schematics_1.mergeWith)(componentsSource, schematics_1.MergeStrategy.Overwrite),
124
+ ];
125
+ // only write model/service if they don't already exist
126
+ if (!tree.exists(`/${modelPath}`)) {
127
+ rules.push((0, schematics_1.mergeWith)(modelSource, schematics_1.MergeStrategy.Default));
128
+ }
129
+ if (!tree.exists(`/${servicePath}`)) {
130
+ rules.push((0, schematics_1.mergeWith)(serviceSource, schematics_1.MergeStrategy.Default));
131
+ }
132
+ if (isStandalone) {
133
+ rules.push(addToAppRoutes(name, isStandalone, options.path));
134
+ }
135
+ else {
136
+ rules.push(addToAppModule(name, options.path));
137
+ }
138
+ return (0, schematics_1.chain)(rules)(tree, context);
139
+ };
140
+ }
141
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/crud/index.ts"],"names":[],"mappings":";;AAsHA,oBAwDC;AA9KD,2DAWoC;AACpC,+CAA+C;AAW/C,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAClC,MAAM,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5D,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;QACxF,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QACpF,OAA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,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface Schema {
2
+ name: string;
3
+ fields: string;
4
+ path: string;
5
+ apiUrl: string;
6
+ standalone: boolean;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/crud/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "ng-crud",
4
+ "title": "Angular CRUD Generator",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "The name of the resource (e.g. product, user, order).",
10
+ "$default": { "$source": "argv", "index": 0 }
11
+ },
12
+ "fields": {
13
+ "type": "string",
14
+ "description": "Comma-separated field definitions. Format: fieldName:type. Example: \"name:string,price:number,active:boolean\"",
15
+ "default": "name:string"
16
+ },
17
+ "path": {
18
+ "type": "string",
19
+ "description": "Path where the module folder will be created, relative to src/app.",
20
+ "default": ""
21
+ },
22
+ "apiUrl": {
23
+ "type": "string",
24
+ "description": "Base API URL for the REST service. Example: http://localhost:3000",
25
+ "default": "http://localhost:3000"
26
+ },
27
+ "standalone": {
28
+ "type": "boolean",
29
+ "description": "Force standalone component generation (Angular 17+). Auto-detected if not provided.",
30
+ "default": false
31
+ }
32
+ },
33
+ "required": ["name"]
34
+ }
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@shivay_18/ng-crud",
3
+ "version": "0.1.0",
4
+ "description": "Angular CRUD generator with Material UI. Generates complete CRUD operations. Safe to uninstall after generation.",
5
+ "keywords": [
6
+ "angular",
7
+ "crud",
8
+ "schematics",
9
+ "material",
10
+ "generator",
11
+ "angular-material"
12
+ ],
13
+ "author": "Shivay <granthik.dev.0@gmail.com>",
14
+ "license": "MIT",
15
+ "schematics": "./dist/collection.json",
16
+ "scripts": {
17
+ "build": "tsc -p tsconfig.json && npm run copy-files",
18
+ "build:watch": "tsc -p tsconfig.json --watch",
19
+ "copy-files": "xcopy /E /I /Y src\\crud\\files dist\\crud\\files && xcopy /Y src\\collection.json dist\\collection.json* && xcopy /Y src\\crud\\schema.json dist\\crud\\schema.json*",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "devDependencies": {
23
+ "@angular-devkit/core": "^17.0.0",
24
+ "@angular-devkit/schematics": "^17.0.0",
25
+ "@angular-devkit/schematics-cli": "^17.0.0",
26
+ "@types/node": "^20.0.0",
27
+ "typescript": "^5.0.0"
28
+ },
29
+ "peerDependencies": {
30
+ "@angular/core": ">=14.0.0",
31
+ "@angular/material": ">=14.0.0"
32
+ }
33
+ }