create-bc-app 1.1.4 → 1.1.6

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 (79) hide show
  1. package/README.md +15 -1
  2. package/dist/index.mjs +1 -1
  3. package/package.json +39 -38
  4. package/template-docs-vitepress/_gitignore +25 -0
  5. package/template-docs-vuepress/_gitignore +26 -0
  6. package/template-laserlib/.gitlab-ci.yml +1 -1
  7. package/template-laserlib/package.json +2 -2
  8. package/template-laserlib/tsconfig.json +3 -3
  9. package/template-laserlib/vite.config.ts +9 -4
  10. package/template-monorepo/.eslintignore +8 -0
  11. package/template-monorepo/.eslintrc.cjs +211 -0
  12. package/template-monorepo/.gitlab-ci.yml +41 -0
  13. package/template-monorepo/README.md +35 -0
  14. package/template-monorepo/build_entry/extract.js +27 -0
  15. package/template-monorepo/index.html +16 -0
  16. package/template-monorepo/package.json +39 -0
  17. package/template-monorepo/packages/index.ts +3 -0
  18. package/template-monorepo/public/group.svg +3 -0
  19. package/template-monorepo/sdk/data-server/api/index.ts +2 -0
  20. package/template-monorepo/sdk/data-server/index.ts +0 -0
  21. package/template-monorepo/sdk/model/index.ts +0 -0
  22. package/template-monorepo/src/App.vue +14 -0
  23. package/template-monorepo/src/assets/bochui.svg +7 -0
  24. package/template-monorepo/src/assets/css/common.less +62 -0
  25. package/template-monorepo/src/assets/css/style.css +12 -0
  26. package/template-monorepo/src/assets/group.svg +3 -0
  27. package/template-monorepo/src/configData/index.ts +1 -0
  28. package/template-monorepo/src/configData/mainToolsBar.json +18 -0
  29. package/template-monorepo/src/constants/index.ts +2 -0
  30. package/template-monorepo/src/hooks/index.ts +25 -0
  31. package/template-monorepo/src/i18n/index.ts +34 -0
  32. package/template-monorepo/src/i18n/langs/page.js +7 -0
  33. package/template-monorepo/src/i18n/langs/zh_Hans.json +1 -0
  34. package/template-monorepo/src/main.ts +22 -0
  35. package/template-monorepo/src/stores/appState.ts +19 -0
  36. package/template-monorepo/src/stores/index.ts +1 -0
  37. package/template-monorepo/src/types/index.ts +28 -0
  38. package/template-monorepo/src/utils/filter.ts +12 -0
  39. package/template-monorepo/src/utils/index.ts +0 -0
  40. package/template-monorepo/src/utils/message.ts +56 -0
  41. package/template-monorepo/src/views/Home.vue +51 -0
  42. package/template-monorepo/src/vite-env.d.ts +6 -0
  43. package/template-monorepo/tsconfig.json +69 -0
  44. package/template-monorepo/tsconfig.node.json +11 -0
  45. package/template-monorepo/vite.config.ts +27 -0
  46. package/template-monorepo/window.d.ts +9 -0
  47. package/template-protocut/.eslintrc.cjs +203 -0
  48. package/template-protocut/.gitlab-ci.yml +41 -0
  49. package/template-protocut/README.md +17 -0
  50. package/template-protocut/_gitignore +24 -0
  51. package/template-protocut/image.png +0 -0
  52. package/template-protocut/index.html +13 -0
  53. package/template-protocut/package-lock.json +4917 -0
  54. package/template-protocut/package.json +38 -0
  55. package/template-protocut/public/vite.svg +1 -0
  56. package/template-protocut/src/App.vue +12 -0
  57. package/template-protocut/src/assets/vue.svg +1 -0
  58. package/template-protocut/src/components/Example.vue +36 -0
  59. package/template-protocut/src/style.css +5 -0
  60. package/template-protocut/src/utils/plugins/watchNodeModules.js +24 -0
  61. package/template-protocut/src/vite-env.d.ts +1 -0
  62. package/template-protocut/template/Home.handlebars +145 -0
  63. package/template-protocut/template/main.handlebars +49 -0
  64. package/template-protocut/test/App.test.ts +16 -0
  65. package/template-protocut/test/Example.test.ts +21 -0
  66. package/template-protocut/tsconfig.app.json +27 -0
  67. package/template-protocut/tsconfig.json +33 -0
  68. package/template-protocut/tsconfig.node.json +11 -0
  69. package/template-protocut/vite-env.d.ts +15 -0
  70. package/template-protocut/vite.config.ts +55 -0
  71. package/template-protocut/window.d.ts +6 -0
  72. package/template-vue-js/.gitlab-ci.yml +1 -1
  73. package/template-vue-ts/.gitlab-ci.yml +1 -1
  74. package/template-vue-ts/_gitignore +24 -0
  75. package/template-vue-ts/vite.config.ts +27 -9
  76. /package/{template-vue-ts/.gitignore → template-laserlib/_gitignore} +0 -0
  77. /package/template-laserlib/{packages → views}/main-page/index.ts +0 -0
  78. /package/template-laserlib/{packages → views}/main-page/index.vue +0 -0
  79. /package/template-vue-js/{.gitignore → _gitignore} +0 -0
package/README.md CHANGED
@@ -1,7 +1,21 @@
1
1
  # 内部项目脚手架
2
- 包含:
2
+
3
+ ## 用法:
4
+ ```js
5
+ npm create bc-app
6
+ ```
7
+
8
+ ## 用途:
9
+ 当你需要快速搭建一个
10
+ npm库、vue+ts、vue+js、vuepress、vitepress项目时可以使用它
11
+
12
+ ## 包含:
3
13
  - vue3 + ts + Vite
4
14
  - vue3 + js + Vite
15
+ - protocut
16
+ - laserlib
17
+ - vuepress
18
+ - vitepress
5
19
  - 单元测试
6
20
  - eslint代码检查
7
21
 
