mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-16 12:39:31 +02:00
fix: create tool
This commit is contained in:
115
.idea/workspace.xml
generated
115
.idea/workspace.xml
generated
@@ -4,22 +4,9 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="fix: readme">
|
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="fix: missing files">
|
||||||
<change afterPath="$PROJECT_DIR$/scripts/create-tool.mjs" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/pages/image/png/change-colors-in-png/change-colors-in-png.service.test.ts" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/pages/image/png/change-colors-in-png/index.tsx" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/pages/image/png/change-colors-in-png/meta.ts" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/pages/image/png/change-colors-in-png/service.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/scripts/create-tool.mjs" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/create-tool.mjs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/images/imageTools.ts" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/images/png/change-colors-in-png/index.tsx" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/images/png/change-colors-in-png/meta.ts" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/images/png/pngTools.ts" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/string/join/string-join.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/string/join/string-join.service.test.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/string/split/string-split.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/string/split/string-split.service.test.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/string/stringTools.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/string/index.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/tools/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/tools/index.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/tsconfig.json" beforeDir="false" afterPath="$PROJECT_DIR$/tsconfig.json" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/tsconfig.json" beforeDir="false" afterPath="$PROJECT_DIR$/tsconfig.json" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@@ -49,36 +36,37 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">{
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||||
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"Vitest.mergeText.executor": "Run",
|
"Vitest.mergeText.executor": "Run",
|
||||||
"Vitest.mergeText.should merge lines and preserve blank lines when deleteBlankLines is false.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",
|
"Vitest.mergeText.should merge lines, preserve blank lines and trailing spaces when both deleteBlankLines and deleteTrailingSpaces are false.executor": "Run",
|
||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "main",
|
||||||
"ignore.virus.scanning.warn.message": "true",
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
"kotlin-language-version-configured": "true",
|
"kotlin-language-version-configured": "true",
|
||||||
"last_opened_file_path": "C:/Users/HP/IdeaProjects/omni-tools/src/pages/string",
|
"last_opened_file_path": "C:/Users/HP/IdeaProjects/omni-tools/src/pages/string",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"npm.dev.executor": "Run",
|
"npm.dev.executor": "Run",
|
||||||
"npm.prebuild.executor": "Run",
|
"npm.prebuild.executor": "Run",
|
||||||
"npm.script:create:tool.executor": "Run",
|
"npm.script:create:tool.executor": "Run",
|
||||||
"prettierjs.PrettierConfiguration.Package": "C:\\Users\\HP\\IdeaProjects\\omni-tools\\node_modules\\prettier",
|
"npm.test.executor": "Run",
|
||||||
"project.structure.last.edited": "Problems",
|
"prettierjs.PrettierConfiguration.Package": "C:\\Users\\HP\\IdeaProjects\\omni-tools\\node_modules\\prettier",
|
||||||
"project.structure.proportion": "0.0",
|
"project.structure.last.edited": "Problems",
|
||||||
"project.structure.side.proportion": "0.2",
|
"project.structure.proportion": "0.0",
|
||||||
"settings.editor.selected.configurable": "settings.typescriptcompiler",
|
"project.structure.side.proportion": "0.2",
|
||||||
"ts.external.directory.path": "C:\\Users\\HP\\IdeaProjects\\omni-tools\\node_modules\\typescript\\lib",
|
"settings.editor.selected.configurable": "settings.typescriptcompiler",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"ts.external.directory.path": "C:\\Users\\HP\\IdeaProjects\\omni-tools\\node_modules\\typescript\\lib",
|
||||||
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}</component>
|
}]]></component>
|
||||||
<component name="ReactDesignerToolWindowState">
|
<component name="ReactDesignerToolWindowState">
|
||||||
<option name="myId2Visible">
|
<option name="myId2Visible">
|
||||||
<map>
|
<map>
|
||||||
@@ -102,7 +90,7 @@
|
|||||||
<recent name="C:\Users\HP\IdeaProjects\omni-tools\src\tools" />
|
<recent name="C:\Users\HP\IdeaProjects\omni-tools\src\tools" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="npm.script:create:tool">
|
<component name="RunManager" selected="npm.test">
|
||||||
<configuration name="dev" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
<configuration name="dev" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
||||||
<package-json value="$PROJECT_DIR$/package.json" />
|
<package-json value="$PROJECT_DIR$/package.json" />
|
||||||
<command value="run" />
|
<command value="run" />
|
||||||
@@ -133,8 +121,19 @@
|
|||||||
<envs />
|
<envs />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<configuration name="test" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
||||||
|
<package-json value="$PROJECT_DIR$/package.json" />
|
||||||
|
<command value="run" />
|
||||||
|
<scripts>
|
||||||
|
<script value="test" />
|
||||||
|
</scripts>
|
||||||
|
<node-interpreter value="project" />
|
||||||
|
<envs />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
|
<item itemvalue="npm.test" />
|
||||||
<item itemvalue="npm.script:create:tool" />
|
<item itemvalue="npm.script:create:tool" />
|
||||||
<item itemvalue="npm.dev" />
|
<item itemvalue="npm.dev" />
|
||||||
<item itemvalue="npm.prebuild" />
|
<item itemvalue="npm.prebuild" />
|
||||||
@@ -161,7 +160,7 @@
|
|||||||
<workItem from="1719092003308" duration="14856000" />
|
<workItem from="1719092003308" duration="14856000" />
|
||||||
<workItem from="1719164664347" duration="2033000" />
|
<workItem from="1719164664347" duration="2033000" />
|
||||||
<workItem from="1719166718305" duration="1783000" />
|
<workItem from="1719166718305" duration="1783000" />
|
||||||
<workItem from="1719168519203" duration="179000" />
|
<workItem from="1719168519203" duration="2752000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="feat: use vite and ts">
|
<task id="LOCAL-00001" summary="feat: use vite and ts">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -435,7 +434,23 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1719165600245</updated>
|
<updated>1719165600245</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="35" />
|
<task id="LOCAL-00035" summary="feat: create tool script">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1719169082452</created>
|
||||||
|
<option name="number" value="00035" />
|
||||||
|
<option name="presentableId" value="LOCAL-00035" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1719169082452</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00036" summary="fix: missing files">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1719170769791</created>
|
||||||
|
<option name="number" value="00036" />
|
||||||
|
<option name="presentableId" value="LOCAL-00036" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1719170769791</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="37" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@@ -456,8 +471,6 @@
|
|||||||
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
<option name="CHECK_NEW_TODO" value="false" />
|
<option name="CHECK_NEW_TODO" value="false" />
|
||||||
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
||||||
<MESSAGE value="fix: netlify" />
|
|
||||||
<MESSAGE value="fix: index title" />
|
|
||||||
<MESSAGE value="chore: split string tools ui" />
|
<MESSAGE value="chore: split string tools ui" />
|
||||||
<MESSAGE value="chore: use formik" />
|
<MESSAGE value="chore: use formik" />
|
||||||
<MESSAGE value="chore: output selector" />
|
<MESSAGE value="chore: output selector" />
|
||||||
@@ -481,7 +494,9 @@
|
|||||||
<MESSAGE value="feat: result copy and download" />
|
<MESSAGE value="feat: result copy and download" />
|
||||||
<MESSAGE value="feat: contributors graph" />
|
<MESSAGE value="feat: contributors graph" />
|
||||||
<MESSAGE value="fix: readme" />
|
<MESSAGE value="fix: readme" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="fix: readme" />
|
<MESSAGE value="feat: create tool script" />
|
||||||
|
<MESSAGE value="fix: missing files" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="fix: missing files" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XSLT-Support.FileAssociations.UIState">
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
<expand />
|
<expand />
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { mkdir, readFile, writeFile } from 'fs/promises'
|
import { readFile, writeFile } from 'fs/promises'
|
||||||
import { dirname, join } from 'path'
|
import fs from 'fs'
|
||||||
|
import { dirname, join, sep } from 'path'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
|
|
||||||
const currentDirname = dirname(fileURLToPath(import.meta.url))
|
const currentDirname = dirname(fileURLToPath(import.meta.url))
|
||||||
@@ -8,7 +9,6 @@ const toolName = process.argv[2]
|
|||||||
const folder = process.argv[3]
|
const folder = process.argv[3]
|
||||||
|
|
||||||
const toolsDir = join(currentDirname, '..', 'src', 'pages', folder ?? '')
|
const toolsDir = join(currentDirname, '..', 'src', 'pages', folder ?? '')
|
||||||
|
|
||||||
if (!toolName) {
|
if (!toolName) {
|
||||||
throw new Error('Please specify a toolname.')
|
throw new Error('Please specify a toolname.')
|
||||||
}
|
}
|
||||||
@@ -17,12 +17,35 @@ function capitalizeFirstLetter(string) {
|
|||||||
return string.charAt(0).toUpperCase() + string.slice(1)
|
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 toolNameCamelCase = toolName.replace(/-./g, (x) => x[1].toUpperCase())
|
||||||
const toolNameTitleCase =
|
const toolNameTitleCase =
|
||||||
toolName[0].toUpperCase() + toolName.slice(1).replace(/-/g, ' ')
|
toolName[0].toUpperCase() + toolName.slice(1).replace(/-/g, ' ')
|
||||||
const toolDir = join(toolsDir, toolName)
|
const toolDir = join(toolsDir, toolName)
|
||||||
|
|
||||||
await mkdir(toolDir)
|
await createFolderStructure(toolDir, folder.split(sep).length)
|
||||||
console.log(`Directory created: ${toolDir}`)
|
console.log(`Directory created: ${toolDir}`)
|
||||||
|
|
||||||
const createToolFile = async (name, content) => {
|
const createToolFile = async (name, content) => {
|
||||||
@@ -53,12 +76,12 @@ createToolFile(
|
|||||||
`
|
`
|
||||||
import { defineTool } from '@tools/defineTool';
|
import { defineTool } from '@tools/defineTool';
|
||||||
import { lazy } from 'react';
|
import { lazy } from 'react';
|
||||||
import image from '../../../assets/text.png';
|
// import image from '@assets/text.png';
|
||||||
|
|
||||||
export const tool = defineTool('${folder}', {
|
export const tool = defineTool('${folder}', {
|
||||||
name: '${toolNameTitleCase}',
|
name: '${toolNameTitleCase}',
|
||||||
path: '/${toolName}',
|
path: '/${toolName}',
|
||||||
image,
|
// image,
|
||||||
description: '',
|
description: '',
|
||||||
keywords: ['${toolName.split('-').join('\', \'')}'],
|
keywords: ['${toolName.split('-').join('\', \'')}'],
|
||||||
component: lazy(() => import('./index'))
|
component: lazy(() => import('./index'))
|
||||||
|
@@ -1,6 +0,0 @@
|
|||||||
import { expect, describe, it } from 'vitest';
|
|
||||||
// import { } from './service';
|
|
||||||
//
|
|
||||||
// describe('change-colors-in-png', () => {
|
|
||||||
//
|
|
||||||
// })
|
|
@@ -27,6 +27,9 @@
|
|||||||
"paths": {
|
"paths": {
|
||||||
"@tools/*": [
|
"@tools/*": [
|
||||||
"./tools/*"
|
"./tools/*"
|
||||||
|
],
|
||||||
|
"@assets/*": [
|
||||||
|
"./assets/*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user