@mckit/schematics 0.0.1

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/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # Getting Started With Schematics
2
+
3
+ This repository is a basic Schematic implementation that serves as a starting point to create and publish Schematics to NPM.
4
+
5
+ ### Testing
6
+
7
+ To test locally, install `@angular-devkit/schematics-cli` globally and use the `schematics` command line tool. That tool acts the same as the `generate` command of the Angular CLI, but also has a debug mode.
8
+
9
+ Check the documentation with
10
+
11
+ ```bash
12
+ schematics --help
13
+ ```
14
+
15
+ ### Unit Testing
16
+
17
+ `npm run test` will run the unit tests, using Jasmine as a runner and test framework.
18
+
19
+ ### Publishing
20
+
21
+ To publish, simply do:
22
+
23
+ ```bash
24
+ npm run build
25
+ npm publish
26
+ ```
27
+
28
+ That's it!
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@mckit/schematics",
3
+ "version": "0.0.1",
4
+ "description": "A blank schematics",
5
+ "scripts": {
6
+ "build": "tsc -p tsconfig.json",
7
+ "test": "npm run build && jasmine src/**/*_spec.js"
8
+ },
9
+ "keywords": [
10
+ "schematics"
11
+ ],
12
+ "author": "",
13
+ "license": "MIT",
14
+ "schematics": "./src/collection.json",
15
+ "dependencies": {
16
+ "@angular-devkit/core": "^18.2.6",
17
+ "@angular-devkit/schematics": "^18.2.6",
18
+ "typescript": "~5.5.2"
19
+ },
20
+ "devDependencies": {
21
+ "@types/node": "^18.18.0",
22
+ "@types/jasmine": "~5.1.0",
23
+ "jasmine": "^5.0.0"
24
+ }
25
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "mc-schematic": {
5
+ "description": "A blank schematic.",
6
+ "factory": "./mc-schematic/index#mcSchematic"
7
+ },
8
+ "init": {
9
+ "description": "Config a new project.",
10
+ "factory": "./init/index#init"
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare function init(_options: any): Rule;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.init = init;
4
+ const child_process_1 = require("child_process");
5
+ function runCommand(command, _context) {
6
+ (0, child_process_1.exec)(command, (error, stdout, stderr) => {
7
+ if (error) {
8
+ _context.logger.error(`❌ Error: ${error.message}`);
9
+ return;
10
+ }
11
+ if (stderr) {
12
+ _context.logger.warn(`⚠️ Warning: ${stderr}`);
13
+ }
14
+ _context.logger.info(`✅ Result: ${stdout}`);
15
+ });
16
+ }
17
+ // You don't have to export the function as default. You can also have more than one rule factory
18
+ // per file.
19
+ function init(_options) {
20
+ return (tree, _context) => {
21
+ // Install the required dependencies
22
+ runCommand('npm install --save @mckit/core primeng @primeng/themes primeicons @ngx-pwa/local-storage@19', _context);
23
+ runCommand('npm install tailwindcss @tailwindcss/postcss postcss --force', _context);
24
+ runCommand('npm i tailwindcss-primeui --save', _context);
25
+ return tree;
26
+ };
27
+ }
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAkBA,oBAUC;AA3BD,iDAAqC;AAErC,SAAS,UAAU,CAAC,OAAe,EAAE,QAA0B;IAC7D,IAAA,oBAAI,EAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;QACtC,IAAI,KAAK,EAAE,CAAC;YACV,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACnD,OAAO;QACT,CAAC;QACD,IAAI,MAAM,EAAE,CAAC;YACX,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,MAAM,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,MAAM,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,iGAAiG;AACjG,YAAY;AACZ,SAAgB,IAAI,CAAC,QAAa;IAChC,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAEhD,oCAAoC;QACpC,UAAU,CAAC,6FAA6F,EAAE,QAAQ,CAAC,CAAC;QACpH,UAAU,CAAC,8DAA8D,EAAE,QAAQ,CAAC,CAAC;QACrF,UAAU,CAAC,kCAAkC,EAAE,QAAQ,CAAC,CAAC;QAEzD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { FormsModule } from '@angular/forms';
4
+ import { <%= classify(name) %>RoutingModule } from './<%= dasherize(name) %>-routing.module';
5
+
6
+ @NgModule({
7
+ declarations: [],
8
+ imports: [
9
+ CommonModule,
10
+ <%= classify(name) %>RoutingModule,
11
+ FormsModule,
12
+ ]
13
+ })
14
+ export class <%= classify(name) %>Module { }
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare function mcSchematic(_options: any): Rule;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mcSchematic = mcSchematic;
4
+ // You don't have to export the function as default. You can also have more than one rule factory
5
+ // per file.
6
+ function mcSchematic(_options) {
7
+ return (tree, _context) => {
8
+ // Aquí puedes definir la lógica para generar archivos o modificar el proyecto
9
+ tree.create('hello.txt', 'Hello, World!');
10
+ return tree;
11
+ };
12
+ }
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAKA,kCAMC;AARD,iGAAiG;AACjG,YAAY;AACZ,SAAgB,WAAW,CAAC,QAAa;IACvC,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,8EAA8E;QAC9E,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const schematics_1 = require("@angular-devkit/schematics");
13
+ const testing_1 = require("@angular-devkit/schematics/testing");
14
+ const path = require("path");
15
+ const collectionPath = path.join(__dirname, '../collection.json');
16
+ describe('mc-schematic', () => {
17
+ it('works', () => __awaiter(void 0, void 0, void 0, function* () {
18
+ const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
19
+ const tree = yield runner.runSchematic('mc-schematic', {}, schematics_1.Tree.empty());
20
+ expect(tree.files).toEqual([]);
21
+ }));
22
+ });
23
+ //# sourceMappingURL=index_spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkD;AAClD,gEAAyE;AACzE,6BAA6B;AAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAElE,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,OAAO,EAAE,GAAS,EAAE;QACrB,MAAM,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,cAAc,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAEzE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "tsconfig",
4
+ "lib": ["es2018", "dom"],
5
+ "declaration": true,
6
+ "module": "commonjs",
7
+ "moduleResolution": "node",
8
+ "noEmitOnError": true,
9
+ "noFallthroughCasesInSwitch": true,
10
+ "noImplicitAny": true,
11
+ "noImplicitThis": true,
12
+ "noUnusedParameters": true,
13
+ "noUnusedLocals": true,
14
+ "rootDir": "src/",
15
+ "skipDefaultLibCheck": true,
16
+ "skipLibCheck": true,
17
+ "sourceMap": true,
18
+ "strictNullChecks": true,
19
+ "target": "es6",
20
+ "types": ["jasmine", "node"]
21
+ },
22
+ "include": ["src/**/*"],
23
+ "exclude": ["src/*/files/**/*"]
24
+ }