bernova 1.0.0 → 1.1.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,31 @@ 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.1.1] - 2026-01-13
9
+
10
+ ### New Features
11
+
12
+ - **Added cli flags**: Added flags to overwrite css, tools and provider customOutDirs
13
+
14
+ ### Documentation
15
+
16
+ - **Added documentation for cli flags**: Added documentation about the flags uses cases
17
+
18
+ ### Fixed
19
+
20
+ - **Prevent transpile declaration files**: Added logic to prevent process typescript declaration files
21
+
22
+ ## [1.0.1] - 2026-01-12
23
+
24
+ ### Fixed
25
+
26
+ - **Semantic problem solved**: change target for targets
27
+
28
+ ### Documentatation
29
+
30
+ - **Added the bernova build script example**: Added the bv-build example.
31
+ - **Added the instalation examples with anothers packages manager**: Added examples for `'npm'` and `'yarn`
32
+
8
33
  ## [1.0.0] - 2026-01-08
9
34
 
10
35
  ### New Features
package/README.md CHANGED
@@ -51,10 +51,20 @@
51
51
  - [Multi themes](#using-multi-themes)
52
52
  - [Provider](#library-provider)
53
53
  - [Foreign CSS documents](#foreign-css-documents)
54
+ - [Compiler Options](#compiler-options)
54
55
 
55
56
  ## Installation
56
57
 
58
+ You can install Bernova using your preferred package manager:
59
+
57
60
  ```bash
61
+ # Using npm
62
+ npm install bernova
63
+
64
+ # Using yarn
65
+ yarn add bernova
66
+
67
+ # Using pnpm (recommended)
58
68
  pnpm add bernova
59
69
  ```
60
70
 
@@ -1791,6 +1801,12 @@ export const LOGIN_BUTTON = {
1791
1801
 
1792
1802
  ## Compiler Options
1793
1803
 
1804
+ There is a script provided by the library to generate a build/dist bundler is:
1805
+
1806
+ ```bash
1807
+ npx bv-build
1808
+ ```
1809
+
1794
1810
  When publishing our projects, depending of the packager configuration, it is necessary to move static files or other types of documents not originalle included. Bernova manages the files necessary for proper operation in production.
1795
1811
 
1796
1812
  ```json
@@ -1836,4 +1852,22 @@ When publishing our projects, depending of the packager configuration, it is nec
1836
1852
  - **customOutDirs**: An optional object that allows you to specify custom output directories for different file types, overriding the default structure:
1837
1853
  - `"css"`: Custom output path for CSS files
1838
1854
  - `"provider"`: Custom output path for provider file
1839
- - `"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
+ ```
@@ -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,target:{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:n,fileExists:o,readConfigData:i,buildRelativePath:c}=require("../src/lib");async function l({baseOutPath:t,jsFile:r,rootDir:i,customOutDirs:l,dir:m,minifyJS:u,preventMoveJS:d,provider:f,type:y=""}){const b=r.name.endsWith(".d.ts"),g=s.resolve(m,r.path,r.name);if(!o(m,g))return void console.error(`File not found: ${g}`);let D=await e.readFile(g,"utf8");if("stats.js"===r.name&&l?.css){const e=a({section:"CssThemes",doc:D}),t=e.replace(/export const cssThemes\s*=\s*/,""),r=new Function(`return (${t})`)(),n=s.relative(i||"",f.path),o=v({cssThemes:r,cssOutPath:c({from:s.resolve(n),to:s.resolve(m,l.css)})});D=D.replace(e,`export const cssThemes = {\n${o}};\n`)}"cjs"!==y||b||(D=await p(D,g,!0)),"esm"!==y||b||(D=await p(D,g)),u&&(D=await h(D));const O=s.relative(i||"",r.path),j=d?g:s.resolve(t,O,r.name);await n(j,D,r.name)}async function m({baseOutPath:t,cssFiles:r,rootDir:a,customOutDirs:i,dir:c}){for(const l of r){const r=(()=>a&&i?.css?s.relative(a,l.path):i?.css?i.css:l.path)(),m=s.resolve(c,l.path,l.name);if(o(c,m)){const a=await e.readFile(m,"utf8");await n(s.resolve(t,r,l.name),a,l.name)}}}function u({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 p(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:n,foreignThemes:o}=r;a&&n&&y(e,{name:t?`${a}.min.css`:`${a}.css`,path:n}),o&&Array.isArray(o)&&o.length>0&&o.forEach(t=>{const r=s.basename(t),a=t.replace(r,"").trim();y(e,{name:r,path:a})})},[]):[]}function f({provider:e,themes:s,preventMoveDTS:t=!1}){const r=s&&s.bvTools?s.reduce((e,{bvTools:s})=>{const{path:r,declarationHelp:a,cssVariables:n,cssClassNames:o,cssMediaQueries:i,cssGlobalStyles:c,availableComponents:l}=s,m=a&&!t;return n&&(y(e,{name:"cssVars.js",path:r}),m&&y(e,{name:"cssVars.d.ts",path:r})),o&&(y(e,{name:"cssClasses.js",path:r}),m&&y(e,{name:"cssClasses.d.ts",path:r})),i&&(y(e,{name:"cssMediaQueries.js",path:r}),m&&y(e,{name:"cssMediaQueries.d.ts",path:r})),c&&(y(e,{name:"cssGlobalStyles.js",path:r}),m&&y(e,{name:"cssGlobalStyles.d.ts",path:r})),l&&(y(e,{name:"cssAvailableComponents.js",path:r}),m&&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 v({cssThemes:e,cssOutPath:t}){return Object.entries(e).reduce((e,[r,{foreign:a}])=>{const{before:n,after:o}=a;n&&Array.isArray(n)&&n.length>0&&n.reduce((e,r,a)=>{const n=s.basename(r);return a>0&&(e+=", "),e+`'${t}${n}'`},""),o&&Array.isArray(o)&&o.length>0&&o.reduce((e,r,a)=>{const n=s.basename(r);return a>0&&(e+=", "),e+`'${t}${n}'`},"")},"")}function y(e,s){e.some(e=>e.name===s.name&&e.path===s.path)||e.push(s)}function b(){const e=["--css","--tools","--provider"],s={};for(let t=0;t<process.argv.length;t++)if(e.includes(process.argv[t])){const e=process.argv[t].replace("--",""),r=process.argv[t+1];s[e]=r,t++}return Object.keys(s).length>0?s:void 0}function g({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:n}=t;r&&a&&n||(console.error("Invalid configuration: Missing compilerOptions, themes or provider"),process.exit(1));const{baseOutDir:o,rootDir:c,minifyCss:p,minifyJS:h,preventMoveJS:v,preventMoveDTS:y,types:D,customOutDirs:O}=r,j=g({jsonCustomOutDirs:O,cliCustomOutDirs:b()}),w=d({themes:n,minifyCss:p}),C=f({provider:a,themes:n,preventMoveDTS:y});if(D&&Array.isArray(D)&&D.length>0)for(const s of D){const t=u({baseOutDir:o,type:s});if(w&&w.length>0&&await m({baseOutPath:t,cssFiles:w,rootDir:c,customOutDirs:j,dir:e}),C&&C.length>0)for(const r of C)await l({baseOutPath:t,jsFile:r,rootDir:c,customOutDirs:j,dir:e,minifyJS:h,preventMoveJS:v,provider:a,type:s})}else{const s=u({baseOutDir:o});if(w&&w.length>0&&await m({baseOutPath:s,cssFiles:w,rootDir:c,customOutDirs:j,dir:e}),C&&C.length>0)for(const t of C)await l({baseOutPath:s,jsFile:t,rootDir:c,customOutDirs:j,dir:e,minifyJS:h,preventMoveJS:v,provider:a})}})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bernova",
3
- "version": "1.0.0",
3
+ "version": "1.1.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",