diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index edb634c..aa42c08 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,22 +4,9 @@
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
+
@@ -49,36 +36,37 @@
- {
- "keyToString": {
- "ASKED_ADD_EXTERNAL_FILES": "true",
- "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
- "RunOnceActivity.OpenProjectViewOnStart": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "Vitest.mergeText.executor": "Run",
- "Vitest.mergeText.should merge lines and preserve blank lines when deleteBlankLines is false.executor": "Run",
- "Vitest.mergeText.should merge lines, preserve blank lines and trailing spaces when both deleteBlankLines and deleteTrailingSpaces are false.executor": "Run",
- "git-widget-placeholder": "main",
- "ignore.virus.scanning.warn.message": "true",
- "kotlin-language-version-configured": "true",
- "last_opened_file_path": "C:/Users/HP/IdeaProjects/omni-tools/src/pages/string",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "npm.dev.executor": "Run",
- "npm.prebuild.executor": "Run",
- "npm.script:create:tool.executor": "Run",
- "prettierjs.PrettierConfiguration.Package": "C:\\Users\\HP\\IdeaProjects\\omni-tools\\node_modules\\prettier",
- "project.structure.last.edited": "Problems",
- "project.structure.proportion": "0.0",
- "project.structure.side.proportion": "0.2",
- "settings.editor.selected.configurable": "settings.typescriptcompiler",
- "ts.external.directory.path": "C:\\Users\\HP\\IdeaProjects\\omni-tools\\node_modules\\typescript\\lib",
- "vue.rearranger.settings.migration": "true"
+
+}]]>
-
+
@@ -133,8 +121,19 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -161,7 +160,7 @@
-
+
@@ -435,7 +434,23 @@
1719165600245
-
+
+
+ 1719169082452
+
+
+
+ 1719169082452
+
+
+
+ 1719170769791
+
+
+
+ 1719170769791
+
+
@@ -456,8 +471,6 @@
-
-
@@ -481,7 +494,9 @@
-
+
+
+
diff --git a/scripts/create-tool.mjs b/scripts/create-tool.mjs
index 66b44ec..eeaa18e 100644
--- a/scripts/create-tool.mjs
+++ b/scripts/create-tool.mjs
@@ -1,5 +1,6 @@
-import { mkdir, readFile, writeFile } from 'fs/promises'
-import { dirname, join } from 'path'
+import { readFile, writeFile } from 'fs/promises'
+import fs from 'fs'
+import { dirname, join, sep } from 'path'
import { fileURLToPath } from 'url'
const currentDirname = dirname(fileURLToPath(import.meta.url))
@@ -8,7 +9,6 @@ const toolName = process.argv[2]
const folder = process.argv[3]
const toolsDir = join(currentDirname, '..', 'src', 'pages', folder ?? '')
-
if (!toolName) {
throw new Error('Please specify a toolname.')
}
@@ -17,12 +17,35 @@ function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1)
}
+function createFolderStructure(basePath, foldersToCreateIndexCount) {
+ const folderArray = basePath.split(sep)
+
+ function recursiveCreate(currentBase, index) {
+ if (index >= folderArray.length) {
+ return
+ }
+ const currentPath = join(currentBase, folderArray[index])
+ if (!fs.existsSync(currentPath)) {
+ fs.mkdirSync(currentPath, { recursive: true })
+ }
+ const indexPath = join(currentPath, 'index.ts')
+ if (!fs.existsSync(indexPath) && index < folderArray.length - 1 && index >= folderArray.length - 1 - foldersToCreateIndexCount) {
+ fs.writeFileSync(indexPath, '// index.ts file')
+ }
+ // Recursively create the next folder
+ recursiveCreate(currentPath, index + 1)
+ }
+
+ // Start the recursive folder creation
+ recursiveCreate('.', 0)
+}
+
const toolNameCamelCase = toolName.replace(/-./g, (x) => x[1].toUpperCase())
const toolNameTitleCase =
toolName[0].toUpperCase() + toolName.slice(1).replace(/-/g, ' ')
const toolDir = join(toolsDir, toolName)
-await mkdir(toolDir)
+await createFolderStructure(toolDir, folder.split(sep).length)
console.log(`Directory created: ${toolDir}`)
const createToolFile = async (name, content) => {
@@ -53,12 +76,12 @@ createToolFile(
`
import { defineTool } from '@tools/defineTool';
import { lazy } from 'react';
-import image from '../../../assets/text.png';
+// import image from '@assets/text.png';
export const tool = defineTool('${folder}', {
name: '${toolNameTitleCase}',
path: '/${toolName}',
- image,
+ // image,
description: '',
keywords: ['${toolName.split('-').join('\', \'')}'],
component: lazy(() => import('./index'))
diff --git a/src/pages/image/png/change-colors-in-png/change-colors-in-png.service.test.ts b/src/pages/image/png/change-colors-in-png/change-colors-in-png.service.test.ts
deleted file mode 100644
index 1c0493f..0000000
--- a/src/pages/image/png/change-colors-in-png/change-colors-in-png.service.test.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { expect, describe, it } from 'vitest';
-// import { } from './service';
-//
-// describe('change-colors-in-png', () => {
-//
-// })
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 56a88aa..9eca3e5 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -27,6 +27,9 @@
"paths": {
"@tools/*": [
"./tools/*"
+ ],
+ "@assets/*": [
+ "./assets/*"
]
}
},