@pronto-tools-and-more/pronto 7.4.0 → 7.6.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/pronto",
3
- "version": "7.4.0",
3
+ "version": "7.6.0",
4
4
  "description": "",
5
5
  "main": "src/main.js",
6
6
  "type": "module",
@@ -17,13 +17,14 @@
17
17
  "@lvce-editor/ipc": "^11.0.1",
18
18
  "@lvce-editor/json-rpc": "^4.2.0",
19
19
  "@lvce-editor/verror": "^1.4.0",
20
- "@pronto-tools-and-more/file-watcher": "7.4.0",
21
- "@pronto-tools-and-more/files": "7.4.0",
22
- "@pronto-tools-and-more/network-process": "7.4.0",
23
- "@pronto-tools-and-more/sass-compiler": "7.4.0",
24
- "@pronto-tools-and-more/components-renderer": "7.4.0",
25
- "@pronto-tools-and-more/components": "7.4.0",
26
- "@pronto-tools-and-more/schema-process": "7.4.0",
20
+ "@pronto-tools-and-more/file-watcher": "7.6.0",
21
+ "@pronto-tools-and-more/files": "7.6.0",
22
+ "@pronto-tools-and-more/network-process": "7.6.0",
23
+ "@pronto-tools-and-more/sass-compiler": "7.6.0",
24
+ "@pronto-tools-and-more/components-renderer": "7.6.0",
25
+ "@pronto-tools-and-more/components": "7.6.0",
26
+ "@pronto-tools-and-more/schema-process": "7.6.0",
27
+ "@pronto-tools-and-more/type-checker": "7.6.0",
27
28
  "execa": "^9.4.1",
28
29
  "express": "^4.21.1"
29
30
  },
@@ -3,11 +3,13 @@ import * as Help from "../Help/Help.js";
3
3
  import * as History from "../History/History.js";
4
4
  import * as ListExperienceVersionsAndPrint from "../ListExperienceVersionsAndPrint/ListExperienceVersionsAndPrint.js";
5
5
  import * as Login from "../Login/Login.js";
6
+ import * as PrintVersion from "../PrintVersion/PrintVersion.js";
6
7
  import * as PullCode from "../PullCode/PullCode.js";
7
8
  import * as PushCode from "../PushCode/PushCode.js";
8
9
  import * as Release from "../Release/Release.js";
9
10
  import * as Server from "../Server/Server.js";
10
11
  import * as Split from "../Split/Split.js";
12
+ import * as TypeCheck from "../TypeCheck/TypeCheck.js";
11
13
  import * as Upgrade from "../Upgrade/Upgrade.js";
12
14
  import * as UploadZip from "../UploadZip/UploadZip.js";
13
15
  import * as ValidateAllSchemas from "../ValidateAllSchemas/ValidateAllSchemas.js";
@@ -27,4 +29,6 @@ export const commandMap = {
27
29
  ListExperienceVersionsAndPrint.listExperienceVersionsAndPrint,
28
30
  "UploadZip.uploadZip": UploadZip.uploadZip,
29
31
  "ValidateAllSchema.validateAllSchemas": ValidateAllSchemas.validateAllSchemas,
32
+ "PrintVersion.printVersion": PrintVersion.printVersion,
33
+ "TypeCheck.typeCheck": TypeCheck.typeCheck,
30
34
  };
