Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

chore: remove used script

wzhudeve7fb4b6cba86
diff --git a/package.json b/package.json
index 5d8ec9ed4b..15ed301b36 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,6 @@
"build": "turbo esbuild",
"build:demo": "turbo esbuild:demo",
"clean": "npm cache clean --force && node scripts/clean.mjs && pnpm install",
- "formatfilename": "node scripts/format-filename.mjs",
"prepare": "husky install",
"pre-commit": "lint-staged",
"lint": "eslint --cache packages/**/src/**/*.{tsx,ts}",
@@ -56,7 +55,6 @@
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-unused-imports": "^3.0.0",
- "fs-extra": "^11.1.1",
"husky": "^8.0.3",
"lint-staged": "^15.0.2",
"prettier": "^3.0.3",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index be23d9a3c3..4c795cd7cc 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -98,9 +98,6 @@ importers:
eslint-plugin-unused-imports:
specifier: ^3.0.0
version: 3.0.0(@typescript-eslint/[email protected])([email protected])
- fs-extra:
- specifier: ^11.1.1
- version: 11.1.1
husky:
specifier: ^8.0.3
version: 8.0.3
diff --git a/scripts/format-filename.mjs b/scripts/format-filename.mjs
deleted file mode 100644
index 9f400a6486..0000000000
--- a/scripts/format-filename.mjs
+++ /dev/null
@@ -1,97 +0,0 @@
-import fs from 'fs-extra';
-import path from 'node:path';
-import { fileURLToPath } from 'url';
-
-const __filename = fileURLToPath(import.meta.url);
-const __dirname = path.dirname(__filename);
-
-const kebabize = (str) => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());
-
-const getAllFiles = function (dirPath, arrayOfFiles) {
- const files = fs.readdirSync(dirPath);
-
- arrayOfFiles = arrayOfFiles || [];
-
- files.forEach(function (file) {
- if (
- file.includes('node_modules') ||
- file.includes('dist') ||
- file.includes('lib') ||
- file.includes('.turbo') ||
- file.includes('coverage') ||
- file.includes('local') ||
- file.includes('design') ||
- file.includes('base-ui') ||
- file.includes('git')
- ) {
- return;
- }
-
- if (fs.statSync(dirPath + '/' + file).isDirectory()) {
- arrayOfFiles = getAllFiles(dirPath + '/' + file, arrayOfFiles);
- } else {
- arrayOfFiles.push(path.join(dirPath, '/', file));
- }
- });
-
- return arrayOfFiles.filter((f) => f.endsWith('.ts') || f.endsWith('.tsx') || f.endsWith('index.module.less'));
-};
-
-function normalizePath(s) {
- // TODO@wzhudev: if the last part is React.TSX, keep it
- const parts = s.split('/');
- return parts
- .map((s, index) => {
- if (index === parts.length - 1 && s.endsWith('.tsx')) {
- return s;
- }
-
- return kebabize(s)
- .replace(/^controller$/i, 'controllers')
- .replace(/^component$/i, 'components')
- .replace(/^service$/i, 'services')
- .replace(/^view$/i, 'views');
- })
- .join('/');
-}
-
-function makeFilePathToKebabCase(file) {
- const prePath = file.split('/packages/')[0];
- const relativePath = file.split('/packages/')[1];
- const kebabCaseFileName = normalizePath(relativePath);
-
- return `${prePath}/packages/${kebabCaseFileName}`;
-}
-
-function move(from, to) {
- fs.moveSync(from, to);
-}
-
-function updateImports(to) {
- const file = fs.readFileSync(to, 'utf8');
-
- const newFile = file
- .replace(/from '(.*?)';/g, (s) => {
- if (!s.includes('./')) {
- return s;
- }
-
- const newRelativePath = normalizePath(s);
- console.log(s, newRelativePath);
- return `${newRelativePath}`;
- })
-
- fs.writeFileSync(to, newFile);
-}
-
-const folderPath = path.join(__dirname, '../packages');
-const allFiles = getAllFiles(folderPath).slice(1);
-const allFilePairs = allFiles.map((f) => [f, makeFilePathToKebabCase(f)]);
-allFilePairs
- .filter(([from, to]) => from !== to)
- .forEach(([from, to]) => {
- move(from, to);
- });
-allFilePairs.forEach(([_, to]) => {
- updateImports(to);
-});