From 686971aea789665dfc7724939c7b366f1e2ab31c Mon Sep 17 00:00:00 2001 From: dailer Date: Mon, 18 Oct 2021 16:45:00 +0800 Subject: [PATCH] init --- .gitignore | 3 +-- README.md | 66 ++++++++++++++++++++++++++++++++++++++++++++++ gulpfile.js | 14 ++++++++++ package.json | 18 +++++++++++++ screenshots/1.png | Bin 0 -> 15901 bytes screenshots/2.png | Bin 0 -> 8865 bytes src/demo.js | 44 +++++++++++++++++++++++++++++++ src/index.js | 18 +++++++++++++ 8 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 gulpfile.js create mode 100644 package.json create mode 100644 screenshots/1.png create mode 100644 screenshots/2.png create mode 100644 src/demo.js create mode 100644 src/index.js diff --git a/.gitignore b/.gitignore index d333b23..8027956 100644 --- a/.gitignore +++ b/.gitignore @@ -105,5 +105,4 @@ dist .tern-port # Stores VSCode versions used for testing VSCode extensions -.vscode-test - +.vscode-test \ No newline at end of file diff --git a/README.md b/README.md index 59e7bf2..a2f97f7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,68 @@ # javascript-dev-demo +## 使用说明 +在插件开发过程中,比较常见的场景是通过`WebResourceProvider`注入一段自定义的javascript文件,如果插件功能较多,在编写插件代码时候大多会拆分为多个js文件编写,在发布插件时合并为一个文件供`WebResourceProvider`引入 + +此仓库提供了es6,es6,typescript三个分支 + +## 项目结构 +常见的项目结构如下图所示,resources下放置js文件 + +![1](./screenshots/1.png) + +建议打包合并的js文件输出到dist目录下,这样对应`WebResourceProvider`中代码为 +``` +public class WebResourceProvider extends AbstractWebResourceProvider { + @Override + public Atom attach() { + return MainComponent.KEY; + } + + @Override + public Atom client() { + return new Component() { + @Override + public ScriptPath script(RequestClient requestClient) { + return ScriptPath.build("/com/fr/plugin/decision/demo/web/dist/dec.plugin.demo.js"); + } + }; + } +} +``` + +如果使用了git,将`node_modules`加入`.gitignore`中 + +## es5-gulp + + +#### 安装nodejs,选装yarn + +这一步省略,可以自行查阅相关资料 + +#### 安装依赖 + +在web路径下启动命令行,执行 + +`npm install` 或者 `yarn install` + +#### 打包合并文件 + +示例中编写了两个js文件,将这两个文件合并为`dec.plugin.demo.js`输出到dist目录下 + +命令行执行 + +`npm run build` 或 `yarn build` + +这是dist目录下将出现`dec.plugin.demo.js`文件,如果需要再次打包,重新执行上述命令即可 + +![2](./screenshots/2.png) + +#### 自动watch文件变动 + +如果需要在源代码变动之后自动合并输出文件,可以采用dev开发模式 + +命令行执行 + +`npm run dev` 或 `yarn dev` + +即启动了一个node进程,每当源代码中任意js文件变更,`dec.plugin.demo.js`都会被自动更新 \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..11bd97c --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,14 @@ +const { src, dest, series } = require("gulp"); +const concat = require("gulp-concat"); +const watch = require("gulp-watch"); + +function buildTask() { + return src(["src/**/*.js"]).pipe(concat("dec.plugin.demo.js")).pipe(dest("./dist")); +} + +function watchTask() { + return watch(["src/**/*.js"], buildTask) +} + +exports.buildTask = buildTask; +exports.devTask = series(buildTask, watchTask); diff --git a/package.json b/package.json new file mode 100644 index 0000000..7f0672d --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "javascript-dev-demo", + "version": "1.0.0", + "main": "index.js", + "repository": "https://code.fanruan.com/dailer/javascript-dev-demo.git", + "author": "dailer ", + "license": "MIT", + "scripts": { + "build": "gulp buildTask", + "dev": "gulp devTask" + }, + "dependencies": { + "gulp": "^4.0.2", + "gulp-concat": "^2.6.1", + "gulp-sourcemaps": "^3.0.0", + "gulp-watch": "^5.0.1" + } +} \ No newline at end of file diff --git a/screenshots/1.png b/screenshots/1.png new file mode 100644 index 0000000000000000000000000000000000000000..6357842a9c14192f90418f6c71b04bb7cda85ea1 GIT binary patch literal 15901 zcmch;d0dlMw>EsERccjms0Brcf{IfKC<-z~D}odRCj=P+NDCs!6s8cSih_ucMyw!H zS`iVENs16i7zKiY2pGbc2nkal1Og!hNb>Cf_Ow0EbKY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*yom~H&=nsUBov+=W4V4v8z ze`b(jD+~?KC3Y|H!H867GMFiRZsy0VThWn%0K9`SfYB&0?bju!ZTc4MhUo)MnIKOu z{7S2P(ctsEj7(CvyfH}&j2iAc&Sgocc3ioi-qH>VPh}POMhOcT^V1u4QiksZG3a*e zKP3~*`$YNgmu3zx89VUK2FRZu<&npXu7h@-@QEE0Y>v6@=}Z4UOQ9^SSR@2MaIC_( z*kaL47!^=43nkC`Piw0}w!Bd#EF<0d6ZU~+xsqPq&CxR=qr;?XGz3Qd$# zRPp8p@0Wf4^E6&M1l>FbP8`NmZdOB7%2x!IY@HBSM^5%silh5k1I3eU9tYdIj5wA! z{+mmQHM#T}HN5$xG zXsE_~#3B_i9boziLv@#lDH{T}_K|@ccV60t&Y{nnb2Q=UpTMXjT~JK_GM_%r!!1Z> z1*G-M?r7r-pV6pTiwNkn4g3fi6?9SH$P3}@H4ha*h5Z)vXdtic6JYXHZjZ}g$Pl&y z{VV!HF3X4QGR&`e3nwZm>GJ2uLa5Ru*^?Stl8RYLXgM+jn6d3fsx|}mm4nd1C)%ot>W1P@U>A^#$ z5(jpA0ge#?|5^b0?{#Rw7BZv_x|q)a!?6pROS@A>$gvWxcyyBGW7OQ74~836Up7ey zDOBWiO(p*`A>A(V!|VUyn<3qw=iF^VH8)H4NL;@W7POly$!;e#ak#{#O1k)9K$&Fk zk1MERw$s;*DWrv>r2Dis6y2D>mT1)u(Rk$0Ba3FwHzqj_Mr3Z35L#nB%l8HvSU6`IPFfs}J5)^g-&maG5ux*%5bxAopHIyz8p z#7usc6i^Wr-89HAgtFE>l?JRm@QL>I?|u+hyXNID_-M_G&vPW+b|BbJH-6^!Ay^u=VzR;o>SOx*By;#8VXbghITsdsVcx!c2sz3a2(m}yvHOm4OOJ;$%SLndd;4fDQpy!HP9yx-{q literal 0 HcmV?d00001 diff --git a/screenshots/2.png b/screenshots/2.png new file mode 100644 index 0000000000000000000000000000000000000000..cb851ec8c63daa8bf673b6e4eb55bdd99ead1412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100644 index 0000000..3f7d7f0 --- /dev/null +++ b/src/demo.js @@ -0,0 +1,44 @@ +// 建议每个文件都包裹一层立即执行函数,避免插件的全局变量污染 +!(function () { + var Widget = BI.inherit(BI.BasicButton, { + + props: { + baseCls: "decision-plugin-demo", + }, + + render: function () { + var self = this, o = this.options; + + return { + type: "bi.vertical", + hgap: 10, + vgap: 10, + items: [ + { + el: { + type: "bi.vertical_adapt", + rgap: 10, + items: [ + { + type: "bi.label", + text: "测试开关" + }, { + type: "bi.switch", + ref: function (_ref) { + self.switchButton = _ref; + }, + selected: false, + handler: function () { + console.log(self.switchButton.isSelected() ? "开启" : "关闭") + } + } + ] + }, + }, + ], + }; + }, + }); + + BI.shortcut("dec.plugin.demo", Widget); +}()); diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..4dbc67b --- /dev/null +++ b/src/index.js @@ -0,0 +1,18 @@ +// 建议每个文件都包裹一层立即执行函数,避免插件的全局变量污染 +!(function () { + // 示例在系统管理新增一个管理节点 + BI.config("dec.provider.management", function (provider) { + provider.inject({ + modules: [ + { + value: "demo", + id: "decision-plugin-demo", + text: BI.i18nText("demo示例"), + cardType: "dec.plugin.demo", + cls: "dir-font-10", + gradeAuth: false, + }, + ], + }); + }); +}());