jizy-packer 2.1.7 → 2.1.9

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.
Files changed (3) hide show
  1. package/README.md +15 -75
  2. package/lib/Rollup.js +1 -1
  3. package/package.json +1 -15
package/README.md CHANGED
@@ -10,13 +10,27 @@ A CLI tool and Node.js library to generate optimized builds for your projects. I
10
10
  - Utilities for cleaning build folders and managing configs
11
11
  - Rollup-based build process with plugin support
12
12
 
13
+ ## Create a jPacker
14
+
15
+ Examples in all jizy packages
16
+ @jizy-browser
17
+ @jizy-cooky
18
+ etc.
19
+
20
+ Look into these packages for the file architecture.
21
+
22
+ ./cli/jpack.js
23
+ ./config/jpack.js
24
+ ./config/jpack.template
25
+ ./config/jpack.wrapper.js
26
+
13
27
  ## Quick Usage
14
28
 
15
29
  ### CLI
16
30
 
17
31
  ```sh
18
32
  node ./cli/jpack.js --debug
19
- node ./cli/jpack.js --action build --name perso --config { "key": "value" }
33
+ node ./cli/jpack.js --action build --name perso --config {"key":"value"}
20
34
  node ./cli/jpack.js --action build --name perso --config ABSOLUTE_PATH_TO_JSON_FILE
21
35
  ```
22
36
 
@@ -38,77 +52,3 @@ await jPackBuild({
38
52
  debug: true
39
53
  });
40
54
  ```
41
-
42
- ### Create a jPacker
43
-
44
- Example from the "jizy-browser" extension.
45
-
46
- ***First for the default dist build***
47
-
48
- #### ./cli/jpack.js
49
- ```js
50
- import { jPackCli } from 'jizy-packer';
51
- import jPackData from '../config/jpack.js';
52
- jPackCli(jPackData);
53
- ```
54
-
55
- #### ./config/jpack.js
56
- ```js
57
- import fs from 'fs';
58
- import path from 'path';
59
- import { LogMe, jPackConfig } from 'jizy-packer';
60
-
61
- const jPackData = function () {
62
- jPackConfig.sets({
63
- name: 'BrowserCompat',
64
- alias: 'jizy-browser',
65
- desktopBreakpoint: "900px"
66
- });
67
-
68
- jPackConfig.set('onCheckConfig', () => { });
69
-
70
- jPackConfig.set('onGenerateBuildJs', (code) => {
71
- LogMe.log('Generate config.less');
72
- LogMe.log(' path: ' + path.join(jPackConfig.get('targetPath'), 'config.less'));
73
- const desktopBreakpoint = jPackConfig.get('desktopBreakpoint') ?? '768px';
74
- let lessContent = `@desktop-breakpoint: ${desktopBreakpoint};` + "\n";
75
- lessContent += `@mobile-breakpoint: @desktop-breakpoint - 1px;`;
76
- fs.writeFileSync(path.join(jPackConfig.get('targetPath'), 'config.less'), lessContent);
77
- return code;
78
- });
79
-
80
- jPackConfig.set('onGenerateWrappedJs', (wrapped) => wrapped);
81
-
82
- jPackConfig.set('onPacked', () => { });
83
- };
84
-
85
- export default jPackData;
86
- ```
87
-
88
- #### ./config/jpack.template
89
- ```js
90
- import BrowserCompat from '{{PREFIX}}lib/js/browsercompat.js';
91
- import '{{PREFIX}}lib/browsercompat.less';
92
- export default BrowserCompat;
93
- ```
94
-
95
- #### ./config/jpack.wrapper.js
96
- ```js
97
- /*! BrowserCompat v@VERSION | @DATE | [@BUNDLE] */
98
- (function (global) {
99
- "use strict";
100
-
101
- if (typeof global !== "object" || !global || !global.document) {
102
- throw new Error("BrowserCompat requires a window and a document");
103
- }
104
-
105
- if (typeof global.BrowserCompat !== "undefined") {
106
- throw new Error("BrowserCompat is already defined");
107
- }
108
-
109
- // @CODE
110
-
111
- global.BrowserCompat = BrowserCompat;
112
-
113
- })(typeof window !== "undefined" ? window : this);
114
- ```
package/lib/Rollup.js CHANGED
@@ -82,7 +82,7 @@ function generateBuildJs() {
82
82
  // append config callback
83
83
  const onGenerateBuildJs = jPackConfig.get('onGenerateBuildJs');
84
84
  if (typeof onGenerateBuildJs === 'function') {
85
- console.log('Calling onGenerateBuildJs callback');
85
+ LogMe.log('Calling onGenerateBuildJs callback');
86
86
  code = onGenerateBuildJs(code);
87
87
  }
88
88
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jizy-packer",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "lib/*.js"
@@ -19,27 +19,13 @@
19
19
  "license": "MIT",
20
20
  "description": "CLI app to generate optimized builds.",
21
21
  "dependencies": {
22
- "@babel/core": "^7.26.10",
23
- "@babel/preset-env": "^7.26.9",
24
22
  "@rollup/plugin-commonjs": "^28.0.3",
25
23
  "@rollup/plugin-json": "^6.1.0",
26
24
  "@rollup/plugin-node-resolve": "^16.0.1",
27
25
  "@rollup/plugin-terser": "^0.4.4",
28
26
  "@rollup/plugin-url": "^8.0.2",
29
- "autoprefixer": "^10.4.21",
30
- "babel-jest": "^29.7.0",
31
- "clean-css": "^5.3.3",
32
- "cross-env": "^7.0.3",
33
- "cssnano": "^7.0.6",
34
- "jest": "^29.7.0",
35
- "jest-environment-jsdom": "^29.7.0",
36
- "jsdom": "^26.1.0",
37
- "less": "^4.3.0",
38
- "less-plugin-clean-css": "^1.6.0",
39
27
  "postcss": "^8.5.3",
40
28
  "rollup": "^4.40.1",
41
- "rollup-plugin-copy": "^3.5.0",
42
- "rollup-plugin-delete": "^3.0.1",
43
29
  "rollup-plugin-postcss": "^4.0.2",
44
30
  "yargs": "^17.7.2"
45
31
  }