jizy-packer 2.1.20 → 2.1.21

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.
@@ -0,0 +1,6 @@
1
+ build/*
2
+ node_modules/
3
+ composer.lock
4
+ package-lock.json
5
+ test/
6
+ vendor/
@@ -0,0 +1,7 @@
1
+ cli/
2
+ node_modules/
3
+ src/
4
+ vendor/
5
+ composer.json
6
+ composer.lock
7
+ package-lock.json
@@ -0,0 +1,3 @@
1
+ import { jPackCli } from 'jizy-packer';
2
+ import jPackData from '../config/jpack.js';
3
+ jPackCli(jPackData);
@@ -4,9 +4,9 @@
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "JDZ",
7
- "%MODULE_NAME"
7
+ "%MODULE_NAME%"
8
8
  ],
9
- "homepage": "https://jdz.joffreydemetz.com/%MODULE_ALIAS%",
9
+ "homepage": "https://jdz.joffreydemetz.com/%MODULE_ALIAS%/",
10
10
  "license": "MIT",
11
11
  "authors": [
12
12
  {
package/cli/init.js CHANGED
@@ -5,13 +5,21 @@ import { fileURLToPath } from "url";
5
5
 
6
6
  async function copyAndReplace(srcDir, destDir, replacements) {
7
7
  const entries = fs.readdirSync(srcDir, { withFileTypes: true });
8
+ console.table(entries);
8
9
  for (const entry of entries) {
9
10
  const srcPath = path.join(srcDir, entry.name);
10
11
  const destName = entry.name.replace(/\.skel$/, "");
11
12
  const destPath = path.join(destDir, destName);
12
13
 
14
+ if (entry.isDirectory()) {
15
+ if (!fs.existsSync(destPath)) fs.mkdirSync(destPath);
16
+ await copyAndReplace(srcPath, destPath, replacements);
17
+ continue;
18
+ }
19
+
13
20
  if (fs.existsSync(destPath)) {
14
- if (entry.name !== 'package.json') {
21
+ const filename = path.basename(destPath);
22
+ if (filename !== 'package.json') {
15
23
  continue; // Skip existing files & folders
16
24
  }
17
25
 
@@ -22,12 +30,6 @@ async function copyAndReplace(srcDir, destDir, replacements) {
22
30
  }
23
31
  }
24
32
 
25
- if (entry.isDirectory()) {
26
- if (!fs.existsSync(destPath)) fs.mkdirSync(destPath);
27
- await copyAndReplace(srcPath, destPath, replacements);
28
- continue;
29
- }
30
-
31
33
  let content = fs.readFileSync(srcPath, "utf8");
32
34
  Object.entries(replacements).forEach(([key, value]) => {
33
35
  content = content.replace(new RegExp(`%${key}%`, "g"), value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jizy-packer",
3
- "version": "2.1.20",
3
+ "version": "2.1.21",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "_example",