devextreme-schematics 1.3.0-beta.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +10 -8
- package/src/add-app-template/index.js +2 -1
- package/src/add-app-template/index.js.map +1 -1
- package/src/add-app-template/index.ts +30 -0
- package/src/add-app-template/index_spec.js +6 -5
- package/src/add-app-template/index_spec.js.map +1 -1
- package/src/add-app-template/index_spec.ts +73 -0
- package/src/add-app-template/schema.json +7 -3
- package/src/add-layout/files/devextreme.json +1 -1
- package/src/add-layout/files/src/app/__name__.component.html +3 -3
- package/src/add-layout/files/src/app/__name__.component.ts +1 -1
- package/src/add-layout/files/src/app/app-routing.module.ts +1 -1
- package/src/add-layout/files/src/app/layouts/side-nav-inner-toolbar/side-nav-inner-toolbar.component.ts +13 -11
- package/src/add-layout/files/src/app/layouts/side-nav-outer-toolbar/side-nav-outer-toolbar.component.ts +10 -9
- package/src/add-layout/files/src/app/layouts/single-card/single-card.component.ts +4 -4
- package/src/add-layout/files/src/app/not-authorized-container.ts +2 -0
- package/src/add-layout/files/src/app/shared/components/change-password-form/change-password-form.component.html +8 -6
- package/src/add-layout/files/src/app/shared/components/change-password-form/change-password-form.component.ts +6 -15
- package/src/add-layout/files/src/app/shared/components/create-account-form/create-account-form.component.html +9 -7
- package/src/add-layout/files/src/app/shared/components/create-account-form/create-account-form.component.ts +4 -13
- package/src/add-layout/files/src/app/shared/components/header/header.component.ts +11 -6
- package/src/add-layout/files/src/app/shared/components/login-form/login-form.component.html +8 -6
- package/src/add-layout/files/src/app/shared/components/login-form/login-form.component.ts +2 -12
- package/src/add-layout/files/src/app/shared/components/reset-password-form/reset-password-form.component.html +8 -6
- package/src/add-layout/files/src/app/shared/components/reset-password-form/reset-password-form.component.ts +2 -12
- package/src/add-layout/files/src/app/shared/components/side-navigation-menu/side-navigation-menu.component.ts +8 -7
- package/src/add-layout/files/src/app/shared/components/user-panel/user-panel.component.html +5 -2
- package/src/add-layout/files/src/app/shared/components/user-panel/user-panel.component.ts +3 -2
- package/src/add-layout/files/src/app/shared/services/auth.service.ts +11 -5
- package/src/add-layout/files/src/app/shared/services/screen.service.ts +2 -2
- package/src/add-layout/files/src/app/unauthenticated-content.ts +53 -0
- package/src/add-layout/files/src/dx-styles.scss +4 -0
- package/src/add-layout/index.js +45 -31
- package/src/add-layout/index.js.map +1 -1
- package/src/add-layout/index.ts +384 -0
- package/src/add-layout/index_spec.js +42 -28
- package/src/add-layout/index_spec.js.map +1 -1
- package/src/add-layout/index_spec.ts +340 -0
- package/src/add-layout/schema.json +6 -2
- package/src/add-sample-views/files/pages/home/home.component.html +5 -5
- package/src/add-sample-views/files/pages/profile/profile.component.ts +1 -1
- package/src/add-sample-views/files/pages/tasks/tasks.component.html +1 -0
- package/src/add-sample-views/index.js +13 -4
- package/src/add-sample-views/index.js.map +1 -1
- package/src/add-sample-views/index.ts +141 -0
- package/src/add-sample-views/index_spec.js +5 -4
- package/src/add-sample-views/index_spec.js.map +1 -1
- package/src/add-sample-views/index_spec.ts +74 -0
- package/src/add-sample-views/schema.json +1 -1
- package/src/add-view/index.d.ts +2 -2
- package/src/add-view/index.js +33 -22
- package/src/add-view/index.js.map +1 -1
- package/src/add-view/index.ts +166 -0
- package/src/add-view/index_spec.js +12 -12
- package/src/add-view/index_spec.js.map +1 -1
- package/src/add-view/index_spec.ts +155 -0
- package/src/add-view/schema.json +4 -4
- package/src/collection.json +2 -1
- package/src/install/index.js +16 -3
- package/src/install/index.js.map +1 -1
- package/src/install/index.ts +88 -0
- package/src/install/index_spec.js +10 -9
- package/src/install/index_spec.js.map +1 -1
- package/src/install/index_spec.ts +106 -0
- package/src/install/schema.json +2 -2
- package/src/utility/array.js +1 -0
- package/src/utility/array.js.map +1 -1
- package/src/utility/array.ts +3 -0
- package/src/utility/change.js +1 -0
- package/src/utility/change.js.map +1 -1
- package/src/utility/change.ts +66 -0
- package/src/utility/latest-versions.d.ts +1 -1
- package/src/utility/latest-versions.js +3 -2
- package/src/utility/latest-versions.js.map +1 -1
- package/src/utility/latest-versions.ts +6 -0
- package/src/utility/modify-json-file.d.ts +1 -0
- package/src/utility/modify-json-file.js +7 -3
- package/src/utility/modify-json-file.js.map +1 -1
- package/src/utility/modify-json-file.ts +16 -0
- package/src/utility/project.d.ts +4 -4
- package/src/utility/project.js +35 -12
- package/src/utility/project.js.map +1 -1
- package/src/utility/project.ts +30 -0
- package/src/utility/routing.js +1 -0
- package/src/utility/routing.js.map +1 -1
- package/src/utility/routing.ts +44 -0
- package/src/utility/source.js +1 -0
- package/src/utility/source.js.map +1 -1
- package/src/utility/source.ts +16 -0
- package/src/utility/string.js +1 -0
- package/src/utility/string.js.map +1 -1
- package/src/utility/string.ts +5 -0
- package/src/utility/styles.d.ts +1 -2
- package/src/utility/styles.js +3 -4
- package/src/utility/styles.js.map +1 -1
- package/src/utility/styles.ts +30 -0
package/src/utility/project.js
CHANGED
@@ -1,26 +1,49 @@
|
|
1
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
|
+
};
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
12
|
+
exports.getRootPath = exports.getSourceRootPath = exports.getApplicationPath = exports.getProjectName = void 0;
|
13
|
+
const workspace_1 = require("@schematics/angular/utility/workspace");
|
14
|
+
function getProjectName(host, projectName) {
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
16
|
+
const projects = [];
|
17
|
+
const workspace = yield workspace_1.getWorkspace(host);
|
18
|
+
/* tslint:disable-next-line:variable-name */
|
19
|
+
workspace.projects.forEach((_v, k) => {
|
20
|
+
projects.push(k);
|
21
|
+
});
|
22
|
+
return projectName && projects.includes(projectName) ? projectName : projects[0];
|
23
|
+
});
|
9
24
|
}
|
10
25
|
exports.getProjectName = getProjectName;
|
11
26
|
function getApplicationPath(host, projectName) {
|
12
|
-
|
13
|
-
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
28
|
+
const sourcePath = yield getSourceRootPath(host, projectName);
|
29
|
+
return sourcePath ? `${sourcePath}/app/` : 'src/app/';
|
30
|
+
});
|
14
31
|
}
|
15
32
|
exports.getApplicationPath = getApplicationPath;
|
16
33
|
function getSourceRootPath(host, projectName) {
|
17
|
-
|
18
|
-
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
35
|
+
const workspace = yield workspace_1.getWorkspace(host);
|
36
|
+
const project = workspace.projects.get(projectName);
|
37
|
+
return project && (project.sourceRoot || project.root);
|
38
|
+
});
|
19
39
|
}
|
20
40
|
exports.getSourceRootPath = getSourceRootPath;
|
21
41
|
function getRootPath(host, projectName) {
|
22
|
-
|
23
|
-
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
43
|
+
const workspace = yield workspace_1.getWorkspace(host);
|
44
|
+
const project = workspace.projects.get(projectName);
|
45
|
+
return project && project.root;
|
46
|
+
});
|
24
47
|
}
|
25
48
|
exports.getRootPath = getRootPath;
|
26
49
|
//# sourceMappingURL=project.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["project.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["project.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qEAAqE;AAErE,SAAsB,cAAc,CAAC,IAAU,EAAE,WAAmB;;QAClE,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAG,MAAM,wBAAY,CAAC,IAAI,CAAC,CAAC;QAC3C,4CAA4C;QAC5C,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;YACnC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,OAAO,WAAW,IAAI,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC;CAAA;AATD,wCASC;AAED,SAAsB,kBAAkB,CAAC,IAAU,EAAE,WAAmB;;QACtE,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC9D,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;IACxD,CAAC;CAAA;AAHD,gDAGC;AAED,SAAsB,iBAAiB,CAAC,IAAU,EAAE,WAAmB;;QACrE,MAAM,SAAS,GAAG,MAAM,wBAAY,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACpD,OAAO,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;CAAA;AAJD,8CAIC;AAED,SAAsB,WAAW,CAAC,IAAU,EAAE,WAAmB;;QAC/D,MAAM,SAAS,GAAG,MAAM,wBAAY,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACpD,OAAO,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IACjC,CAAC;CAAA;AAJD,kCAIC"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
2
|
+
import { getWorkspace } from '@schematics/angular/utility/workspace';
|
3
|
+
|
4
|
+
export async function getProjectName(host: Tree, projectName: string) {
|
5
|
+
const projects: string[] = [];
|
6
|
+
const workspace = await getWorkspace(host);
|
7
|
+
/* tslint:disable-next-line:variable-name */
|
8
|
+
workspace.projects.forEach((_v, k) => {
|
9
|
+
projects.push(k);
|
10
|
+
});
|
11
|
+
|
12
|
+
return projectName && projects.includes(projectName) ? projectName : projects[0];
|
13
|
+
}
|
14
|
+
|
15
|
+
export async function getApplicationPath(host: Tree, projectName: string) {
|
16
|
+
const sourcePath = await getSourceRootPath(host, projectName);
|
17
|
+
return sourcePath ? `${sourcePath}/app/` : 'src/app/';
|
18
|
+
}
|
19
|
+
|
20
|
+
export async function getSourceRootPath(host: Tree, projectName: string) {
|
21
|
+
const workspace = await getWorkspace(host);
|
22
|
+
const project = workspace.projects.get(projectName);
|
23
|
+
return project && (project.sourceRoot || project.root);
|
24
|
+
}
|
25
|
+
|
26
|
+
export async function getRootPath(host: Tree, projectName: string) {
|
27
|
+
const workspace = await getWorkspace(host);
|
28
|
+
const project = workspace.projects.get(projectName);
|
29
|
+
return project && project.root;
|
30
|
+
}
|
package/src/utility/routing.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.findRoutesInSource = exports.getRoute = exports.hasComponentInRoutes = void 0;
|
3
4
|
const typescript_1 = require("typescript");
|
4
5
|
const core_1 = require("@angular-devkit/core");
|
5
6
|
function getRouteComponentName(pageName) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"routing.js","sourceRoot":"","sources":["routing.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"routing.js","sourceRoot":"","sources":["routing.ts"],"names":[],"mappings":";;;AAAA,2CAIoB;AAEpB,+CAI8B;AAE9B,SAAS,qBAAqB,CAAC,QAAgB;IAC7C,OAAO,GAAG,cAAO,CAAC,QAAQ,CAAC,eAAQ,CAAC,gBAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC;AACvE,CAAC;AAED,SAAgB,oBAAoB,CAAC,MAAY,EAAE,IAAY;IAC7D,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IACpC,MAAM,aAAa,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAClD,OAAO,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AAClD,CAAC;AAJD,oDAIC;AAED,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO;aACI,cAAO,CAAC,SAAS,CAAC,IAAI,CAAC;iBACnB,qBAAqB,CAAC,IAAI,CAAC;;IAExC,CAAC;AACL,CAAC;AAND,4BAMC;AAED,SAAS,eAAe,CAAC,IAAU,EAAE,IAAY;IAC7C,OAAO,IAAI,CAAC,IAAI,KAAK,uBAAU,CAAC,iBAAiB;QAC/C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AACtC,CAAC;AAEH,SAAgB,kBAAkB,CAAC,MAAkB;IACnD,uCAAuC;IACvC,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,EAAE;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC5B,IAAI,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;YAC/B,OAAO,IAAI,CAAC;SACb;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AARD,gDAQC"}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import {
|
2
|
+
Node,
|
3
|
+
SourceFile,
|
4
|
+
SyntaxKind
|
5
|
+
} from 'typescript';
|
6
|
+
|
7
|
+
import {
|
8
|
+
strings,
|
9
|
+
basename,
|
10
|
+
normalize
|
11
|
+
} from '@angular-devkit/core';
|
12
|
+
|
13
|
+
function getRouteComponentName(pageName: string) {
|
14
|
+
return `${strings.classify(basename(normalize(pageName)))}Component`;
|
15
|
+
}
|
16
|
+
|
17
|
+
export function hasComponentInRoutes(routes: Node, name: string) {
|
18
|
+
const routesText = routes.getText();
|
19
|
+
const componentName = getRouteComponentName(name);
|
20
|
+
return routesText.indexOf(componentName) !== -1;
|
21
|
+
}
|
22
|
+
|
23
|
+
export function getRoute(name: string) {
|
24
|
+
return ` {
|
25
|
+
path: '${strings.dasherize(name)}',
|
26
|
+
component: ${getRouteComponentName(name)},
|
27
|
+
canActivate: [ AuthGuardService ]
|
28
|
+
}`;
|
29
|
+
}
|
30
|
+
|
31
|
+
function isRouteVariable(node: Node, text: string) {
|
32
|
+
return node.kind === SyntaxKind.VariableStatement &&
|
33
|
+
text.search(/\:\s*Routes/) !== -1;
|
34
|
+
}
|
35
|
+
|
36
|
+
export function findRoutesInSource(source: SourceFile) {
|
37
|
+
// TODO: try to use ast-utils/findNodes
|
38
|
+
return source.forEachChild((node) => {
|
39
|
+
const text = node.getText();
|
40
|
+
if (isRouteVariable(node, text)) {
|
41
|
+
return node;
|
42
|
+
}
|
43
|
+
});
|
44
|
+
}
|
package/src/utility/source.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"source.js","sourceRoot":"","sources":["source.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["source.ts"],"names":[],"mappings":";;;AACA,2CAIoB;AAEpB,SAAgB,aAAa,CAAC,IAAU,EAAE,QAAgB;IACxD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEnC,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IACD,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAE,CAAC,QAAQ,EAAE,CAAC;IACvD,OAAO,6BAAgB,CAAC,QAAQ,EAAE,cAAc,EAAE,yBAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC/E,CAAC;AARD,sCAQC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
2
|
+
import {
|
3
|
+
createSourceFile,
|
4
|
+
ScriptTarget,
|
5
|
+
SourceFile
|
6
|
+
} from 'typescript';
|
7
|
+
|
8
|
+
export function getSourceFile(host: Tree, filePath: string): SourceFile | undefined {
|
9
|
+
const buffer = host.read(filePath);
|
10
|
+
|
11
|
+
if (!buffer) {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
const serializedFile = host.read(filePath)!.toString();
|
15
|
+
return createSourceFile(filePath, serializedFile, ScriptTarget.Latest, true);
|
16
|
+
}
|
package/src/utility/string.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["string.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["string.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAE/C,SAAgB,QAAQ,CAAC,GAAW;IAClC,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,cAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClF,CAAC;AAFD,4BAEC"}
|
package/src/utility/styles.d.ts
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
export declare function addStylesToApp(host: Tree, project: string, config: any, styles?: Array<any>): any;
|
1
|
+
export declare function addStylesToApp(project: string, config: any, styles?: Array<any>): any;
|
package/src/utility/styles.js
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
|
3
|
+
exports.addStylesToApp = void 0;
|
4
4
|
const array_1 = require("./array");
|
5
5
|
function cleanStyles(projectStyles, defaultStyles) {
|
6
6
|
return projectStyles.filter((style) => {
|
7
7
|
return style !== defaultStyles[0] && style !== defaultStyles[1];
|
8
8
|
});
|
9
9
|
}
|
10
|
-
function addStylesToApp(
|
11
|
-
const
|
12
|
-
const projectBuildOptopns = config['projects'][projectName]['architect']['build']['options'];
|
10
|
+
function addStylesToApp(project, config, styles) {
|
11
|
+
const projectBuildOptopns = config['projects'][project]['architect']['build']['options'];
|
13
12
|
const defaultStyles = [
|
14
13
|
'node_modules/devextreme/dist/css/dx.light.css',
|
15
14
|
'node_modules/devextreme/dist/css/dx.common.css'
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["styles.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["styles.ts"],"names":[],"mappings":";;;AAAA,mCAA0C;AAE1C,SAAS,WAAW,CAAC,aAAyB,EAAE,aAAkB;IAChE,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QACpC,OAAO,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,cAAc,CAAC,OAAe,EAAE,MAAW,EAAE,MAAmB;IAC9E,MAAM,mBAAmB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC;IACzF,MAAM,aAAa,GAAG;QACpB,+CAA+C;QAC/C,gDAAgD;KACjD,CAAC;IACF,IAAI,aAAa,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAElD,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,GAAG,aAAa,CAAC;KACxB;SAAM;QACL,aAAa,GAAG,WAAW,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;KAC3D;IAED,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACvB,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,mBAAmB,CAAC,QAAQ,CAAC,GAAG,uBAAe,CAAC,aAAa,CAAC,CAAC;IAE/D,OAAO,MAAM,CAAC;AAChB,CAAC;AArBD,wCAqBC"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { makeArrayUnique } from './array';
|
2
|
+
|
3
|
+
function cleanStyles(projectStyles: Array<any>, defaultStyles: any) {
|
4
|
+
return projectStyles.filter((style) => {
|
5
|
+
return style !== defaultStyles[0] && style !== defaultStyles[1];
|
6
|
+
});
|
7
|
+
}
|
8
|
+
|
9
|
+
export function addStylesToApp(project: string, config: any, styles?: Array<any>) {
|
10
|
+
const projectBuildOptopns = config['projects'][project]['architect']['build']['options'];
|
11
|
+
const defaultStyles = [
|
12
|
+
'node_modules/devextreme/dist/css/dx.light.css',
|
13
|
+
'node_modules/devextreme/dist/css/dx.common.css'
|
14
|
+
];
|
15
|
+
let projectStyles = projectBuildOptopns['styles'];
|
16
|
+
|
17
|
+
if (!styles) {
|
18
|
+
styles = defaultStyles;
|
19
|
+
} else {
|
20
|
+
projectStyles = cleanStyles(projectStyles, defaultStyles);
|
21
|
+
}
|
22
|
+
|
23
|
+
styles.forEach((style) => {
|
24
|
+
projectStyles.unshift(style);
|
25
|
+
});
|
26
|
+
|
27
|
+
projectBuildOptopns['styles'] = makeArrayUnique(projectStyles);
|
28
|
+
|
29
|
+
return config;
|
30
|
+
}
|