package/dist/index.mjs CHANGED
@@ -67,5 +67,5 @@ Expecting `+I.join(", ")+", got '"+(this.terminals_[w]||w)+"'":ie="Parse error o
67
67
  return undefined
68
68
  }
69
69
  `.trim()},blockValue:function(a){var n=this.aliasable("container.hooks.blockHelperMissing"),m=[this.contextName(0)];this.setupHelperArgs(a,0,m);var v=this.popStack();m.splice(1,0,v),this.push(this.source.functionCall(n,"call",m))},ambiguousBlockValue:function(){var a=this.aliasable("container.hooks.blockHelperMissing"),n=[this.contextName(0)];this.setupHelperArgs("",0,n,!0),this.flushInline();var m=this.topStack();n.splice(1,0,m),this.pushSource(["if (!",this.lastHelper,") { ",m," = ",this.source.functionCall(a,"call",n),"}"])},appendContent:function(a){this.pendingContent?a=this.pendingContent+a:this.pendingLocation=this.source.currentLocation,this.pendingContent=a},append:function(){if(this.isInline())this.replaceStack(function(n){return[" != null ? ",n,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var a=this.popStack();this.pushSource(["if (",a," != null) { ",this.appendToBuffer(a,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(a){this.lastContext=a},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(a,n,m,v){var S=0;!v&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(a[S++])):this.pushContext(),this.resolvePath("context",a,S,n,m)},lookupBlockParam:function(a,n){this.useBlockParams=!0,this.push(["blockParams[",a[0],"][",a[1],"]"]),this.resolvePath("context",n,1)},lookupData:function(a,n,m){a?this.pushStackLiteral("container.data(data, "+a+")"):this.pushStackLiteral("data"),this.resolvePath("data",n,0,!0,m)},resolvePath:function(a,n,m,v,S){var _=this;if(this.options.strict||this.options.assumeObjects){this.push(d(this.options.strict&&S,this,n,m,a));return}for(var w=n.length;m<w;m++)this.replaceStack(function(g){var y=_.nameLookup(g,n[m],a);return v?[" && ",y]:[" != null ? ",y," : ",g]})},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(a,n){this.pushContext(),this.pushString(n),n!=="SubExpression"&&(typeof a=="string"?this.pushString(a):this.pushStackLiteral(a))},emptyHash:function(a){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(a?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var a=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(a.ids)),this.stringParams&&(this.push(this.objectLiteral(a.contexts)),this.push(this.objectLiteral(a.types))),this.push(this.objectLiteral(a.values))},pushString:function(a){this.pushStackLiteral(this.quotedString(a))},pushLiteral:function(a){this.pushStackLiteral(a)},pushProgram:function(a){a!=null?this.pushStackLiteral(this.programExpression(a)):this.pushStackLiteral(null)},registerDecorator:function(a,n){var m=this.nameLookup("decorators",n,"decorator"),v=this.setupHelperArgs(n,a);this.decorators.push(["fn = ",this.decorators.functionCall(m,"",["fn","props","container",v])," || fn;"])},invokeHelper:function(a,n,m){var v=this.popStack(),S=this.setupHelper(a,n),_=[];m&&_.push(S.name),_.push(v),this.options.strict||_.push(this.aliasable("container.hooks.helperMissing"));var w=["(",this.itemsSeparatedBy(_,"||"),")"],g=this.source.functionCall(w,"call",S.callParams);this.push(g)},itemsSeparatedBy:function(a,n){var m=[];m.push(a[0]);for(var v=1;v<a.length;v++)m.push(n,a[v]);return m},invokeKnownHelper:function(a,n){var m=this.setupHelper(a,n);this.push(this.source.functionCall(m.name,"call",m.callParams))},invokeAmbiguous:function(a,n){this.useRegister("helper");var m=this.popStack();this.emptyHash();var v=this.setupHelper(0,a,n),S=this.lastHelper=this.nameLookup("helpers",a,"helper"),_=["(","(helper = ",S," || ",m,")"];this.options.strict||(_[0]="(helper = ",_.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"))),this.push(["(",_,v.paramsInit?["),(",v.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",v.callParams)," : helper))"])},invokePartial:function(a,n,m){var v=[],S=this.setupParams(n,1,v);a&&(n=this.popStack(),delete S.name),m&&(S.indent=JSON.stringify(m)),S.helpers="helpers",S.partials="partials",S.decorators="container.decorators",a?v.unshift(n):v.unshift(this.nameLookup("partials",n,"partial")),this.options.compat&&(S.depths="depths"),S=this.objectLiteral(S),v.push(S),this.push(this.source.functionCall("container.invokePartial","",v))},assignToHash:function(a){var n=this.popStack(),m=void 0,v=void 0,S=void 0;this.trackIds&&(S=this.popStack()),this.stringParams&&(v=this.popStack(),m=this.popStack());var _=this.hash;m&&(_.contexts[a]=m),v&&(_.types[a]=v),S&&(_.ids[a]=S),_.values[a]=n},pushId:function(a,n,m){a==="BlockParam"?this.pushStackLiteral("blockParams["+n[0]+"].path["+n[1]+"]"+(m?" + "+JSON.stringify("."+m):"")):a==="PathExpression"?this.pushString(n):a==="SubExpression"?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:u,compileChildren:function(a,n){for(var m=a.children,v=void 0,S=void 0,_=0,w=m.length;_<w;_++){v=m[_],S=new this.compiler;var g=this.matchExistingProgram(v);if(g==null){this.context.programs.push("");var y=this.context.programs.length;v.index=y,v.name="program"+y,this.context.programs[y]=S.compile(v,n,this.context,!this.precompile),this.context.decorators[y]=S.decorators,this.context.environments[y]=v,this.useDepths=this.useDepths||S.useDepths,this.useBlockParams=this.useBlockParams||S.useBlockParams,v.useDepths=this.useDepths,v.useBlockParams=this.useBlockParams}else v.index=g.index,v.name="program"+g.index,this.useDepths=this.useDepths||g.useDepths,this.useBlockParams=this.useBlockParams||g.useBlockParams}},matchExistingProgram:function(a){for(var n=0,m=this.context.environments.length;n<m;n++){var v=this.context.environments[n];if(v&&v.equals(a))return v}},programExpression:function(a){var n=this.environment.children[a],m=[n.index,"data",n.blockParams];return(this.useBlockParams||this.useDepths)&&m.push("blockParams"),this.useDepths&&m.push("depths"),"container.program("+m.join(", ")+")"},useRegister:function(a){this.registers[a]||(this.registers[a]=!0,this.registers.list.push(a))},push:function(a){return a instanceof c||(a=this.source.wrap(a)),this.inlineStack.push(a),a},pushStackLiteral:function(a){this.push(new c(a))},pushSource:function(a){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),a&&this.source.push(a)},replaceStack:function(a){var n=["("],m=void 0,v=void 0,S=void 0;if(!this.isInline())throw new f.default("replaceStack on non-inline");var _=this.popStack(!0);if(_ instanceof c)m=[_.value],n=["(",m],S=!0;else{v=!0;var w=this.incrStack();n=["((",this.push(w)," = ",_,")"],m=this.topStack()}var g=a.call(this,m);S||this.popStack(),v&&this.stackSlot--,this.push(n.concat(g,")"))},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;this.inlineStack=[];for(var n=0,m=a.length;n<m;n++){var v=a[n];if(v instanceof c)this.compileStack.push(v);else{var S=this.incrStack();this.pushSource([S," = ",v,";"]),this.compileStack.push(S)}}},isInline:function(){return this.inlineStack.length},popStack:function(a){var n=this.isInline(),m=(n?this.inlineStack:this.compileStack).pop();if(!a&&m instanceof c)return m.value;if(!n){if(!this.stackSlot)throw new f.default("Invalid stack pop");this.stackSlot--}return m},topStack:function(){var a=this.isInline()?this.inlineStack:this.compileStack,n=a[a.length-1];return n instanceof c?n.value:n},contextName:function(a){return this.useDepths&&a?"depths["+a+"]":"depth"+a},quotedString:function(a){return this.source.quotedString(a)},objectLiteral:function(a){return this.source.objectLiteral(a)},aliasable:function(a){var n=this.aliases[a];return n?(n.referenceCount++,n):(n=this.aliases[a]=this.source.wrap(a),n.aliasable=!0,n.referenceCount=1,n)},setupHelper:function(a,n,m){var v=[],S=this.setupHelperArgs(n,a,v,m),_=this.nameLookup("helpers",n,"helper"),w=this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})");return{params:v,paramsInit:S,name:_,callParams:[w].concat(v)}},setupParams:function(a,n,m){var v={},S=[],_=[],w=[],g=!m,y=void 0;g&&(m=[]),v.name=this.quotedString(a),v.hash=this.popStack(),this.trackIds&&(v.hashIds=this.popStack()),this.stringParams&&(v.hashTypes=this.popStack(),v.hashContexts=this.popStack());var P=this.popStack(),b=this.popStack();(b||P)&&(v.fn=b||"container.noop",v.inverse=P||"container.noop");for(var C=n;C--;)y=this.popStack(),m[C]=y,this.trackIds&&(w[C]=this.popStack()),this.stringParams&&(_[C]=this.popStack(),S[C]=this.popStack());return g&&(v.args=this.source.generateArray(m)),this.trackIds&&(v.ids=this.source.generateArray(w)),this.stringParams&&(v.types=this.source.generateArray(_),v.contexts=this.source.generateArray(S)),this.options.data&&(v.data="data"),this.useBlockParams&&(v.blockParams="blockParams"),v},setupHelperArgs:function(a,n,m,v){var S=this.setupParams(a,n,m);return S.loc=JSON.stringify(this.source.currentLocation),S=this.objectLiteral(S),v?(this.useRegister("options"),m.push("options"),["options=",S]):m?(m.push(S),""):S}},function(){for(var i="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),a=u.RESERVED_WORDS={},n=0,m=i.length;n<m;n++)a[i[n]]=!0}(),u.isValidJavaScriptVariableName=function(i){return!u.RESERVED_WORDS[i]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(i)};function d(i,a,n,m,v){var S=a.popStack(),_=n.length;for(i&&_--;m<_;m++)S=a.nameLookup(S,n[m],v);return i?[a.aliasable("container.strict"),"(",S,", ",a.quotedString(n[m]),", ",JSON.stringify(a.source.currentLocation)," )"]:S}e.default=u,t.exports=e.default})(Mt,Mt.exports);var La=Mt.exports;(function(t,e){e.__esModule=!0;function r(_){return _&&_.__esModule?_:{default:_}}var s=jo,p=r(s),f=Ar,l=r(f),h=ge,o=me,c=La,u=r(c),d=Pt,i=r(d),a=Or,n=r(a),m=p.default.create;function v(){var _=m();return _.compile=function(w,g){return o.compile(w,g,_)},_.precompile=function(w,g){return o.precompile(w,g,_)},_.AST=l.default,_.Compiler=o.Compiler,_.JavaScriptCompiler=u.default,_.Parser=h.parser,_.parse=h.parse,_.parseWithoutProcessing=h.parseWithoutProcessing,_}var S=v();S.create=v,n.default(S),S.Visitor=i.default,S.default=S,e.default=S,t.exports=e.default})(Qe,Qe.exports);var Oa=Qe.exports,De={};De.__esModule=!0,De.print=Na,De.PrintVisitor=A;function Aa(t){return t&&t.__esModule?t:{default:t}}var Ia=Pt,Ra=Aa(Ia);function Na(t){return new A().accept(t)}function A(){this.padding=0}A.prototype=new Ra.default,A.prototype.pad=function(t){for(var e="",r=0,s=this.padding;r<s;r++)e+=" ";return e+=t+`
70
- `,e},A.prototype.Program=function(t){var e="",r=t.body,s=void 0,p=void 0;if(t.blockParams){var f="BLOCK PARAMS: [";for(s=0,p=t.blockParams.length;s<p;s++)f+=" "+t.blockParams[s];f+=" ]",e+=this.pad(f)}for(s=0,p=r.length;s<p;s++)e+=this.accept(r[s]);return this.padding--,e},A.prototype.MustacheStatement=function(t){return this.pad("{{ "+this.SubExpression(t)+" }}")},A.prototype.Decorator=function(t){return this.pad("{{ DIRECTIVE "+this.SubExpression(t)+" }}")},A.prototype.BlockStatement=A.prototype.DecoratorBlock=function(t){var e="";return e+=this.pad((t.type==="DecoratorBlock"?"DIRECTIVE ":"")+"BLOCK:"),this.padding++,e+=this.pad(this.SubExpression(t)),t.program&&(e+=this.pad("PROGRAM:"),this.padding++,e+=this.accept(t.program),this.padding--),t.inverse&&(t.program&&this.padding++,e+=this.pad("{{^}}"),this.padding++,e+=this.accept(t.inverse),this.padding--,t.program&&this.padding--),this.padding--,e},A.prototype.PartialStatement=function(t){var e="PARTIAL:"+t.name.original;return t.params[0]&&(e+=" "+this.accept(t.params[0])),t.hash&&(e+=" "+this.accept(t.hash)),this.pad("{{> "+e+" }}")},A.prototype.PartialBlockStatement=function(t){var e="PARTIAL BLOCK:"+t.name.original;return t.params[0]&&(e+=" "+this.accept(t.params[0])),t.hash&&(e+=" "+this.accept(t.hash)),e+=" "+this.pad("PROGRAM:"),this.padding++,e+=this.accept(t.program),this.padding--,this.pad("{{> "+e+" }}")},A.prototype.ContentStatement=function(t){return this.pad("CONTENT[ '"+t.value+"' ]")},A.prototype.CommentStatement=function(t){return this.pad("{{! '"+t.value+"' }}")},A.prototype.SubExpression=function(t){for(var e=t.params,r=[],s=void 0,p=0,f=e.length;p<f;p++)r.push(this.accept(e[p]));return e="["+r.join(", ")+"]",s=t.hash?" "+this.accept(t.hash):"",this.accept(t.path)+" "+e+s},A.prototype.PathExpression=function(t){var e=t.parts.join("/");return(t.data?"@":"")+"PATH:"+e},A.prototype.StringLiteral=function(t){return'"'+t.value+'"'},A.prototype.NumberLiteral=function(t){return"NUMBER{"+t.value+"}"},A.prototype.BooleanLiteral=function(t){return"BOOLEAN{"+t.value+"}"},A.prototype.UndefinedLiteral=function(){return"UNDEFINED"},A.prototype.NullLiteral=function(){return"NULL"},A.prototype.Hash=function(t){for(var e=t.pairs,r=[],s=0,p=e.length;s<p;s++)r.push(this.accept(e[s]));return"HASH{"+r.join(", ")+"}"},A.prototype.HashPair=function(t){return t.key+"="+this.accept(t.value)};var Te=Oa.default,Qr=De;Te.PrintVisitor=Qr.PrintVisitor,Te.print=Qr.print;var Da=Te;function Zr(t,e){var r=R,s=r.readFileSync(e,"utf8");t.exports=Te.compile(s)}typeof Me<"u"&&Me.extensions&&(Me.extensions[".handlebars"]=Zr,Me.extensions[".hbs"]=Zr);const Xr=He(Da),Ta={protocut:"template-protocut",laserlib:"template-laserlib"},Bt=process.cwd(),ei=Mn(process.argv.slice(2),{default:{help:!1},alias:{h:"help",t:"template"},string:["_"]}),ti={_gitignore:".gitignore"},ri={"protocut-2d":{"@fsdev/cadui-2d":"^0.0.2","@fsdev/cutui-2d":"^0.0.2","@fsdev/webcad-js":"1.1.0"},"protocut-3d":{"@fsdev/cutui-3d":"^0.0.2","@fsdev/webcad-platform":"1.1.0"}},ii="fsapp-project",Ba=ni(ei._[0]);let Z=Ba||ii;const Be=()=>Z==="."?N.basename(N.resolve()):Z;async function Ha(){return fr.override({overwrite:ei.overwrite}),await fr([{type:"text",name:"projectName",message:_r("Project Name:"),onState:t=>{Z=ni(t.value)||ii}},{type:()=>!R.existsSync(Z)||qa(Z)?null:"select",name:"overwrite",message:()=>Z==="."?"Current directory":`Target directory ${Z}is not empty. Please choose how to proceed:`,initial:0,choices:[{title:"Remove existing files and continue",value:"yes"},{title:"Cancel operation",value:"no"},{title:"Ignore files and continue",value:"ignore"}]},{type:(t,{overwrite:e})=>{if(e==="no")throw new Error(yr("\u2716")+"Operation cancelled");return null},name:"overwriteChecker"},{type:oi(Be())?null:"text",name:"packageName",message:_r("Package name:"),initial:()=>$a(Be()),validate:t=>oi(t)||"Invalid package.json name"},{type:"select",name:"template",message:"Select a template",choices:[{title:"Vue",value:"vue"},{title:"Docs",value:"docs"},{title:"ProtoCut",value:"protocut"},{title:"Lib",value:"laserlib"}]},{type:(t,{template:e})=>e==="laserlib"?null:"select",name:"variant",message:"Select a templateUse arrow-keys. Return to submit",choices:t=>t==="vue"?[{title:"TypeScript",value:"ts"},{title:"JavaScript",value:"js"}]:t==="docs"?[{title:"VitePress",value:"vitepress"},{title:"VuePress",value:"vuepress"}]:t==="protocut"?[{title:"2D",value:"2d"},{title:"3D",value:"3d"}]:[]}],{onCancel:()=>{throw new Error(yr("\u2716")+" Operation cancelled")}})}async function Fa(){const{overwrite:t,template:e,packageName:r,variant:s}=await Ha(),p=N.join(Bt,Z);t==="yes"?Ga(p):R.existsSync(p)||R.mkdirSync(p,{recursive:!0});const f=N.resolve(ai(import.meta.url),"../..",Ta[e]||`template-${e}-${s}`),l=R.readdirSync(f);function h(d,i){const a=N.join(p,ti[d]??d);i?R.writeFileSync(a,i):si(N.join(f,d),a)}function o(d){const i=N.join(p,ti[d]??d);return new Promise((a,n)=>{R.readFile(i,"utf-8",(m,v)=>{m&&(console.error("\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25",m),n(m)),a(v)})})}for(const d of l.filter(i=>i!=="package.json"&&!i.includes("template")))h(d);const c=JSON.parse(R.readFileSync(N.join(f,"package.json"),"utf-8"));if(c.name=r||Be(),ri[`${e}-${s}`]&&Object.assign(c.dependencies,ri[`${e}-${s}`]),h("package.json",JSON.stringify(c,null,2)+`
70
+ `,e},A.prototype.Program=function(t){var e="",r=t.body,s=void 0,p=void 0;if(t.blockParams){var f="BLOCK PARAMS: [";for(s=0,p=t.blockParams.length;s<p;s++)f+=" "+t.blockParams[s];f+=" ]",e+=this.pad(f)}for(s=0,p=r.length;s<p;s++)e+=this.accept(r[s]);return this.padding--,e},A.prototype.MustacheStatement=function(t){return this.pad("{{ "+this.SubExpression(t)+" }}")},A.prototype.Decorator=function(t){return this.pad("{{ DIRECTIVE "+this.SubExpression(t)+" }}")},A.prototype.BlockStatement=A.prototype.DecoratorBlock=function(t){var e="";return e+=this.pad((t.type==="DecoratorBlock"?"DIRECTIVE ":"")+"BLOCK:"),this.padding++,e+=this.pad(this.SubExpression(t)),t.program&&(e+=this.pad("PROGRAM:"),this.padding++,e+=this.accept(t.program),this.padding--),t.inverse&&(t.program&&this.padding++,e+=this.pad("{{^}}"),this.padding++,e+=this.accept(t.inverse),this.padding--,t.program&&this.padding--),this.padding--,e},A.prototype.PartialStatement=function(t){var e="PARTIAL:"+t.name.original;return t.params[0]&&(e+=" "+this.accept(t.params[0])),t.hash&&(e+=" "+this.accept(t.hash)),this.pad("{{> "+e+" }}")},A.prototype.PartialBlockStatement=function(t){var e="PARTIAL BLOCK:"+t.name.original;return t.params[0]&&(e+=" "+this.accept(t.params[0])),t.hash&&(e+=" "+this.accept(t.hash)),e+=" "+this.pad("PROGRAM:"),this.padding++,e+=this.accept(t.program),this.padding--,this.pad("{{> "+e+" }}")},A.prototype.ContentStatement=function(t){return this.pad("CONTENT[ '"+t.value+"' ]")},A.prototype.CommentStatement=function(t){return this.pad("{{! '"+t.value+"' }}")},A.prototype.SubExpression=function(t){for(var e=t.params,r=[],s=void 0,p=0,f=e.length;p<f;p++)r.push(this.accept(e[p]));return e="["+r.join(", ")+"]",s=t.hash?" "+this.accept(t.hash):"",this.accept(t.path)+" "+e+s},A.prototype.PathExpression=function(t){var e=t.parts.join("/");return(t.data?"@":"")+"PATH:"+e},A.prototype.StringLiteral=function(t){return'"'+t.value+'"'},A.prototype.NumberLiteral=function(t){return"NUMBER{"+t.value+"}"},A.prototype.BooleanLiteral=function(t){return"BOOLEAN{"+t.value+"}"},A.prototype.UndefinedLiteral=function(){return"UNDEFINED"},A.prototype.NullLiteral=function(){return"NULL"},A.prototype.Hash=function(t){for(var e=t.pairs,r=[],s=0,p=e.length;s<p;s++)r.push(this.accept(e[s]));return"HASH{"+r.join(", ")+"}"},A.prototype.HashPair=function(t){return t.key+"="+this.accept(t.value)};var Te=Oa.default,Qr=De;Te.PrintVisitor=Qr.PrintVisitor,Te.print=Qr.print;var Da=Te;function Zr(t,e){var r=R,s=r.readFileSync(e,"utf8");t.exports=Te.compile(s)}typeof Me<"u"&&Me.extensions&&(Me.extensions[".handlebars"]=Zr,Me.extensions[".hbs"]=Zr);const Xr=He(Da),Ta={protocut:"template-protocut",laserlib:"template-laserlib",monorepo:"template-monorepo"},Bt=process.cwd(),ei=Mn(process.argv.slice(2),{default:{help:!1},alias:{h:"help",t:"template"},string:["_"]}),ti={_gitignore:".gitignore"},ri={"protocut-2d":{"@fsdev/cadui-2d":"^0.0.2","@fsdev/cutui-2d":"^0.0.2","@fsdev/webcad-js":"1.1.0"},"protocut-3d":{"@fsdev/cutui-3d":"^0.0.2","@fsdev/webcad-platform":"1.1.0"}},ii="fsapp-project",Ba=ni(ei._[0]);let Z=Ba||ii;const Be=()=>Z==="."?N.basename(N.resolve()):Z;async function Ha(){return fr.override({overwrite:ei.overwrite}),await fr([{type:"text",name:"projectName",message:_r("Project Name:"),onState:t=>{Z=ni(t.value)||ii}},{type:()=>!R.existsSync(Z)||qa(Z)?null:"select",name:"overwrite",message:()=>Z==="."?"Current directory":`Target directory ${Z}is not empty. Please choose how to proceed:`,initial:0,choices:[{title:"Remove existing files and continue",value:"yes"},{title:"Cancel operation",value:"no"},{title:"Ignore files and continue",value:"ignore"}]},{type:(t,{overwrite:e})=>{if(e==="no")throw new Error(yr("\u2716")+"Operation cancelled");return null},name:"overwriteChecker"},{type:oi(Be())?null:"text",name:"packageName",message:_r("Package name:"),initial:()=>$a(Be()),validate:t=>oi(t)||"Invalid package.json name"},{type:"select",name:"template",message:"Select a template",choices:[{title:"Vue",value:"vue"},{title:"Docs",value:"docs"},{title:"ProtoCut",value:"protocut"},{title:"Lib",value:"laserlib"},{title:"Monorepo",value:"monorepo"}]},{type:(t,{template:e})=>["laserlib","monorepo"].includes(e)?null:"select",name:"variant",message:"Select a templateUse arrow-keys. Return to submit",choices:t=>t==="vue"?[{title:"TypeScript",value:"ts"},{title:"JavaScript",value:"js"}]:t==="docs"?[{title:"VitePress",value:"vitepress"},{title:"VuePress",value:"vuepress"}]:t==="protocut"?[{title:"2D",value:"2d"},{title:"3D",value:"3d"}]:[]}],{onCancel:()=>{throw new Error(yr("\u2716")+" Operation cancelled")}})}async function Fa(){const{overwrite:t,template:e,packageName:r,variant:s}=await Ha(),p=N.join(Bt,Z);t==="yes"?Ga(p):R.existsSync(p)||R.mkdirSync(p,{recursive:!0});const f=N.resolve(ai(import.meta.url),"../..",Ta[e]||`template-${e}-${s}`),l=R.readdirSync(f);function h(d,i){const a=N.join(p,ti[d]??d);i?R.writeFileSync(a,i):si(N.join(f,d),a)}function o(d){const i=N.join(p,ti[d]??d);return new Promise((a,n)=>{R.readFile(i,"utf-8",(m,v)=>{m&&(console.error("\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25",m),n(m)),a(v)})})}for(const d of l.filter(i=>i!=="package.json"&&!i.includes("template")))h(d);const c=JSON.parse(R.readFileSync(N.join(f,"package.json"),"utf-8"));if(c.name=r||Be(),ri[`${e}-${s}`]&&Object.assign(c.dependencies,ri[`${e}-${s}`]),h("package.json",JSON.stringify(c,null,2)+`
71
71
  `),e==="protocut"){const d=s==="2d";let i=R.readFileSync(N.join(f,"template/Home.handlebars"),"utf-8"),a=Xr.compile(i)({is2D:d});h("src/views/Home.vue",a),i=R.readFileSync(N.join(f,"template/main.handlebars"),"utf-8"),a=Xr.compile(i)({is2D:d}),h("src/main.ts",a)}if(e==="laserlib"){const d=await o("/data/message/process.ts");if(d){const i=d.replace(/project-name-/g,Be());h("data/message/process.ts",i)}}const u=N.relative(Bt,p);console.log("Done. Now run:"),p!==Bt&&console.log(`cd ${u.includes(" ")?`"${u}"`:u}`),e==="docs"?(console.log(" npm install"),console.log(" npm run docs:dev")):(console.log(" npm install"),console.log(" npm run dev"))}function si(t,e){R.statSync(t).isDirectory()?Va(t,e):R.copyFileSync(t,e)}function Va(t,e){R.mkdirSync(e,{recursive:!0});for(const r of R.readdirSync(t)){const s=N.resolve(t,r),p=N.resolve(e,r);si(s,p)}}function qa(t){const e=R.readdirSync(t);return e.length===0||e.length===1&&e[0]===".git"}function ni(t){return t?.trim().replace(/\/+$/g,"")}function oi(t){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(t)}function $a(t){return t.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Ga(t){if(R.existsSync(t))for(const e of R.readdirSync(t))e!==".git"&&R.rmSync(N.resolve(t,e),{recursive:!0,force:!0})}Fa().catch(console.error);
package/package.json CHANGED
@@ -1,39 +1,40 @@
1
- {
2
- "name": "create-bc-app",
3
- "version": "1.1.4",
4
- "description": "",
5
- "bin": "index.js",
6
- "type": "module",
7
- "scripts": {
8
- "build": "unbuild"
9
- },
10
- "author": "wbb",
11
- "license": "ISC",
12
- "devDependencies": {
13
- "@types/minimist": "^1.2.5",
14
- "@types/prompts": "^2.4.9",
15
- "cross-spawn": "^7.0.3",
16
- "handlebars": "^4.7.8",
17
- "kolorist": "^1.8.0",
18
- "minimist": "^1.2.8",
19
- "prompts": "^2.4.2",
20
- "typescript": "^5.5.4",
21
- "unbuild": "^2.0.0"
22
- },
23
- "publishConfig": {
24
- "registry": "https://registry.npmjs.org"
25
- },
26
- "files": [
27
- "template-vue-js/.gitignore",
28
- "template-vue-js/",
29
- "template-vue-ts/",
30
- "template-protocut-2d/.gitignore",
31
- "template-protocut-2d/",
32
- "template-docs-vitepress/",
33
- "template-docs-vuepress/",
34
- "template-laserlib/",
35
- "template-vue-ts/.gitignore",
36
- "dist/",
37
- "index.js"
38
- ]
1
+ {
2
+ "name": "create-bc-app",
3
+ "version": "1.1.6",
4
+ "description": "",
5
+ "bin": "index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "build": "unbuild"
9
+ },
10
+ "author": "wbb",
11
+ "license": "ISC",
12
+ "devDependencies": {
13
+ "@types/minimist": "^1.2.5",
14
+ "@types/prompts": "^2.4.9",
15
+ "cross-spawn": "^7.0.3",
16
+ "handlebars": "^4.7.8",
17
+ "kolorist": "^1.8.0",
18
+ "minimist": "^1.2.8",
19
+ "prompts": "^2.4.2",
20
+ "typescript": "^5.5.4",
21
+ "unbuild": "^2.0.0"
22
+ },
23
+ "publishConfig": {
24
+ "registry": "https://registry.npmjs.org"
25
+ },
26
+ "files": [
27
+ "template-docs-vitepress",
28
+ "template-docs-vuepress",
29
+ "template-laserlib",
30
+ "template-protocut",
31
+ "template-vue-js",
32
+ "template-vue-ts",
33
+ "template-monorepo",
34
+ "index.js",
35
+ "dist"
36
+ ],
37
+ "engines": {
38
+ "node": "^18.0.0"
39
+ }
39
40
  }
@@ -0,0 +1,25 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?
25
+ cache
@@ -0,0 +1,26 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?
25
+ .cache
26
+ .temp
@@ -33,7 +33,7 @@ notify-fail:
33
33
  - node_modules/
34
34
  script:
35
35
  - >
36
- curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=需要找企业微信管理员或斌斌'
36
+ curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=需要找企业微信管理员'
37
37
  -H 'Content-Type: application/json'
38
38
  -d "{\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"项目构建结果:<font color=\\"warning\\">失败</font>\n>本次构建由: $GITLAB_USER_NAME 触发\n>项目名称:$CI_PROJECT_NAME\n>提交号:$CI_COMMIT_SHA\n>提交日志:$CI_COMMIT_MESSAGE\n>构建分支: $CI_COMMIT_REF_NAME\n>流水线地址:[$CI_PIPELINE_URL]($CI_PIPELINE_URL)\"}}"
39
39
  when: on_failure
@@ -6,8 +6,8 @@
6
6
  "scripts": {
7
7
  "dev": "vite --mode @fsdev",
8
8
  "lib": "vue-tsc && vite build",
9
- "lib:test": "rimraf lib && vite build --mode @fsdev",
10
- "lib:prod": "rimraf lib && vite build --mode @fscut",
9
+ "lib:test": "rimraf lib && vite build --mode test",
10
+ "lib:prod": "rimraf lib && vite build --mode prod",
11
11
  "watch": "set NODE_ENV=development vue-tsc && vite build --mode development --watch --emptyOutDir",
12
12
  "watch:yalc": "nodemon --watch lib/ --verbose -x yalc publish --push",
13
13
  "preview": "vite preview",
@@ -33,9 +33,9 @@
33
33
  "data/**/*.d.ts",
34
34
  "model/**/*.ts",
35
35
  "model/**/*.d.ts",
36
- "packages/**/index.ts",
37
- "packages/**/**.vue",
38
- "packages/**/**.ts",
36
+ "views/**/index.ts",
37
+ "views/**/**.vue",
38
+ "views/**/**.ts",
39
39
  "src/index.ts",
40
40
  "vite-env.d.ts",
41
41
  "types/index.d.ts"
@@ -8,19 +8,24 @@ import { resolve } from 'path'
8
8
  const __dirname = resolve()
9
9
 
10
10
  // https://vitejs.dev/config/
11
- export default ({ mode }) => {
11
+ export default ({ mode }:{mode: string}) => {
12
+ let pkg = mode === 'test' ? '@fsdev' : '@fscut'
12
13
  return defineConfig({
13
14
  plugins: [vue(), dts({ rollupTypes: true })],
14
15
  resolve: {
15
16
  alias: {
16
17
  '@': resolve(__dirname, 'src'),
17
- 'packages': resolve(__dirname, 'packages'),
18
- '@fs': path.resolve(__dirname, `node_modules/${mode}`),
18
+ '@fs/bochui': path.resolve(__dirname, `node_modules/${pkg}/bochui`),
19
+ '@fs/utils': path.resolve(__dirname, `node_modules/${pkg}/fs-utils`),
20
+ '@fs/fscadweb': path.resolve(__dirname, `node_modules/${pkg}/fscadweb`),
21
+ '@fs/sandbox': path.resolve(__dirname, `node_modules/${pkg}/assemblysandbox`),
22
+ '@fs/sandbox/assets': path.resolve(__dirname, `node_modules/${pkg}/assemblysandbox/lib/assets`),
23
+ '@fs/webcad-platform': path.resolve(__dirname, `node_modules/${pkg}/webcad-platform`),
19
24
  }
20
25
  },
21
26
  build: {
22
27
  rollupOptions: {
23
- external: ['vue', '@fsdev/bochui', 'element-plus']
28
+ external: ['vue', '@fs/bochui', '@fs/utils', '@fs/fscadweb', '@fs/sandbox', '@fs/sandbox/assets', '@fs/webcad-platform']
24
29
  },
25
30
  outDir: 'lib',
26
31
  lib: {
@@ -0,0 +1,8 @@
1
+ /build/
2
+ /config/
3
+ /dist/
4
+ /*.js
5
+ /*.d.ts
6
+ /public
7
+ /*.cjs
8
+ *.min.js
@@ -0,0 +1,211 @@
1
+ /* eslint-env node */
2
+ require('@rushstack/eslint-patch/modern-module-resolution')
3
+
4
+ module.exports = {
5
+ root: true,
6
+ extends: [
7
+ 'plugin:vue/recommended',
8
+ 'plugin:vue/vue3-essential',
9
+ 'plugin:vue/vue3-strongly-recommended',
10
+ 'plugin:@typescript-eslint/recommended',
11
+ 'eslint:recommended'
12
+ ],
13
+ ignorePatterns: ['sdk/'],
14
+ globals: {
15
+ 'process': true
16
+ },
17
+ parser: 'vue-eslint-parser',
18
+ parserOptions: {
19
+ ecmaVersion: 'latest',
20
+ parser: '@typescript-eslint/parser'
21
+ },
22
+ rules: {
23
+ '@typescript-eslint/no-unused-vars': 'error',
24
+ '@typescript-eslint/no-explicit-any': 'off',
25
+ '@typescript-eslint/ban-ts-comment': 'off',
26
+ '@typescript-eslint/type-annotation-spacing': [
27
+ 'error',
28
+ {
29
+ before: false,
30
+ after: true
31
+ }
32
+ ],
33
+ 'vue/multi-word-component-names': ['off'],
34
+ 'vue/no-v-for-template-key': 'off',
35
+ 'vue/no-multiple-template-root': 'off',
36
+ 'vue/no-v-model-argument': 'off',
37
+ 'vue/max-attributes-per-line': ['error', {
38
+ 'singleline': {
39
+ 'max': 3
40
+ },
41
+ 'multiline': {
42
+ 'max': 3
43
+ }
44
+ }],
45
+ 'accessor-pairs': 2,
46
+ 'arrow-spacing': [2, {
47
+ 'before': true,
48
+ 'after': true
49
+ }],
50
+ 'block-spacing': [2, 'always'],
51
+ 'brace-style': [2, '1tbs', {
52
+ 'allowSingleLine': true
53
+ }],
54
+ 'camelcase': [2, {
55
+ 'properties': 'always'
56
+ }],
57
+ 'comma-dangle': [2, 'never'],
58
+ 'comma-spacing': [2, {
59
+ 'before': false,
60
+ 'after': true
61
+ }],
62
+ 'comma-style': [2, 'last'],
63
+ 'constructor-super': 2,
64
+ 'curly': [2, 'multi-line'],
65
+ 'dot-location': [2, 'property'],
66
+ 'eol-last': 2,
67
+ 'eqeqeq': [2, 'allow-null'],
68
+ 'generator-star-spacing': [2, {
69
+ 'before': true,
70
+ 'after': true
71
+ }],
72
+ 'handle-callback-err': [2, '^(err|error)$'],
73
+ 'indent': [1, 2, {
74
+ 'SwitchCase': 1
75
+ }],
76
+ 'jsx-quotes': [2, 'prefer-single'],
77
+ 'key-spacing': [2, {
78
+ 'beforeColon': false,
79
+ 'afterColon': true
80
+ }],
81
+ 'keyword-spacing': [2, {
82
+ 'before': true,
83
+ 'after': true
84
+ }],
85
+ 'new-cap': [2, {
86
+ 'newIsCap': true,
87
+ 'capIsNew': false
88
+ }],
89
+ 'new-parens': 2,
90
+ 'no-array-constructor': 2,
91
+ 'no-caller': 2,
92
+ 'no-console': process.env.NODE_ENV === 'production' ? 2 : 0,
93
+ 'no-class-assign': 2,
94
+ 'no-cond-assign': 2,
95
+ 'no-const-assign': 2,
96
+ 'no-control-regex': 0,
97
+ 'no-delete-var': 2,
98
+ 'no-dupe-args': 2,
99
+ 'no-dupe-class-members': 2,
100
+ 'no-dupe-keys': 2,
101
+ 'no-duplicate-case': 2,
102
+ 'no-empty-character-class': 2,
103
+ 'no-empty-pattern': 2,
104
+ 'no-eval': 2,
105
+ 'no-ex-assign': 2,
106
+ 'no-extend-native': 2,
107
+ 'no-extra-bind': 2,
108
+ 'no-extra-boolean-cast': 2,
109
+ 'no-extra-parens': [2, 'functions'],
110
+ 'no-fallthrough': 2,
111
+ 'no-floating-decimal': 2,
112
+ 'no-func-assign': 2,
113
+ 'no-implied-eval': 2,
114
+ 'no-inner-declarations': [2, 'functions'],
115
+ 'no-invalid-regexp': 2,
116
+ 'no-irregular-whitespace': 2,
117
+ 'no-iterator': 2,
118
+ 'no-label-var': 2,
119
+ 'no-labels': [2, {
120
+ 'allowLoop': false,
121
+ 'allowSwitch': false
122
+ }],
123
+ 'no-lone-blocks': 2,
124
+ 'no-mixed-spaces-and-tabs': 2,
125
+ 'no-multi-spaces': 2,
126
+ 'no-multi-str': 2,
127
+ 'no-multiple-empty-lines': [2, {
128
+ 'max': 1
129
+ }],
130
+ 'no-native-reassign': 2,
131
+ 'no-negated-in-lhs': 2,
132
+ 'no-new-object': 2,
133
+ 'no-new-require': 2,
134
+ 'no-new-symbol': 2,
135
+ 'no-new-wrappers': 2,
136
+ 'no-obj-calls': 2,
137
+ 'no-octal': 2,
138
+ 'no-octal-escape': 2,
139
+ 'no-path-concat': 2,
140
+ 'no-proto': 2,
141
+ 'no-redeclare': 2,
142
+ 'no-regex-spaces': 2,
143
+ 'no-return-assign': [2, 'except-parens'],
144
+ 'no-self-assign': 2,
145
+ 'no-self-compare': 2,
146
+ 'no-sequences': 2,
147
+ 'no-shadow-restricted-names': 2,
148
+ 'no-spaced-func': 2,
149
+ 'no-sparse-arrays': 2,
150
+ 'no-this-before-super': 2,
151
+ 'no-throw-literal': 2,
152
+ 'no-trailing-spaces': 2,
153
+ 'no-undef': 2,
154
+ 'no-undef-init': 2,
155
+ 'no-unexpected-multiline': 2,
156
+ 'no-unmodified-loop-condition': 2,
157
+ 'no-unneeded-ternary': [2, {
158
+ 'defaultAssignment': false
159
+ }],
160
+ 'no-unreachable': 2,
161
+ 'no-unsafe-finally': 2,
162
+ 'no-unused-vars': 'off',
163
+ 'no-useless-call': 2,
164
+ 'no-useless-computed-key': 2,
165
+ 'no-useless-constructor': 2,
166
+ 'no-useless-escape': 1,
167
+ 'no-whitespace-before-property': 2,
168
+ 'no-with': 2,
169
+ 'one-var': [2, {
170
+ 'initialized': 'never'
171
+ }],
172
+ 'operator-linebreak': [2, 'after', {
173
+ 'overrides': {
174
+ '?': 'before',
175
+ ':': 'before'
176
+ }
177
+ }],
178
+ 'padded-blocks': [2, 'never'],
179
+ 'quotes': [1, 'single', {
180
+ 'avoidEscape': true,
181
+ 'allowTemplateLiterals': true
182
+ }],
183
+ 'semi': [2, 'never'],
184
+ 'semi-spacing': [2, {
185
+ 'before': false,
186
+ 'after': true
187
+ }],
188
+ 'space-before-blocks': [2, 'always'],
189
+ 'space-in-parens': [2, 'never'],
190
+ 'space-infix-ops': 2,
191
+ 'space-unary-ops': [2, {
192
+ 'words': true,
193
+ 'nonwords': false
194
+ }],
195
+ 'spaced-comment': [2, 'always', {
196
+ 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
197
+ }],
198
+ 'template-curly-spacing': [2, 'never'],
199
+ 'use-isnan': 2,
200
+ 'valid-typeof': 2,
201
+ 'wrap-iife': [2, 'any'],
202
+ 'yield-star-spacing': [2, 'both'],
203
+ 'yoda': [2, 'never'],
204
+ 'prefer-const': 0,
205
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
206
+ 'object-curly-spacing': [2, 'always', {
207
+ objectsInObjects: false
208
+ }],
209
+ 'array-bracket-spacing': [2, 'never']
210
+ }
211
+ }
@@ -0,0 +1,41 @@
1
+ stages:
2
+ - install
3
+ - eslint
4
+ - notify
5
+
6
+ cache:
7
+ key: '$CI_COMMIT_REF_SLUG'
8
+
9
+ install:
10
+ stage: install
11
+ cache:
12
+ paths:
13
+ - node_modules/
14
+ script:
15
+ - cnpm install
16
+ tags:
17
+ - sonar
18
+
19
+ eslint:
20
+ stage: eslint
21
+ cache:
22
+ paths:
23
+ - node_modules/
24
+ script:
25
+ - npm run lint
26
+ tags:
27
+ - sonar
28
+
29
+ notify-fail:
30
+ stage: notify
31
+ cache:
32
+ paths:
33
+ - node_modules/
34
+ script:
35
+ - >
36
+ curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=需要找企业微信管理员或斌斌'
37
+ -H 'Content-Type: application/json'
38
+ -d "{\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"项目构建结果:<font color=\\"warning\\">失败</font>\n>本次构建由: $GITLAB_USER_NAME 触发\n>项目名称:$CI_PROJECT_NAME\n>提交号:$CI_COMMIT_SHA\n>提交日志:$CI_COMMIT_MESSAGE\n>构建分支: $CI_COMMIT_REF_NAME\n>流水线地址:[$CI_PIPELINE_URL]($CI_PIPELINE_URL)\"}}"
39
+ when: on_failure
40
+ tags:
41
+ - sonar
@@ -0,0 +1,35 @@
1
+ ## 项目结构
2
+
3
+ ```
4
+ |—— root
5
+ |—— build_entry // 存放翻译脚本
6
+ |—— packages // 存放各模块ui组件
7
+ |—— index.ts // 导出各个组件
8
+ |—— public // 存放公共文件
9
+ |—— sdk
10
+ |—— model // model层
11
+ |—— {{ module }} // 具体模块
12
+ |—— constants.ts // 存放模块常量
13
+ |—— index.ts // 模块入口
14
+ |—— manager.ts // 模块管理器实现(按需创建)
15
+ |—— type.ts // 模块类型定义
16
+ |—— data-server // 数据层
17
+ |—— api // API定义
18
+ |—— {{ module }} // 具体模块
19
+ |—— adapterImpl.ts // 数据处理
20
+ |—— dataServerImpl.ts // 数据请求+message处理
21
+ |—— index.ts // 模块入口
22
+ |—— type.ts // 模块类型定义
23
+ |—— src // 项目的源代码包
24
+ |—— assets // 静态资源文件,如图片、css等
25
+ |—— configData // 各类json配置数据
26
+ |—— constants // 存放常量
27
+ |—— hooks // 通用的钩子函数
28
+ |—— i18n // 国际化相关
29
+ |—— stores // pinia状态管理器;编写状态管理modules、向外暴露一个store实例
30
+ |—— types // 类型定义
31
+ |—— utils // 工具函数
32
+ |—— views // 存放开发的页面组件
33
+ |—— App.vue // 项目的根组件
34
+ |—— main.ts // 项目的入口文件
35
+ ```
@@ -0,0 +1,27 @@
1
+ import fs from 'fs'
2
+ import dlgZh from '../src/i18n/langs/page.js'
3
+ import mainToolsBar from '../src/configData/mainToolsBar.json' assert{type: 'json'}
4
+
5
+ const zh = { ...dlgZh }
6
+
7
+ function setJson(data, module = '') {
8
+ let prefix = module ? module + '.' : ''
9
+ for (const key in data) {
10
+ setKey(prefix + key + '.Title', data[key].Title)
11
+ if (data[key].More) {
12
+ setJson(data[key].More, module)
13
+ }
14
+ }
15
+ }
16
+
17
+ function setKey(key, value) {
18
+ if (value) {
19
+ if (!zh[key]) {
20
+ zh[key] = value
21
+ }
22
+ }
23
+ }
24
+
25
+ setJson(mainToolsBar, 'MainTools')
26
+
27
+ fs.writeFile('./src/i18n/langs/zh_Hans.json', JSON.stringify(zh), (err) => { console.log(err) })
@@ -0,0 +1,16 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <link rel="icon" type="image/svg+xml" href="/group.svg" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
+ <title>example project</title>
9
+ </head>
10
+
11
+ <body>
12
+ <div id="app"></div>
13
+ <script type="module" src="/src/main.ts"></script>
14
+ </body>
15
+
16
+ </html>