create-dlightjs
Advanced tools
Comparing version
@@ -17,4 +17,4 @@ #!/usr/bin/env node | ||
\\______/ | ||
`;import{fileURLToPath as h}from"node:url";import y from"node-fetch";import v from"path";import r from"fs";var j=process.env.NPM_CONFIG_REGISTRY??"https://registry.npmjs.org/",a=await u({message:"\u{1F4BB} Your project name",default:"my-dlight-app",validate:e=>e.length===0?"Enter a valid project name!":r.existsSync(e)?"Folder already exsits":/^[a-z]+([-_][a-z0-9]+)*$/.test(e)?!0:"Use lowercase letters, no spaces or special characters. Use hyphens or underscores to separate words."}),w=await i({message:"\u{1F951} Language support",choices:[{name:"Javascript",value:"js"},{name:"Typescript",value:"ts"}]}),x=await i({message:"\u{1F4C3} blank template",choices:[{name:"yes",value:!0},{name:"no",value:!1}]}),g=await f({message:"\u{1F4E6} Packages to be installed",choices:[{name:"@dlightjs/components",value:"@dlightjs/components"},{name:"@dlightjs/material-icons",value:"@dlightjs/material-icons"},{name:"@dlightjs/markit",value:"@dlightjs/markit"}]}),$=["vite","vite-plugin-dlight"];g.push("@dlightjs/dlight");var E=async e=>await y(`${j}${e}`).then(async D=>await D.json()).then(D=>D["dist-tags"].latest),p=async e=>{let D={};return await Promise.all(e.map(async o=>{let d=await E(o);D[o]=`^${d}`})),D},[N,P]=await Promise.all([p(g),p($)]),b=v.resolve(h(import.meta.url),"../../templates",`dlight-vite-${x?"min-":""}${w}`);m(`cp -r ${b} ./${a}`);var _=`${a}/package.json`,S=r.readFileSync(_,{encoding:"utf8",flag:"r"});r.writeFileSync(_,S.replace("{{ PROJECT_NAME }}",a).replace("{{ DEPENDENCIES }}",s(N)).replace("{{ DEV_DEPENDENCIES }}",s(P)),{encoding:"utf8",flag:"w"});var t=await i({message:"\u{1F372} Package manager",choices:[{name:"NPM",value:"npm"},{name:"PNPM",value:"pnpm"},{name:"YARN",value:"yarn"},{name:"NONE",value:void 0,description:"Install by yourself"}]});if(t){m(`${t} install`,{cwd:a,stdio:"inherit"}),c(`Successfully installed dependencies using ${t}!`);let e="";t==="pnpm"?e="pnpm dev":t==="npm"?e="npm run dev":t==="yarn"&&(e="yarn dev"),n(`Run app with \`cd ${a} && ${e}\` | ||
`;import{fileURLToPath as h}from"node:url";import y from"node-fetch";import v from"path";import r from"fs";var j=process.env.NPM_CONFIG_REGISTRY??"https://registry.npmjs.org/",a=await u({message:"\u{1F4BB} Your project name",default:"my-dlight-app",validate:e=>e.length===0?"Enter a valid project name!":r.existsSync(e)?"Folder already exsits":/^[a-z]+([-_][a-z0-9]+)*$/.test(e)?!0:"Use lowercase letters, no spaces or special characters. Use hyphens or underscores to separate words."}),w=await i({message:"\u{1F951} Language support",choices:[{name:"Javascript",value:"js"},{name:"Typescript",value:"ts"}]}),x=await i({message:"\u{1F4C3} blank template",choices:[{name:"yes",value:!0},{name:"no",value:!1}]}),g=await f({message:"\u{1F4E6} Packages to be installed",choices:[{name:"@dlightjs/components",value:"@dlightjs/components"},{name:"@dlightjs/material-icons",value:"@dlightjs/material-icons"},{name:"@dlightjs/markit",value:"@dlightjs/markit"}]}),$=["vite","vite-plugin-dlight"];g.push("@dlightjs/dlight");var N=async e=>await y(`${j}${e}`).then(async t=>await t.json()).then(t=>t["dist-tags"].latest),p=async e=>{let t={};return await Promise.all(e.map(async o=>{let d=await N(o);t[o]=`^${d}`})),t},[b,E]=await Promise.all([p(g),p($)]),P=v.resolve(h(import.meta.url),"../../templates",`dlight-vite-${x?"min-":""}${w}`);m(`cp -r ${P} ./${a}`);var _=`${a}/package.json`,S=r.readFileSync(_,{encoding:"utf8",flag:"r"});r.writeFileSync(_,S.replace("{{ PROJECT_NAME }}",a).replace("{{ DEPENDENCIES }}",s(b)).replace("{{ DEV_DEPENDENCIES }}",s(E)),{encoding:"utf8",flag:"w"});var D=await i({message:"\u{1F372} Package manager",choices:[{name:"NPM",value:"npm"},{name:"PNPM",value:"pnpm"},{name:"YARN",value:"yarn"},{name:"BUN",value:"bun"},{name:"NONE",value:void 0,description:"Install by yourself"}]});if(D){m(`${D} install`,{cwd:a,stdio:"inherit"}),c(`Successfully installed dependencies using ${D}!`);let e="";D==="pnpm"?e="pnpm dev":D==="npm"?e="npm run dev":D==="yarn"?e="yarn dev":D==="bun"&&(e="bun dev"),n(`Run app with \`cd ${a} && ${e}\` | ||
`)}n("\u{1F389} All done!");n(l);n(":D Happy coding in DLight!"); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "create-dlightjs", | ||
"version": "1.0.0-beta.0", | ||
"version": "1.0.0-beta.1", | ||
"description": "DLight cli", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -6,4 +6,4 @@ import { defineConfig } from 'vite' | ||
plugins: [ | ||
dlight({ files: "**/*.{view,model}.ts" }) | ||
dlight({ files: "**/*.{view,model}.js" }) | ||
] | ||
}); |
@@ -1,5 +0,6 @@ | ||
import { View } from "@dlightjs/dlight" | ||
import { View, div } from "@dlightjs/dlight" | ||
@Main | ||
@View | ||
export default class App { | ||
class App { | ||
View() { | ||
@@ -6,0 +7,0 @@ div("hello dlight!") |
@@ -6,4 +6,4 @@ import { defineConfig } from 'vite' | ||
plugins: [ | ||
dlight({ files: "**/*.{view,model}.ts" }) | ||
dlight({ files: "**/*.{view,model}.js" }) | ||
] | ||
}); |
@@ -1,8 +0,6 @@ | ||
import { View, type Typed, type Pretty, div } from "@dlightjs/dlight" | ||
import { View, Main, div } from "@dlightjs/dlight" | ||
interface AppProps { | ||
} | ||
@Main | ||
@View | ||
class App implements AppProps { | ||
class App { | ||
View() { | ||
@@ -12,3 +10,1 @@ div("hello dlight") | ||
} | ||
export default App as Pretty as Typed<AppProps> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
57254
0.33%33
-5.71%572
-1.04%