vue3-quickstart-cli
Version:
一个用于快速创建 Vue3 项目的脚手架工具。
17 lines (16 loc) • 528 B
JavaScript
import path from 'path';
import fs from 'fs-extra';
import chalk from 'chalk';
export default function genVueuse(targetDir, pkg) {
pkg.dependencies['@vueuse/core'] = '^10.9.0';
const usePath = path.join(targetDir, 'src/useCounter.ts');
fs.writeFileSync(usePath, `import { ref } from 'vue';
import { useIntervalFn } from '@vueuse/core';
export function useCounter() {
const count = ref(0);
useIntervalFn(() => count.value++, 1000);
return { count };
}
`);
console.log(chalk.green('已集成 vueuse!'));
}