@salty-css/core 0.0.1-alpha.66 → 0.0.1-alpha.67
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 +5 -5
- package/bin/main.js +29 -29
- package/package.json +1 -1
package/bin/main.cjs
CHANGED
@@ -1,10 +1,10 @@
|
|
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"),
|
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"),L=require("winston"),se=require("child_process"),ae=require("ora");var M=typeof document<"u"?document.currentScript:null;const t=L.createLogger({level:"debug",format:L.format.combine(L.format.colorize(),L.format.cli()),transports:[new L.transports.Console({})]}),m=c=>{t.error(c)},X=c=>new Promise((h,S)=>{se.exec(c,F=>{if(F)return S(F);h()})}),N=async(...c)=>{const h=c.map(k=>k.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),S=ae(`Installing packages: ${h}`).start(),F=c.join(" ");await X(`npm install ${F}`),S.succeed(`Installed packages: ${h}`)},oe=()=>Q.existsSync(i.join(process.cwd(),"node_modules",".bin","prettier"));async function I(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-CG_WJLam.cjs"))},S=async(n,a)=>{const{default:r}=await h[n],u=te.render(r,a);return{fileName:n,content:u}},F=async()=>{const n=i.join(process.cwd(),".saltyrc");return await s.readFile(n,"utf-8").then(JSON.parse).catch(()=>({}))},k=i.join(process.cwd(),"package.json"),q=async(n=k)=>{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=k)=>{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:M&&M.tagName.toUpperCase()==="SCRIPT"&&M.src||new URL("bin/main.cjs",document.baseURI).href);return q(n)},V=await(async()=>(await F()).defaultProject)(),x=await B(),A={core:`@salty-css/core@${x.version}`,react:`@salty-css/react@${x.version}`,eslintPluginCore:`@salty-css/eslint-plugin-core@${x.version}`,vite:`@salty-css/vite@${x.version}`,next:`@salty-css/next@${x.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 q().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 N(A.core,A.react),await N(`-D ${A.eslintPluginCore}`));const f=process.cwd(),l=H(r),b=await Promise.all([S("salty.config.ts"),S("saltygen/index.css")]);await s.mkdir(l,{recursive:!0});const y=b.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 P=e.split("/").slice(0,-1).join("/");P&&await s.mkdir(i.join(l,P),{recursive:!0}),t.info("Creating file: "+d),await s.writeFile(d,p),await I(d)});await Promise.all(y);const $=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:$,projects:[$]},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($),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
|
5
|
-
`)));const v=["src","public","assets","styles","css","app"],z=["styles","css","app","pages"],G=["index","styles","main","global","globals"],R=[".css",".scss",".sass"],
|
6
|
-
`+p),await
|
5
|
+
`)));const v=["src","public","assets","styles","css","app"],z=["styles","css","app","pages"],G=["index","styles","main","global","globals"],R=[".css",".scss",".sass"],J=await(async()=>{if(u)return u;for(const e of v)for(const p of G)for(const d of R){const C=i.join(l,e,p+d);if(await s.readFile(C,"utf-8").catch(()=>{})!==void 0)return i.relative(l,C);for(const _ of z){const E=i.join(l,e,_,p+d);if(await s.readFile(E,"utf-8").catch(()=>{})!==void 0)return i.relative(l,E)}}})();if(J){const e=i.join(l,J),p=await s.readFile(e,"utf-8").catch(()=>{});if(p!==void 0&&!p.includes("saltygen")){const C=i.join(e,".."),_=`@import '${i.relative(C,i.join(l,"saltygen/index.css"))}';`;t.info("Adding global import statement to CSS file: "+e),await s.writeFile(e,_+`
|
6
|
+
`+p),await I(e)}}else t.warn("Could not find a CSS file to import the generated CSS. Please add it manually.");const T=i.join(l,"vite.config.ts"),W=await s.readFile(T,"utf-8").catch(()=>{});if(W!==void 0&&!W.includes("saltyPlugin")){t.info("Edit file: "+T);const p=`import { saltyPlugin } from '@salty-css/vite';
|
7
7
|
`,C=W.replace(/(plugins: \[)/,`$1
|
8
|
-
saltyPlugin(__dirname),`);g||await
|
8
|
+
saltyPlugin(__dirname),`);g||await N(`-D ${A.vite}`),t.info("Adding Salty-CSS plugin to Vite config..."),await s.writeFile(T,p+C),await I(T)}const U=["next.config.js","next.config.cjs","next.config.ts","next.config.mjs"].map(e=>i.join(l,e)).find(e=>Q.existsSync(e));if(U){let e=await s.readFile(U,"utf-8").catch(()=>{});if(e!==void 0&&!e.includes("withSaltyCss")){let d=!1;/\splugins([^=]*)=[^[]\[/.test(e)&&!d&&(e=e.replace(/\splugins([^=]*)=[^[]\[/,(E,D)=>` plugins${D}= [withSaltyCss,`),d=!0);const P=e.includes("module.exports"),_=P?`const { withSaltyCss } = require('@salty-css/next');
|
9
9
|
`:`import { withSaltyCss } from '@salty-css/next';
|
10
|
-
`;P&&!d?(e=e.replace(/module.exports = ([^;]+)/,(
|
10
|
+
`;P&&!d?(e=e.replace(/module.exports = ([^;]+)/,(E,D)=>`module.exports = withSaltyCss(${D})`),d=!0):d||(e=e.replace(/export default ([^;]+)/,(E,D)=>`export default withSaltyCss(${D})`)),g||await N(`-D ${A.next}`),t.info("Adding Salty-CSS plugin to Next.js config..."),await s.writeFile(U,_+e),await I(U)}}const Z=await q().catch(()=>m("Could not read package.json file.")).then(e=>(e.scripts||(e.scripts={}),e.scripts.prepare?e.scripts.prepare.includes("salty-css")||(t.info("Edit file: "+k),e.scripts.prepare=e.scripts.prepare+" && npx salty-css build"):(t.info("Edit file: "+k),e.scripts.prepare="npx salty-css build"),e));await Y(Z),t.info("🎉 Salty CSS project initialized successfully!"),t.info("Next steps:"),t.info("1. Configure variables and templates in `salty.config.ts`"),t.info("2. Create a new component with `npx salty-css generate [component-name]`"),t.info("3. Run `npx salty-css build` to generate the CSS"),t.info("4. Read about the features in the documentation: https://salty-css.dev"),t.info("5. Star the project on GitHub: https://github.com/margarita-form/salty-css ⭐")}),c.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=V){t.info("Building the Salty-CSS project...");const{dir:a=n}=this.opts();if(!a)return m("Project directory must be provided. Add it as the first argument after build command or use the --dir option.");const r=H(a);await ne.generateCss(r)}),c.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.").option("-rc, --reactComponent <rc>","Generate a React component as well.").action(async function(n,a=V){const{file:r=n,dir:u=a,tag:g,name:f,className:l,reactComponent:b=!1}=this.opts();if(!r)return m("File to generate must be provided. Add it as the first argument after generate command or use the --file option.");if(!u)return m("Project directory must be provided. Add it as the second argument after generate command or use the --dir option.");const y=H(u),$=r.split("/").slice(0,-1).join("/");$&&await s.mkdir(i.join(y,$),{recursive:!0});const j=i.join(y,r),o=i.parse(j);o.ext||(o.ext=".ts"),o.name.endsWith(".css")||(o.name=o.name+".css"),o.base=o.name+o.ext;const w=i.format(o);if(await s.readFile(w,"utf-8").catch(()=>{})!==void 0){t.error("File already exists:",w);return}let v=ie.pascalCase(f||o.base.replace(/\.css\.\w+$/,""));if(b){const G=v+"Component";v=v+"Wrapper";const R=o.base.replace(/\.css\.\w+$/,""),{content:K}=await S("react/react-vanilla-file.ts",{tag:g,componentName:G,styledComponentName:v,className:l,fileName:R});o.name=R.replace(/\.css$/,""),o.ext=".tsx",o.base=o.name+o.ext;const J=i.format(o);t.info("Generating a new file: "+J),await s.writeFile(J,K),await I(J)}const{content:z}=await S("react/react-styled-file.ts",{tag:g,name:v,className:l});t.info("Generating a new file: "+w),await s.writeFile(w,z),await I(w)}),c.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:a,version:r=n}=this.opts(),u=i.join(process.cwd(),"package.json"),g=await q(u).catch(y=>m(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 m("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 b=l.map(y=>r==="@"?`${y}@${x.version}`:`${y}@${r.replace(/^@/,"")}`);a?(t.warn("Using legacy peer dependencies to update packages."),await N(...b,"--legacy-peer-deps")):await N(...b),t.info("Salty-CSS packages updated successfully!")}),c.option("-v, --version","Show the current version of Salty-CSS.").action(async function(){const n=await B();t.info("CLI is running: "+n.version);const a=i.join(process.cwd(),"package.json"),r=await q(a).catch(f=>m(f));if(!r)return;const u={...r.dependencies,...r.devDependencies},g=Object.keys(u).filter(f=>f==="salty-css"||f.startsWith("@salty-css/"));if(!g.length)return m("No Salty-CSS packages found in package.json. Make sure you are running update command in the same directory! Used package.json path: "+a);for(const f of g)t.info(`${f}: ${u[f]}`)}),c.parseAsync(process.argv)}exports.main=re;
|
package/bin/main.js
CHANGED
@@ -19,11 +19,11 @@ const e = ct({
|
|
19
19
|
if (x) return C(x);
|
20
20
|
w();
|
21
21
|
});
|
22
|
-
}),
|
22
|
+
}), I = async (...r) => {
|
23
23
|
const w = r.map((b) => b.replace("-D", "").split("@").slice(0, -1).join("@").trim()).join(", "), C = dt(`Installing packages: ${w}`).start(), x = r.join(" ");
|
24
24
|
await tt(`npm install ${x}`), C.succeed(`Installed packages: ${w}`);
|
25
25
|
}, ft = () => Z(o(process.cwd(), "node_modules", ".bin", "prettier"));
|
26
|
-
async function
|
26
|
+
async function A(r) {
|
27
27
|
try {
|
28
28
|
if (!ft()) return;
|
29
29
|
await tt(`./node_modules/.bin/prettier --write "${r}"`), e.info(`Formatted ${r} with Prettier`);
|
@@ -47,7 +47,7 @@ async function xt() {
|
|
47
47
|
}, x = async () => {
|
48
48
|
const s = o(process.cwd(), ".saltyrc");
|
49
49
|
return await m(s, "utf-8").then(JSON.parse).catch(() => ({}));
|
50
|
-
}, b = o(process.cwd(), "package.json"),
|
50
|
+
}, b = o(process.cwd(), "package.json"), E = async (s = b) => {
|
51
51
|
const a = await m(s, "utf-8").then(JSON.parse).catch(() => {
|
52
52
|
});
|
53
53
|
if (!a) throw "Could not read package.json file!";
|
@@ -56,8 +56,8 @@ async function xt() {
|
|
56
56
|
typeof s == "object" && (s = JSON.stringify(s, null, 2)), await y(a, s);
|
57
57
|
}, K = async () => {
|
58
58
|
const s = new URL("../package.json", import.meta.url);
|
59
|
-
return
|
60
|
-
}, Q = await (async () => (await x()).defaultProject)(), F = await K(),
|
59
|
+
return E(s);
|
60
|
+
}, Q = await (async () => (await x()).defaultProject)(), F = await K(), O = {
|
61
61
|
core: `@salty-css/core@${F.version}`,
|
62
62
|
react: `@salty-css/react@${F.version}`,
|
63
63
|
eslintPluginCore: `@salty-css/eslint-plugin-core@${F.version}`,
|
@@ -68,12 +68,12 @@ async function xt() {
|
|
68
68
|
return o(i, a);
|
69
69
|
};
|
70
70
|
r.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(s = ".") {
|
71
|
-
if (!await
|
71
|
+
if (!await E().catch(() => {
|
72
72
|
})) return h("Salty CSS project must be initialized in a directory with a package.json file.");
|
73
73
|
e.info("Initializing a new Salty-CSS project!");
|
74
74
|
const { dir: i = s, cssFile: f, skipInstall: g } = this.opts();
|
75
75
|
if (!i) return h("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");
|
76
|
-
g || (await
|
76
|
+
g || (await I(O.core, O.react), await I(`-D ${O.eslintPluginCore}`));
|
77
77
|
const d = process.cwd(), c = G(i), $ = await Promise.all([C("salty.config.ts"), C("saltygen/index.css")]);
|
78
78
|
await B(c, { recursive: !0 });
|
79
79
|
const u = $.map(async ({ fileName: t, content: p }) => {
|
@@ -84,7 +84,7 @@ async function xt() {
|
|
84
84
|
return;
|
85
85
|
}
|
86
86
|
const k = t.split("/").slice(0, -1).join("/");
|
87
|
-
k && await B(o(c, k), { recursive: !0 }), e.info("Creating file: " + l), await y(l, p), await
|
87
|
+
k && await B(o(c, k), { recursive: !0 }), e.info("Creating file: " + l), await y(l, p), await A(l);
|
88
88
|
});
|
89
89
|
await Promise.all(u);
|
90
90
|
const J = z(d, c) || ".", P = o(d, ".saltyrc"), n = await m(P, "utf-8").catch(() => {
|
@@ -110,7 +110,7 @@ async function xt() {
|
|
110
110
|
# Salty-CSS
|
111
111
|
saltygen
|
112
112
|
`)));
|
113
|
-
const j = ["src", "public", "assets", "styles", "css", "app"], W = ["styles", "css", "app", "pages"], M = ["index", "styles", "main", "global", "globals"], R = [".css", ".scss", ".sass"],
|
113
|
+
const j = ["src", "public", "assets", "styles", "css", "app"], W = ["styles", "css", "app", "pages"], M = ["index", "styles", "main", "global", "globals"], R = [".css", ".scss", ".sass"], D = await (async () => {
|
114
114
|
if (f) return f;
|
115
115
|
for (const t of j)
|
116
116
|
for (const p of M)
|
@@ -118,20 +118,20 @@ saltygen
|
|
118
118
|
const v = o(c, t, p + l);
|
119
119
|
if (await m(v, "utf-8").catch(() => {
|
120
120
|
}) !== void 0) return z(c, v);
|
121
|
-
for (const
|
122
|
-
const
|
123
|
-
if (await m(
|
124
|
-
}) !== void 0) return z(c,
|
121
|
+
for (const L of W) {
|
122
|
+
const H = o(c, t, L, p + l);
|
123
|
+
if (await m(H, "utf-8").catch(() => {
|
124
|
+
}) !== void 0) return z(c, H);
|
125
125
|
}
|
126
126
|
}
|
127
127
|
})();
|
128
|
-
if (
|
129
|
-
const t = o(c,
|
128
|
+
if (D) {
|
129
|
+
const t = o(c, D), p = await m(t, "utf-8").catch(() => {
|
130
130
|
});
|
131
131
|
if (p !== void 0 && !p.includes("saltygen")) {
|
132
|
-
const v = o(t, ".."),
|
133
|
-
e.info("Adding global import statement to CSS file: " + t), await y(t,
|
134
|
-
` + p), await
|
132
|
+
const v = o(t, ".."), L = `@import '${z(v, o(c, "saltygen/index.css"))}';`;
|
133
|
+
e.info("Adding global import statement to CSS file: " + t), await y(t, L + `
|
134
|
+
` + p), await A(t);
|
135
135
|
}
|
136
136
|
} else
|
137
137
|
e.warn("Could not find a CSS file to import the generated CSS. Please add it manually.");
|
@@ -142,7 +142,7 @@ saltygen
|
|
142
142
|
const p = `import { saltyPlugin } from '@salty-css/vite';
|
143
143
|
`, v = q.replace(/(plugins: \[)/, `$1
|
144
144
|
saltyPlugin(__dirname),`);
|
145
|
-
g || await
|
145
|
+
g || await I(`-D ${O.vite}`), e.info("Adding Salty-CSS plugin to Vite config..."), await y(U, p + v), await A(U);
|
146
146
|
}
|
147
147
|
const _ = ["next.config.js", "next.config.cjs", "next.config.ts", "next.config.mjs"].map((t) => o(c, t)).find((t) => Z(t));
|
148
148
|
if (_) {
|
@@ -150,14 +150,14 @@ saltygen
|
|
150
150
|
});
|
151
151
|
if (t !== void 0 && !t.includes("withSaltyCss")) {
|
152
152
|
let l = !1;
|
153
|
-
/\splugins([^=]*)=[^[]\[/.test(t) && !l && (t = t.replace(/\splugins([^=]*)=[^[]\[/, (
|
154
|
-
const k = t.includes("module.exports"),
|
153
|
+
/\splugins([^=]*)=[^[]\[/.test(t) && !l && (t = t.replace(/\splugins([^=]*)=[^[]\[/, (H, N) => ` plugins${N}= [withSaltyCss,`), l = !0);
|
154
|
+
const k = t.includes("module.exports"), L = k ? `const { withSaltyCss } = require('@salty-css/next');
|
155
155
|
` : `import { withSaltyCss } from '@salty-css/next';
|
156
156
|
`;
|
157
|
-
k && !l ? (t = t.replace(/module.exports = ([^;]+)/, (
|
157
|
+
k && !l ? (t = t.replace(/module.exports = ([^;]+)/, (H, N) => `module.exports = withSaltyCss(${N})`), l = !0) : l || (t = t.replace(/export default ([^;]+)/, (H, N) => `export default withSaltyCss(${N})`)), g || await I(`-D ${O.next}`), e.info("Adding Salty-CSS plugin to Next.js config..."), await y(_, L + t), await A(_);
|
158
158
|
}
|
159
159
|
}
|
160
|
-
const st = await
|
160
|
+
const st = await E().catch(() => h("Could not read package.json file.")).then((t) => (t.scripts || (t.scripts = {}), t.scripts.prepare ? t.scripts.prepare.includes("salty-css") || (e.info("Edit file: " + b), t.scripts.prepare = t.scripts.prepare + " && npx salty-css build") : (e.info("Edit file: " + b), t.scripts.prepare = "npx salty-css build"), t));
|
161
161
|
await et(st), e.info("🎉 Salty CSS project initialized successfully!"), e.info("Next steps:"), e.info("1. Configure variables and templates in `salty.config.ts`"), e.info("2. Create a new component with `npx salty-css generate [component-name]`"), e.info("3. Run `npx salty-css build` to generate the CSS"), e.info("4. Read about the features in the documentation: https://salty-css.dev"), e.info("5. Star the project on GitHub: https://github.com/margarita-form/salty-css ⭐");
|
162
162
|
}), r.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(s = Q) {
|
163
163
|
e.info("Building the Salty-CSS project...");
|
@@ -185,13 +185,13 @@ saltygen
|
|
185
185
|
j = j + "Wrapper";
|
186
186
|
const R = n.base.replace(/\.css\.\w+$/, ""), { content: X } = await C("react/react-vanilla-file.ts", { tag: g, componentName: M, styledComponentName: j, className: c, fileName: R });
|
187
187
|
n.name = R.replace(/\.css$/, ""), n.ext = ".tsx", n.base = n.name + n.ext;
|
188
|
-
const
|
189
|
-
e.info("Generating a new file: " +
|
188
|
+
const D = Y(n);
|
189
|
+
e.info("Generating a new file: " + D), await y(D, X), await A(D);
|
190
190
|
}
|
191
191
|
const { content: W } = await C("react/react-styled-file.ts", { tag: g, name: j, className: c });
|
192
|
-
e.info("Generating a new file: " + S), await y(S, W), await
|
192
|
+
e.info("Generating a new file: " + S), await y(S, W), await A(S);
|
193
193
|
}), r.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(s = "latest") {
|
194
|
-
const { legacyPeerDeps: a, version: i = s } = this.opts(), f = o(process.cwd(), "package.json"), g = await
|
194
|
+
const { legacyPeerDeps: a, version: i = s } = this.opts(), f = o(process.cwd(), "package.json"), g = await E(f).catch((u) => h(u));
|
195
195
|
if (!g) return;
|
196
196
|
const d = { ...g.dependencies, ...g.devDependencies }, c = Object.keys(d).filter((u) => u === "salty-css" || u.startsWith("@salty-css/"));
|
197
197
|
if (!c.length)
|
@@ -199,11 +199,11 @@ saltygen
|
|
199
199
|
"No Salty-CSS packages found in package.json. Make sure you are running update command in the same directory! Used package.json path: " + f
|
200
200
|
);
|
201
201
|
const $ = c.map((u) => i === "@" ? `${u}@${F.version}` : `${u}@${i.replace(/^@/, "")}`);
|
202
|
-
a ? (e.warn("Using legacy peer dependencies to update packages."), await
|
202
|
+
a ? (e.warn("Using legacy peer dependencies to update packages."), await I(...$, "--legacy-peer-deps")) : await I(...$), e.info("Salty-CSS packages updated successfully!");
|
203
203
|
}), r.option("-v, --version", "Show the current version of Salty-CSS.").action(async function() {
|
204
204
|
const s = await K();
|
205
205
|
e.info("CLI is running: " + s.version);
|
206
|
-
const a = o(process.cwd(), "package.json"), i = await
|
206
|
+
const a = o(process.cwd(), "package.json"), i = await E(a).catch((d) => h(d));
|
207
207
|
if (!i) return;
|
208
208
|
const f = { ...i.dependencies, ...i.devDependencies }, g = Object.keys(f).filter((d) => d === "salty-css" || d.startsWith("@salty-css/"));
|
209
209
|
if (!g.length)
|