ui-fix-add-listeners-js 1.3.3 → 1.3.5

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,17 @@
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": " ${folderName}();",
12
+ "duplicationCheck": "${folderName}();",
13
+ "insertAfter": [
14
+ "const hookAllListeners = () => {"
15
+ ]
16
+ }
17
+ }
@@ -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) {
@@ -29,27 +27,6 @@ const run = ({ endPointsJsPath, showLog, inActionName, inFolderName, inGetType,
29
27
  }
30
28
  }
31
29
 
32
- if (input.cmd === "ShowKeys") {
33
- console.log(checkLinesKeys);
34
- return;
35
- }
36
-
37
- if (input.cmd === "ShowValue") {
38
- const key = input.args[1];
39
- if (!key) {
40
- console.error(`Error: Please specify a key. Valid keys are: ${checkLinesKeys.join(", ")}`);
41
- process.exit(1);
42
- }
43
- try {
44
- const val = getCheckLinesValue({ inKey: key });
45
- console.log(JSON.stringify(val, null, 2));
46
- } catch (e) {
47
- console.error(e.message);
48
- process.exit(1);
49
- }
50
- return;
51
- }
52
-
53
30
  return updateJs(input);
54
31
  };
55
32
 
package/index.js CHANGED
@@ -1,29 +1,14 @@
1
+ import { createRequire } from "module";
1
2
  import getLatestVersion from "./bin/core/getLatestVersion.js";
2
3
 
3
- const load = async ({ endPointsJsPath, inActionName, showLog, inFolderName,
4
- inGetType, inColumnName }) => {
4
+ const require = createRequire(import.meta.url);
5
5
 
6
+ const load = (options) => {
6
7
  const v = getLatestVersion();
7
8
 
8
- const module = await import(`./bin/${v}/start.js`);
9
+ const mod = require(`./bin/${v}/start.js`);
9
10
 
10
- return await module.default({
11
- endPointsJsPath, inFolderName,
12
- inActionName, showLog, inGetType, inColumnName
13
- });
11
+ return mod.default(options);
14
12
  };
15
13
 
16
- const getCheckLinesKeys = async () => {
17
- const v = getLatestVersion();
18
- const { checkLinesKeys } = await import(`./bin/${v}/UpdateJs/index.js`);
19
- return checkLinesKeys;
20
- };
21
-
22
- const getCheckLinesValue = async ({ inKey }) => {
23
- const v = getLatestVersion();
24
- const { getCheckLinesValue } = await import(`./bin/${v}/UpdateJs/index.js`);
25
- return getCheckLinesValue({ inKey });
26
- };
27
-
28
- export { getCheckLinesKeys, getCheckLinesValue };
29
- export default load;
14
+ export default load;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-fix-add-listeners-js",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "ui hook html id to add listeners file",
5
5
  "keywords": [
6
6
  "cli",
@@ -10,7 +10,7 @@
10
10
  "project-generator"
11
11
  ],
12
12
  "dependencies": {
13
- "express-fix-any-js": "^1.7.7"
13
+ "express-fix-any-js": "^1.8.4"
14
14
  },
15
15
  "type": "module",
16
16
  "exports": {
@@ -1,21 +0,0 @@
1
- {
2
- "simple": {
3
- "importLines": {
4
- "toInsertLine": "import folderName from './${folderName}/start.js';",
5
- "duplicationCheck": "from './${folderName}/start.js'",
6
- "insertAfter": [
7
- "import funcFrom",
8
- "import express"
9
- ]
10
- },
11
- "useLines": {
12
- "toInsertLine": "router.use('/${endpoint}', routerFrom${endpoint});",
13
- "toInsertLine_old": "router.get('/${endpoint}', (req, res) => funcFrom${folderName}({ req, res, inTablePath: tablePath }));",
14
- "duplicationCheck": "router.use('/${endpoint}'",
15
- "insertAfter": [
16
- "router.",
17
- "const router = "
18
- ]
19
- }
20
- }
21
- }
File without changes
File without changes