@lukfel/ng-scaffold 20.0.49 → 20.0.50
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 +1 -1
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/add-styles.d.ts +2 -0
- package/schematics/ng-add/add-styles.js +38 -0
- package/schematics/ng-add/add-styles.js.map +1 -0
- package/schematics/ng-add/index.d.ts +2 -0
- package/schematics/ng-add/index.js +17 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/schema.json +7 -0
package/package.json
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addStyles = addStyles;
|
|
4
|
+
const SNIPPET = `
|
|
5
|
+
@use "@lukfel/ng-scaffold/styles" as lf;
|
|
6
|
+
// Create a base theme and include it with @include lf.scaffold-theme($base-theme);
|
|
7
|
+
// Include additional themes with @include lf.scaffold-colors($theme2, 'theme2');
|
|
8
|
+
|
|
9
|
+
`;
|
|
10
|
+
function addStyles() {
|
|
11
|
+
return (tree, context) => {
|
|
12
|
+
context.logger.info('[Styles] Searching for styles file ...');
|
|
13
|
+
const possiblePaths = [
|
|
14
|
+
'src/styles.scss',
|
|
15
|
+
'src/styles.sass',
|
|
16
|
+
'src/styles.css',
|
|
17
|
+
'src/styles.css.scss',
|
|
18
|
+
'styles.scss'
|
|
19
|
+
];
|
|
20
|
+
const path = possiblePaths.find(p => tree.exists(p));
|
|
21
|
+
if (!path) {
|
|
22
|
+
context.logger.warn('[Styles] No global styles file found. Skip.');
|
|
23
|
+
return tree;
|
|
24
|
+
}
|
|
25
|
+
;
|
|
26
|
+
const content = tree.read(path).toString('utf-8');
|
|
27
|
+
if (content.includes('@lukfel/ng-scaffold/styles') || content.includes('lf.scaffold-theme')) {
|
|
28
|
+
context.logger.info('[Styles] Styles already added. Skip.');
|
|
29
|
+
return tree;
|
|
30
|
+
}
|
|
31
|
+
const recorder = tree.beginUpdate(path);
|
|
32
|
+
recorder.insertLeft(content.length, SNIPPET);
|
|
33
|
+
tree.commitUpdate(recorder);
|
|
34
|
+
context.logger.info('[Styles] Successfully added.');
|
|
35
|
+
return tree;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=add-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-styles.js","sourceRoot":"","sources":["../../../../projects/ng-scaffold/schematics/ng-add/add-styles.ts"],"names":[],"mappings":";;AASA,8BA8BC;AArCD,MAAM,OAAO,GAAG;;;;;CAKf,CAAC;AAEF,SAAgB,SAAS;IACrB,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC7C,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;QAE9D,MAAM,aAAa,GAAG;YAClB,iBAAiB;YACjB,iBAAiB;YACjB,gBAAgB;YAChB,qBAAqB;YACrB,aAAa;SAChB,CAAC;QAEF,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;YACnE,OAAO,IAAI,CAAA;QACf,CAAC;QAAA,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAC1F,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YAC5D,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACxC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7C,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC5B,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = ngAdd;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
// import { addModule } from './add-module';
|
|
6
|
+
// import { addService } from './add-service';
|
|
7
|
+
const add_styles_1 = require("./add-styles");
|
|
8
|
+
// import { addTemplate } from './add-template';
|
|
9
|
+
function ngAdd() {
|
|
10
|
+
return (0, schematics_1.chain)([
|
|
11
|
+
// addModule(),
|
|
12
|
+
// addService(),
|
|
13
|
+
// addTemplate(),
|
|
14
|
+
(0, add_styles_1.addStyles)(),
|
|
15
|
+
]);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ng-scaffold/schematics/ng-add/index.ts"],"names":[],"mappings":";;AAMA,wBAOC;AAbD,2DAAyD;AACzD,4CAA4C;AAC5C,8CAA8C;AAC9C,6CAAyC;AACzC,gDAAgD;AAEhD,SAAwB,KAAK;IACzB,OAAO,IAAA,kBAAK,EAAC;QACT,eAAe;QACf,gBAAgB;QAChB,iBAAiB;QACjB,IAAA,sBAAS,GAAE;KACd,CAAC,CAAC;AACP,CAAC"}
|