|
1 | 1 | #! /usr/bin/env node
|
2 |
| -/* eslint-disable curly */ |
3 | 2 | import { fileURLToPath } from 'node:url'
|
4 | 3 | import process from 'node:process'
|
5 | 4 | import { $, argv, chalk, fs, glob, path } from 'zx'
|
@@ -29,7 +28,7 @@ let macro = await select({
|
29 | 28 | },
|
30 | 29 | )
|
31 | 30 |
|
32 |
| -let render = 'export-render' |
| 31 | +let render |
33 | 32 | if (macro === 'jsx-directive') {
|
34 | 33 | render = await select({
|
35 | 34 | message: chalk.green(
|
@@ -77,31 +76,23 @@ const files = await glob(`${targetDirectory}/**/*.vue`, {
|
77 | 76 | ].filter(Boolean),
|
78 | 77 | })
|
79 | 78 |
|
80 |
| -// await Promise.all(files.map(async file => fs.move(file, `${file}.sg.html`))) |
81 |
| - |
82 | 79 | if (['jsx-directive', 'setup-sfc'].includes(macro)) {
|
83 |
| - await $`${sg} scan -c ${config}.yml -U --filter '^v-(on|directive)' ${targetDirectory}` |
| 80 | + await $`${sg} scan -c ${config}.yml -U --filter '^v-' ${targetDirectory}` |
84 | 81 |
|
85 |
| - await $`${sg} scan -c ${config}.yml -U --filter '^${macro === 'setup-sfc' ? render : 'export-render'}' ${targetDirectory}` |
| 82 | + await $`${sg} scan -c ${config}.yml -U --filter '^${macro === 'setup-sfc' ? 'export-render' : render}' ${targetDirectory}` |
86 | 83 |
|
87 | 84 | await $`${sg} scan -c ${config}.yml -U --filter '^setup-sfc' ${targetDirectory}`
|
88 | 85 |
|
89 |
| - // await Promise.all(files.map(async file => fs.move(`${file}.sg.html`, `${file}.sg.tsx`))) |
90 |
| - |
91 |
| - await $`${sg} scan -c ${config}-tsx.yml -U --filter '^tsx v-' ${targetDirectory}` |
| 86 | + await $`${sg} scan -c ${config}-tsx.yml -U --filter '^v-' ${targetDirectory}` |
92 | 87 |
|
93 | 88 | if (defineSlots === 'define-short-slots')
|
94 |
| - await $`${sg} scan -c ${config}.yml -U --filter 'tsx define-short-slots' ${targetDirectory}` |
| 89 | + await $`${sg} scan -c ${config}-tsx.yml -U --filter 'define-short-slots' ${targetDirectory}` |
95 | 90 |
|
96 |
| - if (macro === 'setup-sfc') { |
| 91 | + if (macro === 'setup-sfc') |
97 | 92 | await Promise.all(files.map(async file => fs.move(file, `${file.slice(0, -3)}setup.tsx`)))
|
98 |
| - } |
99 |
| - else { |
100 |
| - await $`${sg} scan -c ${config}-tsx.yml -U --filter '^tsx sfc$' ${targetDirectory}` |
101 |
| - // await Promise.all(files.map(async file => fs.move(`${file}.sg.tsx`, file))) |
102 |
| - } |
| 93 | + else |
| 94 | + await $`${sg} scan -c ${config}-tsx.yml -U --filter '^sfc$' ${targetDirectory}` |
103 | 95 | }
|
104 | 96 | else {
|
105 | 97 | await $`${sg} scan -c ${config}.yml -U --filter ^${macro} ${targetDirectory}`
|
106 |
| - // await Promise.all(files.map(async file => fs.move(`${file}.sg.html`, file))) |
107 | 98 | }
|
0 commit comments