@das-fed/cli 1.0.2 → 1.0.4-beta.0

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.
Files changed (57) hide show
  1. package/bin/index.js +1 -1
  2. package/package.json +12 -9
  3. package/src/commands/build/generate-nginx.js +1 -0
  4. package/src/commands/build/get-window-config.js +1 -0
  5. package/src/commands/build/index.js +1 -1
  6. package/src/commands/build/nginx.main.conf +55 -0
  7. package/src/commands/build/nginx.micro.conf +62 -0
  8. package/src/commands/dev/index.js +1 -1
  9. package/src/commands/dev-helper/index.js +1 -1
  10. package/src/commands/dev-helper/init-das-fe-web-type/index.js +1 -1
  11. package/src/commands/dev-helper/init-git-ignore.js +3 -3
  12. package/src/commands/dev-helper/init-public-config.js +1 -1
  13. package/src/commands/dev-helper/run-package-script.js +1 -0
  14. package/src/commands/dev-helper/watchers/i18n/index.js +1 -1
  15. package/src/commands/dev-helper/watchers/index.js +1 -1
  16. package/src/commands/dev-helper/watchers/oss/index.js +1 -0
  17. package/src/commands/dev-helper/watchers/theme/index.js +1 -1
  18. package/src/commands/help/index.js +1 -1
  19. package/src/commands/init/index.js +1 -0
  20. package/src/commands/init/template/.prettierignore +21 -0
  21. package/src/commands/init/template/.prettierrc +8 -0
  22. package/src/commands/init/template/README.md +19 -0
  23. package/src/commands/init/template/config.js +9 -0
  24. package/src/commands/init/template/index.html +12 -0
  25. package/src/commands/init/template/package.json +26 -0
  26. package/src/commands/init/template/public/config.js +1 -0
  27. package/src/commands/init/template/src/demo/app.vue +61 -0
  28. package/src/commands/init/template/src/demo/i18n/index.ts +14 -0
  29. package/src/commands/init/template/src/demo/router.ts +13 -0
  30. package/src/commands/init/template/src/demo/theme/index.ts +7 -0
  31. package/src/commands/init/template/src/main.ts +8 -0
  32. package/src/commands/init/template/src/micro-app.ts +8 -0
  33. package/src/commands/init/template/src/views/hello/api/index.ts +6 -0
  34. package/src/commands/init/template/src/views/hello/app.vue +157 -0
  35. package/src/commands/init/template/src/views/hello/assets/das.png +0 -0
  36. package/src/commands/init/template/src/views/hello/assets/vite.svg +1 -0
  37. package/src/commands/init/template/src/views/hello/assets/vue.svg +1 -0
  38. package/src/commands/init/template/src/views/hello/i18n/index.ts +16 -0
  39. package/src/commands/init/template/src/views/hello/router.ts +12 -0
  40. package/src/commands/init/template/src/views/hello/theme/index.ts +18 -0
  41. package/src/commands/init/template/src/vite-env.d.ts +1 -0
  42. package/src/commands/init/template/tsconfig.app.json +27 -0
  43. package/src/commands/init/template/tsconfig.json +11 -0
  44. package/src/commands/init/template/tsconfig.node.json +13 -0
  45. package/src/commands/init/template/vite.config.ts +14 -0
  46. package/src/commands/version/index.js +1 -1
  47. package/src/utils/check-local-workspace.js +1 -1
  48. package/src/utils/get-cli-config/index.js +1 -1
  49. package/src/utils/json2snippets/index.js +1 -1
  50. package/src/utils/json2type/index.js +1 -1
  51. package/src/utils/minio.js +1 -1
  52. package/src/utils/ts-morph/index.js +1 -1
  53. package/src/vite-plugins/das-fe-ui/core/style.js +1 -1
  54. package/src/vite-plugins/das-fe-web/core/das-fe-web.js +1 -1
  55. package/src/vite-plugins/das-fe-web/core/style.js +1 -1
  56. package/src/vite-plugins/index.js +1 -1
  57. package/src/commands/create-app/index.js +0 -1
package/bin/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{createCliApp}from"@dimple-smile/node-helper";import{fileURLToPath}from"url";import{dirname,resolve}from"path";const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);createCliApp({cwd:resolve(__dirname,"../")});
2
+ import{createCliApp}from"@dimple-smile/node-helper";import{fileURLToPath}from"url";import{dirname,resolve}from"path";let __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);createCliApp({cwd:resolve(__dirname,"../")});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@das-fed/cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.4-beta.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -12,25 +12,28 @@
12
12
  "license": "ISC",
13
13
  "dependencies": {
14
14
  "@dimple-smile/node-helper": "^1.0.0",
15
+ "@vitejs/plugin-vue-jsx": "^3.1.0",
15
16
  "chokidar": "^3.6.0",
16
17
  "concurrently": "^8.2.2",
17
18
  "fast-glob": "^3.3.2",
19
+ "fs-extra": "^11.2.0",
20
+ "inquirer": "^9.3.2",
18
21
  "json-schema-to-typescript": "^13.1.2",
19
22
  "json5": "^2.2.3",
20
23
  "minimatch": "^9.0.3",
21
24
  "minimist": "^1.2.8",
25
+ "minio": "^7.1.3",
26
+ "prettier": "^3.2.5",
27
+ "rollup-plugin-visualizer": "^5.12.0",
28
+ "strip-comments": "^2.0.1",
22
29
  "ts-morph": "^21.0.1",
30
+ "unplugin-auto-import": "^0.17.5",
31
+ "unplugin-vue-components": "^0.26.0",
32
+ "vite-plugin-compression": "^0.5.1",
23
33
  "vite-plugin-style-import": "^2.0.0"
24
34
  },
25
35
  "devDependencies": {
26
- "es-module-lexer": "^1.4.1",
27
- "esbuild": "^0.20.1",
28
- "fs-extra": "^11.2.0",
29
- "svgo": "^3.2.0",
30
- "svgstore": "^3.0.1",
31
- "uglify-js": "^3.17.4",
32
- "unplugin-auto-import": "^0.17.5",
33
- "unplugin-vue-components": "^0.26.0"
36
+ "uglify-js": "^3.18.0"
34
37
  },
