devextreme-schematics 1.3.3 → 1.4.2
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 +9 -8
- package/src/add-app-template/README.md +1 -1
- package/src/add-app-template/index.js +26 -5
- package/src/add-app-template/index.js.map +1 -1
- package/src/add-app-template/index.ts +27 -1
- package/src/add-app-template/schema.json +1 -1
- package/src/add-layout/README.md +2 -2
- package/src/add-layout/files/src/app/layouts/side-nav-inner-toolbar/side-nav-inner-toolbar.component.scss +1 -16
- package/src/add-layout/files/src/app/layouts/side-nav-outer-toolbar/side-nav-outer-toolbar.component.scss +0 -9
- package/src/add-layout/files/src/dx-styles.scss +12 -0
- package/src/add-layout/index.js +45 -43
- package/src/add-layout/index.js.map +1 -1
- package/src/add-layout/index.ts +8 -7
- package/src/add-layout/index_spec.js +5 -5
- package/src/add-layout/index_spec.js.map +1 -1
- package/src/add-layout/index_spec.ts +2 -2
- package/src/add-layout/schema.json +1 -1
- package/src/add-sample-views/index.js +15 -15
- package/src/add-sample-views/index.js.map +1 -1
- package/src/add-view/README.md +2 -2
- package/src/add-view/index.js +21 -21
- package/src/add-view/index.js.map +1 -1
- package/src/add-view/index.ts +1 -1
- package/src/install/index.js +12 -12
- package/src/install/index.js.map +1 -1
- package/src/install/index.ts +6 -7
- package/src/install/schema.json +1 -1
- package/src/utility/change.d.ts +1 -1
- package/src/utility/change.ts +1 -1
- package/src/utility/latest-versions.js +2 -2
- package/src/utility/latest-versions.ts +2 -2
- package/src/utility/modify-json-file.js +1 -1
- package/src/utility/modify-json-file.js.map +1 -1
- package/src/utility/patch.d.ts +4 -0
- package/src/utility/patch.js +20 -0
- package/src/utility/patch.js.map +1 -0
- package/src/utility/patch.ts +14 -0
- package/src/utility/project.js +3 -3
- package/src/utility/project.js.map +1 -1
- package/src/utility/routing.d.ts +1 -1
- package/src/utility/routing.js +2 -2
- package/src/utility/routing.js.map +1 -1
- package/src/utility/routing.ts +1 -1
- package/src/utility/source.d.ts +1 -1
- package/src/utility/source.js +2 -2
- package/src/utility/source.js.map +1 -1
- package/src/utility/source.ts +1 -1
- package/src/utility/styles.js +1 -1
- package/src/utility/styles.js.map +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "devextreme-schematics",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.4.2",
|
4
4
|
"description": "DevExtreme schematics",
|
5
5
|
"scripts": {
|
6
6
|
"build": "tsc -p tsconfig.json",
|
@@ -24,15 +24,16 @@
|
|
24
24
|
"dependencies": {
|
25
25
|
"@angular-devkit/core": "^12.0.0",
|
26
26
|
"@angular-devkit/schematics": "^12.0.0",
|
27
|
-
"@schematics/angular": "^12.0.0"
|
28
|
-
"rxjs": "~6.4.0",
|
29
|
-
"typescript": "~4.3.1"
|
27
|
+
"@schematics/angular": "^12.0.0"
|
30
28
|
},
|
31
29
|
"devDependencies": {
|
32
|
-
"@types/jasmine": "~3.10.
|
33
|
-
"@types/node": "
|
30
|
+
"@types/jasmine": "~3.10.6",
|
31
|
+
"@types/node": "ts4.3",
|
32
|
+
"@types/semver": "^7.3.10",
|
34
33
|
"jasmine": "^2.8.0",
|
35
|
-
"
|
34
|
+
"rxjs": "^6.0.0",
|
35
|
+
"tslint": "^5.15.0",
|
36
|
+
"typescript": "^4.3.1"
|
36
37
|
},
|
37
|
-
"gitHead": "
|
38
|
+
"gitHead": "b48e36220ea219b061fb6db3aa58f48dbae70e5a"
|
38
39
|
}
|
@@ -16,5 +16,5 @@ A schematic that adds a DevExtreme layout template to an Angular application.
|
|
16
16
|
- empty (Boolean)
|
17
17
|
Specifies whether to skip sample views generation
|
18
18
|
|
19
|
-
-
|
19
|
+
- resolve-conflicts (string)
|
20
20
|
Specifies whether to override the existing app component or create a component with another name
|
@@ -1,27 +1,48 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
|
+
const fs_1 = require("fs");
|
5
|
+
const path_1 = require("path");
|
6
|
+
const child_process_1 = require("child_process");
|
4
7
|
function default_1(options) {
|
5
8
|
const rules = [
|
6
|
-
schematics_1.schematic('install', {
|
9
|
+
(0, schematics_1.schematic)('install', {
|
7
10
|
dxversion: options.dxversion,
|
8
11
|
project: options.project
|
9
12
|
}),
|
10
|
-
schematics_1.schematic('add-layout', {
|
13
|
+
(0, schematics_1.schematic)('add-layout', {
|
11
14
|
layout: options.layout,
|
12
15
|
resolveConflicts: options.resolveConflicts,
|
13
16
|
project: options.project,
|
14
17
|
skipInstall: true,
|
15
18
|
updateBudgets: options.updateBudgets,
|
16
19
|
globalNgCliVersion: options.globalNgCliVersion
|
17
|
-
})
|
20
|
+
}),
|
21
|
+
// schematics installed packages with flag --ignore-scripts
|
22
|
+
// @angular/cli@14 add option allowScript to NodePackageInstallTask
|
23
|
+
(host) => {
|
24
|
+
postinstallScripts();
|
25
|
+
return host;
|
26
|
+
}
|
18
27
|
];
|
19
28
|
if (!options.empty) {
|
20
|
-
rules.push(schematics_1.schematic('add-sample-views', {
|
29
|
+
rules.push((0, schematics_1.schematic)('add-sample-views', {
|
21
30
|
project: options.project
|
22
31
|
}));
|
23
32
|
}
|
24
|
-
return schematics_1.chain(rules);
|
33
|
+
return (0, schematics_1.chain)(rules);
|
25
34
|
}
|
26
35
|
exports.default = default_1;
|
36
|
+
const postinstallScripts = () => {
|
37
|
+
const isWin = /^win/.test(process.platform);
|
38
|
+
const sassEmbeddedPath = (0, path_1.resolve)('node_modules', 'sass-embedded');
|
39
|
+
const sassVendorPath = (0, path_1.join)(sassEmbeddedPath, 'dist', 'lib', 'src', 'vendor', 'dart-sass-embedded');
|
40
|
+
if (!(0, fs_1.existsSync)(sassVendorPath)) {
|
41
|
+
(0, child_process_1.spawnSync)('npm', ['run', 'postinstall'], {
|
42
|
+
cwd: (0, path_1.resolve)((0, path_1.join)('node_modules', 'sass-embedded')),
|
43
|
+
windowsVerbatimArguments: true,
|
44
|
+
shell: isWin ? false : true
|
45
|
+
});
|
46
|
+
}
|
47
|
+
};
|
27
48
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,2DAKoC;AAEpC,2BAAgC;AAChC,+BAAqC;AAErC,iDAA0C;AAE1C,mBAAwB,OAAY;IAClC,MAAM,KAAK,GAAG;QACZ,IAAA,sBAAS,EAAC,SAAS,EAAE;YACnB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC;QACF,IAAA,sBAAS,EAAC,YAAY,EAAE;YACtB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,WAAW,EAAE,IAAI;YACjB,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;SAC/C,CAAC;QACF,2DAA2D;QAC3D,mEAAmE;QACnE,CAAC,IAAU,EAAE,EAAE;YACb,kBAAkB,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;IAEF,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;QAClB,KAAK,CAAC,IAAI,CAAC,IAAA,sBAAS,EAAC,kBAAkB,EAAE;YACvC,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC,CAAC,CAAC;KACL;IAED,OAAO,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC;AACtB,CAAC;AA7BD,4BA6BC;AAED,MAAM,kBAAkB,GAAG,GAAG,EAAE;IAC9B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE5C,MAAM,gBAAgB,GAAG,IAAA,cAAO,EAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IAClE,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IACpG,IAAI,CAAC,IAAA,eAAU,EAAC,cAAc,CAAC,EAAE;QAC/B,IAAA,yBAAS,EAAC,KAAK,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,EAAE;YACvC,GAAG,EAAE,IAAA,cAAO,EAAC,IAAA,WAAI,EAAC,cAAc,EAAE,eAAe,CAAC,CAAC;YACnD,wBAAwB,EAAE,IAAI;YAC9B,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;SAC5B,CAAC,CAAC;KACJ;AACH,CAAC,CAAC"}
|
@@ -2,8 +2,14 @@ import {
|
|
2
2
|
Rule,
|
3
3
|
chain,
|
4
4
|
schematic,
|
5
|
+
Tree,
|
5
6
|
} from '@angular-devkit/schematics';
|
6
7
|
|
8
|
+
import { existsSync } from 'fs';
|
9
|
+
import { resolve, join } from 'path';
|
10
|
+
|
11
|
+
import { spawnSync } from 'child_process';
|
12
|
+
|
7
13
|
export default function(options: any): Rule {
|
8
14
|
const rules = [
|
9
15
|
schematic('install', {
|
@@ -17,7 +23,13 @@ export default function(options: any): Rule {
|
|
17
23
|
skipInstall: true,
|
18
24
|
updateBudgets: options.updateBudgets,
|
19
25
|
globalNgCliVersion: options.globalNgCliVersion
|
20
|
-
})
|
26
|
+
}),
|
27
|
+
// schematics installed packages with flag --ignore-scripts
|
28
|
+
// @angular/cli@14 add option allowScript to NodePackageInstallTask
|
29
|
+
(host: Tree) => {
|
30
|
+
postinstallScripts();
|
31
|
+
return host;
|
32
|
+
}
|
21
33
|
];
|
22
34
|
|
23
35
|
if (!options.empty) {
|
@@ -28,3 +40,17 @@ export default function(options: any): Rule {
|
|
28
40
|
|
29
41
|
return chain(rules);
|
30
42
|
}
|
43
|
+
|
44
|
+
const postinstallScripts = () => {
|
45
|
+
const isWin = /^win/.test(process.platform);
|
46
|
+
|
47
|
+
const sassEmbeddedPath = resolve('node_modules', 'sass-embedded');
|
48
|
+
const sassVendorPath = join(sassEmbeddedPath, 'dist', 'lib', 'src', 'vendor', 'dart-sass-embedded');
|
49
|
+
if (!existsSync(sassVendorPath)) {
|
50
|
+
spawnSync('npm', ['run', 'postinstall'], {
|
51
|
+
cwd: resolve(join('node_modules', 'sass-embedded')),
|
52
|
+
windowsVerbatimArguments: true,
|
53
|
+
shell: isWin ? false : true
|
54
|
+
});
|
55
|
+
}
|
56
|
+
};
|
package/src/add-layout/README.md
CHANGED
@@ -10,9 +10,9 @@ A schematic that adds a DevExtreme layout to a DevExtreme Angular application.
|
|
10
10
|
- project (string)
|
11
11
|
The name of a project to modify
|
12
12
|
|
13
|
-
-
|
13
|
+
- resolve-conflicts (string)
|
14
14
|
Specifies whether to override the existing app component or create a component with another name
|
15
15
|
|
16
|
-
-
|
16
|
+
- skip-install (boolean)
|
17
17
|
Specifies whether to skip the dependency package installation
|
18
18
|
|
@@ -2,21 +2,6 @@
|
|
2
2
|
width: 100%;
|
3
3
|
}
|
4
4
|
|
5
|
-
.container {
|
6
|
-
height: 100%;
|
7
|
-
flex-direction: column;
|
8
|
-
display: flex;
|
9
|
-
}
|
10
|
-
|
11
|
-
.layout-body {
|
12
|
-
flex: 1;
|
13
|
-
min-height: 0;
|
14
|
-
}
|
15
|
-
|
16
|
-
.content {
|
17
|
-
flex-grow: 1;
|
18
|
-
}
|
19
|
-
|
20
5
|
#navigation-header {
|
21
6
|
@import "../../../themes/generated/variables.additional.scss";
|
22
7
|
background-color: $base-accent;
|
@@ -29,7 +14,7 @@
|
|
29
14
|
:host-context(.screen-x-small) & {
|
30
15
|
padding-left: 20px;
|
31
16
|
}
|
32
|
-
|
17
|
+
|
33
18
|
:host-context(.dx-theme-generic) & {
|
34
19
|
padding-top: 10px;
|
35
20
|
padding-bottom: 10px;
|
@@ -10,6 +10,7 @@ html, body {
|
|
10
10
|
|
11
11
|
.content {
|
12
12
|
line-height: 1.5;
|
13
|
+
flex-grow: 1;
|
13
14
|
|
14
15
|
h2 {
|
15
16
|
font-size: 30px;
|
@@ -18,6 +19,17 @@ html, body {
|
|
18
19
|
}
|
19
20
|
}
|
20
21
|
|
22
|
+
.container {
|
23
|
+
height: 100%;
|
24
|
+
flex-direction: column;
|
25
|
+
display: flex;
|
26
|
+
}
|
27
|
+
|
28
|
+
.layout-body {
|
29
|
+
flex: 1;
|
30
|
+
min-height: 0;
|
31
|
+
}
|
32
|
+
|
21
33
|
.side-nav-outer-toolbar .dx-drawer {
|
22
34
|
height: calc(100% - 56px)
|
23
35
|
}
|
package/src/add-layout/index.js
CHANGED
@@ -12,17 +12,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const schematics_1 = require("@angular-devkit/schematics");
|
13
13
|
const core_1 = require("@angular-devkit/core");
|
14
14
|
const path_1 = require("path");
|
15
|
+
const semver_1 = require("semver");
|
15
16
|
const project_1 = require("../utility/project");
|
16
17
|
const string_1 = require("../utility/string");
|
17
18
|
const styles_1 = require("../utility/styles");
|
18
19
|
const modify_json_file_1 = require("../utility/modify-json-file");
|
19
20
|
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
20
|
-
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
21
21
|
const source_1 = require("../utility/source");
|
22
22
|
const change_1 = require("../utility/change");
|
23
23
|
const routing_1 = require("../utility/routing");
|
24
24
|
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
25
25
|
const workspace_1 = require("@schematics/angular/utility/workspace");
|
26
|
+
const patch_1 = require("../utility/patch");
|
26
27
|
const projectFilesSource = './files/src';
|
27
28
|
const workspaceFilesSource = './files';
|
28
29
|
function addScriptSafe(scripts, name, value) {
|
@@ -41,7 +42,7 @@ function addScriptSafe(scripts, name, value) {
|
|
41
42
|
}
|
42
43
|
function addBuildThemeScript() {
|
43
44
|
return (host) => {
|
44
|
-
modify_json_file_1.modifyJSONFile(host, './package.json', config => {
|
45
|
+
(0, modify_json_file_1.modifyJSONFile)(host, './package.json', config => {
|
45
46
|
const scripts = config['scripts'];
|
46
47
|
addScriptSafe(scripts, 'build-themes', 'devextreme build');
|
47
48
|
addScriptSafe(scripts, 'postinstall', 'npm run build-themes');
|
@@ -52,23 +53,23 @@ function addBuildThemeScript() {
|
|
52
53
|
}
|
53
54
|
function addCustomThemeStyles(host, options, sourcePath = '') {
|
54
55
|
return __awaiter(this, void 0, void 0, function* () {
|
55
|
-
const projectName = yield project_1.getProjectName(host, options.project);
|
56
|
-
modify_json_file_1.modifyJSONFile(host, './angular.json', config => {
|
56
|
+
const projectName = yield (0, project_1.getProjectName)(host, options.project);
|
57
|
+
(0, modify_json_file_1.modifyJSONFile)(host, './angular.json', config => {
|
57
58
|
const stylesList = [
|
58
59
|
`${sourcePath}/dx-styles.scss`,
|
59
60
|
`${sourcePath}/themes/generated/theme.additional.css`,
|
60
61
|
`${sourcePath}/themes/generated/theme.base.css`,
|
61
62
|
'node_modules/devextreme/dist/css/dx.common.css'
|
62
63
|
];
|
63
|
-
return styles_1.addStylesToApp(projectName, config, stylesList);
|
64
|
+
return (0, styles_1.addStylesToApp)(projectName, config, stylesList);
|
64
65
|
});
|
65
66
|
return host;
|
66
67
|
});
|
67
68
|
}
|
68
69
|
function updateBudgets(host, options) {
|
69
70
|
return __awaiter(this, void 0, void 0, function* () {
|
70
|
-
const projectName = yield project_1.getProjectName(host, options.project);
|
71
|
-
modify_json_file_1.modifyJSONFile(host, './angular.json', config => {
|
71
|
+
const projectName = yield (0, project_1.getProjectName)(host, options.project);
|
72
|
+
(0, modify_json_file_1.modifyJSONFile)(host, './angular.json', config => {
|
72
73
|
const budgets = config.projects[projectName].architect.build.configurations.production.budgets;
|
73
74
|
const budget = budgets.find((item) => item.type === 'initial');
|
74
75
|
if (budget) {
|
@@ -82,7 +83,7 @@ function updateBudgets(host, options) {
|
|
82
83
|
}
|
83
84
|
function addViewportToBody(sourcePath = '') {
|
84
85
|
return (host) => {
|
85
|
-
const indexPath = path_1.join(sourcePath, 'index.html');
|
86
|
+
const indexPath = (0, path_1.join)(sourcePath, 'index.html');
|
86
87
|
let indexContent = host.read(indexPath).toString();
|
87
88
|
indexContent = indexContent.replace(/<body>/, '<body class="dx-viewport">');
|
88
89
|
host.overwrite(indexPath, indexContent);
|
@@ -91,24 +92,24 @@ function addViewportToBody(sourcePath = '') {
|
|
91
92
|
}
|
92
93
|
function modifyFileRule(path, callback) {
|
93
94
|
return (host) => {
|
94
|
-
const source = source_1.getSourceFile(host, path);
|
95
|
+
const source = (0, source_1.getSourceFile)(host, path);
|
95
96
|
if (!source) {
|
96
97
|
return host;
|
97
98
|
}
|
98
99
|
const changes = callback(source);
|
99
|
-
return change_1.applyChanges(host, changes, path);
|
100
|
+
return (0, change_1.applyChanges)(host, changes, path);
|
100
101
|
};
|
101
102
|
}
|
102
103
|
function updateAppModule(host, sourcePath) {
|
103
104
|
const appModulePath = sourcePath + 'app.module.ts';
|
104
105
|
const importSetter = (importName, path) => {
|
105
106
|
return (source) => {
|
106
|
-
return ast_utils_1.addImportToModule(source, appModulePath, importName, path);
|
107
|
+
return (0, ast_utils_1.addImportToModule)(source, appModulePath, importName, path);
|
107
108
|
};
|
108
109
|
};
|
109
110
|
const providerSetter = (importName, path) => {
|
110
111
|
return (source) => {
|
111
|
-
return ast_utils_1.addProviderToModule(source, appModulePath, importName, path);
|
112
|
+
return (0, ast_utils_1.addProviderToModule)(source, appModulePath, importName, path);
|
112
113
|
};
|
113
114
|
};
|
114
115
|
const rules = [
|
@@ -128,7 +129,7 @@ function updateAppModule(host, sourcePath) {
|
|
128
129
|
if (!hasRoutingModule(host, sourcePath)) {
|
129
130
|
rules.push(modifyFileRule(appModulePath, importSetter('AppRoutingModule', './app-routing.module')));
|
130
131
|
}
|
131
|
-
return schematics_1.chain(rules);
|
132
|
+
return (0, schematics_1.chain)(rules);
|
132
133
|
}
|
133
134
|
function getComponentName(host, sourcePath) {
|
134
135
|
let name = '';
|
@@ -148,11 +149,12 @@ function hasRoutingModule(host, sourcePath) {
|
|
148
149
|
return host.exists(sourcePath + 'app-routing.module.ts');
|
149
150
|
}
|
150
151
|
function addPackagesToDependency(globalNgCliVersion) {
|
152
|
+
const version = new semver_1.SemVer(globalNgCliVersion.replace(/\^|\~/g, ''));
|
151
153
|
return (host) => {
|
152
|
-
dependencies_1.addPackageJsonDependency(host, {
|
154
|
+
(0, dependencies_1.addPackageJsonDependency)(host, {
|
153
155
|
type: dependencies_1.NodeDependencyType.Default,
|
154
156
|
name: '@angular/cdk',
|
155
|
-
version:
|
157
|
+
version: `~${version.major}.${version.minor}.0`
|
156
158
|
});
|
157
159
|
return host;
|
158
160
|
};
|
@@ -160,7 +162,7 @@ function addPackagesToDependency(globalNgCliVersion) {
|
|
160
162
|
function modifyContentByTemplate(sourcePath = '', templateSourcePath, filePath, templateOptions = {}, modifyContent) {
|
161
163
|
return (host, context) => {
|
162
164
|
const modifyIfExists = (fileEntry) => {
|
163
|
-
const fileEntryPath = path_1.join(sourcePath, fileEntry.path.toString());
|
165
|
+
const fileEntryPath = (0, path_1.join)(sourcePath, fileEntry.path.toString());
|
164
166
|
if (!host.exists(fileEntryPath)) {
|
165
167
|
return fileEntry;
|
166
168
|
}
|
@@ -177,16 +179,16 @@ function modifyContentByTemplate(sourcePath = '', templateSourcePath, filePath,
|
|
177
179
|
return null;
|
178
180
|
};
|
179
181
|
const rules = [
|
180
|
-
schematics_1.filter(path => {
|
181
|
-
return !filePath || path_1.join('./', path) === path_1.join('./', filePath);
|
182
|
+
(0, schematics_1.filter)(path => {
|
183
|
+
return !filePath || (0, path_1.join)('./', path) === (0, path_1.join)('./', filePath);
|
182
184
|
}),
|
183
|
-
schematics_1.template(templateOptions),
|
184
|
-
schematics_1.forEach(modifyIfExists),
|
185
|
-
schematics_1.move(sourcePath)
|
185
|
+
(0, schematics_1.template)(templateOptions),
|
186
|
+
(0, schematics_1.forEach)(modifyIfExists),
|
187
|
+
(0, schematics_1.move)(sourcePath)
|
186
188
|
];
|
187
|
-
const modifiedSource = schematics_1.apply(schematics_1.url(templateSourcePath), rules);
|
188
|
-
const resultRule = schematics_1.mergeWith(modifiedSource);
|
189
|
-
return schematics_1.callRule(resultRule, host, context);
|
189
|
+
const modifiedSource = (0, schematics_1.apply)((0, schematics_1.url)(templateSourcePath), rules);
|
190
|
+
const resultRule = (0, schematics_1.mergeWith)(modifiedSource);
|
191
|
+
return (0, schematics_1.callRule)(resultRule, host, context);
|
190
192
|
};
|
191
193
|
}
|
192
194
|
function updateDevextremeConfig(sourcePath = '') {
|
@@ -204,28 +206,28 @@ function updateDevextremeConfig(sourcePath = '') {
|
|
204
206
|
}
|
205
207
|
const modifyRoutingModule = (host, routingModulePath) => {
|
206
208
|
// TODO: Try to use the isolated host to generate the result string
|
207
|
-
let source = source_1.getSourceFile(host, routingModulePath);
|
208
|
-
const importChange = ast_utils_1.insertImport(source, routingModulePath, 'LoginFormComponent', './shared/components');
|
209
|
-
const providerChanges = ast_utils_1.addProviderToModule(source, routingModulePath, 'AuthGuardService', './shared/services');
|
210
|
-
change_1.applyChanges(host, [importChange, ...providerChanges], routingModulePath);
|
211
|
-
source = source_1.getSourceFile(host, routingModulePath);
|
212
|
-
const routes = routing_1.findRoutesInSource(source);
|
213
|
-
if (!routing_1.hasComponentInRoutes(routes, 'login-form')) {
|
214
|
-
const loginFormRoute = routing_1.getRoute('login-form');
|
215
|
-
change_1.insertItemToArray(host, routingModulePath, routes, loginFormRoute);
|
209
|
+
let source = (0, source_1.getSourceFile)(host, routingModulePath);
|
210
|
+
const importChange = (0, ast_utils_1.insertImport)(source, routingModulePath, 'LoginFormComponent', './shared/components');
|
211
|
+
const providerChanges = (0, ast_utils_1.addProviderToModule)(source, routingModulePath, 'AuthGuardService', './shared/services');
|
212
|
+
(0, change_1.applyChanges)(host, [importChange, ...providerChanges], routingModulePath);
|
213
|
+
source = (0, source_1.getSourceFile)(host, routingModulePath);
|
214
|
+
const routes = (0, routing_1.findRoutesInSource)(source);
|
215
|
+
if (!(0, routing_1.hasComponentInRoutes)(routes, 'login-form')) {
|
216
|
+
const loginFormRoute = (0, routing_1.getRoute)('login-form');
|
217
|
+
(0, change_1.insertItemToArray)(host, routingModulePath, routes, loginFormRoute);
|
216
218
|
}
|
217
219
|
};
|
218
220
|
function default_1(options) {
|
219
221
|
return (host) => __awaiter(this, void 0, void 0, function* () {
|
220
222
|
const ngConfig = host.read('./angular.json').toString();
|
221
|
-
const defaultProjectName = modify_json_file_1.parseJson(ngConfig).defaultProject;
|
222
|
-
const project = yield project_1.getProjectName(host, options.project);
|
223
|
-
const workspace = yield workspace_1.getWorkspace(host);
|
223
|
+
const defaultProjectName = (0, modify_json_file_1.parseJson)(ngConfig).defaultProject;
|
224
|
+
const project = yield (0, project_1.getProjectName)(host, options.project);
|
225
|
+
const workspace = yield (0, workspace_1.getWorkspace)(host);
|
224
226
|
const ngProject = workspace.projects.get(project);
|
225
227
|
const prefix = ngProject === null || ngProject === void 0 ? void 0 : ngProject.prefix;
|
226
|
-
const title = string_1.humanize(project);
|
227
|
-
const appPath = yield project_1.getApplicationPath(host, project);
|
228
|
-
const sourcePath = yield project_1.getSourceRootPath(host, project);
|
228
|
+
const title = (0, string_1.humanize)(project);
|
229
|
+
const appPath = yield (0, project_1.getApplicationPath)(host, project);
|
230
|
+
const sourcePath = yield (0, project_1.getSourceRootPath)(host, project);
|
229
231
|
const layout = options.layout;
|
230
232
|
const override = options.resolveConflicts === 'override';
|
231
233
|
const componentName = override ? 'app' : getComponentName(host, appPath);
|
@@ -239,10 +241,10 @@ function default_1(options) {
|
|
239
241
|
prefix
|
240
242
|
};
|
241
243
|
const modifyContent = (templateContent, currentContent, filePath) => {
|
242
|
-
if (path_1.basename(filePath) === 'styles.scss') {
|
244
|
+
if ((0, path_1.basename)(filePath) === 'styles.scss') {
|
243
245
|
return `${currentContent}\n${templateContent}`;
|
244
246
|
}
|
245
|
-
if (path_1.basename(filePath) === 'app-routing.module.ts' && hasRoutingModule(host, appPath)) {
|
247
|
+
if ((0, path_1.basename)(filePath) === 'app-routing.module.ts' && hasRoutingModule(host, appPath)) {
|
246
248
|
modifyRoutingModule(host, filePath);
|
247
249
|
return currentContent;
|
248
250
|
}
|
@@ -262,7 +264,7 @@ function default_1(options) {
|
|
262
264
|
}
|
263
265
|
if (!options.skipInstall) {
|
264
266
|
rules.push((_, context) => {
|
265
|
-
context.addTask(new
|
267
|
+
context.addTask(new patch_1.PatchNodePackageInstallTask());
|
266
268
|
});
|
267
269
|
}
|
268
270
|
if (override) {
|
@@ -271,7 +273,7 @@ function default_1(options) {
|
|
271
273
|
rules.push(modifyContentByTemplate('./', workspaceFilesSource, 'e2e/src/app.po.ts'));
|
272
274
|
}
|
273
275
|
}
|
274
|
-
return schematics_1.chain(rules);
|
276
|
+
return (0, schematics_1.chain)(rules);
|
275
277
|
});
|
276
278
|
}
|
277
279
|
exports.default = default_1;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAcoC;AAMpC,+CAA+C;AAE/C,+BAAsC;AAEtC,gDAI6B;AAE7B,8CAE2B;AAE3B,8CAE4B;AAE5B,kEAGsC;AAEtC,2EAGkD;AAElD,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAcoC;AAMpC,+CAA+C;AAE/C,+BAAsC;AAEtC,mCAAgC;AAEhC,gDAI6B;AAE7B,8CAE2B;AAE3B,8CAE4B;AAE5B,kEAGsC;AAEtC,2EAGkD;AAElD,8CAAkD;AAElD,8CAG2B;AAE3B,gDAI4B;AAE5B,qEAE+C;AAE/C,qEAAqE;AAGrE,4CAA+D;AAE/D,MAAM,kBAA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,IAAI,CAAC,uBAAuB,CAAC,IAAI,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBACtG,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,EAAE,oBAAoB,EAAE,mBAAmB,CAAC,CAAC,CAAC;aACtF;SACF;QAED,OAAO,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC;IACtB,CAAC,CAAA,CAAC;AACJ,CAAC;AAlED,4BAkEC"}
|
package/src/add-layout/index.ts
CHANGED
@@ -16,12 +16,14 @@ import {
|
|
16
16
|
|
17
17
|
import {
|
18
18
|
SourceFile
|
19
|
-
} from 'typescript';
|
19
|
+
} from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript';
|
20
20
|
|
21
21
|
import { strings } from '@angular-devkit/core';
|
22
22
|
|
23
23
|
import { join, basename } from 'path';
|
24
24
|
|
25
|
+
import { SemVer } from 'semver';
|
26
|
+
|
25
27
|
import {
|
26
28
|
getApplicationPath,
|
27
29
|
getSourceRootPath,
|
@@ -46,10 +48,6 @@ import {
|
|
46
48
|
addPackageJsonDependency
|
47
49
|
} from '@schematics/angular/utility/dependencies';
|
48
50
|
|
49
|
-
import {
|
50
|
-
NodePackageInstallTask
|
51
|
-
} from '@angular-devkit/schematics/tasks';
|
52
|
-
|
53
51
|
import { getSourceFile } from '../utility/source';
|
54
52
|
|
55
53
|
import {
|
@@ -70,6 +68,8 @@ import {
|
|
70
68
|
import { getWorkspace } from '@schematics/angular/utility/workspace';
|
71
69
|
import { Change } from '@schematics/angular/utility/change';
|
72
70
|
|
71
|
+
import { PatchNodePackageInstallTask } from '../utility/patch';
|
72
|
+
|
73
73
|
const projectFilesSource = './files/src';
|
74
74
|
const workspaceFilesSource = './files';
|
75
75
|
|
@@ -226,11 +226,12 @@ function hasRoutingModule(host: Tree, sourcePath: string) {
|
|
226
226
|
}
|
227
227
|
|
228
228
|
function addPackagesToDependency(globalNgCliVersion: string) {
|
229
|
+
const version = new SemVer(globalNgCliVersion.replace(/\^|\~/g, ''));
|
229
230
|
return (host: Tree) => {
|
230
231
|
addPackageJsonDependency(host, {
|
231
232
|
type: NodeDependencyType.Default,
|
232
233
|
name: '@angular/cdk',
|
233
|
-
version:
|
234
|
+
version: `~${version.major}.${version.minor}.0`
|
234
235
|
});
|
235
236
|
|
236
237
|
return host;
|
@@ -368,7 +369,7 @@ export default function(options: any): Rule {
|
|
368
369
|
|
369
370
|
if (!options.skipInstall) {
|
370
371
|
rules.push((_: Tree, context: SchematicContext) => {
|
371
|
-
context.addTask(new
|
372
|
+
context.addTask(new PatchNodePackageInstallTask());
|
372
373
|
});
|
373
374
|
}
|
374
375
|
|
@@ -32,7 +32,7 @@ describe('layout', () => {
|
|
32
32
|
const options = {
|
33
33
|
layout: 'side-nav-outer-toolbar',
|
34
34
|
resolveConflicts: 'override',
|
35
|
-
globalNgCliVersion: '^
|
35
|
+
globalNgCliVersion: '^12.2.0'
|
36
36
|
};
|
37
37
|
const angularSchematicsCollection = require.resolve('../../node_modules/@schematics/angular/collection.json');
|
38
38
|
const schematicRunner = new testing_1.SchematicTestRunner('@schematics/angular', angularSchematicsCollection);
|
@@ -117,8 +117,8 @@ describe('layout', () => {
|
|
117
117
|
expect(packageConfig.scripts['postinstall']).toBe('npm run build-themes');
|
118
118
|
}));
|
119
119
|
it('should set static flag', () => __awaiter(void 0, void 0, void 0, function* () {
|
120
|
-
dependencies_1.removePackageJsonDependency(appTree, '@angular/core');
|
121
|
-
dependencies_1.addPackageJsonDependency(appTree, {
|
120
|
+
(0, dependencies_1.removePackageJsonDependency)(appTree, '@angular/core');
|
121
|
+
(0, dependencies_1.addPackageJsonDependency)(appTree, {
|
122
122
|
type: dependencies_1.NodeDependencyType.Default,
|
123
123
|
name: '@angular/core',
|
124
124
|
version: '7.0.0'
|
@@ -129,7 +129,7 @@ describe('layout', () => {
|
|
129
129
|
expect(navigationMenu).toContain('@ViewChild(DxTreeViewComponent, { static: true })');
|
130
130
|
}));
|
131
131
|
it('should add npm scripts safely', () => __awaiter(void 0, void 0, void 0, function* () {
|
132
|
-
modify_json_file_1.modifyJSONFile(appTree, './package.json', config => {
|
132
|
+
(0, modify_json_file_1.modifyJSONFile)(appTree, './package.json', config => {
|
133
133
|
const scripts = config['scripts'];
|
134
134
|
scripts['build-themes'] = 'prev value 1';
|
135
135
|
scripts['postinstall'] = 'prev value 2';
|
@@ -153,7 +153,7 @@ describe('layout', () => {
|
|
153
153
|
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
154
154
|
const tree = yield runner.runSchematicAsync('add-layout', options, appTree).toPromise();
|
155
155
|
const packageConfig = JSON.parse(tree.readContent('package.json'));
|
156
|
-
expect(packageConfig.dependencies['@angular/cdk']).toBe('
|
156
|
+
expect(packageConfig.dependencies['@angular/cdk']).toBe('~12.2.0');
|
157
157
|
}));
|
158
158
|
it('should update budgets if updateBudgets option is true', () => __awaiter(void 0, void 0, void 0, function* () {
|
159
159
|
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|