-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 优化构建脚本。 - 加入自动移除class前后空格功能。 - 当dom_tag为空时,为其指定默认tag。 - 修复dom_attr参数为null或undefined时,会报错的bug。 - 修复dom_attr参数为字符串时,无法输出html文本的bug。
- Loading branch information
Showing
16 changed files
with
177 additions
and
156 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
react.html | ||
react.test.js | ||
dist/ | ||
npm/ | ||
npm/ | ||
node_modules/ |
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 |
---|---|---|
@@ -1,36 +1,54 @@ | ||
# JQuery DOM | ||
|
||
- Version: 1.1.6 Build 20240115 | ||
- 优化构建脚本。 | ||
- 加入自动移除class前后空格功能。 | ||
- 当dom_tag为空时,为其指定默认tag。 | ||
- 修复dom_attr参数为null或undefined时,会报错的bug。 | ||
- 修复dom_attr参数为字符串时,无法输出html文本的bug。 | ||
|
||
- Version: 1.1.5 Build 20240112 | ||
- 更新文档。 | ||
- 加入NPM模块打包发布脚本。 | ||
- 修复传入的对象、子项为已被React.createElement封装的对象时报错的bug。 | ||
|
||
- Version: 1.1.4 Build 20240110 | ||
- 加入构建脚本。 | ||
- 加入ReactDOMHtml模块导出。 | ||
- 修复使用标准参数时无法输出html文本的bug。 | ||
- 修复ReactDOMHtml中class为数组时不生效的bug。 | ||
|
||
- Version: 1.1.3 Build 20240109 | ||
- 加入ReactDOMHtml。 | ||
- 整理项目资源。 | ||
- 优化vueDOMHtml结构,拆分DOMHtml和VueDOMHtml。 | ||
|
||
- Version: 1.1.2 Build 20240105 | ||
- 加入vueDOMHtml功能。 | ||
|
||
- Version: 1.1.1 Build 20240104 | ||
- 修复数组形式插入DOM时无法插入的bug。 | ||
|
||
- Version: 1.1.0 Build 20231229 | ||
- 加入attribute PascalCase→kebab-case转换。 | ||
- 优化DOM插入性能。 | ||
|
||
- Version: 1.0.9 Build 20231228 | ||
- 将$更名为jQuery以适配更多场合。 | ||
- 加入原生getDOMHtml功能。 | ||
|
||
- Version: 1.0.9 Build 20231227 | ||
- 将getHtml更名为getDOMHtml。 | ||
- 加入表格使用tr替代tbody功能。 | ||
- 加入dom_tag和dom_attr单层对象写法。 | ||
- 更新文档。 | ||
|
||
- Version: 1.0.8 Build 20231222 | ||
- 加入获取生成的HTML功能。 | ||
|
||
- Version: 1.0.7 Build 20230606 | ||
- 加入表格DOM的语法糖。 | ||
- 修复部分情况下,元素中children会出现重复内容的bug。 | ||
|
||
- Version: 1.0.6 Build 20210514 | ||
- 修复部分情况下,appendDOM中直接传递对象时无法添加元素的bug。 |
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
@echo off | ||
mkdir dist | ||
move /y *.min.js dist\ | ||
copy /y react.extensions.dom.module.js dist\react-extensions-dom-module.js | ||
copy /y react.extensions.dom.module.js npm\index.js | ||
node build.js | ||
pause |
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,93 @@ | ||
const fs=require(`fs`); | ||
const UglifyJS = require(`uglify-js`); | ||
|
||
String.prototype.replaceAll=function(org,tgt){ | ||
return this.split(org).join(tgt); | ||
} | ||
|
||
//创建文件夹 | ||
try{ | ||
fs.mkdirSync(`dist`); | ||
fs.mkdirSync(`npm`); | ||
}catch(e){} | ||
|
||
// 压缩非模块脚本 | ||
const uglifyList=[ | ||
`jquery.extensions.dom`, | ||
`html.dom`, | ||
`vue.extensions.dom`, | ||
`react.extensions.dom`, | ||
] | ||
for(let s of uglifyList){ | ||
try{ | ||
let origin=fs.readFileSync(`${s}.js`,`utf-8`); | ||
let target=UglifyJS.minify(origin); | ||
if (target.error) { | ||
console.error(`Error in minifying JS file: ${target.error}`); | ||
} else { | ||
fs.writeFileSync(`dist/${s}.min.js`, target.code, {encoding:`utf-8`}); | ||
console.log(`Compression ${s} completed successfully!`); | ||
} | ||
}catch(e){ | ||
console.error(`An error occurred while compressing the JS file: ${e}`); | ||
} | ||
} | ||
|
||
// 处理模块脚本 | ||
const moduleOriginTag=`/* --- FOR MODULE --- */`; | ||
const moduleTargetTag=`/* MODULE INSERT */`; | ||
const moduleList=[ | ||
{origin:`react.extensions.dom`,target:`react.extensions.dom.module`,output:`react-extensions-dom-module`}, | ||
] | ||
for(let m of moduleList){ | ||
try{ | ||
let origin=fs.readFileSync(`${m.origin}.js`,`utf-8`); | ||
let target=fs.readFileSync(`${m.target}.m`,`utf-8`); | ||
let originCode=origin.split(moduleOriginTag)[1]; | ||
let targetCode=target.replaceAll(moduleTargetTag, originCode).trim(); | ||
fs.writeFileSync(`dist/${m.output}.js`, targetCode, {encoding:`utf-8`}); | ||
fs.writeFileSync(`npm/index.js`, targetCode, {encoding:`utf-8`}); | ||
console.log(`Output module ${m.output} completed successfully!`); | ||
}catch(e){ | ||
console.error(`An error occurred while output the JS module file: ${e}`); | ||
} | ||
} | ||
|
||
// 创建NPM包 | ||
// 读取VERSION.md获取版本号 | ||
let versionMd=fs.readFileSync(`VERSION.md`,`utf-8`); | ||
let versionSplit=versionMd.split(`\n`); | ||
let version=``; | ||
for(let v of versionSplit){ | ||
if(v.includes(`Version: `)){ | ||
version=v.split(` `)[2]; | ||
break; | ||
} | ||
} | ||
//创建package.json | ||
const packageJson={ | ||
name: `react-extensions-dom`, | ||
version: version, | ||
description: `A plugin for React, use object instead of JSX to manage React elements.`, | ||
main: `index.js`, | ||
scripts: { | ||
test: `echo "Error: no test specified" && exit 1`, | ||
}, | ||
repository: { | ||
type: `git`, | ||
url: `git+https://github.com/road0001/JQueryDOM.git`, | ||
}, | ||
author: ``, | ||
license: `MIT`, | ||
bugs: { | ||
url: `https://github.com/road0001/JQueryDOM/issues`, | ||
}, | ||
homepage: `https://github.com/road0001/JQueryDOM#readme`, | ||
} | ||
//写入package.json | ||
try{ | ||
fs.writeFileSync(`npm/package.json`, JSON.stringify(packageJson, null, `\t`), {encoding:`utf-8`}); | ||
console.log(`Output package.json completed successfully!`); | ||
}catch(e){ | ||
console.error(`An error occurred while output the package.json file: ${e}`); | ||
} |
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,2 @@ | ||
npm install uglify-js --save-dev | ||
node build.js |
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,3 @@ | ||
@echo off | ||
call npm install uglify-js --save-dev | ||
pause |
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 @@ | ||
npm install uglify-js --save-dev |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"devDependencies": { | ||
"uglify-js": "^3.17.4" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
@echo off | ||
mkdir npm | ||
cd npm | ||
npm login | ||
npm publish | ||
|
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,3 @@ | ||
cd npm | ||
npm login | ||
npm publish |
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
Oops, something went wrong.