netcore-blueprint 0.0.21 → 0.0.22

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
- const { buildReplaceMap, applyReplacements } = require('./replacer');
5
+ const { buildReplaceMap, applyReplacements } = require('../lib/replacer');
6
6
 
7
7
  // =======================
8
8
  // Args
@@ -0,0 +1,45 @@
1
+ // scripts/replacer.js
2
+
3
+ function buildReplaceMap({
4
+ sourceModuleName, // "__MODULE__"
5
+ newModuleName, // e.g. Product
6
+ sourceEntityName, // "__ITEM__"
7
+ newEntityName // e.g. Order
8
+ }) {
9
+ return [
10
+ // =====================
11
+ // Module placeholders
12
+ // =====================
13
+ { from: "__MODULE__", to: newModuleName },
14
+ { from: "__module__", to: newModuleName.toLowerCase() },
15
+
16
+ // =====================
17
+ // Entity placeholders
18
+ // =====================
19
+ { from: "__ITEM__", to: newEntityName },
20
+ { from: "__item__", to: newEntityName.toLowerCase() },
21
+
22
+ // =====================
23
+ // (Optional) Legacy fallback
24
+ // =====================
25
+ { from: "Item", to: newEntityName },
26
+ { from: "item", to: newEntityName.toLowerCase() },
27
+ ];
28
+ }
29
+
30
+ function applyReplacements(text, replaceMap) {
31
+ let result = text;
32
+
33
+ for (const { from, to } of replaceMap) {
34
+ // Escape regex special chars just in case
35
+ const escapedFrom = from.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
36
+ result = result.replace(new RegExp(escapedFrom, 'g'), to);
37
+ }
38
+
39
+ return result;
40
+ }
41
+
42
+ module.exports = {
43
+ buildReplaceMap,
44
+ applyReplacements
45
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "netcore-blueprint",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "A custom project blueprint",
5
5
  "main": "create.js",
6
6
  "bin": {
@@ -17,6 +17,8 @@
17
17
  "author": "",
18
18
  "license": "ISC",
19
19
  "files": [
20
+ "bin/**",
21
+ "lib/**",
20
22
  "Modules/**",
21
23
  "BlueprintTemplate/**"
22
24
  ]