create-berna-stencil 2.0.3 → 2.0.4

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 (2) hide show
  1. package/bin/create.js +27 -13
  2. package/package.json +1 -1
package/bin/create.js CHANGED
@@ -13,23 +13,16 @@ const COPY_TARGETS = [
13
13
  '.eleventyignore',
14
14
  ];
15
15
 
16
- const configExample = path.join(targetDir, 'src/backend/config.example.php');
17
- const configDest = path.join(targetDir, 'src/backend/config.php');
18
- if (fs.existsSync(configExample) && !fs.existsSync(configDest)) {
19
- fs.copyFileSync(configExample, configDest);
20
- fs.unlinkSync(configExample);
21
- }
22
-
23
16
  const PROJECT_PACKAGE = {
24
17
  name: path.basename(targetDir),
25
- version: '2.0.3',
18
+ version: '2.0.4',
26
19
  private: true,
27
20
  scripts: {
28
- "build:css": "sass src/frontend/scss:out/css --no-source-map --style=compressed --quiet",
21
+ "build:css": "sass src/frontend/scss:out/css --no-source-map --style=compressed --quiet --load-path=node_modules",
29
22
  "build:js": "esbuild \"src/frontend/js/pages/*.js\" --bundle --outdir=out/js/pages --minify",
30
23
  "build:11ty": "eleventy",
31
24
  "build": "npm run clean && npm run build:css && npm run build:js && npm run build:11ty",
32
- "serve:css": "sass --watch src/frontend/scss:out/css --no-source-map --quiet",
25
+ "serve:css": "sass --watch src/frontend/scss:out/css --no-source-map --quiet --load-path=node_modules",
33
26
  "serve:js": "esbuild \"src/frontend/js/pages/*.js\" --bundle --outdir=out/js/pages --watch",
34
27
  "serve:11ty": "eleventy --serve --quiet",
35
28
  "clean": "node _tools/cleanOutput.js",
@@ -56,9 +49,9 @@ const PROJECT_PACKAGE = {
56
49
 
57
50
  const GITIGNORE_CONTENT = `
58
51
  node_modules/
59
- src/api/core/vendor/
52
+ src/backend/_core/vendor/
60
53
  out/
61
- src/api/config.php
54
+ src/backend/config.php
62
55
  `;
63
56
 
64
57
  const { writeSync } = require('fs');
@@ -72,6 +65,7 @@ function copyRecursive(src, dest) {
72
65
  if (stat.isDirectory()) {
73
66
  fs.mkdirSync(dest, { recursive: true });
74
67
  for (const child of fs.readdirSync(src)) {
68
+ if (child === '.git') continue;
75
69
  copyRecursive(path.join(src, child), path.join(dest, child));
76
70
  }
77
71
  } else {
@@ -80,6 +74,17 @@ function copyRecursive(src, dest) {
80
74
  }
81
75
  }
82
76
 
77
+ function deleteFileRecursive(dir, filename) {
78
+ for (const child of fs.readdirSync(dir)) {
79
+ const fullPath = path.join(dir, child);
80
+ if (fs.statSync(fullPath).isDirectory()) {
81
+ deleteFileRecursive(fullPath, filename);
82
+ } else if (child === filename) {
83
+ fs.unlinkSync(fullPath);
84
+ }
85
+ }
86
+ }
87
+
83
88
  if (!fs.existsSync(targetDir)) {
84
89
  fs.mkdirSync(targetDir, { recursive: true });
85
90
  }
@@ -95,6 +100,15 @@ for (const target of COPY_TARGETS) {
95
100
  }
96
101
  }
97
102
 
103
+ // config.php
104
+ const configDest = path.join(targetDir, 'src/backend/config.php');
105
+ const configExample = path.join(targetDir, 'src/backend/config.example.php');
106
+ if (!fs.existsSync(configDest) && fs.existsSync(configExample)) {
107
+ fs.copyFileSync(configExample, configDest);
108
+ log('+ src/backend/config.php');
109
+ }
110
+ deleteFileRecursive(targetDir, 'config.example.php');
111
+
98
112
  fs.writeFileSync(
99
113
  path.join(targetDir, 'package.json'),
100
114
  JSON.stringify(PROJECT_PACKAGE, null, 2)
@@ -112,4 +126,4 @@ if (process.argv[2]) {
112
126
  log(`cd ${process.argv[2]}`);
113
127
  }
114
128
  log('npm install');
115
- log('npm run serve\n');
129
+ log('npm run serve\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-berna-stencil",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Eleventy boilerplate with per-page SCSS/JS pipeline, esbuild bundling, multi-framework CSS support and a built-in page management CLI",
5
5
  "keywords": [],
6
6
  "author": "Michele Garofalo",