@abp/aspnetcore.mvc.ui 8.1.3 → 8.2.0-rc.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 +2 -7
- package/gulp/copy-resources.js +0 -172
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "8.
|
|
2
|
+
"version": "8.2.0-rc.2",
|
|
3
3
|
"name": "@abp/aspnetcore.mvc.ui",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
@@ -10,12 +10,7 @@
|
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"ansi-colors": "^4.1.1"
|
|
14
|
-
"extend-object": "^1.0.0",
|
|
15
|
-
"glob": "^7.1.6",
|
|
16
|
-
"gulp": "^4.0.2",
|
|
17
|
-
"merge-stream": "^2.0.0",
|
|
18
|
-
"micromatch": "^4.0.2"
|
|
13
|
+
"ansi-colors": "^4.1.1"
|
|
19
14
|
},
|
|
20
15
|
"gitHead": "bb4ea17d5996f01889134c138d00b6c8f858a431",
|
|
21
16
|
"homepage": "https://abp.io",
|
package/gulp/copy-resources.js
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
(function () {
|
|
4
|
-
|
|
5
|
-
var gulp = require("gulp"),
|
|
6
|
-
merge = require("merge-stream"),
|
|
7
|
-
fs = require('fs'),
|
|
8
|
-
glob = require('glob'),
|
|
9
|
-
micromatch = require('micromatch'),
|
|
10
|
-
path = require("path"),
|
|
11
|
-
extendObject = require('extend-object');
|
|
12
|
-
|
|
13
|
-
var investigatedPackagePaths = {};
|
|
14
|
-
|
|
15
|
-
var resourceMapping;
|
|
16
|
-
var rootPath;
|
|
17
|
-
|
|
18
|
-
function replaceAliases(text) {
|
|
19
|
-
if (!resourceMapping.aliases) {
|
|
20
|
-
return text;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
for (var alias in resourceMapping.aliases) {
|
|
24
|
-
if (!resourceMapping.aliases.hasOwnProperty(alias)) {
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
text = replaceAll(text, alias, resourceMapping.aliases[alias]);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return text;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function replaceAll(text, search, replacement) {
|
|
35
|
-
return text.replace(new RegExp(search, 'g'), replacement);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function requireOptional(filePath) {
|
|
39
|
-
//TODO: Implement this using a library instead of try-catch!
|
|
40
|
-
try {
|
|
41
|
-
return require(filePath);
|
|
42
|
-
} catch (e) {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function cleanDirsAndFiles(patterns) {
|
|
48
|
-
const { dirs, files } = findDirsAndFiles(patterns);
|
|
49
|
-
|
|
50
|
-
files.forEach(file => {
|
|
51
|
-
try {
|
|
52
|
-
fs.unlinkSync(file);
|
|
53
|
-
} catch (_) {}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
dirs.sort((a, b) => a < b ? 1 : -1);
|
|
57
|
-
|
|
58
|
-
dirs.forEach(dir => {
|
|
59
|
-
if (fs.readdirSync(dir).length) return;
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
fs.rmdirSync(dir, {});
|
|
63
|
-
} catch (_) {}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function findDirsAndFiles(patterns) {
|
|
68
|
-
const dirs = [];
|
|
69
|
-
const files = [];
|
|
70
|
-
|
|
71
|
-
const list = glob.sync('**/*', { dot: true });
|
|
72
|
-
|
|
73
|
-
const matches = micromatch(list, normalizeGlob(patterns), {
|
|
74
|
-
dot: true,
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
matches.forEach(match => {
|
|
78
|
-
if (!fs.existsSync(match)) return;
|
|
79
|
-
|
|
80
|
-
(fs.statSync(match).isDirectory() ? dirs : files).push(match);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
return { dirs, files };
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function normalizeGlob(patterns) {
|
|
87
|
-
return patterns.map(pattern => {
|
|
88
|
-
const prefix = /\*$/.test(pattern) ? '' : '/**';
|
|
89
|
-
return replaceAliases(pattern).replace(/(!?)\.\//, '$1') + prefix;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function normalizeResourceMapping(resourcemapping) {
|
|
94
|
-
var defaultSettings = {
|
|
95
|
-
aliases: {
|
|
96
|
-
"@node_modules": "./node_modules",
|
|
97
|
-
"@libs": "./wwwroot/libs"
|
|
98
|
-
},
|
|
99
|
-
clean: [
|
|
100
|
-
"@libs"
|
|
101
|
-
]
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
extendObject(defaultSettings.aliases, resourcemapping.aliases);
|
|
105
|
-
resourcemapping.aliases = defaultSettings.aliases;
|
|
106
|
-
|
|
107
|
-
resourcemapping.clean = resourcemapping.clean || defaultSettings.clean;
|
|
108
|
-
|
|
109
|
-
return resourcemapping;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function buildResourceMapping(packagePath) {
|
|
113
|
-
if (investigatedPackagePaths[packagePath]) {
|
|
114
|
-
return {};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
investigatedPackagePaths[packagePath] = 'OK';
|
|
118
|
-
|
|
119
|
-
var packageJson = requireOptional(path.join(packagePath, 'package.json'));
|
|
120
|
-
var resourcemapping = requireOptional(path.join(packagePath, 'abp.resourcemapping.js')) || { };
|
|
121
|
-
|
|
122
|
-
if (packageJson && packageJson.dependencies) {
|
|
123
|
-
var aliases = {};
|
|
124
|
-
var mappings = {};
|
|
125
|
-
|
|
126
|
-
for (var dependency in packageJson.dependencies) {
|
|
127
|
-
if (packageJson.dependencies.hasOwnProperty(dependency)) {
|
|
128
|
-
var dependedPackagePath = path.join(rootPath, 'node_modules', dependency);
|
|
129
|
-
var importedResourceMapping = buildResourceMapping(dependedPackagePath);
|
|
130
|
-
extendObject(aliases, importedResourceMapping.aliases);
|
|
131
|
-
extendObject(mappings, importedResourceMapping.mappings);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
extendObject(aliases, resourcemapping.aliases);
|
|
136
|
-
extendObject(mappings, resourcemapping.mappings);
|
|
137
|
-
|
|
138
|
-
resourcemapping.aliases = aliases;
|
|
139
|
-
resourcemapping.mappings = mappings;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return resourcemapping;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function copyResourcesTask (path) {
|
|
146
|
-
rootPath = path;
|
|
147
|
-
resourceMapping = normalizeResourceMapping(buildResourceMapping(rootPath));
|
|
148
|
-
|
|
149
|
-
cleanDirsAndFiles(resourceMapping.clean);
|
|
150
|
-
|
|
151
|
-
var tasks = [];
|
|
152
|
-
|
|
153
|
-
if (resourceMapping.mappings) {
|
|
154
|
-
for (var mapping in resourceMapping.mappings) {
|
|
155
|
-
if (resourceMapping.mappings.hasOwnProperty(mapping)) {
|
|
156
|
-
var destination = replaceAliases(resourceMapping.mappings[mapping]);
|
|
157
|
-
if (fs.existsSync(destination)) continue;
|
|
158
|
-
|
|
159
|
-
var source = replaceAliases(mapping);
|
|
160
|
-
tasks.push(
|
|
161
|
-
gulp.src(source).pipe(gulp.dest(destination))
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return merge(tasks);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
module.exports = copyResourcesTask;
|
|
171
|
-
|
|
172
|
-
})();
|