bernova 1.0.1 → 1.2.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,34 @@ All notable changes to Bernova will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.2.0] - 2026-01-14
9
+
10
+ ### New Features
11
+
12
+ - **Added new bv-build cli flags**: Added flags to overwrite baseOutDir, rootDir, preventMoveJS, preventMoveDTS and set preventProcessJS
13
+
14
+ ### Fixed
15
+
16
+ - **Prevent minify declaration files**: Prevent minify with terser the typescript declaration files
17
+
18
+ ### Documentation
19
+
20
+ - **Added the new flags documentation**: Added the documentation about the new flags cases
21
+
22
+ ## [1.1.0] - 2026-01-13
23
+
24
+ ### New Features
25
+
26
+ - **Added cli bv-build flags**: Added flags to overwrite css, tools and provider customOutDirs
27
+
28
+ ### Documentation
29
+
30
+ - **Added documentation for cli flags**: Added documentation about the flags uses cases
31
+
32
+ ### Fixed
33
+
34
+ - **Prevent transpile declaration files**: Added logic to prevent process typescript declaration files
35
+
8
36
  ## [1.0.1] - 2026-01-12
9
37
 
10
38
  ### Fixed
package/README.md CHANGED
@@ -1852,4 +1852,48 @@ When publishing our projects, depending of the packager configuration, it is nec
1852
1852
  - **customOutDirs**: An optional object that allows you to specify custom output directories for different file types, overriding the default structure:
1853
1853
  - `"css"`: Custom output path for CSS files
1854
1854
  - `"provider"`: Custom output path for provider file
