@build-in-blocks/dev.resources 1.0.0 → 1.0.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.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @build-in-blocks/dev.resources
2
2
 
3
- [![All Contributors](https://img.shields.io/github/all-contributors/build-in-blocks/dev.resources?color=ee8449&style=flat-square)](#contributors)
3
+ ![Latest Version](https://img.shields.io/npm/v/@build-in-blocks/dev.resources.svg?label=latest&color=brightgreen&style=flat-square) [![Npm package total downloads](https://flat.badgen.net/npm/dt/@build-in-blocks/dev.resources?color=blue)](https://npmjs.com/package/@build-in-blocks/dev.resources) ![build passing](https://img.shields.io/badge/build-passing-brightgreen?style=flat-square)
4
4
 
5
- [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/build-in-blocks/dev.resources/blob/develop/docs.contributors/README.md) [![License: AGPL v3.0](https://img.shields.io/badge/license-AGPL%20v3.0-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) ![build passing](https://img.shields.io/badge/build-passing-brightgreen?style=flat)
5
+ [![License: AGPL v3.0](https://img.shields.io/badge/license-AGPL%20v3.0-blue.svg?style=flat-square)](https://www.gnu.org/licenses/agpl-3.0) [![All Contributors](https://img.shields.io/github/all-contributors/build-in-blocks/dev.resources?color=ee8449&style=flat-square)](#contributors) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat-square)](https://github.com/build-in-blocks/dev.resources/blob/develop/docs.contributors/README.md)
6
6
 
7
7
  #
8
8
 
@@ -22,10 +22,6 @@
22
22
 
23
23
  #
24
24
 
25
- **Dependency:** `@build-in-blocks` framework libraries that have `dev.` in their name are only useful for local development, and should only be installed as a `devDependency` in your project.
26
-
27
- #
28
-
29
25
  **User guide:** See [docs.users README.md](https://github.com/build-in-blocks/dev.resources/blob/develop/docs.users/README.md)
30
26
 
31
27
  #
@@ -1,3 +1,4 @@
1
+ export * from './node.blocks-terminal-logger';
1
2
  export * from './node.file-system';
2
3
  export * from './web.blocks-app';
3
4
  export * from './types';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./node.blocks-terminal-logger"), exports);
17
18
  __exportStar(require("./node.file-system"), exports);
18
19
  __exportStar(require("./web.blocks-app"), exports);
19
20
  __exportStar(require("./types"), exports);
@@ -0,0 +1,2 @@
1
+ import { BlocksTerminalLogger } from './types/node.blocks-logger.types';
2
+ export declare const blocksTerminalLogger: ({ internalPackage, userApp, errorSource, suggestion, originalErrorMessage, processExit }: BlocksTerminalLogger) => void;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.blocksTerminalLogger = void 0;
4
+ const blocksTerminalLogger = ({ internalPackage, userApp, errorSource, suggestion, originalErrorMessage, processExit }) => {
5
+ var _a, _b, _c, _d;
6
+ //-
7
+ const messageListDisplay = ({ noNewLineAtEnd }) => {
8
+ //-
9
+ const messageList = suggestion === null || suggestion === void 0 ? void 0 : suggestion.messageList;
10
+ if (!messageList)
11
+ return;
12
+ //-
13
+ messageList.forEach((message, index) => {
14
+ const isLastMessage = index === messageList.length - 1;
15
+ const isAppendNewLineRequested = isLastMessage && !noNewLineAtEnd;
16
+ console.error(`${message}${isAppendNewLineRequested ? '\n' : ''}`);
17
+ });
18
+ };
19
+ //-
20
+ try {
21
+ const isInternalPackageErrorRequested = (internalPackage === null || internalPackage === void 0 ? void 0 : internalPackage.fullName) && internalPackage.errorMessage;
22
+ const isUserAppErrorRequested = (userApp === null || userApp === void 0 ? void 0 : userApp.fullName) && userApp.errorMessage;
23
+ const isSuggestionRequested = (_a = suggestion === null || suggestion === void 0 ? void 0 : suggestion.messageList) === null || _a === void 0 ? void 0 : _a.length;
24
+ //-
25
+ const internalPackageNameText = `${internalPackage === null || internalPackage === void 0 ? void 0 : internalPackage.fullName} (internal)`;
26
+ const suggestionSectionTitle = `Suggestion${((_b = suggestion === null || suggestion === void 0 ? void 0 : suggestion.blocksConfig) === null || _b === void 0 ? void 0 : _b.showCurrentState) ? ' (based on current state)' : ''}:`;
27
+ //-
28
+ if (isInternalPackageErrorRequested) {
29
+ console.error('--------------------------');
30
+ console.error('ERROR |', `${internalPackageNameText}:`);
31
+ console.error('Type generation failed.');
32
+ }
33
+ //-
34
+ if (isUserAppErrorRequested) {
35
+ console.error('--------------------------');
36
+ console.error('ERROR |', `${userApp === null || userApp === void 0 ? void 0 : userApp.fullName} (your app):`);
37
+ console.error(userApp.errorMessage);
38
+ }
39
+ //-
40
+ if (errorSource) {
41
+ console.error('--------------------------');
42
+ console.error(`ERROR SOURCE => ${internalPackageNameText}`);
43
+ }
44
+ //-
45
+ if (isSuggestionRequested && !((_c = suggestion === null || suggestion === void 0 ? void 0 : suggestion.blocksConfig) === null || _c === void 0 ? void 0 : _c.showCurrentState)) {
46
+ console.error('--------------------------');
47
+ console.error(suggestionSectionTitle);
48
+ messageListDisplay({});
49
+ }
50
+ //-
51
+ if (isSuggestionRequested && ((_d = suggestion === null || suggestion === void 0 ? void 0 : suggestion.blocksConfig) === null || _d === void 0 ? void 0 : _d.showCurrentState)) {
52
+ console.error('--------------------------');
53
+ console.error(`Your blocks config current state:`);
54
+ console.error(suggestion === null || suggestion === void 0 ? void 0 : suggestion.blocksConfig.referenceMessage);
55
+ console.error('--------------------------');
56
+ console.error(suggestionSectionTitle);
57
+ messageListDisplay({
58
+ noNewLineAtEnd: true,
59
+ });
60
+ }
61
+ //-
62
+ if (originalErrorMessage) {
63
+ console.error('--------------------------');
64
+ console.error('ORIGINAL ERROR:\n', originalErrorMessage);
65
+ }
66
+ }
67
+ catch (error) {
68
+ console.error('--------------------------');
69
+ console.error('ERROR |', `@build-in-blocks/dev.resources (internal):`);
70
+ console.error('Error log failed.');
71
+ console.error('--------------------------');
72
+ console.error('ORIGINAL ERROR:\n', error);
73
+ }
74
+ //-
75
+ if (processExit) {
76
+ process.exit(1);
77
+ }
78
+ };
79
+ exports.blocksTerminalLogger = blocksTerminalLogger;
@@ -1 +1,2 @@
1
+ export * from './node.blocks-logger.types';
1
2
  export * from './web.blocks-app.types';
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./node.blocks-logger.types"), exports);
17
18
  __exportStar(require("./web.blocks-app.types"), exports);
@@ -0,0 +1,20 @@
1
+ export interface BlocksTerminalLogger {
2
+ internalPackage?: {
3
+ fullName?: string;
4
+ errorMessage?: string;
5
+ };
6
+ userApp?: {
7
+ fullName?: string;
8
+ errorMessage?: string;
9
+ };
10
+ errorSource?: boolean;
11
+ suggestion?: {
12
+ blocksConfig?: {
13
+ showCurrentState?: boolean;
14
+ referenceMessage?: string;
15
+ };
16
+ messageList?: string[];
17
+ };
18
+ originalErrorMessage?: Error;
19
+ processExit?: boolean;
20
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,10 @@
1
1
  export interface BlocksConfig {
2
2
  devBuild?: {
3
- srcFolderRoot?: string;
3
+ srcCodeFolder?: string;
4
4
  entryFileName?: string;
5
+ devServer?: {
6
+ port?: number;
7
+ open?: boolean;
8
+ };
5
9
  };
6
10
  }
@@ -1,5 +1,5 @@
1
1
  export declare const _default: {
2
- srcFolderRoot: string;
2
+ srcCodeFolder: string;
3
3
  entryFileName: string;
4
4
  fileExtension: string;
5
5
  };
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._default = void 0;
4
4
  exports._default = {
5
- srcFolderRoot: 'src',
5
+ srcCodeFolder: 'src',
6
6
  entryFileName: 'index',
7
7
  //-
8
8
  fileExtension: '.ts',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@build-in-blocks/dev.resources",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Shared @build-in-blocks framework Typescript code development library.",
5
5
  "main": "./build/index.js",
6
6
  "module": "./build/index.js",
@@ -33,7 +33,6 @@
33
33
  "lint-staged": "^16.4.0",
34
34
  "npm-run-all": "^4.1.5",
35
35
  "prettier": "^3.8.1",
36
- "typescript": "^5.9.3",
37
36
  "typescript-eslint": "^8.58.0"
38
37
  },
39
38
  "homepage": "https://github.com/build-in-blocks/dev.resources#readme",