@xaendar/cli 0.9.19 → 0.9.23
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/cli.js +2 -2
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ describe('${t}Component', () => {
|
|
|
19
19
|
expect(component).toBeTruthy();
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
|
-
`}function d(){
|
|
22
|
+
`}function d(){return new _("generate").alias("g").description("Generate Xaendar building blocks").command("component <name>").alias("c").option("-p, --path <path>","Custom path for the generated component (default: current directory)").option("-f, --force","Force generation deleting current component if already exists").description("Generate a new component (creates <name>/ folder with .ts, .html, .css, .spec.ts)").action((e,t)=>{let n=t.path||process.cwd();m(e,n,!!t.force)})}import{Command as M}from"commander";import{existsSync as W,mkdirSync as $,readdirSync as A,writeFileSync as B}from"fs";import{resolve as p}from"path/win32";import{readFileSync as I}from"fs";import{resolve as L}from"path";function f(e){return`<!DOCTYPE html>
|
|
23
23
|
<html lang="en">
|
|
24
24
|
<head>
|
|
25
25
|
<meta charset="UTF-8" />
|
|
@@ -105,4 +105,4 @@ export default defineConfig({
|
|
|
105
105
|
"style": "${t}"
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
}`}function X(){try{let e=JSON.parse(I(L(import.meta.filename,"..","../package.json"),"utf8"));if(!e.version)throw"Unable to determine Xaendar CLI version.";return e.version}catch(e){console.error("Error reading Xaendar CLI version:",e),process.exit(1)}}function v(e){let t=X(),n=e.name,o=`${n}-root`;return[{type:"file",name:"package.json",content:u(n,t)},{type:"file",name:"xaendar.json",content:h(n,e.style)},{type:"file",name:"vite.config.ts",content:C()},{type:"file",name:"tsconfig.json",content:x()},{type:"directory",name:"src",children:[{type:"file",name:"index.html",content:f(o)},{type:"file",name:"signals.ts",content:y()},{type:"file",name:"main.ts",content:g(o)},{type:"generateComponent",name:o}]}]}import{execSync as G}from"child_process";function b(){return new M("new").description("Scaffold a new Xaendar project").argument("<name>","Name of the project to create").option("-p, --path <path>","Custom path for the generated project (default: current directory)").option("-s, --style <style>","CSS preprocessor to use (css, scss, less, styl)","css").action((e,t)=>{let n=H(t.style),o=t.path||process.cwd(),r=p(o,e);V(r),S(v({name:e,style:n}),r,n),G("npm i",{stdio:"inherit",cwd:r})})}function H(e){let t=["css","scss","less","styl"];return e?(t.includes(e)||(console.error(`\u2716 Invalid style option: ${e}`),process.exit(1)),e):"css"}function V(e){let t=W(e);t&&A(e).length&&(console.error(`\u2716 Cannot create project: target directory is not empty: ${e}`),process.exit(1)),t||$(e)}function S(e,t,n){for(let o=0;o<e.length;o++){let r=e[o];switch(r.type){case"file":case void 0:let a=r.content;B(p(t,r.name),a,"utf8");break;case"directory":let s=p(t,r.name);$(s),r.children&&S(r.children,s,n);break;case"generateComponent":m(r.name,t,!1,n);break}}}import{Command as z}from"commander";import K from"@rolldown/plugin-babel";import{createServer as R}from"vite";import{xaendarPlugin as Y}from"@xaendar/build-tools";function w(){return new z("start").description("Start the project").action(async()=>{await(await R({plugins:[K({presets:[{preset:()=>({plugins:[["@babel/plugin-proposal-decorators",{version:"2023-11"}]]}),rolldown:{filter:{code:"@"}}}]}),Y()]})).listen()})}var Q=JSON.parse(Z(q(import.meta.filename,"..","../package.json"),"utf-8")).version;c.name("xd").description("Xaendar CLI").version(Q);c.addCommand(d());c.addCommand(b());c.addCommand(w());c.parse();
|
|
108
|
+
}`}function X(){try{let e=JSON.parse(I(L(import.meta.filename,"..","../package.json"),"utf8"));if(!e.version)throw"Unable to determine Xaendar CLI version.";return e.version}catch(e){console.error("Error reading Xaendar CLI version:",e),process.exit(1)}}function v(e){let t=X(),n=e.name,o=`${n}-root`;return[{type:"file",name:"package.json",content:u(n,t)},{type:"file",name:"xaendar.json",content:h(n,e.style)},{type:"file",name:"vite.config.ts",content:C()},{type:"file",name:"tsconfig.json",content:x()},{type:"directory",name:"src",children:[{type:"file",name:"index.html",content:f(o)},{type:"file",name:"signals.ts",content:y()},{type:"file",name:"main.ts",content:g(o)},{type:"generateComponent",name:o}]}]}import{execSync as G}from"child_process";function b(){return new M("new").description("Scaffold a new Xaendar project").argument("<name>","Name of the project to create").option("-p, --path <path>","Custom path for the generated project (default: current directory)").option("-s, --style <style>","CSS preprocessor to use (css, scss, less, styl)","css").action((e,t)=>{let n=H(t.style),o=t.path||process.cwd(),r=p(o,e);V(r),S(v({name:e,style:n}),r,n),G("npm i",{stdio:"inherit",cwd:r})})}function H(e){let t=["css","scss","less","styl"];return e?(t.includes(e)||(console.error(`\u2716 Invalid style option: ${e}`),process.exit(1)),e):"css"}function V(e){let t=W(e);t&&A(e).length&&(console.error(`\u2716 Cannot create project: target directory is not empty: ${e}`),process.exit(1)),t||$(e)}function S(e,t,n){for(let o=0;o<e.length;o++){let r=e[o];switch(r.type){case"file":case void 0:let a=r.content;B(p(t,r.name),a,"utf8");break;case"directory":let s=p(t,r.name);$(s),r.children&&S(r.children,s,n);break;case"generateComponent":m(r.name,t,!1,n);break}}}import{Command as z}from"commander";import K from"@rolldown/plugin-babel";import{createServer as R}from"vite";import{xaendarPlugin as Y}from"@xaendar/build-tools";function w(){return new z("start").alias("s").description("Start the project").action(async()=>{await(await R({plugins:[K({presets:[{preset:()=>({plugins:[["@babel/plugin-proposal-decorators",{version:"2023-11"}]]}),rolldown:{filter:{code:"@"}}}]}),Y()]})).listen()})}var Q=JSON.parse(Z(q(import.meta.filename,"..","../package.json"),"utf-8")).version;c.name("xd").description("Xaendar CLI").version(Q);c.addCommand(d());c.addCommand(b());c.addCommand(w());c.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaendar/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.23",
|
|
4
4
|
"description": "Cli tool for Xaendar framework",
|
|
5
5
|
"author": "Kaitenjo",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"main": "./dist/cli.js",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@rolldown/plugin-babel": "^0.2.3",
|
|
20
|
-
"@xaendar/build-tools": "0.9.
|
|
21
|
-
"@xaendar/common": "0.9.
|
|
20
|
+
"@xaendar/build-tools": "0.9.23",
|
|
21
|
+
"@xaendar/common": "0.9.23",
|
|
22
22
|
"commander": "^15.0.0",
|
|
23
23
|
"vite": "^8.2.2"
|
|
24
24
|
}
|