@ansstory/hias 1.0.1 → 1.0.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/lib/core/action.js +6 -3
- package/package.json +1 -1
package/lib/core/action.js
CHANGED
|
@@ -23,12 +23,15 @@ const beginAction = async (project, args) => {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async function addComponentAction(cpnName, temPath, fileType) {
|
|
26
|
+
const dest = program.opts().dest || 'src/components'
|
|
27
|
+
const [folderName = 'index'] = dest.match(/[^\\/]+$/)
|
|
28
|
+
const name = cpnName === 'index' ? folderName : cpnName
|
|
29
|
+
|
|
26
30
|
const result = await compileEjs(temPath, {
|
|
27
|
-
name:
|
|
28
|
-
lowername:
|
|
31
|
+
name: name,
|
|
32
|
+
lowername: name.toLowerCase(),
|
|
29
33
|
})
|
|
30
34
|
|
|
31
|
-
const dest = program.opts().dest || 'src/components'
|
|
32
35
|
await writeFile(`${dest}/${cpnName}.${fileType}`, result)
|
|
33
36
|
console.log(chalk.green.bold('Component creation was successful:'), chalk.blue.bold(`${cpnName}.${fileType}`), chalk.underline(dest))
|
|
34
37
|
}
|