express-fix-any-js 1.2.5 → 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.
@@ -2,7 +2,6 @@ import readFile from "../readFile.js";
2
2
  import checkDuplicate from "./checkDuplicate.js";
3
3
  import findInsertIndex from "./findInsertIndex.js";
4
4
  import writeFile from "../writeFile.js";
5
- import validateAppJsPath from "../../validations/validateAppJsPath.js";
6
5
 
7
6
  import buildUpdatedContent from "./buildUpdatedContent.js";
8
7
 
@@ -1,19 +1,16 @@
1
1
  // v2/AppJs/index.js
2
2
 
3
3
  import checkLines from "./checkLines.json" with {type: "json"};
4
- import validateEndpoint from "./validations/validateEndpoint.js";
5
4
  import alterFile from "./common/AlterFile/index.js";
6
5
 
7
- const updateAppJs = ({ inEndPointsJsPath, actionName, inCheckLines,
6
+ const updateAppJs = ({ inJsFilePath, inCheckLines,
8
7
  showLog = false }) => {
9
8
 
10
- validateEndpoint({ endpoint: actionName });
11
-
12
9
  const localCheckLines = inCheckLines || checkLines;
13
10
  // console.log("bbbbbbbbbbbb : ", localCheckLines);
14
11
 
15
12
  alterFile({
16
- jsFilePath: inEndPointsJsPath,
13
+ jsFilePath: inJsFilePath,
17
14
  toInsertLine: localCheckLines.importLines.toInsertLine,
18
15
  duplicationCheck: localCheckLines.importLines.duplicationCheck,
19
16
  insertAfter: localCheckLines.importLines.insertAfter,
@@ -21,7 +18,7 @@ const updateAppJs = ({ inEndPointsJsPath, actionName, inCheckLines,
21
18
  });
22
19
 
23
20
  alterFile({
24
- jsFilePath: inEndPointsJsPath,
21
+ jsFilePath: inJsFilePath,
25
22
  toInsertLine: localCheckLines.useLines.toInsertLine,
26
23
  duplicationCheck: localCheckLines.useLines.duplicationCheck,
27
24
  insertAfter: localCheckLines.useLines.insertAfter,
@@ -1,14 +1,13 @@
1
- export default function parseInput({ endPointsJsPath, actionName,
1
+ export default function parseInput({ jsFilePath,
2
2
  inCheckLines = {}, showLog }) {
3
3
 
4
4
  const [...args] = process.argv.slice(2);
5
5
 
6
6
  return {
7
- actionName: args[0] || actionName,
8
7
  showLog: args[1] === undefined
9
8
  ? showLog
10
9
  : args[1] === "true",
11
- endPointsJsPath: endPointsJsPath || process.cwd(),
10
+ inJsFilePath: jsFilePath || process.cwd(),
12
11
  inCheckLines
13
12
  };
14
13
  };
@@ -1,18 +1,18 @@
1
1
  import parseInput from "./core/parseInput.js";
2
2
  import showUsage from './core/showUsage.js';
3
3
 
4
- import endPointsJs from "./EndPointsJs/index.js";
4
+ import updateJs 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, actionName, inCheckLines, showLog }) => {
11
- const input = parseInput({ endPointsJsPath, actionName, inCheckLines, showLog });
10
+ const run = ({ jsFilePath, inCheckLines, showLog }) => {
11
+ const input = parseInput({ jsFilePath, inCheckLines, showLog });
12
12
 
13
13
  if (input.cmd === "--help" || input.cmd === "-h" || input.cmd === "help") return showUsage(version);
14
14
 
15
- endPointsJs(input);
15
+ updateJs(input);
16
16
  };
17
17
 
18
18
  export default run;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-fix-any-js",
3
- "version": "1.2.5",
3
+ "version": "1.3.2",
4
4
  "description": "CLI to build for appjs, the endpoints",
5
5
  "keywords": [
6
6
  "cli",
@@ -1,11 +0,0 @@
1
- // v2/AppJs/validations/validateAppJsPath.js
2
-
3
- import fs from "fs";
4
-
5
- const validateAppJsPath = ({ jsFilePath }) => {
6
- if (!fs.existsSync(jsFilePath)) {
7
- throw new Error(`${jsFilePath} file not found`);
8
- };
9
- };
10
-
11
- export default validateAppJsPath;
@@ -1,9 +0,0 @@
1
- // v2/AppJs/validations/validateEndpoint.js
2
-
3
- const validateEndpoint = ({ endpoint }) => {
4
- if (!endpoint || endpoint.trim() === "") {
5
- throw new Error("endpoint should not be empty");
6
- };
7
- };
8
-
9
- export default validateEndpoint;
@@ -1,14 +0,0 @@
1
- import updateAppJs from "./UpdateAppJs/index.js";
2
-
3
- export default ({ actionName, endPointsJsPath, inCheckLines, showLog }) => {
4
- const localToPath = endPointsJsPath;
5
-
6
- const fromUpdate = updateAppJs({
7
- inEndPointsJsPath: `${localToPath}/end-points.js`,
8
- actionName,
9
- inCheckLines,
10
- showLog
11
- });
12
-
13
- return true;
14
- };
File without changes
File without changes