jizy-packer 2.1.7 → 2.1.8
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/README.md +10 -70
- package/lib/Rollup.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ A CLI tool and Node.js library to generate optimized builds for your projects. I
|
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
18
|
node ./cli/jpack.js --debug
|
|
19
|
-
node ./cli/jpack.js --action build --name perso --config {
|
|
19
|
+
node ./cli/jpack.js --action build --name perso --config {"key":"value"}
|
|
20
20
|
node ./cli/jpack.js --action build --name perso --config ABSOLUTE_PATH_TO_JSON_FILE
|
|
21
21
|
```
|
|
22
22
|
|
|
@@ -41,74 +41,14 @@ await jPackBuild({
|
|
|
41
41
|
|
|
42
42
|
### Create a jPacker
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
Examples in all jizy packages
|
|
45
|
+
@jizy-browser
|
|
46
|
+
@jizy-cooky
|
|
47
|
+
etc.
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
Look into these packages for the file architecture.
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
```
|
|
51
|
+
./cli/jpack.js
|
|
52
|
+
./config/jpack.js
|
|
53
|
+
./config/jpack.template
|
|
54
|
+
./config/jpack.wrapper.js
|
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
|
-
|
|
85
|
+
LogMe.log('Calling onGenerateBuildJs callback');
|
|
86
86
|
code = onGenerateBuildJs(code);
|
|
87
87
|
}
|
|
88
88
|
|