ui-fix-add-listeners-js 1.2.2 → 1.3.2

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,19 @@
1
+ {
2
+ "importLines": {
3
+ "toInsertLine": "import ${folderName} from './${folderName}/start.js';",
4
+ "duplicationCheck": "from './${folderName}/start.js'",
5
+ "insertAfter": [
6
+ "import ",
7
+ "import express"
8
+ ]
9
+ },
10
+ "useLines": {
11
+ "toInsertLine": "router.use('/${endpoint}', routerFrom${endpoint});",
12
+ "toInsertLine_old": "router.get('/${endpoint}', (req, res) => funcFrom${folderName}({ req, res, inTablePath: tablePath }));",
13
+ "duplicationCheck": "router.use('/${endpoint}'",
14
+ "insertAfter": [
15
+ "router.",
16
+ "const router = "
17
+ ]
18
+ }
19
+ }
@@ -1,16 +1,8 @@
1
1
  import fixAnyJs from "express-fix-any-js";
2
2
  import checkLines from "./checkLines.json" with {type: "json"};
3
3
 
4
- const checkLinesKeys = Object.keys(checkLines);
5
-
6
- const alterLines = ({ inActionName, inFolderName, inGetType }) => {
7
- let checkLinesData = checkLines;
8
- if (!checkLinesData[inGetType]) {
9
- throw new Error(`Invalid inGetType: ${inGetType}. Must be one of: ${checkLinesKeys.join(", ")}`);
10
- };
11
-
12
- // Deep clone the configuration to avoid mutating the cached JSON import.
13
- let localCheckLines = JSON.parse(JSON.stringify(checkLinesData[inGetType]));
4
+ const alterLines = ({ inActionName, inFolderName }) => {
5
+ let localCheckLines = checkLines;
14
6
 
15
7
  if (localCheckLines.importLines && localCheckLines.importLines.toInsertLine) {
16
8
  localCheckLines.importLines.toInsertLine = localCheckLines.importLines.toInsertLine.replaceAll("${folderName}", inFolderName);
@@ -31,17 +23,9 @@ const alterLines = ({ inActionName, inFolderName, inGetType }) => {
31
23
  return localCheckLines;
32
24
  };
33
25
 
34
- const getCheckLinesValue = ({ inKey }) => {
35
- if (!(inKey in checkLines)) {
36
- throw new Error(`Invalid inKey: ${inKey}. Must be one of: ${checkLinesKeys.join(", ")}`);
37
- };
38
-
39
- return checkLines[inKey];
40
- };
41
-
42
- const startFunc = ({ inJsFilePath, inActionName, inFolderName, showLog = false, inGetType }) => {
26
+ const startFunc = ({ inJsFilePath, inActionName, inFolderName, showLog = false }) => {
43
27
 
44
- const localCheckLines = alterLines({ inActionName, inFolderName, inGetType });
28
+ const localCheckLines = alterLines({ inActionName, inFolderName });
45
29
 
46
30
  const fromFixAnyJs = fixAnyJs({
47
31
  showLog,
@@ -52,5 +36,5 @@ const startFunc = ({ inJsFilePath, inActionName, inFolderName, showLog = false,
52
36
  return fromFixAnyJs;
53
37
  };
54
38
 
55
- export { getCheckLinesValue, checkLinesKeys };
39
+ export { checkLines };
56
40
  export default startFunc;
@@ -1,6 +1,5 @@
1
- export default function parseInput({ jsFilePath, inGetType = "simple",
2
- showLog, inActionName = "KeshavSoftAction", inFolderName = "KeshavSoftFolderName",
3
- inColumnName
1
+ export default function parseInput({ jsFilePath,
2
+ showLog, inActionName = "KeshavSoftAction", inFolderName = "KeshavSoftFolderName"
4
3
  }) {
5
4
 
6
5
  const [...args] = process.argv.slice(2);
@@ -11,8 +10,7 @@ export default function parseInput({ jsFilePath, inGetType = "simple",
11
10
  ? showLog
12
11
  : args[1] === "true",
13
12
  inJsFilePath: jsFilePath || process.cwd(),
14
- inActionName, inFolderName, inGetType,
15
- inColumnName,
13
+ inActionName, inFolderName,
16
14
  args
17
15
  };
18
- };
16
+ };
@@ -1,19 +1,17 @@
1
1
  import parseInput from "./core/parseInput.js";
2
2
  import showUsage from './core/showUsage.js';
3
3
 
4
- import updateJs, { checkLinesKeys, getCheckLinesValue } from "./UpdateJs/index.js";
4
+ import updateJs, { checkLines } from "./UpdateJs/index.js";
5
5
 
6
6
  import pkg from '../../package.json' with { type: 'json' };
7
7
 
8
8
  const version = pkg.version;
9
9
 
10
- const run = ({ endPointsJsPath, showLog, inActionName, inFolderName, inGetType,
11
- inColumnName
12
- }) => {
10
+ const run = ({ endPointsJsPath, showLog, inActionName, inFolderName }) => {
13
11
 
14
12
  const input = parseInput({
15
13
  jsFilePath: endPointsJsPath, showLog,
16
- inActionName, inFolderName, inGetType, inColumnName
14
+ inActionName, inFolderName
17
15
  });
18
16
 
19
17
  if (!endPointsJsPath) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui-fix-add-listeners-js",
3
- "version": "1.2.2",
4
- "description": "CLI to build for appjs, the endpoints",
3
+ "version": "1.3.2",
4
+ "description": "ui hook html id to add listeners file",
5
5
  "keywords": [
6
6
  "cli",
7
7
  "scaffold",
@@ -28,9 +28,9 @@
28
28
  "homepage": "https://cli.keshavsoft.com",
29
29
  "repository": {
30
30
  "type": "git",
31
- "url": "https://github.com/keshavsoft/ui-fix-addListeners-js"
31
+ "url": "https://github.com/keshavsoft/ui-fix-add-listeners-js"
32
32
  },
33
33
  "bugs": {
34
- "url": "https://github.com/keshavsoft/ui-fix-addListeners-js/issues"
34
+ "url": "https://github.com/keshavsoft/ui-fix-add-listeners-js/issues"
35
35
  }
36
36
  }
@@ -1,58 +0,0 @@
1
- {
2
- "simple": {
3
- "importLines": {
4
- "toInsertLine": "import { router as routerFrom${folderName} } from './${folderName}/end-points.js';",
5
- "toInsertLine_old": "import funcFrom${folderName} from './${folderName}/controller.js';",
6
- "duplicationCheck": "from './${folderName}/end-points.js'",
7
- "insertAfter": [
8
- "import funcFrom",
9
- "import express"
10
- ]
11
- },
12
- "useLines": {
13
- "toInsertLine": "router.use('/${endpoint}', routerFrom${endpoint});",
14
- "toInsertLine_old": "router.get('/${endpoint}', (req, res) => funcFrom${folderName}({ req, res, inTablePath: tablePath }));",
15
- "duplicationCheck": "router.use('/${endpoint}'",
16
- "insertAfter": [
17
- "router.",
18
- "const router = "
19
- ]
20
- }
21
- },
22
- "withParams": {
23
- "importLines": {
24
- "toInsertLine": "import funcFrom${folderName} from './${folderName}/controller.js';",
25
- "duplicationCheck": "from './${folderName}/controller.js'",
26
- "insertAfter": [
27
- "import funcFrom",
28
- "import express"
29
- ]
30
- },
31
- "useLines": {
32
- "toInsertLine": "router.get('/${endpoint}/:pk', (req, res) => funcFrom${folderName}({ req, res, inTablePath: tablePath }));",
33
- "duplicationCheck": "router.get('/${endpoint}'",
34
- "insertAfter": [
35
- "router.",
36
- "const router = "
37
- ]
38
- }
39
- },
40
- "withParamsDynamic": {
41
- "importLines": {
42
- "toInsertLine": "import funcFrom${folderName} from './${folderName}/controller.js';",
43
- "duplicationCheck": "from './${folderName}/controller.js'",
44
- "insertAfter": [
45
- "import funcFrom",
46
- "import express"
47
- ]
48
- },
49
- "useLines": {
50
- "toInsertLine": "router.get('/${endpoint}/:${inColumnName}', (req, res) => funcFrom${folderName}({ req, res, inTablePath: tablePath }));",
51
- "duplicationCheck": "router.get('/${endpoint}'",
52
- "insertAfter": [
53
- "router.",
54
- "const router = "
55
- ]
56
- }
57
- }
58
- }
File without changes
File without changes