1855
- - `"tools"`: Custom output path for tools files (cssVars, cssClasses, etc)
1855
+ - `"tools"`: Custom output path for tools files (cssVars, cssClasses, etc)
1856
+
1857
+ ### Overwrite or set a single customOutDirs
1858
+
1859
+ You may need to run the bv-build script in multiple outputs, and the bernova.config.json file configuration only supports one path. In these cases, you can use flags to specify the output path for the specific case.
1860
+
1861
+ ```bash
1862
+ # css case
1863
+ npx bv-build --css dist/custom/output
1864
+
1865
+ # tools case
1866
+ npx bv-build --tools dist/custom/output
1867
+
1868
+ # provider and stats case
1869
+ npx bv-build --provider dist/custom/output
1870
+
1871
+ # full case
1872
+ npx bv-build --css dist/custom/output --tools dist/custom/output --provider dist/custom/output
1873
+ ```
1874
+
1875
+ There are other cases where you may need to override values set in the bernova.config.json document or set a specific value for a single case.
1876
+
1877
+ **Important**: For affirmative Boolean values, it is sufficient to set the flag. And to remove values set in the bernova.config.json file, the word `'none'` is used.
1878
+
1879
+ The flags available for this are:
1880
+
1881
+ ```bash
1882
+ # baseOutDir case
1883
+ npx bv-build --base-out-dir custom/base/out/dir
1884
+
1885
+ # rootDir case
1886
+ npx bv-build --root-dir custom/root/dir
1887
+
1888
+ # preventMoveJS case
1889
+ npx bv-build --prevent-move-js
1890
+
1891
+ # preventMoveDTS case
1892
+ npx bv-build --prevent-move-dts
1893
+
1894
+ # unset types values from bernova.config.json
1895
+ npx bv-build --types none
1896
+
1897
+ # Prevent process the js ad dts files
1898
+ npx bv-build --prevent-process-js
1899
+ ```
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const e=require("fs").promises,s=require("path"),t=require("@babel/core"),{minify:a}=require("terser"),{extractDocFragment:r,writeDoc:n,fileExists:o,readConfigData:i,buildRelativePath:c}=require("../src/lib");async function m({baseOutPath:t,jsFile:a,rootDir:i,customOutDirs:m,dir:l,minifyJS:p,preventMoveJS:f,provider:d,type:y=""}){const b=s.resolve(l,a.path,a.name);if(!o(l,b))return void console.error(`File not found: ${b}`);let D=await e.readFile(b,"utf8");if("stats.js"===a.name&&m?.css){const e=r({section:"CssThemes",doc:D}),t=e.replace(/export const cssThemes\s*=\s*/,""),a=new Function(`return (${t})`)(),n=s.relative(i||"",d.path),o=v({cssThemes:a,cssOutPath:c({from:s.resolve(n),to:s.resolve(l,m.css)})});D=D.replace(e,`export const cssThemes = {\n${o}};\n`)}"cjs"===y&&(D=await u(D,b,!0)),"esm"===y&&(D=await u(D,b)),p&&(D=await h(D));const O=s.relative(i||"",a.path),g=f?b:s.resolve(t,O,a.name);await n(g,D,a.name)}async function l({baseOutPath:t,cssFiles:a,rootDir:r,customOutDirs:i,dir:c}){for(const m of a){const a=(()=>r&&i?.css?s.relative(r,m.path):i?.css?i.css:m.path)(),l=s.resolve(c,m.path,m.name);if(o(c,l)){const r=await e.readFile(l,"utf8");await n(s.resolve(t,a,m.name),r,m.name)}}}function p({baseOutDir:e,type:t="-"}){const a=(()=>{switch(t){case"cjs":return"cjs";case"esm":return"esm";default:return""}})();return s.join(e,a)}async function u(e,s,a=!1){const r=!!a&&"commonjs";return(await t.transformAsync(e,{filename:s,presets:[["@babel/preset-env",{modules:r,targets:{node:"current"}}]]})).code}async function h(e){return(await a(e,{compress:{dead_code:!0,drop_console:!1,drop_debugger:!0,keep_classnames:!1,keep_fargs:!0,keep_fnames:!1,keep_infinity:!1},mangle:{toplevel:!1},format:{comments:!1}})).code}function f({themes:e,minifyCss:t}){return e&&Array.isArray(e)&&e.length>0?e.reduce((e,a)=>{const{name:r,stylesPath:n,foreignThemes:o}=a;r&&n&&y(e,{name:t?`${r}.min.css`:`${r}.css`,path:n}),o&&Array.isArray(o)&&o.length>0&&o.forEach(t=>{const a=s.basename(t),r=t.replace(a,"").trim();y(e,{name:a,path:r})})},[]):[]}function d({provider:e,themes:s,preventMoveDTS:t=!1}){const a=s&&s.bvTools?s.reduce((e,{bvTools:s})=>{const{path:a,declarationHelp:r,cssVariables:n,cssClassNames:o,cssMediaQueries:i,cssGlobalStyles:c,availableComponents:m}=s,l=r&&!t;return n&&(y(e,{name:"cssVars.js",path:a}),l&&y(e,{name:"cssVars.d.ts",path:a})),o&&(y(e,{name:"cssClasses.js",path:a}),l&&y(e,{name:"cssClasses.d.ts",path:a})),i&&(y(e,{name:"cssMediaQueries.js",path:a}),l&&y(e,{name:"cssMediaQueries.d.ts",path:a})),c&&(y(e,{name:"cssGlobalStyles.js",path:a}),l&&y(e,{name:"cssGlobalStyles.d.ts",path:a})),m&&(y(e,{name:"cssAvailableComponents.js",path:a}),l&&y(e,{name:"cssAvailableComponents.d.js",path:a})),e},[]):[];return e&&(y(a,{name:`${e.name.toLocaleLowerCase()}.js`,path:e.path}),y(a,{name:"stats.js",path:`${e.path}/stats`}),e.declarationHelp&&!t&&(y(a,{name:`${e.name.toLocaleLowerCase()}.d.ts`,path:e.path}),y(a,{name:"stats.d.ts",path:`${e.path}/stats`}))),a}function v({cssThemes:e,cssOutPath:t}){return Object.entries(e).reduce((e,[a,{foreign:r}])=>{const{before:n,after:o}=r;n&&Array.isArray(n)&&n.length>0&&n.reduce((e,a,r)=>{const n=s.basename(a);return r>0&&(e+=", "),e+`'${t}${n}'`},""),o&&Array.isArray(o)&&o.length>0&&o.reduce((e,a,r)=>{const n=s.basename(a);return r>0&&(e+=", "),e+`'${t}${n}'`},"")},"")}function y(e,s){e.some(e=>e.name===s.name&&e.path===s.path)||e.push(s)}(async()=>{const e=process.cwd(),t=await i(s.resolve(e,"bernova.config.json")),{compilerOptions:a,provider:r,themes:n}=t;a&&r&&n||(console.error("Invalid configuration: Missing compilerOptions, themes or provider"),process.exit(1));const{baseOutDir:o,rootDir:c,minifyCss:u,minifyJS:h,preventMoveJS:v,preventMoveDTS:y,types:b,customOutDirs:D}=a,O=f({themes:n,minifyCss:u}),g=d({provider:r,themes:n,preventMoveDTS:y});if(b&&Array.isArray(b)&&b.length>0)for(const s of b){const t=p({baseOutDir:o,type:s});if(O&&O.length>0&&await l({baseOutPath:t,cssFiles:O,rootDir:c,customOutDirs:D,dir:e}),g&&g.length>0)for(const a of g)await m({baseOutPath:t,jsFile:a,rootDir:c,customOutDirs:D,dir:e,minifyJS:h,preventMoveJS:v,provider:r,type:s})}else{const s=p({baseOutDir:o});if(O&&O.length>0&&await l({baseOutPath:s,cssFiles:O,rootDir:c,customOutDirs:D,dir:e}),g&&g.length>0)for(const t of g)await m({baseOutPath:s,jsFile:t,rootDir:c,customOutDirs:D,dir:e,minifyJS:h,preventMoveJS:v,provider:r})}})();
2
+ const e=require("fs").promises,s=require("path"),t=require("@babel/core"),{minify:r}=require("terser"),{extractDocFragment:a,writeDoc:o,fileExists:n,readConfigData:i,buildRelativePath:c}=require("../src/lib");async function p({baseOutPath:t,jsFile:r,rootDir:i,customOutDirs:p,dir:l,minifyJS:m,preventMoveJS:d,provider:v,type:y=""}){const b=r.name.endsWith(".d.ts"),D=s.resolve(l,r.path,r.name);if(!n(l,D))return void console.error(`File not found: ${D}`);let g=await e.readFile(D,"utf8");if("stats.js"===r.name&&p?.css){const e=a({section:"CssThemes",doc:g}),t=e.replace(/export const cssThemes\s*=\s*/,""),r=new Function(`return (${t})`)(),o=s.relative(i||"",v.path),n=f({cssThemes:r,cssOutPath:c({from:s.resolve(o),to:s.resolve(l,p.css)})});g=g.replace(e,`export const cssThemes = {\n${n}};\n`)}"cjs"!==y||b||(g=await u(g,D,!0)),"esm"!==y||b||(g=await u(g,D)),m&&!b&&(g=await h(g));const O=s.relative(i||"",r.path),j=d?D:s.resolve(t,O,r.name);await o(j,g,r.name)}async function l({baseOutPath:t,cssFiles:r,rootDir:a,customOutDirs:i,dir:c}){for(const p of r){const r=(()=>a&&i?.css?s.relative(a,p.path):i?.css?i.css:p.path)(),l=s.resolve(c,p.path,p.name);if(n(c,l)){const a=await e.readFile(l,"utf8");await o(s.resolve(t,r,p.name),a,p.name)}}}function m({baseOutDir:e,type:t="-"}){const r=(()=>{switch(t){case"cjs":return"cjs";case"esm":return"esm";default:return""}})();return s.join(e,r)}async function u(e,s,r=!1){const a=!!r&&"commonjs";return(await t.transformAsync(e,{filename:s,presets:[["@babel/preset-env",{modules:a,targets:{node:"current"}}]]})).code}async function h(e){return(await r(e,{compress:{dead_code:!0,drop_console:!1,drop_debugger:!0,keep_classnames:!1,keep_fargs:!0,keep_fnames:!1,keep_infinity:!1},mangle:{toplevel:!1},format:{comments:!1}})).code}function d({themes:e,minifyCss:t}){return e&&Array.isArray(e)&&e.length>0?e.reduce((e,r)=>{const{name:a,stylesPath:o,foreignThemes:n}=r;return a&&o&&y(e,{name:t?`${a}.min.css`:`${a}.css`,path:o}),n&&Array.isArray(n)&&n.length>0&&n.forEach(t=>{const r=s.basename(t),a=t.replace(r,"").trim();y(e,{name:r,path:a})}),e},[]):[]}function v({provider:e,themes:s,preventMoveDTS:t=!1}){const r=s&&s.bvTools?s.reduce((e,{bvTools:s})=>{const{path:r,declarationHelp:a,cssVariables:o,cssClassNames:n,cssMediaQueries:i,cssGlobalStyles:c,availableComponents:p}=s,l=a&&!t;return o&&(y(e,{name:"cssVars.js",path:r}),l&&y(e,{name:"cssVars.d.ts",path:r})),n&&(y(e,{name:"cssClasses.js",path:r}),l&&y(e,{name:"cssClasses.d.ts",path:r})),i&&(y(e,{name:"cssMediaQueries.js",path:r}),l&&y(e,{name:"cssMediaQueries.d.ts",path:r})),c&&(y(e,{name:"cssGlobalStyles.js",path:r}),l&&y(e,{name:"cssGlobalStyles.d.ts",path:r})),p&&(y(e,{name:"cssAvailableComponents.js",path:r}),l&&y(e,{name:"cssAvailableComponents.d.js",path:r})),e},[]):[];return e&&(y(r,{name:`${e.name.toLocaleLowerCase()}.js`,path:e.path}),y(r,{name:"stats.js",path:`${e.path}/stats`}),e.declarationHelp&&!t&&(y(r,{name:`${e.name.toLocaleLowerCase()}.d.ts`,path:e.path}),y(r,{name:"stats.d.ts",path:`${e.path}/stats`}))),r}function f({cssThemes:e,cssOutPath:t}){return Object.entries(e).reduce((e,[r,{foreign:a}])=>{const{before:o,after:n}=a;o&&Array.isArray(o)&&o.length>0&&o.reduce((e,r,a)=>{const o=s.basename(r);return a>0&&(e+=", "),e+`'${t}${o}'`},""),n&&Array.isArray(n)&&n.length>0&&n.reduce((e,r,a)=>{const o=s.basename(r);return a>0&&(e+=", "),e+`'${t}${o}'`},"")},"")}function y(e,s){e.some(e=>e.name===s.name&&e.path===s.path)||e.push(s)}function b(){const e=["--base-out-dir","--root-dir","--prevent-process-js","--prevent-move-js","--prevent-move-dts","--types","--css","--tools","--provider"],s={};for(let t=0;t<process.argv.length;t++)if(e.includes(process.argv[t])){const r=process.argv[t].replace("--","").replace(/-([a-z])/g,(e,s)=>s.toUpperCase()),a=process.argv[t+1];s[r]=(()=>!(a&&!e.includes(a))||("none"===a.toLocaleLowerCase()?"":a))()}return s}function D({jsonCustomOutDirs:e,cliCustomOutDirs:s}){let t={};return e&&(t={...e}),s&&(t={...t,...s}),Object.keys(t).length>0?t:void 0}(async()=>{const e=process.cwd(),t=await i(s.resolve(e,"bernova.config.json")),{compilerOptions:r,provider:a,themes:o}=t;r&&a&&o||(console.error("Invalid configuration: Missing compilerOptions, themes or provider"),process.exit(1));const{baseOutDir:n,rootDir:c,minifyCss:u,minifyJS:h,preventMoveJS:f,preventMoveDTS:y,types:g,customOutDirs:O}=r,{baseOutDir:j,rootDir:w,types:C,preventMoveJs:S,preventMoveDts:A,preventProcessJs:M=!1,...$}=b(),F=j??n??"",P=w??c??void 0,T=S??f??!1,J=A??y??!1,_=C??g??void 0,L=D({jsonCustomOutDirs:O,cliCustomOutDirs:$}),k=d({themes:o,minifyCss:u}),q=M?[]:v({provider:a,themes:o,preventMoveDTS:J});if(_&&Array.isArray(_)&&_.length>0)for(const s of _){const t=m({baseOutDir:F,type:s});if(k&&k.length>0&&await l({baseOutPath:t,cssFiles:k,rootDir:P,customOutDirs:L,dir:e}),q&&q.length>0)for(const r of q)await p({baseOutPath:t,jsFile:r,rootDir:P,customOutDirs:L,dir:e,minifyJS:h,preventMoveJS:T,provider:a,type:s})}else{const s=m({baseOutDir:F});if(k&&k.length>0&&await l({baseOutPath:s,cssFiles:k,rootDir:P,customOutDirs:L,dir:e}),q&&q.length>0)for(const t of q)await p({baseOutPath:s,jsFile:t,rootDir:P,customOutDirs:L,dir:e,minifyJS:h,preventMoveJS:T,provider:a})}})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bernova",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "The best way to write CSS with Javascript syntax",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",