-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify stdf file structure to reduce NPM volume
- Loading branch information
Showing
91 changed files
with
187 additions
and
94 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import Button from './button/Button.svelte'; | ||
import NavBar from './navBar/NavBar.svelte'; | ||
import Icon from './icon/Icon.svelte'; | ||
import Divider from './divider/Divider.svelte'; | ||
import Cell from './cell/Cell.svelte'; | ||
import CellGroup from './cell/CellGroup.svelte'; | ||
import Switch from './switch/Switch.svelte'; | ||
import Avatar from './avatar/Avatar.svelte'; | ||
import Tabs from './tabs/Tabs.svelte'; | ||
import Tab from './tabs/Tab.svelte'; | ||
import TabContent from './tabs/TabContent.svelte'; | ||
import TabBar from './tabBar/TabBar.svelte'; | ||
import Steps from './steps/Steps.svelte'; | ||
import IndexBar from './indexBar/IndexBar.svelte'; | ||
import Radio from './radio/Radio.svelte'; | ||
import RadioGroup from './radio/RadioGroup.svelte'; | ||
import Checkbox from './checkbox/Checkbox.svelte'; | ||
import CheckboxGroup from './checkbox/CheckboxGroup.svelte'; | ||
import Input from './input/Input.svelte'; | ||
import Grids from './grids/Grids.svelte'; | ||
import Grid from './grids/Grid.svelte'; | ||
import Swiper from './swiper/Swiper.svelte'; | ||
import Placeholder from './placeholder/Placeholder.svelte'; | ||
import Skeleton from './skeleton/Skeleton.svelte'; | ||
import Rate from './rate/Rate.svelte'; | ||
import Slider from './slider/Slider.svelte'; | ||
import Badge from './badge/Badge.svelte'; | ||
import NoticeBar from './noticeBar/NoticeBar.svelte'; | ||
import Progress from './progress/Progress.svelte'; | ||
import ProgressLoop from './progressLoop/ProgressLoop.svelte'; | ||
import Mask from './mask/Mask.svelte'; | ||
import Toast from './toast/Toast.svelte'; | ||
import Loading from './loading/Loading.svelte'; | ||
import Popup from './popup/Popup.svelte'; | ||
import BottomSheet from './bottomSheet/BottomSheet.svelte'; | ||
import Modal from './modal/Modal.svelte'; | ||
import Dialog from './dialog/Dialog.svelte'; | ||
import ActionSheet from './actionSheet/ActionSheet.svelte'; | ||
import Picker from './picker/Picker.svelte'; | ||
import AsyncPicker from './asyncPicker/AsyncPicker.svelte'; | ||
import TimePicker from './timePicker/TimePicker.svelte'; | ||
import Calendar from './calendar/Calendar.svelte'; | ||
import Pagination from './pagination/Pagination.svelte'; | ||
|
||
export { | ||
Button, | ||
NavBar, | ||
Icon, | ||
Divider, | ||
Cell, | ||
CellGroup, | ||
Switch, | ||
Avatar, | ||
Tabs, | ||
Tab, | ||
TabContent, | ||
TabBar, | ||
Steps, | ||
IndexBar, | ||
Radio, | ||
RadioGroup, | ||
Checkbox, | ||
CheckboxGroup, | ||
Input, | ||
Grids, | ||
Grid, | ||
Swiper, | ||
Placeholder, | ||
Skeleton, | ||
Rate, | ||
Slider, | ||
Badge, | ||
NoticeBar, | ||
Progress, | ||
ProgressLoop, | ||
Toast, | ||
Mask, | ||
Loading, | ||
Popup, | ||
BottomSheet, | ||
Modal, | ||
Dialog, | ||
ActionSheet, | ||
Picker, | ||
AsyncPicker, | ||
TimePicker, | ||
Calendar, | ||
Pagination, | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// 1. 将 components 下所有文件复制到 dist/components 下 | ||
// 2. 将 lang 和 assets 下所有文件复制到 dist 下 | ||
// 3. 将 dist 下所有 svelte 和 js 文件中的注释和空行,合并为一行 | ||
|
||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
|
||
// 创建 dist 目录 | ||
if (!fs.existsSync('dist')) { | ||
fs.mkdirSync('dist'); | ||
} | ||
|
||
// 创建 dist/components 目录 | ||
if (!fs.existsSync('dist/components')) { | ||
fs.mkdirSync('dist/components'); | ||
} | ||
|
||
// 创建 dist/lang 目录 | ||
if (!fs.existsSync('dist/lang')) { | ||
fs.mkdirSync('dist/lang'); | ||
} | ||
|
||
// 创建 dist/assets 目录 | ||
if (!fs.existsSync('dist/assets')) { | ||
fs.mkdirSync('dist/assets'); | ||
} | ||
|
||
function copyDirRecursive(sourceDir, targetDir) { | ||
// 创建目标文件夹 | ||
if (!fs.existsSync(targetDir)) { | ||
fs.mkdirSync(targetDir); | ||
} | ||
|
||
// 读取源文件夹中的所有文件和子文件夹 | ||
const files = fs.readdirSync(sourceDir); | ||
|
||
files.forEach(file => { | ||
const sourcePath = path.join(sourceDir, file); | ||
const targetPath = path.join(targetDir, file); | ||
|
||
const stats = fs.statSync(sourcePath); | ||
|
||
if (stats.isFile()) { | ||
// 如果是文件,则直接复制 | ||
fs.copyFileSync(sourcePath, targetPath); | ||
} else if (stats.isDirectory()) { | ||
// 如果是文件夹,则递归复制 | ||
copyDirRecursive(sourcePath, targetPath); | ||
} | ||
}); | ||
} | ||
|
||
// 复制 components 目录下的所有文件到 dist/components 目录下 | ||
copyDirRecursive('components', 'dist/components'); | ||
|
||
// 复制 lang 目录下的所有文件到 dist 目录下 | ||
copyDirRecursive('lang', 'dist/lang'); | ||
|
||
// 复制 assets 目录下的所有文件到 dist 目录下 | ||
copyDirRecursive('assets', 'dist/assets'); | ||
|
||
// 递归遍历目录下的所有 svelte 和 js 文件 | ||
function processFiles(dir) { | ||
fs.readdirSync(dir).forEach(file => { | ||
const filePath = path.join(dir, file); | ||
const stat = fs.statSync(filePath); | ||
|
||
if (stat.isDirectory()) { | ||
// 如果是目录,则递归处理 | ||
processFiles(filePath); | ||
} else if (file.endsWith('.svelte') || file.endsWith('.js')) { | ||
// 处理 svelte 和 js 文件 | ||
let content = fs.readFileSync(filePath, 'utf8'); | ||
|
||
// 删除 /* ... */ 形式的注释 | ||
content = content.replace(/\/\*[\s\S]*?\*\//g, ''); | ||
|
||
// 删除 // 形式的注释 | ||
content = content.replace(/\/\/.*/g, ''); | ||
|
||
// 删除空行 | ||
content = content.replace(/^\s*[\r\n]/gm, ''); | ||
|
||
// 合并为一行,仅留一个空格 | ||
content = content.replace(/\s+/g, ' '); | ||
|
||
fs.writeFileSync(filePath, content, 'utf8'); | ||
} | ||
}); | ||
} | ||
|
||
processFiles('dist'); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.