create-bc-app 1.1.9 → 1.2.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.
- package/dist/index.mjs +1 -1
- package/package.json +3 -2
- package/template-monorepo/.gitlab-ci.yml +41 -0
- package/template-monorepo/README.md +8 -3
- package/template-monorepo/apps/App-A/vite.config.ts +7 -4
- package/template-monorepo/config/fileWatcher.plugin.ts +29 -0
- package/template-webcad/README.md +102 -0
- package/template-webcad/eslint.config.js +109 -0
- package/template-webcad/index.html +14 -0
- package/template-webcad/package.json +32 -0
- package/template-webcad/public/gpu-browser.js +19520 -0
- package/template-webcad/public/vite.svg +1 -0
- package/template-webcad/src/App.vue +26 -0
- package/template-webcad/src/assets/vue.svg +1 -0
- package/template-webcad/src/main.ts +5 -0
- package/template-webcad/src/sdk/apis/api.ts +111 -0
- package/template-webcad/src/sdk/cmd/cmd_types.ts +7 -0
- package/template-webcad/src/sdk/cmd/index.ts +1 -0
- package/template-webcad/src/sdk/index.ts +5 -0
- package/template-webcad/src/sdk/template_app.ts +53 -0
- package/template-webcad/src/sdk/view/scene/template_scene_creator.ts +9 -0
- package/template-webcad/src/sdk/view/template_canvas.ts +43 -0
- package/template-webcad/src/sdk/view/template_canvas_observer.ts +5 -0
- package/template-webcad/src/style.css +77 -0
- package/template-webcad/src/vite-env.d.ts +1 -0
- package/template-webcad/tsconfig.app.json +14 -0
- package/template-webcad/tsconfig.json +46 -0
- package/template-webcad/tsconfig.node.json +24 -0
- package/template-webcad/vite.config.ts +61 -0
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",mvvm:"template-mvvm",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"},{title:"Mvvm",value:"mvvm"}]},{type:(t,{template:e})=>["laserlib","monorepo","mvvm"].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)+`
|
|
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",mvvm:"template-mvvm",monorepo:"template-monorepo",webcad:"template-webcad"},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"},{title:"Mvvm",value:"mvvm"},{title:"WebCAD",value:"webcad"}]},{type:(t,{template:e})=>["laserlib","monorepo","mvvm","webcad"].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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-bc-app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"bin": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -33,10 +33,11 @@
|
|
|
33
33
|
"template-vue-ts",
|
|
34
34
|
"template-monorepo",
|
|
35
35
|
"template-mvvm",
|
|
36
|
+
"template-webcad",
|
|
36
37
|
"index.js",
|
|
37
38
|
"dist"
|
|
38
39
|
],
|
|
39
40
|
"engines": {
|
|
40
41
|
"node": "^18.0.0"
|
|
41
42
|
}
|
|
42
|
-
}
|
|
43
|
+
}
|
|
@@ -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
|
+
- pnpm 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
|
|
@@ -28,13 +28,13 @@ npm install pnpm -g
|
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
#
|
|
31
|
+
# 初始化项目时,使用-r参数递归安装各个子包依赖
|
|
32
32
|
pnpm install -r
|
|
33
33
|
|
|
34
34
|
# 使用-w参数安装一个全局依赖到工作区目录,确保各个子包不需要再次安装就能引用
|
|
35
35
|
pnpm install pkgName -w
|
|
36
36
|
|
|
37
|
-
#
|
|
37
|
+
# 进入到对应子包,为子包单独安装依赖(不推荐,除非很特殊的依赖)
|
|
38
38
|
cd ./packages/pkgName
|
|
39
39
|
pnpm install
|
|
40
40
|
```
|
|
@@ -69,4 +69,9 @@ pnpm --filter ./apps/App-A build:prod
|
|
|
69
69
|
|
|
70
70
|
### 依赖缓存问题
|
|
71
71
|
|
|
72
|
-
在dev模式运行时,可能会出现子包里的内容修改了但是vite的dev服务器并没有触发热更新情况,此时需要修改vite.config.ts里的`optimizeDeps
|
|
72
|
+
在dev模式运行时,可能会出现子包里的内容修改了但是vite的dev服务器并没有触发热更新情况,此时需要修改vite.config.ts里的`optimizeDeps`字段,在`exclude`字段中加入对应的包名以告知vite优化依赖关系
|
|
73
|
+
|
|
74
|
+
### 子包依赖管理最佳实践
|
|
75
|
+
|
|
76
|
+
monorepo项目的node_modules分为两部分,分别是:各个子包的node_modules和工作区根目录下的node_modules。安装第三方依赖(即不是workspace的依赖)时,都推荐使用-w或-wD参数安装在根目录下的node_modules中,可以有效减少项目依赖包的大小,以及避免各个子包使用的同一个依赖版本不一致问题
|
|
77
|
+
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { defineConfig } from 'vite'
|
|
3
3
|
import vue from '@vitejs/plugin-vue'
|
|
4
4
|
import resolveConfig from '../../config/resolve.config'
|
|
5
|
+
import fileWatcherPlugin from '../../config/fileWatcher.plugin'
|
|
6
|
+
import path from 'path'
|
|
7
|
+
const __dirname = path.resolve()
|
|
5
8
|
|
|
6
9
|
// https://vitejs.dev/config/
|
|
7
10
|
// @ts-ignore
|
|
@@ -10,11 +13,11 @@ export default defineConfig(({ mode }) => {
|
|
|
10
13
|
const pkg = mode === 'production' ? '@fscut' : '@fsdev'
|
|
11
14
|
return {
|
|
12
15
|
plugins: [
|
|
13
|
-
vue()
|
|
16
|
+
vue(),
|
|
17
|
+
fileWatcherPlugin({
|
|
18
|
+
path: [path.resolve(__dirname, '../../packages')]
|
|
19
|
+
})
|
|
14
20
|
],
|
|
15
|
-
optimizeDeps: {
|
|
16
|
-
include: ['@fsdev/pkg-a', '@fsdev/pkg-b']
|
|
17
|
-
},
|
|
18
21
|
css: {
|
|
19
22
|
preprocessorOptions: {
|
|
20
23
|
less: {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Plugin } from 'vite'
|
|
2
|
+
|
|
3
|
+
type IFileWatcherPluginOptions = {
|
|
4
|
+
path: string[]
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const fileWatcherPlugin = (opts: IFileWatcherPluginOptions): Plugin => {
|
|
8
|
+
return {
|
|
9
|
+
name: 'file-watcher-plugin',
|
|
10
|
+
configureServer(server) {
|
|
11
|
+
console.log('HMR Watch Path: ', opts.path)
|
|
12
|
+
server.watcher.add(opts.path)
|
|
13
|
+
server.watcher.on('change', (file) => {
|
|
14
|
+
console.log('File changed: ', file)
|
|
15
|
+
const mod = server.moduleGraph.getModuleById(file)
|
|
16
|
+
if (mod) {
|
|
17
|
+
server.reloadModule(mod)
|
|
18
|
+
} else {
|
|
19
|
+
server.ws.send({
|
|
20
|
+
type: 'full-reload',
|
|
21
|
+
path: '*'
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default fileWatcherPlugin
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# WebCAD业务库模板
|
|
2
|
+
|
|
3
|
+
这是一个基于CADNginx引擎的WebCAD业务库模板项目,用于快速构建和开发3D CAD Web应用。该模板使用Vue 3、TypeScript和Vite作为前端开发框架,提供了一套完整的CAD应用开发结构。
|
|
4
|
+
|
|
5
|
+
## 项目特点
|
|
6
|
+
|
|
7
|
+
- 基于Vue 3框架和TypeScript开发
|
|
8
|
+
- 使用Vite作为构建工具,提供快速的开发体验
|
|
9
|
+
- 集成CADNginx引擎,提供强大的3D CAD能力
|
|
10
|
+
- 模块化设计,易于扩展和定制
|
|
11
|
+
- 提供完整的MVC架构模板
|
|
12
|
+
|
|
13
|
+
## 环境要求
|
|
14
|
+
|
|
15
|
+
- Node.js 16.x或更高版本
|
|
16
|
+
- NPM 7.x或更高版本(或使用Yarn)
|
|
17
|
+
|
|
18
|
+
## 安装指南
|
|
19
|
+
|
|
20
|
+
1. 克隆项目
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
git clone <项目仓库地址>
|
|
24
|
+
cd webcad-template
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
2. 安装依赖
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install
|
|
31
|
+
# 或
|
|
32
|
+
yarn
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
3. 启动开发服务器
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm run dev
|
|
39
|
+
# 或
|
|
40
|
+
yarn dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 项目结构
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
webcad-template/
|
|
47
|
+
├── public/ # 静态资源目录
|
|
48
|
+
├── src/ # 源代码目录
|
|
49
|
+
│ ├── assets/ # 资源文件(图片、字体等)
|
|
50
|
+
│ ├── sdk/ # WebCAD SDK核心代码
|
|
51
|
+
│ │ ├── adapter/ # 适配器
|
|
52
|
+
│ │ ├── apis/ # API接口
|
|
53
|
+
│ │ ├── cmd/ # 命令定义
|
|
54
|
+
│ │ ├── command/ # 命令实现
|
|
55
|
+
│ │ ├── display/ # 显示相关
|
|
56
|
+
│ │ ├── model/ # 数据模型
|
|
57
|
+
│ │ ├── protobuf/ # Protobuf相关
|
|
58
|
+
│ │ ├── view/ # 视图相关
|
|
59
|
+
│ │ ├── index.ts # SDK导出
|
|
60
|
+
│ │ └── template_app.ts # 应用主类
|
|
61
|
+
│ ├── App.vue # Vue主组件
|
|
62
|
+
│ ├── main.ts # 应用入口
|
|
63
|
+
│ └── style.css # 全局样式
|
|
64
|
+
├── index.html # HTML入口
|
|
65
|
+
├── vite.config.ts # Vite配置
|
|
66
|
+
├── tsconfig.json # TypeScript配置
|
|
67
|
+
└── package.json # 项目依赖和脚本
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 开发说明
|
|
71
|
+
|
|
72
|
+
### 应用配置
|
|
73
|
+
|
|
74
|
+
应用的核心配置在`src/sdk/template_app.ts`中定义,包括背景、相机设置、控制器等。
|
|
75
|
+
|
|
76
|
+
### 自定义扩展
|
|
77
|
+
|
|
78
|
+
1. 在`src/sdk/model/`目录中添加新的数据模型
|
|
79
|
+
2. 在`src/sdk/view/`目录中添加新的视图组件
|
|
80
|
+
3. 在`src/sdk/cmd/`和`src/sdk/command/`中添加新的命令
|
|
81
|
+
|
|
82
|
+
### 构建与部署
|
|
83
|
+
|
|
84
|
+
开发模式构建(带UI):
|
|
85
|
+
```bash
|
|
86
|
+
npm run dev
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
生产模式构建(仅SDK):
|
|
90
|
+
```bash
|
|
91
|
+
npm run build
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## API参考
|
|
95
|
+
|
|
96
|
+
详细API文档请参考CADNginx引擎文档。
|
|
97
|
+
|
|
98
|
+
## 版权声明
|
|
99
|
+
|
|
100
|
+
© 柏楚电子科技股份有限公司版权所有。保留所有权利。
|
|
101
|
+
|
|
102
|
+
本项目为公司内部专有软件,未经授权不得外泄、复制、传播或用于商业目的。
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import globals from 'globals';
|
|
2
|
+
import js from '@eslint/js';
|
|
3
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
4
|
+
import tsParser from '@typescript-eslint/parser';
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
js.configs.recommended,
|
|
8
|
+
{
|
|
9
|
+
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
10
|
+
ignores: ['**/public/**'],
|
|
11
|
+
languageOptions: {
|
|
12
|
+
parser: tsParser,
|
|
13
|
+
globals: {
|
|
14
|
+
...globals.browser
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
plugins: {
|
|
18
|
+
'@typescript-eslint': tsPlugin
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
// 基础规则
|
|
22
|
+
'no-debugger': 'warn', // 禁止使用debugger
|
|
23
|
+
'no-alert': 'warn', // 禁止使用alert
|
|
24
|
+
'no-var': 'error', // 禁止使用var
|
|
25
|
+
'prefer-const': 'error', // 建议使用const
|
|
26
|
+
'no-unused-vars': 'off', // 禁止定义未使用的变量
|
|
27
|
+
|
|
28
|
+
// 代码风格
|
|
29
|
+
'indent': ['error', 4, {
|
|
30
|
+
'SwitchCase': 1, // switch case 语句缩进1个层级
|
|
31
|
+
'VariableDeclarator': 1, // 变量声明缩进1个层级
|
|
32
|
+
'outerIIFEBody': 1, // 立即执行函数缩进1个层级
|
|
33
|
+
'MemberExpression': 1, // 链式调用缩进1个层级
|
|
34
|
+
'FunctionDeclaration': {
|
|
35
|
+
'parameters': 1, // 函数参数缩进1个层级
|
|
36
|
+
'body': 1 // 函数体缩进1个层级
|
|
37
|
+
},
|
|
38
|
+
'FunctionExpression': {
|
|
39
|
+
'parameters': 1, // 函数表达式参数缩进1个层级
|
|
40
|
+
'body': 1 // 函数表达式体缩进1个层级
|
|
41
|
+
},
|
|
42
|
+
'CallExpression': {
|
|
43
|
+
'arguments': 1 // 函数调用参数缩进1个层级
|
|
44
|
+
},
|
|
45
|
+
'ArrayExpression': 1, // 数组缩进1个层级
|
|
46
|
+
'ObjectExpression': 1, // 对象缩进1个层级
|
|
47
|
+
'ImportDeclaration': 1, // import语句缩进1个层级
|
|
48
|
+
'flatTernaryExpressions': false, // 三元表达式不允许平铺
|
|
49
|
+
'offsetTernaryExpressions': true, // 三元表达式缩进
|
|
50
|
+
'ignoreComments': false // 注释跟随代码缩进
|
|
51
|
+
}],
|
|
52
|
+
'quotes': ['error', 'single'], // 使用单引号
|
|
53
|
+
'semi': ['error', 'always'], // 必须使用分号
|
|
54
|
+
'comma-dangle': ['error', 'never'], // 禁止末尾逗号
|
|
55
|
+
'no-multiple-empty-lines': ['error', {
|
|
56
|
+
'max': 1, // 最多允许连续一个空行
|
|
57
|
+
'maxEOF': 1, // 文件末尾最多一个空行
|
|
58
|
+
'maxBOF': 0 // 文件开头不允许空行
|
|
59
|
+
}],
|
|
60
|
+
'padding-line-between-statements': [
|
|
61
|
+
'error',
|
|
62
|
+
{ blankLine: 'always', prev: '*', next: 'return' }, // return 语句前必须有空行
|
|
63
|
+
// { blankLine: 'always', prev: ['const', 'let'], next: '*' }, // 变量声明后必须有空行
|
|
64
|
+
{ blankLine: 'any', prev: ['const', 'let'], next: ['const', 'let'] }, // 连续变量声明可不需要空行
|
|
65
|
+
{ blankLine: 'always', prev: 'directive', next: '*' }, // 指令后必须有空行
|
|
66
|
+
{ blankLine: 'always', prev: ['case', 'default'], next: '*' }, // case/default 后必须有空行
|
|
67
|
+
{ blankLine: 'always', prev: '*', next: 'function' }, // 函数声明前必须有空行
|
|
68
|
+
{ blankLine: 'always', prev: '*', next: 'class' }, // class 声明前必须有空行
|
|
69
|
+
{ blankLine: 'always', prev: '*', next: 'block-like' } // 代码块前必须有空行
|
|
70
|
+
],
|
|
71
|
+
'lines-between-class-members': ['error', 'always', {
|
|
72
|
+
exceptAfterSingleLine: true // 单行类成员后可以不空行
|
|
73
|
+
}],
|
|
74
|
+
'eol-last': ['error', 'always'], // 文件末尾必须有一个空行
|
|
75
|
+
'object-curly-spacing': ['error', 'always'], // 对象字面量大括号前后必须有空格
|
|
76
|
+
'comma-spacing': ['error', { 'before': false, 'after': true }], // 逗号前不空格,后空格
|
|
77
|
+
'key-spacing': ['error', {
|
|
78
|
+
'beforeColon': false, // 冒号前不要空格
|
|
79
|
+
'afterColon': true, // 冒号后必须有空格
|
|
80
|
+
'mode': 'strict' // 严格模式
|
|
81
|
+
}], // 对象属性冒号的空格规则
|
|
82
|
+
'space-before-blocks': ['error', 'always'], // 大括号前必须有空格
|
|
83
|
+
'space-before-function-paren': ['error', {
|
|
84
|
+
'anonymous': 'always',
|
|
85
|
+
'named': 'never',
|
|
86
|
+
'asyncArrow': 'always'
|
|
87
|
+
}], // 函数括号前的空格规则
|
|
88
|
+
'space-in-parens': ['error', 'never'], // 禁止圆括号内的空格
|
|
89
|
+
'space-infix-ops': 'error', // 操作符前后必须有空格
|
|
90
|
+
'array-bracket-spacing': ['error', 'never'], // 数组括号内不要空格
|
|
91
|
+
'semi-spacing': ['error', {
|
|
92
|
+
'before': false, // 分号前不允许空格
|
|
93
|
+
'after': true // 分号后需要空格
|
|
94
|
+
}],
|
|
95
|
+
|
|
96
|
+
// TypeScript 相关
|
|
97
|
+
'@typescript-eslint/explicit-function-return-type': 'off', // 函数返回值类型
|
|
98
|
+
'@typescript-eslint/no-explicit-any': 'off', // 允许使用any
|
|
99
|
+
'@typescript-eslint/no-unused-vars': 'off', // 未使用的变量
|
|
100
|
+
'@typescript-eslint/no-empty-interface': 'warn', // 空接口警告
|
|
101
|
+
'@typescript-eslint/no-empty-function': 'warn', // 空函数警告
|
|
102
|
+
|
|
103
|
+
// 导入导出
|
|
104
|
+
'import/no-unresolved': 'off', // 导入模块检查
|
|
105
|
+
'import/prefer-default-export': 'off', // 默认导出
|
|
106
|
+
'import/no-extraneous-dependencies': 'off' // 外部依赖检查
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + Vue + TS</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script src="/gpu-browser.js"></script>
|
|
12
|
+
<script type="module" src="/src/main.ts"></script>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "webcad-template",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite --force --host --mode @fsdev",
|
|
8
|
+
"build": "vite build --mode @fsdev",
|
|
9
|
+
"lint": "eslint src/**/*.ts --fix"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"vue": "^3.5.13"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"protobufjs": "6.11.3",
|
|
16
|
+
"@fsdev/cadnginx": "^0.0.1-beta.31",
|
|
17
|
+
"@types/three": "0.159.0",
|
|
18
|
+
"@typescript-eslint/eslint-plugin": "^8.14.0",
|
|
19
|
+
"@typescript-eslint/parser": "^8.14.0",
|
|
20
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
21
|
+
"@vue/tsconfig": "^0.7.0",
|
|
22
|
+
"axios": "^1.8.1",
|
|
23
|
+
"eslint": "^9.15.0",
|
|
24
|
+
"eslint-config-prettier": "^9.1.0",
|
|
25
|
+
"typescript": "~5.7.2",
|
|
26
|
+
"vite": "^6.2.0",
|
|
27
|
+
"vite-plugin-banner": "^0.8.0",
|
|
28
|
+
"vite-plugin-dts": "^4.5.3",
|
|
29
|
+
"vue": "^3.5.13",
|
|
30
|
+
"vue-tsc": "^2.2.4"
|
|
31
|
+
}
|
|
32
|
+
}
|