vueless 0.0.794 → 0.0.795
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/commands/copy.js +6 -3
- package/package.json +1 -1
package/bin/commands/copy.js
CHANGED
|
@@ -56,6 +56,9 @@ async function modifyCreatedComponent(destPath, componentName, newComponentName)
|
|
|
56
56
|
const destFiles = await getDirFiles(destPath, "");
|
|
57
57
|
const storybookId = await getStorybookId();
|
|
58
58
|
|
|
59
|
+
const componentFileName = `${componentName}.vue`;
|
|
60
|
+
const newComponentFileName = `${newComponentName}.vue`;
|
|
61
|
+
|
|
59
62
|
for await (const filePath of destFiles) {
|
|
60
63
|
const fileContent = await readFile(filePath, "utf-8");
|
|
61
64
|
|
|
@@ -78,13 +81,13 @@ async function modifyCreatedComponent(destPath, componentName, newComponentName)
|
|
|
78
81
|
storyLines[storyIdIndex] = ` id: "${storybookId}",`;
|
|
79
82
|
storyLines[storyTitleIndex] = ` title: "Custom / ${newComponentName}",`;
|
|
80
83
|
storyLines[storyComponentImportIndex] =
|
|
81
|
-
`import ${newComponentName} from "../${
|
|
84
|
+
`import ${newComponentName} from "../${newComponentFileName}"`;
|
|
82
85
|
|
|
83
86
|
updatedContent = storyLines.join("\n").replaceAll(componentName, newComponentName);
|
|
84
87
|
}
|
|
85
88
|
|
|
86
|
-
if (targetPath.endsWith(
|
|
87
|
-
targetPath = targetPath.replace(
|
|
89
|
+
if (targetPath.endsWith(componentFileName)) {
|
|
90
|
+
targetPath = targetPath.replace(componentFileName, newComponentFileName);
|
|
88
91
|
|
|
89
92
|
await rename(filePath, targetPath);
|
|
90
93
|
}
|