@@ -0,0 +1 @@
1
+ export const Error = 128;
@@ -23,6 +23,9 @@ export const getCommandFromCliArgs = (argv) => {
23
23
  if (argv.includes("history")) {
24
24
  return "History.history";
25
25
  }
26
+ if (argv.includes("check")) {
27
+ return "TypeCheck.typeCheck";
28
+ }
26
29
  if (argv.includes("split")) {
27
30
  return "Split.split";
28
31
  }
@@ -32,5 +35,8 @@ export const getCommandFromCliArgs = (argv) => {
32
35
  if (argv.includes("release-minor")) {
33
36
  return "Release.releaseMinor";
34
37
  }
38
+ if (argv.includes("--version")) {
39
+ return "PrintVersion.printVersion";
40
+ }
35
41
  return "Help.help";
36
42
  };
@@ -0,0 +1,15 @@
1
+ import * as HandleIpc from "../HandleIpc/HandleIpc.js";
2
+ import * as IpcParent from "../IpcParent/IpcParent.js";
3
+ import * as IpcParentType from "../IpcParentType/IpcParentType.js";
4
+ import * as TypeCheckerProcessPath from "../TypeCheckerProcessPath/TypeCheckerProcessPath.js";
5
+
6
+ export const launchTypeCheckerProcess = async () => {
7
+ const ipc = await IpcParent.create({
8
+ method: IpcParentType.NodeForkedProcess,
9
+ path: TypeCheckerProcessPath.typeCheckerProcessPath,
10
+ });
11
+ HandleIpc.handleIpc(ipc);
12
+ // @ts-ignore
13
+ ipc._rawIpc.unref();
14
+ return ipc;
15
+ };
@@ -0,0 +1,5 @@
1
+ import * as Version from "../Version/Version.js";
2
+
3
+ export const printVersion = () => {
4
+ console.info(`[pronto] ${Version.version}`);
5
+ };
@@ -0,0 +1,32 @@
1
+ import { existsSync } from "fs";
2
+ import { join } from "path";
3
+ import * as Cwd from "../Cwd/Cwd.js";
4
+ import * as TypeCheckerProcess from "../TypeCheckerProcess/TypeCheckerProcess.js";
5
+ import * as ExitCode from "../ExitCode/ExitCode.js";
6
+
7
+ export const typeCheck = async () => {
8
+ const customServerPath = join(
9
+ Cwd.cwd,
10
+ "src",
11
+ "default",
12
+ "storefront",
13
+ "assets",
14
+ "scripts",
15
+ "custom.server.js"
16
+ );
17
+ if (!existsSync(customServerPath)) {
18
+ return;
19
+ }
20
+ const errors = await TypeCheckerProcess.invoke(
21
+ "CheckTypes.checkTypes",
22
+ customServerPath
23
+ );
24
+ const errorCount = errors.length;
25
+ if (errorCount === 0) {
26
+ TypeCheckerProcess.dispose();
27
+ return;
28
+ }
29
+ console.info(`[pronto-type-checker] found ${errorCount} errors`);
30
+ console.info({ errors });
31
+ process.exit(ExitCode.Error);
32
+ };
@@ -0,0 +1,26 @@
1
+ import * as JsonRpc from "../JsonRpc/JsonRpc.js";
2
+ import * as LaunchTypeCheckerProcess from "../LaunchTypeCheckerProcess/LaunchTypeCheckerProcess.js";
3
+
4
+ const state = {
5
+ /**
6
+ * @type {any}
7
+ */
8
+ ipc: undefined,
9
+ };
10
+
11
+ const getOrCreate = () => {
12
+ if (!state.ipc) {
13
+ state.ipc = LaunchTypeCheckerProcess.launchTypeCheckerProcess();
14
+ }
15
+ return state.ipc;
16
+ };
17
+
18
+ export const invoke = async (method, ...params) => {
19
+ const ipc = await getOrCreate();
20
+ return JsonRpc.invoke(ipc, method, ...params);
21
+ };
22
+
23
+ export const dispose = async () => {
24
+ const ipc = await getOrCreate();
25
+ ipc.dispose();
26
+ };
@@ -0,0 +1,13 @@
1
+ import * as Path from "node:path";
2
+ import * as ResolveBin from "../ResolveBin/ResolveBin.js";
3
+ import * as Root from "../Root/Root.js";
4
+
5
+ export const typeCheckerProcessPath =
6
+ ResolveBin.resolveBin("@pronto-tools-and-more/type-checker") ||
7
+ Path.join(
8
+ Root.root,
9
+ "packages",
10
+ "pronto-type-checker",
11
+ "src",
12
+ "typeCheckerMain.js"
13
+ );
@@ -4,6 +4,7 @@ import * as FilesPath from "../FilesPath/FilesPath.js";
4
4
  import * as JsonFile from "../JsonFile/JsonFile.js";
5
5
  import * as ValidateSchema from "../ValidateSchema/ValidateSchema.js";
6
6
  import * as SchemaProcess from "../SchemaProcess/SchemaProcess.js";
7
+ import * as ExitCode from "../ExitCode/ExitCode.js";
7
8
 
8
9
  export const validateAllSchemas = async () => {
9
10
  const dist = join(Cwd.cwd, ".tmp", "dist");
@@ -32,7 +33,7 @@ export const validateAllSchemas = async () => {
32
33
  `[pronto] views json schema error: ${error.message} at ${error.instancePath} `
33
34
  );
34
35
  }
35
- process.exit(128);
36
+ process.exit(ExitCode.Error);
36
37
  }
37
38
  await SchemaProcess.dispose();
38
39
  };
@@ -0,0 +1 @@
1
+ export const version = '7.6.0'