35
38
  "publishConfig": {
36
39
  "access": "public",
@@ -0,0 +1 @@
1
+ import fs from"fs-extra";import{dirname,resolve}from"path";import{fileURLToPath}from"url";let __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),generateNginx=async e=>{let{cwd:r,mainAppName:a="",microAppName:i="",microApps:n=""}=e;0<n.length&&(n=n.map(e=>({...e,name:e.name.toLocaleLowerCase()}))),a=a.toLocaleLowerCase(),i=i.toLocaleLowerCase();a;var e=!!i,o=resolve(__dirname,"./nginx.main.conf"),t=resolve(__dirname,"./nginx.micro.conf"),l=resolve(r,"public/nginx.conf"),o=(await fs.ensureFile(l),fs.readFileSync(o).toString());let m=fs.readFileSync(t).toString();e&&(m=m.replace(/\{url\}/g,("/"+i).replace(/\/\//g,"/"))),await fs.writeFile(l,e?m:o)};export{generateNginx};
@@ -0,0 +1 @@
1
+ import fs from"fs-extra";import prettier from"prettier";import strip from"strip-comments";import json5 from"json5";let getWindowConfig=async r=>{r=(await fs.readFile(r)).toString(),r=(await prettier.format(strip(r),{parser:"typescript"})).split(";").find(r=>r.match("window.config")).replace(/\s/g,"").replace("window.config=","");return json5.parse(r)};export{getWindowConfig};
@@ -1 +1 @@
1
- import concurrently from"concurrently";import{initPublicConfig}from"../dev-helper/init-public-config.js";import{initWatchers}from"../dev-helper/watchers/index.js";export default{handle:i=>{var e={cwd:process.cwd(),isDev:!1,isBuild:!0};initPublicConfig(e),initWatchers(e),concurrently([{command:"npx vite build",name:"vite"}])}};
1
+ import{initPublicConfig}from"../dev-helper/init-public-config.js";import{initWatchers}from"../dev-helper/watchers/index.js";import{execSync}from"child_process";import{resolve,relative,dirname}from"path";import{fileURLToPath}from"url";import minimist from"minimist";import fs from"fs-extra";import{generateNginx}from"./generate-nginx.js";import{getWindowConfig}from"./get-window-config.js";import{runPackageScript}from"../dev-helper/run-package-script.js";let __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);export default{handle:async i=>{var[,...e]=i,i=minimist(i),t=process.cwd(),r={cwd:t,isDev:!1,isBuild:!0,...i};await runPackageScript("@das-fed/ui","scripts/utils/build-svg-icon.js"),await runPackageScript("@das-fed/ui","scripts/utils/gen-components-entry.js"),await initPublicConfig(r),await initWatchers(r);let o=await getWindowConfig(resolve(t,"public/config.js"));try{var a,n=resolve(t,"config.js");await fs.exists(n)&&(a=(await import(relative(resolve(__dirname),n)))["default"],""===o.microAppName&&delete o.microAppName,o={...a,...o})}catch(i){console.log("get rootConfig error",i)}await generateNginx({cwd:t,...o});(e||[]).join(" ");let s="";i.c&&(s+="-c "+i.c),execSync("npx vite build "+s,{cwd:t,stdio:"inherit"})}};
@@ -0,0 +1,55 @@
1
+ worker_processes auto;
2
+ worker_rlimit_nofile 6000;
3
+ events {
4
+ worker_connections 1000;
5
+ }
6
+ http {
7
+ include mime.types;
8
+ default_type application/octet-stream;
9
+
10
+ # 使用gzip压缩
11
+ gzip on;
12
+ gzip_proxied any;
13
+ gzip_http_version 1.0;
14
+ gzip_min_length 1100;
15
+ gzip_buffers 4 16k;
16
+ gzip_comp_level 1;
17
+ gzip_vary on;
18
+ gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/json application/javascript image/x-icon;
19
+ gzip_disable "MSIE [1-6]\.";
20
+
21
+ # proxy配置
22
+ proxy_http_version 1.1;
23
+ proxy_connect_timeout 86400s;
24
+ proxy_read_timeout 86400s;
25
+ proxy_send_timeout 86400s;
26
+ proxy_set_header Upgrade $http_upgrade;
27
+ proxy_set_header Connection "upgrade";
28
+ proxy_set_header Host $host;
29
+ proxy_set_header X-Real-IP $remote_addr;
30
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
31
+ proxy_set_header X-Forwarded-Proto $scheme;
32
+ proxy_set_header X-Frame-Options SAMEORIGIN;
33
+
34
+
35
+
36
+ sendfile on;
37
+ keepalive_timeout 65;
38
+ client_max_body_size 500m;
39
+ server_tokens off;
40
+ server {
41
+ listen 80;
42
+ etag on;
43
+ location / {
44
+ root /usr/share/nginx/html;
45
+ index index.html index.htm;
46
+ try_files $uri $uri/ /index.html;
47
+ expires 0;
48
+ }
49
+
50
+ error_page 500 502 503 504 /50x.html;
51
+ location = /50x.html {
52
+ root html;
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,62 @@
1
+ worker_processes auto;
2
+ worker_rlimit_nofile 2000;
3
+ events {
4
+ worker_connections 1000;
5
+ }
6
+ http {
7
+ include mime.types;
8
+ default_type application/octet-stream;
9
+ # 使用gzip压缩
10
+ gzip on;
11
+ gzip_proxied any;
12
+ gzip_http_version 1.0;
13
+ gzip_min_length 1100;
14
+ gzip_buffers 4 16k;
15
+ gzip_comp_level 1;
16
+ gzip_vary on;
17
+ gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/json application/javascript image/x-icon;
18
+ gzip_disable "MSIE [1-6]\.";
19
+
20
+ # proxy配置
21
+ proxy_http_version 1.1;
22
+ proxy_connect_timeout 86400s;
23
+ proxy_read_timeout 86400s;
24
+ proxy_send_timeout 86400s;
25
+ proxy_set_header Upgrade $http_upgrade;
26
+ proxy_set_header Connection "upgrade";
27
+ proxy_set_header Host $host;
28
+ proxy_set_header X-Real-IP $remote_addr;
29
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
30
+ proxy_set_header X-Forwarded-Proto $scheme;
31
+ proxy_set_header X-Frame-Options SAMEORIGIN;
32
+
33
+
34
+ sendfile on;
35
+ keepalive_timeout 65;
36
+ client_max_body_size 500m;
37
+ server_tokens off;
38
+ server {
39
+ listen 80;
40
+ etag on;
41
+ location / {
42
+ root /usr/share/nginx/html;
43
+ try_files $uri $uri/ /index.html;
44
+ expires 0;
45
+ }
46
+
47
+ location ~ ^/(api|oss)/ {
48
+ proxy_pass http://gateway;
49
+ }
50
+
51
+ location {url} {
52
+ alias /usr/share/nginx/html;
53
+ try_files $uri $uri/ {url}/index.html;
54
+ expires 0;
55
+ }
56
+
57
+ error_page 500 502 503 504 /50x.html;
58
+ location = /50x.html {
59
+ root html;
60
+ }
61
+ }
62
+ }
@@ -1 +1 @@
1
- import concurrently from"concurrently";import{dirname,resolve}from"path";import{fileURLToPath}from"url";const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);export default{handle:e=>{concurrently([{command:"das-cli dev-helper",name:"das-cli"},{command:"npx vite",name:"vite"}])}};
1
+ import concurrently from"concurrently";import{dirname,resolve}from"path";import{fileURLToPath}from"url";import minimist from"minimist";let __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);export default{handle:e=>{var[,...m]=e,e=minimist(e),m=(m||[]).join(" ");let i="";e.c&&(i+="-c "+e.c),concurrently([{command:"das-cli dev-helper "+m,name:"das-cli"},{command:"npx vite "+i,name:"vite"}])}};
@@ -1 +1 @@
1
- import{initGitignore}from"./init-git-ignore.js";import{initPublicConfig}from"./init-public-config.js";import{initWatchers}from"./watchers/index.js";import fs from"fs-extra";import{resolve}from"path";import{fileURLToPath}from"url";import{dirname}from"path";import{execSync}from"child_process";const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),runPackageScript=async(i,r)=>{var i=resolve(__dirname,"../../../../",i),e=resolve(i,r);await fs.exists(e)&&execSync("node "+r,{cwd:i,stdio:"inherit"})};export default{handle:async i=>{console.log("das-cli dev-helper running!");var r={cwd:process.cwd(),isDev:!0};initGitignore(r),initPublicConfig(r),initWatchers(r),runPackageScript("das-ui","scripts/utils/build-svg-icon.js"),runPackageScript("das-ui","scripts/utils/gen-components-entry.js")}};
1
+ import{initGitignore}from"./init-git-ignore.js";import{initPublicConfig}from"./init-public-config.js";import{initWatchers}from"./watchers/index.js";import{runPackageScript}from"./run-package-script.js";import minimist from"minimist";export default{handle:async i=>{console.log("das-cli dev-helper running!");i=minimist(i),i={cwd:process.cwd(),isDev:!0,...i};await runPackageScript("@das-fed/ui","scripts/utils/build-svg-icon.js"),await runPackageScript("@das-fed/ui","scripts/utils/gen-components-entry.js"),initGitignore(i),initPublicConfig(i),initWatchers(i)}};
@@ -1,4 +1,4 @@
1
- import fs from"fs-extra";import{resolve}from"path";const initDasFeWebType=async e=>{e=e.cwd||process.cwd(),e=resolve(e,"src/das-fe-local-runtime/das-fe.d.ts");await fs.exists(e)||await fs.ensureFile(e);await fs.writeFile(e,`
1
+ import fs from"fs-extra";import{resolve}from"path";let initDasFeWebType=async e=>{e=e.cwd||process.cwd(),e=resolve(e,"src/das-fe-local-runtime/das-fe.d.ts");await fs.exists(e)||await fs.ensureFile(e);await fs.writeFile(e,`
2
2
  import type { ThemeName, ThemeVarKey } from './theme/type'
3
3
  import type { I18NName, I18NKey } from './i18n/type'
4
4
 
@@ -1,3 +1,3 @@
1
- import{resolve}from"path";import fs from"fs-extra";const ignoreList=["*.local.*","*/*local*/*"],initGitignore=async(t={})=>{t=(t||{}).isDev;if(t){t=resolve(process.cwd(),".gitignore");await fs.exists(t)||await fs.writeFile(t,"");let i=(await fs.readFile(t)).toString();for(const e of ignoreList)i.indexOf(e)<0&&(i+=`\r
2
- ${e}\r
3
- `);await fs.writeFile(t,i)}};export{initGitignore};
1
+ import{resolve}from"path";import fs from"fs-extra";let ignoreList=["*.local.*","**/*local*/*"],initGitignore=async(e={})=>{e=(e||{}).isDev;if(e){var t,e=resolve(process.cwd(),".gitignore");await fs.exists(e)||await fs.writeFile(e,"");let i=(await fs.readFile(e)).toString();for(t of ignoreList)i.indexOf(t)<0&&(i+=`\r
2
+ ${t}\r
3
+ `);await fs.writeFile(e,i)}};export{initGitignore};
@@ -1 +1 @@
1
- import{resolve}from"path";import fs from"fs-extra";const initPublicConfig=async(i={})=>{var i=i["isDev"],s=resolve(process.cwd(),"public/config.js"),e=resolve(process.cwd(),"public/config.local.js");await fs.exists(s)||(await fs.ensureFile(s),await fs.writeFile(s,"window.config = {}")),i&&!await fs.exists(e)&&await fs.copyFile(s,e)};export{initPublicConfig};
1
+ import{resolve}from"path";import fs from"fs-extra";let initPublicConfig=async(i={})=>{var i=i["isDev"],s=resolve(process.cwd(),"public/config.js"),e=resolve(process.cwd(),"public/config.local.js");await fs.exists(s)||(await fs.ensureFile(s),await fs.writeFile(s,"window.config = {}")),i&&!await fs.exists(e)&&await fs.copyFile(s,e)};export{initPublicConfig};
@@ -0,0 +1 @@
1
+ import{resolve}from"path";import{execSync}from"child_process";import fs from"fs-extra";let runPackageScript=async(e,r)=>{var e=resolve(process.cwd(),"node_modules",e),o=resolve(e,r);await fs.exists(o)&&execSync("node "+r,{cwd:e,stdio:"inherit"})};export{runPackageScript};
@@ -1 +1 @@
1
- import glob from"fast-glob";import fs from"fs-extra";import json5 from"json5";import{resolve}from"path";import{getExportDefaultsByAst}from"../../../../utils/ts-morph/index.js";import{json2type}from"../../../../utils/json2type/index.js";import{getCliConfig}from"../../../../utils/get-cli-config/index.js";const watchGlob=["src/views/*/i18n/*.ts"],handle=async(t={})=>{var e=t["cwd"],o=(await getCliConfig()).i18n?.watchGlob||[],o=getExportDefaultsByAst([...watchGlob,...o],t);let s={};o.map((t,e)=>{t=t.defaultText;Object.assign(s,json5.parse(t))});var a=[];for(const c of await glob(["src/**/*.vue"]))for(var r=(await fs.readFile(c)).toString(),i=/i18n\(\s*(.+)\s*\)/g;null!==(l=i.exec(r));){var[,l]=l;a.push(l)}a.forEach(t=>{for(var e=/['"](.*?)['"]/g;null!==(o=e.exec(t));){var[,o]=o;s[o]||(s[o]={})}});const n={"zh-CN":""};Object.values(s).filter(t=>!!t["zh-CN"]).map(t=>Object.assign(n,t)),0===Object.keys(s).length&&(s.any="");t=resolve(e,"src/das-fe-local-runtime/i18n/type.d.ts");await json2type({data:[{title:"I18NName",type:"string",enum:Object.keys(n)},{title:"I18NKey",type:"string",enum:Object.keys(s)}],outputFilePath:t})};export default{name:"das-i18n",glob:watchGlob,ignoreGlob:[],load:handle,change:handle};
1
+ import glob from"fast-glob";import fs from"fs-extra";import json5 from"json5";import{resolve}from"path";import{getExportDefaultsByAst}from"../../../../utils/ts-morph/index.js";import{json2type}from"../../../../utils/json2type/index.js";import{getCliConfig}from"../../../../utils/get-cli-config/index.js";let watchGlob=["src/**/i18n/*.ts"],handle=async(t={})=>{var e=t["cwd"],a=(await getCliConfig()).i18n?.watchGlob||[],a=getExportDefaultsByAst([...watchGlob,...a],t);let o={};a.map((t,e)=>{t=t.defaultText;Object.assign(o,json5.parse(t))});var s,r=[];for(s of await glob(["src/**/*.vue"]))for(var i=(await fs.readFile(s)).toString(),l=/i18n\(\s*(.+)\s*\)/g;null!==(n=l.exec(i));){var[,n]=n;r.push(n)}r.forEach(t=>{for(var e=/['"](.*?)['"]/g;null!==(a=e.exec(t));){var[,a]=a;o[a]||(o[a]={})}});let f={"zh-CN":""};Object.values(o).filter(t=>!!t["zh-CN"]).map(t=>Object.assign(f,t)),0===Object.keys(o).length&&(o.any="");t=resolve(e,"src/das-fe-local-runtime/i18n-runtime/type.d.ts");await json2type({data:[{title:"I18NName",type:"string",enum:Object.keys(f)},{title:"I18NKey",type:"string",enum:Object.keys(o)}],outputFilePath:t})};export default{name:"das-i18n",glob:watchGlob,ignoreGlob:[],load:handle,change:handle};
@@ -1 +1 @@
1
- import glob from"fast-glob";import chokidar from"chokidar";import{minimatch}from"minimatch";import{dirname,resolve}from"path";import{fileURLToPath}from"url";const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),loadWatcherModules=async a=>{var e=await glob("./*/index.js",{cwd:resolve(__dirname)});if(console.log(resolve(__dirname)),0!==e.length)return Promise.all(e.map(a=>import("./"+a).then(a=>a?.default||{})))},initWatchers=async o=>{const i=await loadWatcherModules();var{isBuild:a=!1,isDev:e=!1,cwd:r=process.cwd()}=o||{};i.map(a=>a?.load(o)),e&&!a&&(e=i.map(a=>a.glob||[]).flat().concat(i.map(a=>a.ignoreGlob||[]).flat()),chokidar.watch(e,{persistent:!0,cwd:r}).on("change",e=>{var a=i.find(a=>a.glob.map(a=>minimatch(e,a)).includes(!0));a&&a.change&&(console.log(`${a.name||"das-fe-watcher"} change!`),a.change(o))}))};export{initWatchers};
1
+ import glob from"fast-glob";import chokidar from"chokidar";import{minimatch}from"minimatch";import{dirname,resolve,relative}from"path";import{fileURLToPath}from"url";import{json2type}from"../../../utils/json2type/index.js";let __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),loadWatcherModules=async e=>{var a,t=await glob("*/index.js",{cwd:resolve(__dirname),absolute:!0});if(0!==t.length)return 0<(a=await glob("das-cli/dev/watchers/*/index.js",{cwd:process.cwd(),absolute:!0})).length&&t.push(...a),Promise.all(t.map(e=>{let a=relative(__dirname,e).replaceAll("\\\\","/").replaceAll("\\","/");return a.startsWith(".")||(a="./"+a),import(a).then(e=>e?.default||{})}))},initWatchers=async t=>{let o=await loadWatcherModules();var e,{isBuild:a=!1,isDev:i=!1,cwd:r=process.cwd()}=t||{};t.json2type=json2type;for(e of o)e.load&&await e?.load(t);i&&!a&&(i=o.map(e=>e.glob||[]).flat().concat(o.map(e=>e.ignoreGlob||[]).flat()),chokidar.watch(i,{persistent:!0,cwd:r}).on("change",a=>{var e=o.find(e=>e.glob.map(e=>minimatch(a,e)).includes(!0));e&&e.change&&(console.log(`${e.name||"das-fe-watcher"} change!`),e.change(t))}))};export{initWatchers};
@@ -0,0 +1 @@
1
+ import glob from"fast-glob";import{resolve}from"path";import{json2type}from"../../../../utils/json2type/index.js";import{minio}from"../../../../utils/minio.js";let watchGlob=["src/**/oss/**","!src/utils/oss/*","!src/watchers/oss/*"],handle=async(o={})=>{var{isBuild:t=!0,cwd:e}=o,s=o.remoteIp||o.remoteIP||o.RemoteIp||o.RemoteIP,o=await glob(watchGlob,{cwd:e,onlyFiles:!0});if(0<o.length&&json2type({data:[{title:"OssName",type:"string",enum:o}],outputFilePath:resolve(e,"src/das-fe-local-runtime/oss-runtime/type.d.ts")}),t&&s)for(var l of o)minio.upload(l,{cwd:e,host:s})};export default{name:"das-oss",glob:watchGlob,ignoreGlob:[],load:handle,change:handle};
@@ -1 +1 @@
1
- import json5 from"json5";import{resolve}from"path";import{getExportDefaultsByAst}from"../../../../utils/ts-morph/index.js";import{json2type}from"../../../../utils/json2type/index.js";import{json2snippets}from"../../../../utils/json2snippets/index.js";import{getCliConfig}from"../../../../utils/get-cli-config/index.js";const watchGlob=["src/views/*/theme/*.ts"],handle=async(e={})=>{var t=e["cwd"],s=await getCliConfig(),o=s.theme?.watchGlob||[],o=getExportDefaultsByAst([...watchGlob,...o],e);let r={};o.map((e,t)=>{let s=e.defaultText;e=s.match(/getVar\(.*\)/g);if(!e)return Object.assign(r,json5.parse(s));for(const a of e){var o=a.replace("getVar('","").replace("')","");s=s.replace(a,`'var(${o})'`)}Object.assign(r,json5.parse(s))});const a={base:""};Object.values(r).filter(e=>!!e.base).map(e=>Object.assign(a,e)),0===Object.keys(r).length&&(r.any=""),json2type({data:[{title:"ThemeName",type:"string",enum:Object.keys(a)},{title:"ThemeVarKey",type:"string",enum:Object.keys(r)}],outputFilePath:resolve(t,"src/das-fe-local-runtime/theme/type.d.ts")});let l=resolve(t,".vscode/das-theme.local.code-snippets");s.workspaceRoot&&(e=resolve(t,s.workspaceRoot),l=resolve(e,".vscode/das-theme.local.code-snippets")),json2snippets({data:{"das-theme-css变量":{prefix:"dasvar",body:[`var(\${1|${Object.keys(r).join(",")}|})`],scope:"css,scss,less",description:"das-theme-css变量"}},outputFilePath:l})};export default{name:"das-theme",glob:watchGlob,ignoreGlob:[],load:handle,change:handle};
1
+ import json5 from"json5";import{resolve}from"path";import{getExportDefaultsByAst}from"../../../../utils/ts-morph/index.js";import{json2type}from"../../../../utils/json2type/index.js";import{json2snippets}from"../../../../utils/json2snippets/index.js";import{getCliConfig}from"../../../../utils/get-cli-config/index.js";let watchGlob=["src/**/theme/*.ts"],handle=async(e={})=>{var t=e["cwd"],s=await getCliConfig(),o=s.theme?.watchGlob||[],o=getExportDefaultsByAst([...watchGlob,...o],e);let r={},a=(o.map((e,t)=>{let s=e.defaultText;var o,e=s.match(/getVar\(.*\)/g);if(!e)return Object.assign(r,json5.parse(s));for(o of e){var a=o.replace("getVar('","").replace("')","");s=s.replace(o,`'var(${a})'`)}Object.assign(r,json5.parse(s))}),{light:""}),l=(Object.values(r).filter(e=>!!e.light).map(e=>Object.assign(a,e)),0===Object.keys(r).length&&(r.any=""),json2type({data:[{title:"ThemeName",type:"string",enum:Object.keys(a)},{title:"ThemeVarKey",type:"string",enum:Object.keys(r)}],outputFilePath:resolve(t,"src/das-fe-local-runtime/theme-runtime/type.d.ts")}),resolve(t,".vscode/das-theme.local.code-snippets"));s.workspaceRoot&&(e=resolve(t,s.workspaceRoot),l=resolve(e,".vscode/das-theme.local.code-snippets")),json2snippets({data:{"das-theme-css变量":{prefix:"dasvar",body:[`var(\${1|${Object.keys(r).join(",")}|})`],scope:"css,scss,less",description:"das-theme-css变量"}},outputFilePath:l})};export default{name:"das-theme",glob:watchGlob,ignoreGlob:[],load:handle,change:handle};
@@ -1 +1 @@
1
- export default{alias:["-h","--help"],flags:[],handle:l=>{console.log(l),console.log("help!")}};
1
+ export default{alias:["-h","--help"],flags:[],handle:e=>{console.log("das-cli init - create a pnpm-workspace app for @das-fed"),console.log("das-cli dev - use vite create develop server"),console.log("das-cli build - use vite create product resource"),console.log("das-cli version - check the cli version")}};
@@ -0,0 +1 @@
1
+ import inquirer from"inquirer";import glob from"fast-glob";import{dirname,resolve}from"path";import{fileURLToPath}from"url";import fs from"fs-extra";let __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);export default{alias:["create","create-app","-c"],handle:async e=>{console.log("create pnpm-workspace app for @das-fed"),console.log("请输入子应用名称,一般形如:enterpriseadmin/xxx,可不输入enterpriseadmin/前缀");var r=(await inquirer.prompt([{name:"inputName",type:"input",message:"请输入子应用名称(一般形如: enterpriseadmin/xxx,可不输入 enterpriseadmin/ 前缀)"}]))["inputName"],[i]=(r||(console.error("子应用名称必填!"),process.exit()),r.split("/").slice(-1)),a="enterpriseadmin/"+i,r=(await inquirer.prompt([{name:"check",type:"confirm",message:`子应用名称为: ${a} 是否继续?`}]))["check"];if(!r)return process.exit();r=(await inquirer.prompt([{name:"overwrite",type:"confirm",message:"初始化项目会在当前目录下创建文件夹,可能会覆盖当前目录已经存在的文件,是否继续?"}])).overwrite;if(!r)return process.exit();var t,o=process.cwd(),p=resolve(__dirname,"./template");for(t of await glob(["**/**"],{cwd:p})){var n,s=resolve(o,t);await fs.copy(resolve(p,t),s,{overwrite:!0}),-1<t.indexOf("config.js")&&(n=(await fs.readFile(s)).toString(),await fs.writeFile(s,n.replaceAll("%microAppName%",a))),-1<t.indexOf("package.json")&&(n=(await fs.readFile(s)).toString(),await fs.writeFile(s,n.replaceAll("%packageName%",i)))}}};
@@ -0,0 +1,21 @@
1
+ ## OS
2
+ .DS_Store
3
+ .idea
4
+ .editorconfig
5
+ pnpm-lock.yaml
6
+ .npmrc
7
+
8
+ # Ignored suffix
9
+ *.log
10
+ *.md
11
+ *.svg
12
+ *.png
13
+ *.ico
14
+ *ignore
15
+
16
+ ## Local
17
+ .husky
18
+
19
+ ## Built-files
20
+ .cache
21
+ dist
@@ -0,0 +1,8 @@
1
+ {
2
+ "singleQuote": true,
3
+ "tabWidth": 2,
4
+ "printWidth": 120,
5
+ "semi": false,
6
+ "trailingComma": "all",
7
+ "bracketSpacing": true
8
+ }
@@ -0,0 +1,19 @@
1
+ # pnpm-workspace app for @das-fed
2
+
3
+ ## install
4
+
5
+ ```
6
+ pnpm i
7
+ ```
8
+
9
+ ## dev
10
+
11
+ ```
12
+ das-cli dev
13
+ ```
14
+
15
+ ## build
16
+
17
+ ```
18
+ das-cli build
19
+ ```
@@ -0,0 +1,9 @@
1
+ export default {
2
+ microAppName: '%microAppName%',
3
+ framework: {
4
+ git: {
5
+ repository: '',
6
+ branch: 'dev',
7
+ },
8
+ },
9
+ }
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title></title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.ts"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@das-fed-apps/%packageName%",
3
+ "description": "pnpm-workspace app for @das-fed",
4
+ "private": true,
5
+ "version": "0.0.0",
6
+ "type": "module",
7
+ "scripts": {
8
+ "dev": "das-cli dev",
9
+ "build": "das-cli build",
10
+ "preview": "vite preview"
11
+ },
12
+ "dependencies": {
13
+ "vue": "^3.4.29",
14
+ "vue-router": "^4.2.5",
15
+ "@das-fed/ui": "workspace:^",
16
+ "@das-fed/utils": "workspace:^",
17
+ "@das-fed/web": "workspace:^"
18
+ },
19
+ "devDependencies": {
20
+ "@das-fed/cli": "workspace:^",
21
+ "@vitejs/plugin-vue": "^5.0.5",
22
+ "typescript": "^5.2.2",
23
+ "vite": "^5.3.1",
24
+ "vue-tsc": "^2.0.21"
25
+ }
26
+ }
@@ -0,0 +1 @@
1
+ window.config = {}
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <div class="demo-container">
3
+ <h2>
4
+ {{ t('demo-msg') }}
5
+ </h2>
6
+
7
+ <a href="http://aiot-ui.rd.chn-das.com/das-ui" target="_blank">
8
+ <p class="read-the-docs">{{ t('demo-doc-tip') }}</p>
9
+ </a>
10
+
11
+ <div>{{ t('demo-component-msg') }}</div>
12
+ <div class="alert-container">
13
+ <div v-for="item in ['info', 'success', 'warning', 'error']" :key="item" class="alert-item">
14
+ <das-alert show-icon :message="`${item} Text`" :type="item" />
15
+ </div>
16
+ </div>
17
+
18
+ <div>@das-fed/ui组件库中DasIcon使用案例</div>
19
+ <das-icon icon="add" />
20
+ </div>
21
+ </template>
22
+
23
+ <script setup lang="ts">
24
+ import { t } from '@das-fed/web'
25
+ import { DasIcon, DasAlert } from '@das-fed/ui'
26
+ </script>
27
+
28
+ <style>
29
+ .demo-container {
30
+ margin: 0 auto;
31
+ padding: 2rem;
32
+ text-align: center;
33
+ height: 100%;
34
+ background: var(--hello-bg);
35
+ color: var(--hello-color);
36
+ }
37
+ .demo-container h2 {
38
+ color: var(--hello-color);
39
+ }
40
+ .alert-container {
41
+ background: var(--demo-alert-bg);
42
+ color: var(--demo-alert-color);
43
+ padding: 20px;
44
+ margin: 10px 0;
45
+ border-radius: 10px;
46
+ box-sizing: border-box;
47
+ height: auto;
48
+ min-width: 600px;
49
+ }
50
+ .alert-item {
51
+ margin-top: 20px;
52
+ }
53
+ .alert-item:first-child {
54
+ margin-top: 0;
55
+ }
56
+ .read-the-docs {
57
+ cursor: pointer;
58
+ font-size: 14px;
59
+ font-weight: 400;
60
+ }
61
+ </style>
@@ -0,0 +1,14 @@
1
+ export default {
2
+ 'demo-msg': {
3
+ 'zh-CN': '这是第一个示例路由页面',
4
+ en: 'This is Demo Page',
5
+ },
6
+ 'demo-doc-tip': {
7
+ 'zh-CN': '查看完整组件库文档',
8
+ en: 'read the components doc',
9
+ },
10
+ 'demo-component-msg': {
11
+ 'zh-CN': '@das-fed/ui组件库中DasAlert使用案例',
12
+ en: 'the DasAlert example of @das-fed/ui',
13
+ },
14
+ }
@@ -0,0 +1,13 @@
1
+ import type { RouteRecordRaw } from 'vue-router'
2
+ import { setI18nRule, setThemeRule } from '@das-fed/web'
3
+ import i18n from './i18n'
4
+ import theme from './theme'
5
+
6
+ setI18nRule(i18n)
7
+ setThemeRule(theme)
8
+
9
+ export default {
10
+ path: '/demo',
11
+ component: () => import('./app.vue'),
12
+ meta: { keepAlive: true },
13
+ } as RouteRecordRaw
@@ -0,0 +1,7 @@
1
+ export default {
2
+ '--demo-alert-bg': {
3
+ light: '#fff',
4
+ dark: 'rgba(255,255,255,.2)',
5
+ },
6
+ '--demo-alert-color': '#000',
7
+ }
@@ -0,0 +1,8 @@
1
+ import { createDasWebApp } from '@das-fed/web'
2
+
3
+ createDasWebApp({
4
+ // @ts-ignore
5
+ microAppName: __MICRO_APPNAME__,
6
+ router: { glob: import.meta.glob('@/views/**/router.ts', { eager: true, import: 'default' }) },
7
+ plugins: { glob: import.meta.glob('@/plugins/*/index.ts', { eager: true, import: 'default' }) },
8
+ })
@@ -0,0 +1,8 @@
1
+ import { createDasWebApp } from '@das-fed/web'
2
+
3
+ createDasWebApp({
4
+ // @ts-ignore
5
+ microAppName: __MICRO_APPNAME__,
6
+ router: { glob: import.meta.glob('@/views/**/router.ts', { eager: true, import: 'default' }) },
7
+ plugins: { glob: import.meta.glob('@/plugins/*/index.ts', { eager: true, import: 'default' }) },
8
+ })
@@ -0,0 +1,6 @@
1
+ import { createService } from '@das-fed/utils/api-services'
2
+
3
+ const http = createService('/test')
4
+
5
+ export const getUser = http.get('/user')
6
+ export const addUser = http.post('/user')
@@ -0,0 +1,157 @@
1
+ <template>
2
+ <div class="hello-container">
3
+ <button type="button" @click="setLang('zh-CN')">中</button>
4
+ <button type="button" style="margin-left: 10px" @click="setLang('en')">英</button>
5
+ <div class="img-container">
6
+ <a href="https://vitejs.dev" target="_blank">
7
+ <img src="./assets/vite.svg" class="logo" alt="Vite logo" />
8
+ </a>
9
+ <a href="https://vuejs.org/" target="_blank">
10
+ <img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
11
+ </a>
12
+ </div>
13
+ <router-link to="/"> {{ t('home-router') }} </router-link>
14
+ <span>-</span>
15
+ <router-link to="/demo"> {{ t('demo-router') }} </router-link>
16
+
17
+ <div>
18
+ <h1>{{ msg }}</h1>
19
+
20
+ <div class="card">
21
+ <p>
22
+ {{ t('edit', 'views/hello/app.vue') }}
23
+ </p>
24
+ </div>
25
+
26
+ <p v-html="t('click-out', `<a href='http://docs.chn-das.com' target='_blank'>达实文档中心</a>`)"></p>
27
+ <p v-html="t('suggest', `<a href='https://github.com/vuejs/language-tools' target='_blank'>Volar</a>`)"></p>
28
+ <router-link to="/demo">
29
+ <p class="read-the-demo">{{ t('read-the-demo') }}</p>
30
+ </router-link>
31
+ </div>
32
+ <button type="button" @click="setTheme('light')">{{ t('light') }}</button>
33
+ <button type="button" style="margin-left: 10px" @click="setTheme('dark')">
34
+ {{ t('dark') }}
35
+ </button>
36
+ <br />
37
+ <br />
38
+ <div class="img-container">
39
+ <a href="https://aiot.chn-das.com/login" target="_blank">
40
+ <img class="das-logo" src="./assets/das.png" />
41
+ </a>
42
+ </div>
43
+ </div>
44
+ </template>
45
+
46
+ <script setup lang="ts">
47
+ import { ref } from 'vue'
48
+ import { t, setLang, setTheme } from '@das-fed/web'
49
+
50
+ const msg = ref('vite + vue + das-fe')
51
+ </script>
52
+
53
+ <style>
54
+
55
+
56
+ .hello-container {
57
+ height: 100%;
58
+ margin: 0 auto;
59
+ padding: 2rem;
60
+ text-align: center;
61
+ background: var(--hello-bg);
62
+ color: var(--hello-color);
63
+ }
64
+ .hello-container p {
65
+ margin-bottom: 10px;
66
+ }
67
+ .hello-container h1 {
68
+ font-weight: 600;
69
+ margin-bottom: 20px;
70
+ color: var(--btn-color);
71
+ }
72
+
73
+ .img-container {
74
+ display: flex;
75
+ justify-content: center;
76
+ }
77
+ body {
78
+ background: var(--hello-bg);
79
+ color: var(--hello-color);
80
+ }
81
+ button {
82
+ background: var(--btn-bg);
83
+ color: var(--btn-color);
84
+ }
85
+ .logo {
86
+ height: 6em;
87
+ padding: 1.5em;
88
+ will-change: filter;
89
+ transition: filter 300ms;
90
+ }
91
+ .logo:hover {
92
+ filter: drop-shadow(0 0 2em #646cffaa);
93
+ }
94
+ .logo.vue:hover {
95
+ filter: drop-shadow(0 0 2em #42b883aa);
96
+ }
97
+ .das-logo {
98
+ height: 30px;
99
+ will-change: filter;
100
+ transition: filter 300ms;
101
+ }
102
+ .das-logo:hover {
103
+ filter: drop-shadow(0 0 2em #646cffaa);
104
+ }
105
+
106
+ .read-the-demo {
107
+ color: #888;
108
+ /* font-size: 14px; */
109
+ font-weight: 400;
110
+ }
111
+ :root {
112
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
113
+ line-height: 1.5;
114
+ font-weight: 400;
115
+
116
+ color-scheme: light dark;
117
+ color: rgba(255, 255, 255, 0.87);
118
+ background-color: #242424;
119
+
120
+ font-synthesis: none;
121
+ text-rendering: optimizeLegibility;
122
+ -webkit-font-smoothing: antialiased;
123
+ -moz-osx-font-smoothing: grayscale;
124
+ }
125
+
126
+ a {
127
+ font-weight: 500;
128
+ color: #646cff;
129
+ text-decoration: inherit;
130
+ }
131
+ a:hover {
132
+ color: #535bf2;
133
+ }
134
+
135
+ h1 {
136
+ font-size: 3.2em;
137
+ line-height: 1.1;
138
+ }
139
+
140
+ button {
141
+ border-radius: 8px;
142
+ border: 1px solid transparent;
143
+ padding: 0.6em 1.2em;
144
+ font-size: 1em;
145
+ font-weight: 500;
146
+ font-family: inherit;
147
+ cursor: pointer;
148
+ transition: border-color 0.25s;
149
+ }
150
+ button:hover {
151
+ border-color: #646cff;
152
+ }
153
+ button:focus,
154
+ button:focus-visible {
155
+ outline: 4px auto -webkit-focus-ring-color;
156
+ }
157
+ </style>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
@@ -0,0 +1,16 @@
1
+ export default {
2
+ 'home-router': { 'zh-CN': '主页', en: 'home' },
3
+ 'demo-router': { 'zh-CN': '示例', en: 'demo' },
4
+ light: { 'zh-CN': '浅色', en: 'light' },
5
+ dark: { 'zh-CN': '深色', en: 'dark' },
6
+ edit: {
7
+ 'zh-CN': '编辑 $0 来测试模块热重载',
8
+ en: 'Edit $0 to test HMR',
9
+ },
10
+ 'click-out': {
11
+ 'zh-CN': '进入 $0 , 快速创建 Vue + Vite + Das Front-End 的开发模板',
12
+ en: 'Click out $0 , check the official Vue + Vite + Das Front-End starter',
13
+ },
14
+ suggest: { 'zh-CN': '安装 $0 在您的IDE中获得更好的开发体验', en: 'Install $0 in your IDE for a better DX' },
15
+ 'read-the-demo': { 'zh-CN': '进入示例页面,查看组件库使用示例', en: 'to read demo' },
16
+ }
@@ -0,0 +1,12 @@
1
+ import type { RouteRecordRaw } from 'vue-router'
2
+ import { setI18nRule, setThemeRule } from '@das-fed/web'
3
+ import i18n from './i18n'
4
+ import theme from './theme'
5
+
6
+ setI18nRule(i18n)
7
+ setThemeRule(theme)
8
+
9
+ export default {
10
+ path: '/',
11
+ component: () => import('./app.vue'),
12
+ } as RouteRecordRaw
@@ -0,0 +1,18 @@
1
+ export default {
2
+ '--hello-bg': {
3
+ light: '#fff',
4
+ dark: '#000',
5
+ },
6
+ '--hello-color': {
7
+ light: '#000',
8
+ dark: '#fff',
9
+ },
10
+ '--btn-bg': {
11
+ light: '#f9f9f9',
12
+ dark: '#1a1a1a',
13
+ },
14
+ '--btn-color': {
15
+ light: '#213547',
16
+ dark: '#f9f9f9',
17
+ },
18
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "target": "ES2020",
6
+ "useDefineForClassFields": true,
7
+ "module": "ESNext",
8
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
9
+ "skipLibCheck": true,
10
+
11
+ /* Bundler mode */
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "moduleDetection": "force",
17
+ "noEmit": true,
18
+ "jsx": "preserve",
19
+
20
+ /* Linting */
21
+ "strict": true,
22
+ "noUnusedLocals": true,
23
+ "noUnusedParameters": true,
24
+ "noFallthroughCasesInSwitch": true
25
+ },
26
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
27
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ {
5
+ "path": "./tsconfig.app.json"
6
+ },
7
+ {
8
+ "path": "./tsconfig.node.json"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
5
+ "skipLibCheck": true,
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "allowSyntheticDefaultImports": true,
9
+ "strict": true,
10
+ "noEmit": true
11
+ },
12
+ "include": ["vite.config.ts"]
13
+ }
@@ -0,0 +1,14 @@
1
+ import { defineConfig } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+ import { dasFeWebVitePlugin } from '@das-fed/cli'
4
+ import config from './config.js'
5
+
6
+ // https://vitejs.dev/config/
7
+ export default defineConfig(({ command }) => {
8
+ const isBuild = command === 'build'
9
+ return {
10
+ define: { __MICRO_APPNAME__: JSON.stringify(config.microAppName) },
11
+ base: isBuild ? `/${config.microAppName}` : '/',
12
+ plugins: [vue(), dasFeWebVitePlugin()],
13
+ }
14
+ })
@@ -1 +1 @@
1
- export default{alias:["-v","-V","--version"],handle:e=>{console.log("this version is xxxx ")}};
1
+ import fs from"fs-extra";import{dirname,resolve}from"path";import{fileURLToPath}from"url";let __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);export default{alias:["-v","-V","--version"],handle:e=>{var r=resolve(__dirname,"../../../package.json");fs.existsSync(r)?(r=fs.readJSONSync(r),console.log(r.name+" "+r.version)):console.error("can't get the version")}};
@@ -1 +1 @@
1
- import{resolve,dirname}from"path";import{fileURLToPath}from"url";import fs from"fs-extra";import json5 from"json5";const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),checkInLocalWorkspace=async()=>{var r=resolve(__dirname,"../../../../package.json");if(!await fs.exists(r))return!1;try{var a=await fs.readFile(r);return"@das-fed/framework"===(await json5.parse(a)).name}catch{return!1}};export{checkInLocalWorkspace};
1
+ import{resolve,dirname}from"path";import{fileURLToPath}from"url";import fs from"fs-extra";import json5 from"json5";let __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),checkInLocalWorkspace=async e=>{e=resolve(e,"package.json"),e=await fs.readJson(e);return!!(e.dependencies&&(e.dependencies["@das-fed/web"]&&e.dependencies["@das-fed/web"].match("workspace")||e.devDependencies&&e.devDependencies["@das-fed/web"]&&e.devDependencies["@das-fed/web"].match("workspace")))};export{checkInLocalWorkspace};
@@ -1 +1 @@
1
- import fs from"fs-extra";import{resolve}from"path";import json5 from"json5";const getCliConfig=async(o={})=>{var{cwd:o=process.cwd()}=o||{},o=resolve(o,"das-cli.config.json");return await fs.exists(o)?(o=(await fs.readFile(o)).toString(),json5.parse(o)):{}};export{getCliConfig};
1
+ import fs from"fs-extra";import{resolve}from"path";import json5 from"json5";let getCliConfig=async(o={})=>{var{cwd:o=process.cwd()}=o||{},o=resolve(o,"das-cli.config.json");return await fs.exists(o)?(o=(await fs.readFile(o)).toString(),json5.parse(o)):{}};export{getCliConfig};
@@ -1 +1 @@
1
- import fs from"fs-extra";const json2snippets=async s=>{var{outputFilePath:s="",data:t={}}=s||{};return s&&(await fs.exists(s)&&await fs.remove(s),await fs.ensureFile(s),await fs.writeJSON(s,t,{spaces:2})),t};export{json2snippets};
1
+ import fs from"fs-extra";let json2snippets=async s=>{var{outputFilePath:s="",data:t={}}=s||{};return s&&(await fs.exists(s)&&await fs.remove(s),await fs.ensureFile(s),await fs.writeJSON(s,t,{spaces:2})),t};export{json2snippets};
@@ -1,2 +1,2 @@
1
- import fs from"fs-extra";import jsonSchema2type from"json-schema-to-typescript";const json2type=async(e={})=>{var{outputFilePath:e,data:t={}}=e||{},t=await compile(t);return e&&(await fs.exists(e)&&await fs.remove(e),await fs.ensureFile(e),await fs.writeFile(e,t)),t},compile=async e=>{let t="";if(Array.isArray(e))for(const s of e){var a=await jsonSchema2type.compile(s);t+=a+`\r
1
+ import fs from"fs-extra";import jsonSchema2type from"json-schema-to-typescript";let json2type=async(e={})=>{var{outputFilePath:e,data:t={}}=e||{},t=await compile(t);return e&&(await fs.exists(e)&&await fs.remove(e),await fs.ensureFile(e),await fs.writeFile(e,t)),t},compile=async e=>{let t="";if(Array.isArray(e))for(var a of e){a=await jsonSchema2type.compile(a);t+=a+`\r
2
2
  `}else t=await jsonSchema2type.compile(e);return t};export{json2type};
@@ -1 +1 @@
1
- const fs=require("fs-extra"),Minio=require("minio"),path=require("path");let minioClient;const initMinioClient=(e={})=>minioClient=minioClient||new Minio.Client({endPoint:e.host||"192.168.100.26",port:9e3,useSSL:!1,accessKey:"admin",secretKey:"das@123!"}),upload=async(e,i={})=>{if(e){initMinioClient(i);i=path.resolve(__dirname,"../../");e=path.resolve(i,e);const o=fs.createReadStream(e),a=await fs.stat(e);var n=path.extname(e).replace(".","");const s={"Content-Type":"image/"+n};const r="front-end/auto-upload/pc"+e.replace(i,"");return new Promise((n,t)=>{minioClient.putObject("resource",r,o,a.size,s,(e,i)=>{if(e)return console.log("oss资源自动上传失败",r),console.log(e),t(e);n(i)})})}};module.exports={minio:{upload:upload}};
1
+ import fs from"fs-extra";import*as Minio from"minio";import*as path from"path";import{getCliConfig}from"./get-cli-config/index.js";let minioClient,initMinioClient=(e={})=>{var i=getCliConfig(),e={useSSL:!1,endPoint:e.host||Buffer.from("MTkyLjE2OC4xMDAuMjY=","base64").toString(),port:Number(Buffer.from("OTAwMA==","base64").toString()),accessKey:Buffer.from("YWRtaW4=","base64").toString(),secretKey:Buffer.from("ZGFzQDEyMyE=","base64").toString()},i=i.minioClientConfig||e;return minioClient=minioClient||new Minio.Client(i)},upload=async(t,o={})=>{if(t){initMinioClient(o);var{cwd:o=process.cwd()}=o;t=path.resolve(o,t);let e=fs.createReadStream(t),i=await fs.stat(t);var a=path.extname(t).replace(".","");let n={"Content-Type":"image/"+a};let r="front-end/auto-upload/pc"+t.replace(o,"");return new Promise((t,o)=>{minioClient.putObject("resource",r,e,i.size,n,(e,i)=>{if(e)return console.log("oss资源自动上传失败",r),console.log(e),o(e);t(i)})})}},minio={upload:upload};export{minio};
@@ -1 +1 @@
1
- import{Project}from"ts-morph";let project;const initProject=(e={})=>project=project||new Project({skipFileDependencyResolution:!0,skipAddingFilesFromTsConfig:!0,skipLoadingLibFiles:!0,compilerOptions:{skipDefaultLibCheck:!0,skipLibCheck:!0,rootDir:e.cwd||process.cwd()},exclude:["node_modules"]}),getExportDefaultsByAst=(e,t={})=>{t=new Project({skipFileDependencyResolution:!0,skipAddingFilesFromTsConfig:!0,skipLoadingLibFiles:!0,compilerOptions:{skipDefaultLibCheck:!0,skipLibCheck:!0,rootDir:t.cwd||process.cwd()},exclude:["node_modules"]});return t.addSourceFilesAtPaths(e),t.getSourceFiles().map(e=>{var t,i,o,r={filePath:e.getFilePath(),name:"default",defaultText:""};for([t,i]of e.getExportedDeclarations())"default"===t&&0!==(o=i.map(e=>(e.getInitializer?e.getInitializer():e).getText())).length&&(r.name=t,r.defaultText=o[0]);return r}).filter(e=>!!e.defaultText)};export{getExportDefaultsByAst};
1
+ import{Project}from"ts-morph";let project,initProject=(e={})=>project=project||new Project({skipFileDependencyResolution:!0,skipAddingFilesFromTsConfig:!0,skipLoadingLibFiles:!0,compilerOptions:{skipDefaultLibCheck:!0,skipLibCheck:!0,rootDir:e.cwd||process.cwd()},exclude:["node_modules"]}),getExportDefaultsByAst=(e,t={})=>{t=new Project({skipFileDependencyResolution:!0,skipAddingFilesFromTsConfig:!0,skipLoadingLibFiles:!0,compilerOptions:{skipDefaultLibCheck:!0,skipLibCheck:!0,rootDir:t.cwd||process.cwd()},exclude:["node_modules"]});return t.addSourceFilesAtPaths(e),t.getSourceFiles().map(e=>{var t,i,o,r={filePath:e.getFilePath(),name:"default",defaultText:""};for([t,i]of e.getExportedDeclarations())"default"===t&&0!==(o=i.map(e=>(e.getInitializer?e.getInitializer():e).getText())).length&&(r.name=t,r.defaultText=o[0]);return r}).filter(e=>!!e.defaultText)};export{getExportDefaultsByAst};
@@ -1 +1 @@
1
- import{createStyleImportPlugin}from"vite-plugin-style-import";const UIStyleResolve=()=>({libraryName:"@das-fed/ui",base:"@das-fed/ui/style/index.css"}),businessUIStyleResolve=()=>({libraryName:"@das-fed/ui/packages/business",base:"@das-fed/ui/style/business.css"}),DasUIStyleImport=(e={})=>e.styleResolve?createStyleImportPlugin({resolves:[UIStyleResolve(),businessUIStyleResolve()]}):null;export{DasUIStyleImport};
1
+ import{createStyleImportPlugin}from"vite-plugin-style-import";let UIStyleResolve=()=>({libraryName:"@das-fed/ui",resolveStyle:e=>"@das-fed/ui/style/business.css",base:"@das-fed/ui/style/index.css"}),businessUIStyleResolve=()=>({libraryName:"@das-fed/ui/packages/business",base:"@das-fed/ui/style/business.css"}),DasUIStyleImport=(e={})=>e.styleResolve?createStyleImportPlugin({resolves:[UIStyleResolve(),businessUIStyleResolve()]}):null;export{DasUIStyleImport};
@@ -1 +1 @@
1
- import{resolve}from"path";const dasFeWeb=e=>{let r;return{name:"das-fe-web",config:(e,{})=>({resolve:{alias:{"@":resolve(process.cwd(),"src")}}}),configResolved(e){r=e},buildStart:async()=>{r.cwd=resolve(process.cwd())},transformIndexHtml:{order:"post",handler:()=>{let e="development"===r.mode?"/config.local.js":"/config.js";return[{tag:"script",attrs:{src:e}}]}}}};export{dasFeWeb};
1
+ import{resolve}from"path";let dasFeWeb=e=>{let s;return{name:"das-fe-web",config:(e,{})=>({resolve:{alias:{"@":resolve(process.cwd(),"src")}},build:{rollupOptions:{output:{manualChunks(r){var e=["sortablejs","echarts","@wangeditor/editor","@antv/x6","mpegts.js"].find(e=>r.includes(e));if(e)return e}}}}}),configResolved(e){s=e},buildStart:async()=>{s.cwd=resolve(process.cwd())},transformIndexHtml:{order:"post",handler:()=>{var e=s.base||"/";let r="development"===s.mode?e+"config.local.js":e+"config.js";return[{tag:"script",attrs:{src:r}}]}}}};export{dasFeWeb};
@@ -1 +1 @@
1
- import{createStyleImportPlugin}from"vite-plugin-style-import";const WebStyleResolve=()=>({libraryName:"@das-fed/web",base:"@das-fed/web/style.css"}),DasWebStyleImport=(e={})=>e.styleResolve?createStyleImportPlugin({resolves:[WebStyleResolve()]}):null;export{DasWebStyleImport};
1
+ import{createStyleImportPlugin}from"vite-plugin-style-import";let WebStyleResolve=()=>({libraryName:"@das-fed/web",base:"@das-fed/web/style.css"}),DasWebStyleImport=(e={})=>e.styleResolve?createStyleImportPlugin({resolves:[WebStyleResolve()]}):null;export{DasWebStyleImport};
@@ -1 +1 @@
1
- import{dasFeWeb,DasWebStyleImport}from"./das-fe-web/index.js";import{DasUIStyleImport}from"./das-fe-ui/index.js";import{checkInLocalWorkspace}from"../utils/check-local-workspace.js";const dasFeWebVitePlugin=async(e={})=>{var{dasWeb:e={styleResolve:!0},dasUI:s={styleResolve:!0}}=e||{};return await checkInLocalWorkspace()&&(e.styleResolve=!1,s.styleResolve=!1),[dasFeWeb(e),DasWebStyleImport(e),DasUIStyleImport(s)]};export{dasFeWebVitePlugin};
1
+ import{dasFeWeb,DasWebStyleImport}from"./das-fe-web/index.js";import{DasUIStyleImport}from"./das-fe-ui/index.js";import{checkInLocalWorkspace}from"../utils/check-local-workspace.js";import vueJsx from"@vitejs/plugin-vue-jsx";import AutoImport from"unplugin-auto-import/vite";import Components from"unplugin-vue-components/vite";import{ElementPlusResolver,AntDesignVueResolver}from"unplugin-vue-components/resolvers";import viteCompression from"vite-plugin-compression";import{visualizer as rollupVisualizer}from"rollup-plugin-visualizer";let dasFeWebVitePlugin=async(e={})=>{var{dasWeb:e={styleResolve:!0},dasUI:s={styleResolve:!0},compression:o={},visualizer:t}=e||{},e=(await checkInLocalWorkspace(process.cwd())&&(e.styleResolve=!1,s.styleResolve=!1),[vueJsx(),AutoImport({resolvers:[ElementPlusResolver(),AntDesignVueResolver()],dts:"./src/das-fe-local-runtime/auto-imports.d.ts"}),Components({resolvers:[ElementPlusResolver(),AntDesignVueResolver()],dts:"./src/das-fe-local-runtime/components.d.ts"}),dasFeWeb(e),DasWebStyleImport(e),DasUIStyleImport(s),viteCompression(o)]);return t&&"object"==typeof t&&e.push(rollupVisualizer({open:!0,filename:"stats.html",gzipSize:!0,brotliSize:!0,...t})),e};export{dasFeWebVitePlugin};
@@ -1 +0,0 @@
1
- export default{alias:["create","init","-c"],handle:e=>{console.log("create-web-app")}};