@salty-css/core 0.0.1-alpha.47 → 0.0.1-alpha.49

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
@@ -7,4 +7,4 @@ saltygen
7
7
  `,S=E.replace(/(plugins: \[)/,`$1
8
8
  saltyPlugin(__dirname),`);g||await b(`-D ${$.vite}`),s.info("Adding Salty-CSS plugin to Vite config..."),await i.writeFile(L,p+S),await _(L)}const T=["next.config.js","next.config.cjs","next.config.ts","next.config.mjs"].map(e=>t.join(l,e)).find(e=>W.existsSync(e));if(T){let e=await i.readFile(T,"utf-8").catch(()=>{});if(e!==void 0&&!e.includes("withSaltyCss")){let c=!1;/\splugins([^=]*)=[^[]\[/.test(e)&&!c&&(e=e.replace(/\splugins([^=]*)=[^[]\[/,(q,x)=>` plugins${x}= [withSaltyCss,`),c=!0);const v=e.includes("module.exports"),J=v?`const { withSaltyCss } = require('@salty-css/next');
9
9
  `:`import { withSaltyCss } from '@salty-css/next';
10
- `;v&&!c?(e=e.replace(/module.exports = ([^;]+)/,(q,x)=>`module.exports = withSaltyCss(${x})`),c=!0):c||(e=e.replace(/export default ([^;]+)/,(q,x)=>`export default withSaltyCss(${x})`)),g||await b(`-D ${$.next}`),s.info("Adding Salty-CSS plugin to Next.js config..."),await i.writeFile(T,J+e),await _(T)}}}),a.command("build [directory]").alias("b").description("Build the Salty-CSS project.").option("-d, --dir <dir>","Project directory to build the project in.").action(async function(n=H){s.info("Building the Salty-CSS project...");const{dir:r=n}=this.opts();if(!r)return h("Project directory must be provided. Add it as the first argument after build command or use the --dir option.");const o=U(r);await Y.generateCss(o)}),a.command("generate [file] [directory]").alias("g").description("Generate a new component file.").option("-f, --file <file>","File to generate.").option("-d, --dir <dir>","Project directory to generate the file in.").option("-t, --tag <tag>","HTML tag of the component.","div").option("-n, --name <name>","Name of the component.").option("-c, --className <className>","CSS class of the component.").action(async function(n,r=H){const{file:o=n,dir:u=r,tag:g,name:f,className:l}=this.opts();if(!o)return h("File to generate must be provided. Add it as the first argument after generate command or use the --file option.");if(!u)return h("Project directory must be provided. Add it as the second argument after generate command or use the --dir option.");const C=U(u),y=o.split("/").slice(0,-1).join("/");y&&await i.mkdir(t.join(C,y),{recursive:!0});const D=t.join(C,o),d=t.parse(D);d.ext||(d.ext=".ts"),d.name.endsWith(".css")||(d.name=d.name+".css"),d.base=d.name+d.ext;const w=t.format(d);if(await i.readFile(w,"utf-8").catch(()=>{})!==void 0){s.error("File already exists:",w);return}s.info("Generating a new file: "+w);const I=Z.pascalCase(f||d.base.replace(/\.css\.\w+$/,"")),{content:O}=await j("react/react-styled-file.ts",{tag:g,name:I,className:l});await i.writeFile(w,O),await _(w)}),a.command("update [version]").alias("up").description("Update Salty-CSS packages to the latest or specified version.").option("-v, --version <version>","Version to update to.").option("--legacy-peer-deps <legacyPeerDeps>","Use legacy peer dependencies (not recommended).",!1).action(async function(n="latest"){const{legacyPeerDeps:r,version:o=n}=this.opts(),u=t.join(process.cwd(),"package.json"),g=await F(u).catch(y=>h(y));if(!g)return;const f={...g.dependencies,...g.devDependencies},l=Object.keys(f).filter(y=>y==="salty-css"||y.startsWith("@salty-css/"));if(!l.length)return h("No Salty-CSS packages found in package.json. Make sure you are running update command in the same directory! Used package.json path: "+u);const C=l.map(y=>o==="@"?`${y}@${k.version}`:`${y}@${o.replace(/^@/,"")}`);r?(s.warn("Using legacy peer dependencies to update packages."),await b(...C,"--legacy-peer-deps")):await b(...C),s.info("Salty-CSS packages updated successfully!")}),a.command("version").alias("v").description("Show the current version of Salty-CSS.").action(async function(){const n=await z();s.info("CLI is running:",n.version);const r=t.join(process.cwd(),"package.json"),o=await F(r).catch(f=>h(f));if(!o)return;const u={...o.dependencies,...o.devDependencies},g=Object.keys(u).filter(f=>f==="salty-css"||f.startsWith("@salty-css/"));if(!g.length)return h("No Salty-CSS packages found in package.json. Make sure you are running update command in the same directory! Used package.json path: "+r);for(const f of g)s.info(f,u[f])}),a.parseAsync(process.argv)}exports.main=ie;
10
+ `;v&&!c?(e=e.replace(/module.exports = ([^;]+)/,(q,x)=>`module.exports = withSaltyCss(${x})`),c=!0):c||(e=e.replace(/export default ([^;]+)/,(q,x)=>`export default withSaltyCss(${x})`)),g||await b(`-D ${$.next}`),s.info("Adding Salty-CSS plugin to Next.js config..."),await i.writeFile(T,J+e),await _(T)}}}),a.command("build [directory]").alias("b").description("Build the Salty-CSS project.").option("-d, --dir <dir>","Project directory to build the project in.").action(async function(n=H){s.info("Building the Salty-CSS project...");const{dir:r=n}=this.opts();if(!r)return h("Project directory must be provided. Add it as the first argument after build command or use the --dir option.");const o=U(r);await Y.generateCss(o)}),a.command("generate [file] [directory]").alias("g").description("Generate a new component file.").option("-f, --file <file>","File to generate.").option("-d, --dir <dir>","Project directory to generate the file in.").option("-t, --tag <tag>","HTML tag of the component.","div").option("-n, --name <name>","Name of the component.").option("-c, --className <className>","CSS class of the component.").action(async function(n,r=H){const{file:o=n,dir:u=r,tag:g,name:f,className:l}=this.opts();if(!o)return h("File to generate must be provided. Add it as the first argument after generate command or use the --file option.");if(!u)return h("Project directory must be provided. Add it as the second argument after generate command or use the --dir option.");const C=U(u),y=o.split("/").slice(0,-1).join("/");y&&await i.mkdir(t.join(C,y),{recursive:!0});const D=t.join(C,o),d=t.parse(D);d.ext||(d.ext=".ts"),d.name.endsWith(".css")||(d.name=d.name+".css"),d.base=d.name+d.ext;const w=t.format(d);if(await i.readFile(w,"utf-8").catch(()=>{})!==void 0){s.error("File already exists:",w);return}s.info("Generating a new file: "+w);const I=Z.pascalCase(f||d.base.replace(/\.css\.\w+$/,"")),{content:O}=await j("react/react-styled-file.ts",{tag:g,name:I,className:l});await i.writeFile(w,O),await _(w)}),a.command("update [version]").alias("up").description("Update Salty-CSS packages to the latest or specified version.").option("-v, --version <version>","Version to update to.").option("--legacy-peer-deps <legacyPeerDeps>","Use legacy peer dependencies (not recommended).",!1).action(async function(n="latest"){const{legacyPeerDeps:r,version:o=n}=this.opts(),u=t.join(process.cwd(),"package.json"),g=await F(u).catch(y=>h(y));if(!g)return;const f={...g.dependencies,...g.devDependencies},l=Object.keys(f).filter(y=>y==="salty-css"||y.startsWith("@salty-css/"));if(!l.length)return h("No Salty-CSS packages found in package.json. Make sure you are running update command in the same directory! Used package.json path: "+u);const C=l.map(y=>o==="@"?`${y}@${k.version}`:`${y}@${o.replace(/^@/,"")}`);r?(s.warn("Using legacy peer dependencies to update packages."),await b(...C,"--legacy-peer-deps")):await b(...C),s.info("Salty-CSS packages updated successfully!")}),a.option("-v, --version","Show the current version of Salty-CSS.").action(async function(){const n=await z();s.info("CLI is running: "+n.version);const r=t.join(process.cwd(),"package.json"),o=await F(r).catch(f=>h(f));if(!o)return;const u={...o.dependencies,...o.devDependencies},g=Object.keys(u).filter(f=>f==="salty-css"||f.startsWith("@salty-css/"));if(!g.length)return h("No Salty-CSS packages found in package.json. Make sure you are running update command in the same directory! Used package.json path: "+r);for(const f of g)s.info(`${f}: ${u[f]}`)}),a.parseAsync(process.argv)}exports.main=ie;
package/bin/main.js CHANGED
@@ -187,9 +187,9 @@ saltygen
187
187
  );
