create-antd-skin 1.1.9 → 1.2.1
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/bin/layout.js +3 -2
- package/bin/skin.js +8 -8
- package/package.json +1 -1
package/bin/layout.js
CHANGED
|
@@ -43,8 +43,9 @@ const generator_1 = __importDefault(require("@babel/generator"));
|
|
|
43
43
|
const t = __importStar(require("@babel/types"));
|
|
44
44
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
45
45
|
const path_1 = __importDefault(require("path"));
|
|
46
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
46
47
|
const LAYOUT_PKG = "@adminui-dev/antd-layout";
|
|
47
|
-
const WARDEN_SKIN_PKG = "../components/warden-
|
|
48
|
+
const WARDEN_SKIN_PKG = "../components/warden-skins";
|
|
48
49
|
async function patchLayoutFile(filePath) {
|
|
49
50
|
const code = await fs_extra_1.default.readFile(filePath, "utf8");
|
|
50
51
|
if (!code.includes("<AntdLayout"))
|
|
@@ -112,7 +113,7 @@ async function patchLayoutFile(filePath) {
|
|
|
112
113
|
},
|
|
113
114
|
});
|
|
114
115
|
await fs_extra_1.default.writeFile(filePath, output.code);
|
|
115
|
-
console.log("
|
|
116
|
+
console.log(chalk_1.default.greenBright("✓") + " Updated:", path_1.default.relative(process.cwd(), filePath));
|
|
116
117
|
}
|
|
117
118
|
function hasThemeSkinsProp(node) {
|
|
118
119
|
return node.attributes.some(attr => t.isJSXAttribute(attr) &&
|
package/bin/skin.js
CHANGED
|
@@ -86,7 +86,7 @@ async function installSkin(skinName) {
|
|
|
86
86
|
const cwd = process.cwd();
|
|
87
87
|
const skins = await getSkinList();
|
|
88
88
|
if (!skins.length) {
|
|
89
|
-
console.error(chalk_1.default.red("
|
|
89
|
+
console.error(chalk_1.default.red("× No skins found."));
|
|
90
90
|
process.exit(1);
|
|
91
91
|
}
|
|
92
92
|
let selectedSkin = skinName;
|
|
@@ -109,7 +109,7 @@ async function installSkin(skinName) {
|
|
|
109
109
|
}
|
|
110
110
|
const skin = skins.find(item => item.name === selectedSkin);
|
|
111
111
|
if (!skin) {
|
|
112
|
-
console.error(chalk_1.default.red(
|
|
112
|
+
console.error(chalk_1.default.red(`× Skin "${selectedSkin}" not found.`));
|
|
113
113
|
process.exit(1);
|
|
114
114
|
}
|
|
115
115
|
const spinner = (0, ora_1.default)(`Installing skin "${selectedSkin}"...`).start();
|
|
@@ -117,13 +117,13 @@ async function installSkin(skinName) {
|
|
|
117
117
|
await copySkinFiles(selectedSkin, skin.path, cwd);
|
|
118
118
|
await updateSkinIndex(selectedSkin, cwd);
|
|
119
119
|
spinner.succeed(`Skin "${selectedSkin}" installed.`);
|
|
120
|
+
console.log(chalk_1.default.greenBright(`✨ Skin installed successfully!`));
|
|
120
121
|
console.log(chalk_1.default.gray(`
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}`));
|
|
122
|
+
// Simply adding the skin name to the settings will take effect, e.g.
|
|
123
|
+
const layoutConfig: LayoutConfig = {
|
|
124
|
+
skinName: "${toCamelCase(selectedSkin) ?? "<skin-name>"}",
|
|
125
|
+
...
|
|
126
|
+
}`));
|
|
127
127
|
}
|
|
128
128
|
catch (e) {
|
|
129
129
|
spinner.fail("Install skin failed.");
|