@mckit/schematics 0.0.3 → 0.0.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mckit/schematics",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "A blank schematics",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -p tsconfig.json",
|
|
@@ -15,17 +15,11 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@angular-devkit/core": "^18.2.6",
|
|
17
17
|
"@angular-devkit/schematics": "^18.2.6",
|
|
18
|
-
"@mckit/core": "^19.0.1",
|
|
19
|
-
"@ngx-pwa/local-storage": "^19.0.0",
|
|
20
|
-
"@primeng/themes": "^19.0.9",
|
|
21
|
-
"primeicons": "^7.0.0",
|
|
22
|
-
"primeng": "^19.0.9",
|
|
23
|
-
"tailwindcss-primeui": "^0.5.1",
|
|
24
18
|
"typescript": "~5.5.2"
|
|
25
19
|
},
|
|
26
20
|
"devDependencies": {
|
|
27
|
-
"@types/jasmine": "~5.1.0",
|
|
28
21
|
"@types/node": "^18.18.0",
|
|
22
|
+
"@types/jasmine": "~5.1.0",
|
|
29
23
|
"jasmine": "^5.0.0"
|
|
30
24
|
}
|
|
31
25
|
}
|
package/src/init/index.js
CHANGED
|
@@ -23,6 +23,71 @@ function createFileWithTemplate(tree, fileName, template) {
|
|
|
23
23
|
tree.create(fileName, content);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
function insertStringAt(originalString, stringToInsert, position) {
|
|
27
|
+
if (position > originalString.length) {
|
|
28
|
+
// Si la posición está fuera del rango, simplemente agrega el string al final
|
|
29
|
+
return originalString + stringToInsert;
|
|
30
|
+
}
|
|
31
|
+
// Dividir el original en dos partes: antes y después de la posición
|
|
32
|
+
const before = originalString.slice(0, position);
|
|
33
|
+
const after = originalString.slice(position);
|
|
34
|
+
// Insertar el string en la posición deseada
|
|
35
|
+
return before + stringToInsert + after;
|
|
36
|
+
}
|
|
37
|
+
function processStyles(tree, _context) {
|
|
38
|
+
const filePath = 'src/styles.scss';
|
|
39
|
+
if (!tree.exists(filePath)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const fileBuffer = tree.read(filePath);
|
|
43
|
+
const content = fileBuffer ? fileBuffer.toString() : '';
|
|
44
|
+
if (content.includes('@use "tailwindcss";')) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// Create string variable with the new content
|
|
48
|
+
const newContent = `@use "tailwindcss";
|
|
49
|
+
@use "primeicons/primeicons.css";
|
|
50
|
+
|
|
51
|
+
body, html {
|
|
52
|
+
height: 100%;
|
|
53
|
+
margin: 0;
|
|
54
|
+
min-height: 100%;
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
const updatedContent = newContent + content;
|
|
58
|
+
tree.overwrite(filePath, updatedContent);
|
|
59
|
+
}
|
|
60
|
+
function processAppConfig(tree, _context) {
|
|
61
|
+
const filePath = 'src/app/app.config.ts';
|
|
62
|
+
if (!tree.exists(filePath)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const fileBuffer = tree.read(filePath);
|
|
66
|
+
let content = fileBuffer ? fileBuffer.toString() : '';
|
|
67
|
+
// Search position of the last import
|
|
68
|
+
const importPosition = content.lastIndexOf('import');
|
|
69
|
+
// Search position of the last ; after import position
|
|
70
|
+
const importEndPosition = content.indexOf(';', importPosition);
|
|
71
|
+
// Add the new import after the last import
|
|
72
|
+
content = insertStringAt(content, `
|
|
73
|
+
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
|
74
|
+
import { providePrimeNG } from 'primeng/config';
|
|
75
|
+
import Aura from '@primeng/themes/aura';`, importEndPosition + 1);
|
|
76
|
+
// Search position of the last ]
|
|
77
|
+
const providerPosition = content.lastIndexOf(']');
|
|
78
|
+
// Add the new provider after the last provider
|
|
79
|
+
content = insertStringAt(content, ` provideAnimationsAsync(),
|
|
80
|
+
providePrimeNG({
|
|
81
|
+
theme: {
|
|
82
|
+
preset: Aura,
|
|
83
|
+
options: {
|
|
84
|
+
prefix: 'p',
|
|
85
|
+
darkModeSelector: '.dark',
|
|
86
|
+
cssLayer: false
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})`, providerPosition - 1);
|
|
90
|
+
}
|
|
26
91
|
// You don't have to export the function as default. You can also have more than one rule factory
|
|
27
92
|
// per file.
|
|
28
93
|
function init(_options) {
|
|
@@ -33,6 +98,12 @@ function init(_options) {
|
|
|
33
98
|
runCommand('npm i tailwindcss-primeui --save', _context);
|
|
34
99
|
// Create .postcssrc.json file from template
|
|
35
100
|
createFileWithTemplate(tree, '.postcssrc.json', '.postcssrc.json.template');
|
|
101
|
+
// Config SCSS
|
|
102
|
+
processStyles(tree, _context);
|
|
103
|
+
// Create .postcssrc.json file from template
|
|
104
|
+
createFileWithTemplate(tree, 'tailwind.config.js', 'tailwind.config.js.template');
|
|
105
|
+
// Config app.config.ts
|
|
106
|
+
processAppConfig(tree, _context);
|
|
36
107
|
return tree;
|
|
37
108
|
};
|
|
38
109
|
}
|
package/src/init/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AA2GA,oBAsBC;AAhID,iDAAqC;AACrC,yBAAyB;AACzB,6BAA6B;AAE7B,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,CAA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gB,GAAG,CAAC,CAAC,CAAC;AAC/B,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,4CAA4C;QAC5C,sBAAsB,CAAC,IAAI,EAAE,iBAAiB,EAAE,0BAA0B,CAAC,CAAC;QAE5E,cAAc;QACd,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAE9B,4CAA4C;QAC5C,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,EAAE,6BAA6B,CAAC,CAAC;QAElF,uBAAuB;QACvB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEjC,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
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 { }
|