jizy-packer 2.1.18 → 2.1.20
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 +1 -1
- package/_example/css/main.css +70 -0
- package/_example/favicon.ico +0 -0
- package/_example/index.html +25 -0
- package/_example/js/main.js +5 -0
- package/_package/.babelrc +3 -0
- package/_package/.browserslistrc +3 -0
- package/_package/LICENSE +21 -0
- package/_package/README.md.skel +1 -0
- package/_package/composer.json.skel +19 -0
- package/_package/config/jpack.js.skel +45 -0
- package/_package/config/jpack.template.skel +5 -0
- package/_package/config/jpack.wrapper.js.skel +16 -0
- package/_package/lib/index.js.skel +5 -0
- package/_package/lib/index.less.skel +16 -0
- package/_package/lib/less/animations.less +0 -0
- package/_package/lib/less/mobile.less +0 -0
- package/_package/lib/less/screen.less +0 -0
- package/_package/lib/less/structure.less +0 -0
- package/_package/lib/less/variables.less +1 -0
- package/_package/package.json.skel +33 -0
- package/cli/init.js +66 -0
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
* {
|
|
2
|
+
-webkit-box-sizing: border-box;
|
|
3
|
+
-moz-box-sizing: border-box;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
a {
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
color: rgb(95, 25, 25);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
body {
|
|
13
|
+
font-size: 16px;
|
|
14
|
+
font-family: "Poppins", Arial, sans-serif;
|
|
15
|
+
background-image: linear-gradient(20deg, #11243c, #8e8a94);
|
|
16
|
+
margin: 0;
|
|
17
|
+
padding: 0;
|
|
18
|
+
background-color: #f4f4f4;
|
|
19
|
+
color: #333;
|
|
20
|
+
min-height: 100vh;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
main {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
padding-top: 80px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.buttons {
|
|
32
|
+
margin-top: 16px;
|
|
33
|
+
display: flex;
|
|
34
|
+
column-gap: 30px;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.btn {
|
|
39
|
+
border: 1px solid rgba(255, 255, 255, 0.8);
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
padding: 6px 12px;
|
|
42
|
+
font-size: 1em;
|
|
43
|
+
border-radius: 10px;
|
|
44
|
+
transition: background 0.3s ease-in-out, color 0.3s ease-in-out;
|
|
45
|
+
background: #EEE;
|
|
46
|
+
outline: 0;
|
|
47
|
+
color: #222;
|
|
48
|
+
font-weight: 700;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.btn:hover {
|
|
52
|
+
background-color: #DDD;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.btn.btn-submit:hover {
|
|
56
|
+
color: #5396ED;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.btn.btn-cancel:hover {
|
|
60
|
+
color: #ac5e5e;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.sr-only {
|
|
64
|
+
position: absolute;
|
|
65
|
+
left: -10000px;
|
|
66
|
+
top: auto;
|
|
67
|
+
width: 1px;
|
|
68
|
+
height: 1px;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<meta name="fragment" content="!" />
|
|
8
|
+
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
|
|
9
|
+
<title>%MODULE_NAME% example page</title>
|
|
10
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
11
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
12
|
+
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap" rel="stylesheet" />
|
|
13
|
+
<link rel="stylesheet" href="css/%MODULE_ALIAS%.min.css" />
|
|
14
|
+
<link rel="stylesheet" href="css/main.css" />
|
|
15
|
+
</head>
|
|
16
|
+
|
|
17
|
+
<body>
|
|
18
|
+
<main>
|
|
19
|
+
<h1>%MODULE_NAME% example page</h1>
|
|
20
|
+
</main>
|
|
21
|
+
<script src="js/%MODULE_ALIAS%.min.js"></script>
|
|
22
|
+
<script src="js/main.js"></script>
|
|
23
|
+
</body>
|
|
24
|
+
|
|
25
|
+
</html>
|
package/_package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-present Joffrey Demetz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# %MODULE_NAME%
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jdz/%MODULE_ALIAS%",
|
|
3
|
+
"type": "library",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"JDZ",
|
|
7
|
+
"%MODULE_NAME"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://jdz.joffreydemetz.com/%MODULE_ALIAS%",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"authors": [
|
|
12
|
+
{
|
|
13
|
+
"name": "Joffrey Demetz",
|
|
14
|
+
"email": "joffrey.demetz@gmail.com",
|
|
15
|
+
"homepage": "https://joffreydemetz.com",
|
|
16
|
+
"role": "Lead"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
LogMe,
|
|
6
|
+
jPackConfig,
|
|
7
|
+
generateLessVariablesFromConfig,
|
|
8
|
+
deleteLessVariablesFile
|
|
9
|
+
} from 'jizy-packer';
|
|
10
|
+
|
|
11
|
+
const jPackData = function () {
|
|
12
|
+
const lessBuildVariablesPath = path.join(jPackConfig.get('basePath'), 'lib/less / _variables.less');
|
|
13
|
+
|
|
14
|
+
jPackConfig.sets({
|
|
15
|
+
name: '%MODULE_NAME%',
|
|
16
|
+
alias: '%MODULE_ALIAS%',
|
|
17
|
+
lessVariables: {
|
|
18
|
+
desktopBreakpoint: '900px',
|
|
19
|
+
scrollbarWidth: '17px'
|
|
20
|
+
// add your custom less variables here
|
|
21
|
+
},
|
|
22
|
+
defaults: {
|
|
23
|
+
// add your custom default config here
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
jPackConfig.set('onCheckConfig', () => { });
|
|
28
|
+
|
|
29
|
+
jPackConfig.set('onGenerateBuildJs', (code) => {
|
|
30
|
+
LogMe.log('Build lib/less/_variables.less');
|
|
31
|
+
const lessVariables = jPackConfig.get('lessVariables') ?? {};
|
|
32
|
+
const lessOriginalVariablesPath = path.join(jPackConfig.get('basePath'), 'lib/less/variables.less');
|
|
33
|
+
generateLessVariablesFromConfig(lessOriginalVariablesPath, lessBuildVariablesPath, lessVariables);
|
|
34
|
+
return code;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
jPackConfig.set('onGenerateWrappedJs', (wrapped) => wrapped);
|
|
38
|
+
|
|
39
|
+
jPackConfig.set('onPacked', () => {
|
|
40
|
+
// for projects using CSS
|
|
41
|
+
deleteLessVariablesFile(lessBuildVariablesPath);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default jPackData;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*! %MODULE_NAME% v@VERSION | MIT | @DATE | [@BUNDLE] */
|
|
2
|
+
(function (global) {
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
if (typeof global !== "object" || !global || !global.document) {
|
|
6
|
+
throw new Error("%MODULE_NAME% requires a window with a document");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (typeof global.%MODULE_NAME% !== "undefined") {
|
|
10
|
+
throw new Error("%MODULE_NAME% is already defined");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// @CODE
|
|
14
|
+
|
|
15
|
+
global.%MODULE_NAME% = %MODULE_NAME%;
|
|
16
|
+
})(typeof window !== "undefined" ? window : this);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@import url("less/_variables.less");
|
|
2
|
+
@import url("less/variables.less");
|
|
3
|
+
// @import url("less/animations.less");
|
|
4
|
+
// @import url("less/structure.less");
|
|
5
|
+
|
|
6
|
+
@media (max-width: @mobile-breakpoint) {
|
|
7
|
+
@import url("less/mobile.less");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@media (min-width: @desktop-breakpoint) {
|
|
11
|
+
@import url("less/screen.less");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media print {
|
|
15
|
+
@import url("less/print.less");
|
|
16
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@mobile-breakpoint: @desktop-breakpoint - 1px;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jdz/%MODULE_ALIAS%",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"browser": "dist/js/%MODULE_ALIAS%.min.js",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"jizy": "dist/",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/*",
|
|
10
|
+
"lib/*"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"jpack:export": "node ./cli/jpack.js --action build --name perso",
|
|
14
|
+
"jpack:export-debug": "node ./cli/jpack.js --action build --name perso --debug",
|
|
15
|
+
"jpack:dist": "node ./cli/jpack.js",
|
|
16
|
+
"jpack:dist-debug": "node ./cli/jpack.js --debug"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/joffreydemetz/%MODULE_ALIAS%.git"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"jdz",
|
|
24
|
+
"jizy"
|
|
25
|
+
],
|
|
26
|
+
"author": "Joffrey Demetz <joffrey.demetz@gmail.com> (https://joffreydemetz.com/)",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"description": "",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"jizy-packer": "^2.1.0",
|
|
31
|
+
"less": "^4.4.1"
|
|
32
|
+
}
|
|
33
|
+
}
|
package/cli/init.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import readline from "readline";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
async function copyAndReplace(srcDir, destDir, replacements) {
|
|
7
|
+
const entries = fs.readdirSync(srcDir, { withFileTypes: true });
|
|
8
|
+
for (const entry of entries) {
|
|
9
|
+
const srcPath = path.join(srcDir, entry.name);
|
|
10
|
+
const destName = entry.name.replace(/\.skel$/, "");
|
|
11
|
+
const destPath = path.join(destDir, destName);
|
|
12
|
+
|
|
13
|
+
if (fs.existsSync(destPath)) {
|
|
14
|
+
if (entry.name !== 'package.json') {
|
|
15
|
+
continue; // Skip existing files & folders
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// read json file and check if the name of the package is set
|
|
19
|
+
const pkg = JSON.parse(fs.readFileSync(srcPath, "utf8"));
|
|
20
|
+
if (pkg.name) {
|
|
21
|
+
continue; // skip existing package.json with name set
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (entry.isDirectory()) {
|
|
26
|
+
if (!fs.existsSync(destPath)) fs.mkdirSync(destPath);
|
|
27
|
+
await copyAndReplace(srcPath, destPath, replacements);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let content = fs.readFileSync(srcPath, "utf8");
|
|
32
|
+
Object.entries(replacements).forEach(([key, value]) => {
|
|
33
|
+
content = content.replace(new RegExp(`%${key}%`, "g"), value);
|
|
34
|
+
});
|
|
35
|
+
fs.writeFileSync(destPath, content, "utf8");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function askQuestion(query) {
|
|
40
|
+
const rl = readline.createInterface({
|
|
41
|
+
input: process.stdin,
|
|
42
|
+
output: process.stdout,
|
|
43
|
+
});
|
|
44
|
+
return new Promise(resolve => rl.question(query, ans => {
|
|
45
|
+
rl.close();
|
|
46
|
+
resolve(ans);
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const moduleName = await askQuestion("Module name: ");
|
|
51
|
+
const moduleAlias = await askQuestion("Module alias: ");
|
|
52
|
+
|
|
53
|
+
// Interactive CLI prompts
|
|
54
|
+
const answers = {
|
|
55
|
+
MODULE_NAME: moduleName,
|
|
56
|
+
MODULE_ALIAS: moduleAlias
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// Copy files from _package to current directory, replacing %KEY% and removing .skel
|
|
60
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
61
|
+
const __dirname = path.dirname(__filename);
|
|
62
|
+
const srcDir = path.join(__dirname, "..", "_package");
|
|
63
|
+
const destDir = process.cwd();
|
|
64
|
+
|
|
65
|
+
console.log(srcDir, destDir);
|
|
66
|
+
await copyAndReplace(srcDir, destDir, answers);
|