mirror of
https://github.com/DavidHDev/vue-bits.git
synced 2026-03-07 06:29:30 -07:00
Add prettier config, format codebase
This commit is contained in:
0
scripts/cleanEmptyLines.js
Normal file
0
scripts/cleanEmptyLines.js
Normal file
@@ -1,15 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import process from "process";
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import process from 'process';
|
||||
|
||||
import { fileURLToPath } from "url";
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
if (args.length < 2) {
|
||||
console.error("Usage: npm run generate:component <ComponentType> <ComponentName>");
|
||||
console.error('Usage: npm run generate:component <ComponentType> <ComponentName>');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ const [componentType, componentName] = args;
|
||||
const componentNameLower = componentName.charAt(0).toLowerCase() + componentName.slice(1);
|
||||
|
||||
const paths = {
|
||||
content: path.join(__dirname, "../src/content", componentType, componentName),
|
||||
demo: path.join(__dirname, "../src/demo", componentType),
|
||||
constants: path.join(__dirname, "../src/constants/code", componentType),
|
||||
content: path.join(__dirname, '../src/content', componentType, componentName),
|
||||
demo: path.join(__dirname, '../src/demo', componentType),
|
||||
constants: path.join(__dirname, '../src/constants/code', componentType)
|
||||
};
|
||||
|
||||
Object.values(paths).forEach((dir) => {
|
||||
Object.values(paths).forEach(dir => {
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
}
|
||||
@@ -31,12 +31,12 @@ Object.values(paths).forEach((dir) => {
|
||||
const files = [
|
||||
path.join(paths.content, `${componentName}.vue`),
|
||||
path.join(paths.demo, `${componentName}Demo.vue`),
|
||||
path.join(paths.constants, `${componentNameLower}Code.ts`),
|
||||
path.join(paths.constants, `${componentNameLower}Code.ts`)
|
||||
];
|
||||
|
||||
files.forEach((file) => {
|
||||
files.forEach(file => {
|
||||
if (!fs.existsSync(file)) {
|
||||
fs.writeFileSync(file, "");
|
||||
fs.writeFileSync(file, '');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user