classnames-minifier 0.1.2 → 0.1.3-canary.0
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/dist/lib/validateDist.js +25 -13
- package/package.json +1 -1
package/dist/lib/validateDist.js
CHANGED
|
@@ -16,7 +16,7 @@ const readManifest = (manifestPath) => {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
const validateDist = (pluginOptions) => {
|
|
19
|
-
var _a, _b;
|
|
19
|
+
var _a, _b, _c;
|
|
20
20
|
const { cacheDir, distDir, prefix, reservedNames } = pluginOptions;
|
|
21
21
|
if (!cacheDir || !distDir) {
|
|
22
22
|
console.log("classnames-minifier: Failed to check the dist folder because cacheDir or distDir is not specified");
|
|
@@ -24,25 +24,37 @@ const validateDist = (pluginOptions) => {
|
|
|
24
24
|
}
|
|
25
25
|
const manifestDir = path_1.default.join(cacheDir, "ncm-meta");
|
|
26
26
|
const manifestPath = path_1.default.join(manifestDir, "manifest.json");
|
|
27
|
-
let
|
|
27
|
+
let configurationError = "";
|
|
28
28
|
if (fs_1.default.existsSync(manifestPath)) {
|
|
29
29
|
const prevData = readManifest(manifestPath);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
prevData.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
const configDiffMessages = [];
|
|
31
|
+
if (prevData.prefix !== prefix) {
|
|
32
|
+
configDiffMessages.push(`Different "prefix": "${prevData.prefix}" -> "${prefix}"`);
|
|
33
|
+
}
|
|
34
|
+
if (prevData.cacheDir !== cacheDir) {
|
|
35
|
+
configDiffMessages.push(`Different "cacheDir": "${prevData.cacheDir}" -> "${cacheDir}"`);
|
|
36
|
+
}
|
|
37
|
+
if (prevData.distDir !== distDir) {
|
|
38
|
+
configDiffMessages.push(`Different "distDir": "${prevData.distDir}" -> "${distDir}"`);
|
|
39
|
+
}
|
|
40
|
+
if (((_a = prevData.reservedNames) === null || _a === void 0 ? void 0 : _a.length) !== (reservedNames === null || reservedNames === void 0 ? void 0 : reservedNames.length) ||
|
|
41
|
+
((_b = prevData.reservedNames) === null || _b === void 0 ? void 0 : _b.some((name) => !(reservedNames === null || reservedNames === void 0 ? void 0 : reservedNames.includes(name))))) {
|
|
42
|
+
configDiffMessages.push(`Different "reservedNames": "${(_c = prevData.reservedNames) === null || _c === void 0 ? void 0 : _c.join(", ")}" -> "${reservedNames === null || reservedNames === void 0 ? void 0 : reservedNames.join(", ")}"`);
|
|
43
|
+
}
|
|
44
|
+
if (prevData.version !== configuration_1.CODE_VERSION) {
|
|
45
|
+
configDiffMessages.push(`Different package version: "${prevData.version}" -> "${configuration_1.CODE_VERSION}"`);
|
|
46
|
+
}
|
|
47
|
+
if (configDiffMessages.length) {
|
|
48
|
+
configurationError = `Changes found in package configuration: \n${configDiffMessages.map((message) => `- ${message};\n`)}`;
|
|
37
49
|
}
|
|
38
50
|
}
|
|
39
51
|
else {
|
|
40
|
-
|
|
52
|
+
configurationError = `Can not find the package cache manifest at ${manifestPath}\n`;
|
|
41
53
|
}
|
|
42
|
-
if (
|
|
43
|
-
console.log(
|
|
54
|
+
if (configurationError) {
|
|
55
|
+
console.log(`classnames-minifier: ${configurationError}Cleaning the dist folder...`);
|
|
44
56
|
fs_1.default.rmSync(distDir, { recursive: true, force: true });
|
|
45
|
-
console.log("classnames-minifier:
|
|
57
|
+
console.log("classnames-minifier: Dist folder cleared");
|
|
46
58
|
}
|
|
47
59
|
if (!fs_1.default.existsSync(manifestDir))
|
|
48
60
|
fs_1.default.mkdirSync(manifestDir, { recursive: true });
|
package/package.json
CHANGED