188
188
  const P = c.map((u) => s === "@" ? `${u}@${F.version}` : `${u}@${s.replace(/^@/, "")}`);
189
189
  a ? (n.warn("Using legacy peer dependencies to update packages."), await b(...P, "--legacy-peer-deps")) : await b(...P), n.info("Salty-CSS packages updated successfully!");
190
- }), o.command("version").alias("v").description("Show the current version of Salty-CSS.").action(async function() {
190
+ }), o.option("-v, --version", "Show the current version of Salty-CSS.").action(async function() {
191
191
  const e = await R();
192
- n.info("CLI is running:", e.version);
192
+ n.info("CLI is running: " + e.version);
193
193
  const a = i(process.cwd(), "package.json"), s = await x(a).catch((p) => h(p));
194
194
  if (!s) return;
195
195
  const f = { ...s.dependencies, ...s.devDependencies }, g = Object.keys(f).filter((p) => p === "salty-css" || p.startsWith("@salty-css/"));
@@ -198,7 +198,7 @@ saltygen
198
198
  "No Salty-CSS packages found in package.json. Make sure you are running update command in the same directory! Used package.json path: " + a
199
199
  );
200
200
  for (const p of g)
201
- n.info(p, f[p]);
201
+ n.info(`${p}: ${f[p]}`);
202
202
  }), o.parseAsync(process.argv);
203
203
  }
204
204
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.47",
3
+ "version": "0.0.1-alpha.49",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",