zen-app-plugin 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/package.json +1 -1
- package/.github/workflows/npm-publish.yml +0 -30
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){let e=require("terser-webpack-plugin"),{VueLoaderPlugin:t}=require("vue-loader"),
|
|
1
|
+
!function(){let e=require("terser-webpack-plugin"),{VueLoaderPlugin:t}=require("vue-loader"),s=require("path"),o=require("fs"),n=require("body-parser"),r=require("./makeIndex"),{makeRootIndex:i,makeSonIndex:l}=r,a=require("./plugin");function c(e,t){if(t.length<2)return;let n,r=t.filter(((t,r)=>(0===r&&(n=s.join(e,t),o.existsSync(n)||o.mkdirSync(n)),r>0)));c(n,r)}var u={entry:{},output:{filename:"[name].js"},watchOptions:{ignored:["node_modules","dist","debug"],poll:300},externals:{vue:"Vue","router-view":"VueRouter","element-plus":"ElementPlus"},plugins:[new t],module:{noParse:/Vue|jquery/,rules:[{test:/\.jsx?$/,exclude:/(node_modules|bower_components)/,use:{loader:"babel-loader",options:{cacheDirectory:!0,presets:[["@vue/app",{modules:"commonjs",loose:!0,useBuiltIns:"entry"}]],plugins:["@babel/plugin-syntax-jsx"]}}},{test:/\.vue$/,loader:"vue-loader"},{test:/\.css$/,use:["style-loader","css-loader"]},{test:/\.scss$/,use:["style-loader","css-loader",{loader:"sass-loader",options:{implementation:require("sass")}}]}]}};module.exports=({target:t,mode:r,ROOT:d,port:p,name:m,apps:h={}})=>{let g,y,f,v,b;const j={};for(Object.keys(h).forEach((e=>{j["/"+e+"/"]={target:"http://127.0.0.1:"+h[e],secure:!1,changeOrigin:!0}})),b=o.readdirSync(s.resolve(d,"src")),f=0,v=b.length;f<v;f++)y=b[f],-1!==y.indexOf(".js")&&(g=s.basename(y),g=g.substr(0,g.length-3),u.entry[g]=s.resolve(d,"src",y));return u.resolve={alias:{"@":s.resolve(d,"src")},extensions:[".js",".vue",".jsx",".json"]},u.mode=r,u.optimization=function(t){return"production"===t?{splitChunks:!1,minimize:!0,maxAssetSize:512e3,minimizer:[new e({parallel:!0,extractComments:!1,exclude:/node_modules/,terserOptions:{compress:{drop_console:!0,collapse_vars:!0,reduce_vars:!0,drop_debugger:!0},mangle:{reserved:["zen","$"]},output:{comments:!1,ascii_only:!0},sourceMap:!1,toplevel:!0,ie8:!1,keep_fnames:!1,safari10:!1}})]}:{}}(r),"development"===r?(u.cache={type:"memory"},u.devServer={open:!0,hot:!0,client:!1,host:"127.0.0.1",allowedHosts:"all",historyApiFallback:!0,onAfterSetupMiddleware:function(e){const{app:t}=e;t.use(n.json());const r=s.join(d,"src","pages");t.get("/coder.html",(function(e,t){return t.send(function(e){return`\n<!DOCTYPE html><html><head> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="chrome,IE=edge"/> <meta name="HandheldFriendly" content="true"/> <meta name="format-detection" content="telephone=no,email=no"/> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, user-scalable=no, minimal-ui, viewport-fit=cover"/> <meta name="renderer" content="webkit"/> <meta name="msapplication-tap-highlight" content="no"/> <title>云智低码引擎</title> <script src="//b.ebus.vip/zeto/latest/zen.js"><\/script> <link rel="stylesheet" type="text/css" href="//b.ebus.vip/zeto/latest/zen.css"> <script> window.coderHost = "https://thor.zeto.me";window.appName='${e}' <\/script></head><body><script src="https://b.ebus.vip/thor/v0.0.2/detail.js"><\/script></body></html>`}(m))})),t.post("/coder/read",(function(e,t){const{file:n,key:i}=e.body;if(!n)return t.json({code:10001,message:"参数错误"});const l=s.join(r,n);if(!o.existsSync(l))return t.json({code:1e4,data:null});let a={code:1e4,data:o.readFileSync(l,"utf-8")};t.json(a)})),t.post("/coder/write",(function(e,t){const{file:n,content:a,type:u}=e.body;if(!n)return t.json({code:10001,message:"参数错误"});const d=n.split("/");c(r,d);const p=s.join(r,n);if(o.writeFileSync(p,a),"page"===u){const e=d.splice(0,d.length-2),t=s.join(r,e.join(s.sep));if(0===e.length)return i(r);l(t,e.join("/"),r)}t.json({code:1e4,message:"操作成功"})}))},proxy:{"/api":{target:"http://127.0.0.1:"+p,secure:!1,changeOrigin:!0},...j},static:{directory:s.join(d,"public")},headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"}}):(u.devtool=!1,u.output.clean=!0,u.output.path=s.join(d,"dist")),u.plugins.push(new a(t)),u}}();
|
package/package.json
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Node.js Package
|
|
5
|
-
|
|
6
|
-
on: [push]
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
steps:
|
|
12
|
-
- uses: actions/checkout@v4
|
|
13
|
-
- uses: actions/setup-node@v4
|
|
14
|
-
with:
|
|
15
|
-
node-version: 20
|
|
16
|
-
- run: npm ci
|
|
17
|
-
|
|
18
|
-
publish-npm:
|
|
19
|
-
needs: build
|
|
20
|
-
runs-on: ubuntu-latest
|
|
21
|
-
steps:
|
|
22
|
-
- uses: actions/checkout@v4
|
|
23
|
-
- uses: actions/setup-node@v4
|
|
24
|
-
with:
|
|
25
|
-
node-version: 20
|
|
26
|
-
registry-url: https://registry.npmjs.org/
|
|
27
|
-
- run: npm ci
|
|
28
|
-
- run: npm publish
|
|
29
|
-
env:
|
|
30
|
-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|