@salty-css/core 0.0.1-alpha.64 → 0.0.1-alpha.65
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/bin/main.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ee=require("commander"),Q=require("fs"),s=require("fs/promises"),i=require("path"),te=require("ejs"),ne=require("../compiler/index.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),E=require("winston"),se=require("child_process"),ae=require("ora");var W=typeof document<"u"?document.currentScript:null;const t=E.createLogger({level:"debug",format:E.format.combine(E.format.colorize(),E.format.cli()),transports:[new E.transports.Console({})]}),m=c=>{t.error(c)},X=c=>new Promise((h,S)=>{se.exec(c,P=>{if(P)return S(P);h()})}),J=async(...c)=>{const h=c.map(F=>F.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),S=ae(`Installing packages: ${h}`).start(),P=c.join(" ");await X(`npm install ${P}`),S.succeed(`Installed packages: ${h}`)},oe=()=>Q.existsSync(i.join(process.cwd(),"node_modules",".bin","prettier"));async function L(c){try{if(!oe())return;await X(`./node_modules/.bin/prettier --write "${c}"`),t.info(`Formatted ${c} with Prettier`)}catch(h){t.error(`Error formatting ${c} with Prettier:`,h)}}async function re(){const c=new ee.Command;c.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const h={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-Dk6ZcCxI.cjs")),"saltygen/index.css":Promise.resolve().then(()=>require("../index-84Wroia-.cjs")),"react/react-styled-file.ts":Promise.resolve().then(()=>require("../react-styled-file-Dkubsz-U.cjs")),"react/react-vanilla-file.ts":Promise.resolve().then(()=>require("../react-vanilla-file-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ee=require("commander"),Q=require("fs"),s=require("fs/promises"),i=require("path"),te=require("ejs"),ne=require("../compiler/index.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),E=require("winston"),se=require("child_process"),ae=require("ora");var W=typeof document<"u"?document.currentScript:null;const t=E.createLogger({level:"debug",format:E.format.combine(E.format.colorize(),E.format.cli()),transports:[new E.transports.Console({})]}),m=c=>{t.error(c)},X=c=>new Promise((h,S)=>{se.exec(c,P=>{if(P)return S(P);h()})}),J=async(...c)=>{const h=c.map(F=>F.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),S=ae(`Installing packages: ${h}`).start(),P=c.join(" ");await X(`npm install ${P}`),S.succeed(`Installed packages: ${h}`)},oe=()=>Q.existsSync(i.join(process.cwd(),"node_modules",".bin","prettier"));async function L(c){try{if(!oe())return;await X(`./node_modules/.bin/prettier --write "${c}"`),t.info(`Formatted ${c} with Prettier`)}catch(h){t.error(`Error formatting ${c} with Prettier:`,h)}}async function re(){const c=new ee.Command;c.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const h={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-Dk6ZcCxI.cjs")),"saltygen/index.css":Promise.resolve().then(()=>require("../index-84Wroia-.cjs")),"react/react-styled-file.ts":Promise.resolve().then(()=>require("../react-styled-file-Dkubsz-U.cjs")),"react/react-vanilla-file.ts":Promise.resolve().then(()=>require("../react-vanilla-file-CXKcUABP.cjs"))},S=async(n,a)=>{const{default:r}=await h[n],u=te.render(r,a);return{fileName:n,content:u}},P=async()=>{const n=i.join(process.cwd(),".saltyrc");return await s.readFile(n,"utf-8").then(JSON.parse).catch(()=>({}))},F=i.join(process.cwd(),"package.json"),D=async(n=F)=>{const a=await s.readFile(n,"utf-8").then(JSON.parse).catch(()=>{});if(!a)throw"Could not read package.json file!";return a},Y=async(n,a=F)=>{typeof n=="object"&&(n=JSON.stringify(n,null,2)),await s.writeFile(a,n)},B=async()=>{const n=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:W&&W.tagName.toUpperCase()==="SCRIPT"&&W.src||new URL("bin/main.cjs",document.baseURI).href);return D(n)},V=await(async()=>(await P()).defaultProject)(),k=await B(),N={core:`@salty-css/core@${k.version}`,react:`@salty-css/react@${k.version}`,eslintPluginCore:`@salty-css/eslint-plugin-core@${k.version}`,vite:`@salty-css/vite@${k.version}`,next:`@salty-css/next@${k.version}`},H=n=>{const a=n==="."?"":n,r=process.cwd();return i.join(r,a)};c.command("init [directory]").description("Initialize a new Salty-CSS project.").option("-d, --dir <dir>","Project directory to initialize the project in.").option("--css-file <css-file>","Existing CSS file where to import the generated CSS. Path must be relative to the given project directory.").option("--skip-install","Skip installing dependencies.").action(async function(n="."){if(!await D().catch(()=>{}))return m("Salty CSS project must be initialized in a directory with a package.json file.");t.info("Initializing a new Salty-CSS project!");const{dir:r=n,cssFile:u,skipInstall:g}=this.opts();if(!r)return m("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");g||(await J(N.core,N.react),await J(`-D ${N.eslintPluginCore}`));const f=process.cwd(),l=H(r),x=await Promise.all([S("salty.config.ts"),S("saltygen/index.css")]);await s.mkdir(l,{recursive:!0});const y=x.map(async({fileName:e,content:p})=>{const d=i.join(l,e);if(await s.readFile(d,"utf-8").catch(()=>{})!==void 0){t.debug("File already exists: "+d);return}const v=e.split("/").slice(0,-1).join("/");v&&await s.mkdir(i.join(l,v),{recursive:!0}),t.info("Creating file: "+d),await s.writeFile(d,p),await L(d)});await Promise.all(y);const b=i.relative(f,l)||".",j=i.join(f,".saltyrc"),o=await s.readFile(j,"utf-8").catch(()=>{});if(o===void 0){t.info("Creating file: "+j);const p=JSON.stringify({defaultProject:b,projects:[b]},null,2);await s.writeFile(j,p)}else{t.info("Edit file: "+j);const e=JSON.parse(o),p=new Set((e==null?void 0:e.projects)||[]);p.add(b),e.projects=[...p];const d=JSON.stringify(e,null,2);await s.writeFile(j,d)}const w=i.join(f,".gitignore"),O=await s.readFile(w,"utf-8").catch(()=>{});O!==void 0&&(O.includes("saltygen")||(t.info("Edit file: "+w),await s.writeFile(w,O+`
|
2
2
|
|
3
3
|
# Salty-CSS
|
4
4
|
saltygen
|
package/bin/main.js
CHANGED
@@ -40,7 +40,7 @@ async function xt() {
|
|
40
40
|
"saltygen/index.css": import("../index-D_732b92.js"),
|
41
41
|
// React
|
42
42
|
"react/react-styled-file.ts": import("../react-styled-file-CGVf5n1B.js"),
|
43
|
-
"react/react-vanilla-file.ts": import("../react-vanilla-file-
|
43
|
+
"react/react-vanilla-file.ts": import("../react-vanilla-file-C19ZM7AJ.js")
|
44
44
|
}, C = async (s, a) => {
|
45
45
|
const { default: i } = await w[s], f = it(i, a);
|
46
46
|
return { fileName: s, content: f };
|
package/package.json
CHANGED