@robert.tools/setup 1.1.0 → 1.2.0

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.
Files changed (38) hide show
  1. package/README.md +30 -5
  2. package/dist/_shared/changes/changes.d.ts +7 -7
  3. package/dist/_shared/changes/changes.js +20 -14
  4. package/dist/_shared/changes/changes.js.map +1 -1
  5. package/dist/_shared/check/check.d.ts +43 -3
  6. package/dist/_shared/check/check.js +154 -11
  7. package/dist/_shared/check/check.js.map +1 -1
  8. package/dist/_shared/git/git.d.ts +1 -0
  9. package/dist/_shared/git/git.js +7 -1
  10. package/dist/_shared/git/git.js.map +1 -1
  11. package/dist/_shared/logger/logger.d.ts +9 -0
  12. package/dist/_shared/logger/logger.js +85 -0
  13. package/dist/_shared/logger/logger.js.map +1 -0
  14. package/dist/_shared/npm/npm.d.ts +22 -2
  15. package/dist/_shared/npm/npm.js +35 -18
  16. package/dist/_shared/npm/npm.js.map +1 -1
  17. package/dist/_shared/test-vars.config.d.ts +46 -0
  18. package/dist/_shared/test-vars.config.js +75 -0
  19. package/dist/_shared/test-vars.config.js.map +1 -0
  20. package/dist/_shared/testing/testing.d.ts +6 -0
  21. package/dist/_shared/testing/testing.js +9 -1
  22. package/dist/_shared/testing/testing.js.map +1 -1
  23. package/dist/_shared/tools/tools.d.ts +1 -0
  24. package/dist/_shared/tools/tools.js +8 -0
  25. package/dist/_shared/tools/tools.js.map +1 -0
  26. package/dist/apps/index.d.ts +2 -2
  27. package/dist/apps/index.js +21 -11
  28. package/dist/apps/index.js.map +1 -1
  29. package/dist/apps/init/init.config.d.ts +21 -0
  30. package/dist/apps/init/init.config.js +75 -0
  31. package/dist/apps/init/init.config.js.map +1 -0
  32. package/dist/apps/init/init.d.ts +4 -3
  33. package/dist/apps/init/init.js +65 -45
  34. package/dist/apps/init/init.js.map +1 -1
  35. package/dist/apps/messages.config.d.ts +31 -0
  36. package/dist/apps/messages.config.js +126 -0
  37. package/dist/apps/messages.config.js.map +1 -0
  38. package/package.json +7 -2
@@ -3,50 +3,67 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLatestVersion = exports.getPackageName = exports.getLocalVersion = exports.getPackageData = void 0;
4
4
  const cmd_1 = require("@robert.tools/cmd");
5
5
  const fs_1 = require("@robert.tools/fs");
6
- const log_1 = require("@robert.tools/log");
6
+ const test_vars_config_1 = require("../test-vars.config");
7
+ /**
8
+ * 🎯 Get data of package.json
9
+ * @param {string} root ➡️ Root directory of the package
10
+ * @returns {any} 📤 object or an empty string
11
+ */
7
12
  const getPackageData = (root) => {
8
13
  const opts = { returnType: 'json' };
9
14
  const packageJson = fs_1.FS.readFile(root + '/package.json', opts);
10
15
  if (!packageJson) {
11
- log_1.LOG.WARN(`No package.json found in ${root}`);
12
16
  return '';
13
17
  }
14
- return packageJson || {};
18
+ return packageJson;
15
19
  };
16
20
  exports.getPackageData = getPackageData;
17
- const getLocalVersion = (packageName, root) => {
21
+ /**
22
+ * 🎯 Get local version of package.json
23
+ * @param {string} root ➡️ Root directory of the package
24
+ * @returns {string} 📤 version or _UNKNOWN
25
+ */
26
+ const getLocalVersion = (root) => {
18
27
  const packageJson = (0, exports.getPackageData)(root);
19
- if (!packageJson || !packageJson.version) {
20
- log_1.LOG.WARN(`No version found for package ${packageName} in npm registry or local package.json`);
21
- return '0.0.0';
28
+ if (!packageJson) {
29
+ return test_vars_config_1._UNKNOWN;
30
+ }
31
+ else if (!packageJson.version) {
32
+ return test_vars_config_1._UNKNOWN;
22
33
  }
23
- return packageJson.version || '0.0.0';
34
+ return packageJson.version;
24
35
  };
25
36
  exports.getLocalVersion = getLocalVersion;
37
+ /**
38
+ * 🎯 Get package name from package.json
39
+ * @param {string} root ➡️ Root directory of the package
40
+ * @returns {string} 📤 name or empty string
41
+ */
26
42
  const getPackageName = (root) => {
27
43
  const packageJson = (0, exports.getPackageData)(root);
28
44
  if (!packageJson || !packageJson.name) {
29
- log_1.LOG.WARN(`No name found for package in local package.json`);
30
45
  return '';
31
46
  }
32
- return packageJson.name || '';
47
+ return packageJson.name;
33
48
  };
34
49
  exports.getPackageName = getPackageName;
35
- const getLatestVersion = (packageName, root) => {
50
+ /**
51
+ * 🎯 Get the latest version of a package from the npm registry
52
+ * @param {string} name ➡️ Name of the package
53
+ * @returns {string} 📤 Latest version or _000
54
+ */
55
+ const getLatestVersion = (name) => {
36
56
  // from npm
37
- const target = `https://registry.npmjs.org/${packageName}/latest`;
57
+ const target = `https://registry.npmjs.org/${name}/latest`;
38
58
  const result = (0, cmd_1.command)(`curl -s ${target}`);
39
59
  const json = JSON.parse(result);
40
60
  if (json.version) {
41
- // check with package version
42
- const localVersion = (0, exports.getLocalVersion)(packageName, root);
43
- if (json.version !== localVersion) {
44
- log_1.LOG.WARN(`Version mismatch for package ${packageName}: npm registry version is ${json.version}, local package.json version is ${localVersion}`);
45
- }
61
+ // TODO: check with package version
46
62
  return json.version;
47
63
  }
48
64
  else {
49
- return '0.0.0'; // no version set yet
65
+ const version = test_vars_config_1._000;
66
+ return version;
50
67
  }
51
68
  };
52
69
  exports.getLatestVersion = getLatestVersion;
@@ -1 +1 @@
1
- {"version":3,"file":"npm.js","sourceRoot":"","sources":["../../../src/_shared/npm/npm.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,yCAAsC;AACtC,2CAAwC;AAEjC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAO,EAAE;IAChD,MAAM,IAAI,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IACpC,MAAM,WAAW,GAAQ,OAAE,CAAC,QAAQ,CAAC,IAAI,GAAG,eAAe,EAAE,IAAI,CAAC,CAAC;IACnE,IAAI,CAAC,WAAW,EAAE,CAAC;QACf,SAAG,CAAC,IAAI,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC;QAC7C,OAAO,EAAE,CAAC;IACd,CAAC;IACD,OAAO,WAAW,IAAI,EAAE,CAAC;AAC7B,CAAC,CAAC;AARW,QAAA,c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AW,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACpC,OAAO,EAAE,CAAC;IACd,CAAC;IACD,OAAO,WAAW,CAAC,IAAI,CAAC;AAC5B,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEF;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAU,EAAE;IACrD,WAAW;IACX,MAAM,MAAM,GAAG,8BAA8B,IAAI,SAAS,CAAC;IAC3D,MAAM,MAAM,GAAG,IAAA,aAAO,EAAC,WAAW,MAAM,EAAE,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,mCAAmC;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;SAAM,CAAC;QACJ,MAAM,OAAO,GAAG,uBAAI,CAAC;QACrB,OAAO,OAAO,CAAC;IACnB,CAAC;AACL,CAAC,CAAC;AAZW,QAAA,gBAAgB,oBAY3B"}
@@ -0,0 +1,46 @@
1
+ export declare const PLACEHOLDER_NAME = "<name>";
2
+ export declare const PLACEHOLDER_DESCRIPTION = "<description>";
3
+ export declare const PLACEHOLDER_VERSION = "<version>";
4
+ export declare const PLACEHOLDER_AUTHOR = "<author>";
5
+ export declare const PLACEHOLDER_LICENSE = "<license>";
6
+ export declare const _123 = "1.2.3";
7
+ export declare const _234 = "2.3.4";
8
+ export declare const _456 = "4.5.6";
9
+ export declare const _987 = "9.8.7";
10
+ export declare const _UNKNOWN = "-0.0.0";
11
+ export declare const _000 = "0.0.0";
12
+ export declare const _001 = "0.0.1";
13
+ export declare const _342 = "3.4.2";
14
+ export declare const _341 = "3.4.1";
15
+ export declare const _600 = "6.0.0";
16
+ export declare const _654 = "6.5.4";
17
+ export declare const OLD_LIB = "@robert.tools/sample";
18
+ export declare const NEW_LIB = "@HORST.SCHLEMMER/foobar";
19
+ export declare const OLD_DESCRIPTION = "Some Modules!";
20
+ export declare const NEW_DESCRIPTION = "Updated Description";
21
+ export declare const MODULE_DESCRIPTION = "Some Module";
22
+ export declare const OLD_DATE = "2024-06-01";
23
+ export declare const NEW_DATE = "01.01.1990";
24
+ export declare const LICENSE = "MIT";
25
+ export declare const AUTHOR = "Robert Willemelis";
26
+ export declare const PROJECT_NAME = "foobar";
27
+ export declare const REPO_USER = "HORST-SCHLEMMER";
28
+ export declare const NPM_USER = "HORST.SCHLEMMER";
29
+ export declare const VALUE_NAME = "SETUP";
30
+ export declare const githubInfos: {
31
+ description: string;
32
+ license: string;
33
+ };
34
+ export declare const REPO: {
35
+ user: string;
36
+ repo: string;
37
+ host: string;
38
+ };
39
+ export declare const KEY_VERSION = "version";
40
+ export declare const KEY_DESCRIPTION = "description";
41
+ export declare const KEY_NAME = "name";
42
+ export declare const KEY_DATE = "date";
43
+ export declare const FUNCTION = "\nexport const test = () => {\n console.log('test');\n};\n";
44
+ export declare const HOME = "/home/willi84/dev/2026/robert-tools/setup";
45
+ import type { MOCKED_FNS } from './testing/testing.d';
46
+ export declare const MOCKED: MOCKED_FNS;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MOCKED = exports.HOME = exports.FUNCTION = exports.KEY_DATE = exports.KEY_NAME = exports.KEY_DESCRIPTION = exports.KEY_VERSION = exports.REPO = exports.githubInfos = exports.VALUE_NAME = exports.NPM_USER = exports.REPO_USER = exports.PROJECT_NAME = exports.AUTHOR = exports.LICENSE = exports.NEW_DATE = exports.OLD_DATE = exports.MODULE_DESCRIPTION = exports.NEW_DESCRIPTION = exports.OLD_DESCRIPTION = exports.NEW_LIB = exports.OLD_LIB = exports._654 = exports._600 = exports._341 = exports._342 = exports._001 = exports._000 = exports._UNKNOWN = exports._987 = exports._456 = exports._234 = exports._123 = exports.PLACEHOLDER_LICENSE = exports.PLACEHOLDER_AUTHOR = exports.PLACEHOLDER_VERSION = exports.PLACEHOLDER_DESCRIPTION = exports.PLACEHOLDER_NAME = void 0;
4
+ const GIT = require("./git/git");
5
+ const NPM = require("./npm/npm");
6
+ const SHELL = require("./shell/shell");
7
+ const CHANGES = require("./changes/changes");
8
+ // using placeholder variable to prevent multi-file overwriting by accident
9
+ exports.PLACEHOLDER_NAME = '<name>';
10
+ exports.PLACEHOLDER_DESCRIPTION = '<description>';
11
+ exports.PLACEHOLDER_VERSION = '<version>';
12
+ exports.PLACEHOLDER_AUTHOR = '<author>';
13
+ exports.PLACEHOLDER_LICENSE = '<license>';
14
+ exports._123 = '1.2.3';
15
+ exports._234 = '2.3.4';
16
+ exports._456 = '4.5.6';
17
+ exports._987 = '9.8.7';
18
+ exports._UNKNOWN = '-0.0.0';
19
+ exports._000 = '0.0.0';
20
+ exports._001 = '0.0.1';
21
+ exports._342 = '3.4.2';
22
+ exports._341 = '3.4.1';
23
+ exports._600 = '6.0.0';
24
+ exports._654 = '6.5.4';
25
+ exports.OLD_LIB = '@robert.tools/sample';
26
+ exports.NEW_LIB = '@HORST.SCHLEMMER/foobar';
27
+ exports.OLD_DESCRIPTION = 'Some Modules!';
28
+ exports.NEW_DESCRIPTION = 'Updated Description';
29
+ exports.MODULE_DESCRIPTION = 'Some Module';
30
+ exports.OLD_DATE = '2024-06-01';
31
+ exports.NEW_DATE = '01.01.1990';
32
+ exports.LICENSE = 'MIT';
33
+ exports.AUTHOR = 'Robert Willemelis';
34
+ exports.PROJECT_NAME = 'foobar';
35
+ exports.REPO_USER = 'HORST-SCHLEMMER';
36
+ exports.NPM_USER = 'HORST.SCHLEMMER';
37
+ exports.VALUE_NAME = 'SETUP'; // <name> placeholder value
38
+ exports.githubInfos = {
39
+ description: exports.OLD_DESCRIPTION,
40
+ license: exports.LICENSE,
41
+ };
42
+ exports.REPO = {
43
+ user: exports.NPM_USER,
44
+ // user: REPO_USER,
45
+ repo: exports.PROJECT_NAME,
46
+ host: 'github.com',
47
+ };
48
+ exports.KEY_VERSION = 'version';
49
+ exports.KEY_DESCRIPTION = 'description';
50
+ exports.KEY_NAME = 'name';
51
+ exports.KEY_DATE = 'date';
52
+ exports.FUNCTION = `
53
+ export const test = () => {
54
+ console.log('test');
55
+ };
56
+ `;
57
+ exports.HOME = '/home/willi84/dev/2026/robert-tools/setup';
58
+ const MOCK_DATA = {
59
+ user: exports.NPM_USER,
60
+ repo: exports.PROJECT_NAME,
61
+ description: exports.OLD_DESCRIPTION,
62
+ license: exports.LICENSE,
63
+ author: exports.AUTHOR,
64
+ year: new Date().getFullYear().toString(),
65
+ };
66
+ exports.MOCKED = {
67
+ getGithubInfos: { module: GIT, returnValue: exports.githubInfos },
68
+ getRemoteRepoInfo: { module: GIT, returnValue: exports.REPO },
69
+ getUserName: { module: GIT, returnValue: exports.AUTHOR },
70
+ getRoot: { module: GIT, returnValue: exports.HOME },
71
+ getLatestVersion: { module: NPM, returnValue: exports._341 },
72
+ getHomeDir: { module: SHELL, returnValue: exports.HOME },
73
+ getPlaceholderItems: { module: CHANGES, returnValue: MOCK_DATA },
74
+ };
75
+ //# sourceMappingURL=test-vars.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-vars.config.js","sourceRoot":"","sources":["../../src/_shared/test-vars.config.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,iCAAiC;AACjC,uCAAuC;AACvC,6CAA6C;AAC7C,2EAA2E;AAC9D,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAC5B,QAAA,uBAAuB,GAAG,eAAe,CAAC;AAC1C,QAAA,mBAAmB,GAAG,WAAW,CAAC;AAClC,QAAA,kBAAkB,GAAG,UAAU,CAAC;AAChC,QAAA,mBAAmB,GAAG,WAAW,CAAC;AAElC,QAAA,IAAI,GAAG,OAAO,CAAC;AACf,QAAA,IAAI,GAAG,OAAO,CAAC;AACf,QAAA,IAAI,GAAG,OAAO,CAAC;AACf,QAAA,IAAI,GAAG,OAAO,CAAC;AACf,QAAA,QAAQ,GAAG,QAAQ,CAAC;AACpB,Q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AClB,WAAW,EAAE,uBAAe;IAC5B,OAAO,EAAE,eAAO;IAChB,MAAM,EAAE,cAAM;IACd,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;CAC5C,CAAC;AAIW,QAAA,MAAM,GAAe;IAC9B,cAAc,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,mBAAW,EAAE;IACzD,iBAAiB,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,YAAI,EAAE;IACrD,WAAW,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,cAAM,EAAE;IACjD,OAAO,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,YAAI,EAAE;IAC3C,gBAAgB,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,YAAI,EAAE;IACpD,UAAU,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,YAAI,EAAE;IAChD,mBAAmB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE;CACnE,CAAC"}
@@ -1,2 +1,8 @@
1
+ import type { MOCKED_FNS } from './testing.d';
1
2
  export declare const mockResponse: (input: any) => jest.SpyInstance<string, [command: string, doLog?: boolean | undefined, showError?: boolean | undefined], any>;
2
3
  export declare const mockFunction: (module: any, fnName: string, returnValue: any) => jest.SpyInstance<any, unknown[], any>;
4
+ export declare const activateAllMockedFunctions: (MOCKED: MOCKED_FNS) => void;
5
+ export declare const _STR: {
6
+ (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
7
+ (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
8
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mockFunction = exports.mockResponse = void 0;
3
+ exports._STR = exports.activateAllMockedFunctions = exports.mockFunction = exports.mockResponse = void 0;
4
4
  const CMD = require("@robert.tools/cmd");
5
5
  const mockResponse = (input) => {
6
6
  const isObject = typeof input === 'object' && input !== null && !Array.isArray(input);
@@ -14,4 +14,12 @@ const mockFunction = (module, fnName, returnValue) => {
14
14
  return spy;
15
15
  };
16
16
  exports.mockFunction = mockFunction;
17
+ const activateAllMockedFunctions = (MOCKED) => {
18
+ Object.keys(MOCKED).forEach((key) => {
19
+ const { module, returnValue } = MOCKED[key];
20
+ (0, exports.mockFunction)(module, key, returnValue);
21
+ });
22
+ };
23
+ exports.activateAllMockedFunctions = activateAllMockedFunctions;
24
+ exports._STR = JSON.stringify;
17
25
  //# sourceMappingURL=testing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing.js","sourceRoot":"","sources":["../../../src/_shared/testing/testing.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AAElC,MAAM,YAAY,GAAG,CAAC,KAAU,EAAE,EAAE;IACvC,MAAM,QAAQ,GACV,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACzE,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACvD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,eAAe,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IACrE,OAAO,GAAG,CAAC;AACf,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB;AAEK,MAAM,YAAY,GAAG,CAAC,MAAW,EAAE,MAAc,EAAE,WAAgB,EAAE,EAAE;IAC1E,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IACpE,OAAO,GAAG,CAAC;AACf,CAAC,CAAC;AAHW,QAAA,YAAY,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}
@@ -0,0 +1 @@
1
+ export declare const getProperty: (obj: any, key: string, fallback: any) => any;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProperty = void 0;
4
+ const getProperty = (obj, key, fallback) => {
5
+ return obj && obj.hasOwnProperty(key) ? obj[key] : fallback;
6
+ };
7
+ exports.getProperty = getProperty;
8
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/_shared/tools/tools.ts"],"names":[],"mappings":";;;AAAO,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAE,GAAW,EAAE,QAAa,EAAE,EAAE;IAChE,OAAO,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChE,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB"}
@@ -3,8 +3,8 @@
3
3
  * 🎯 A module to run setup tasks like release, init.
4
4
  * @module release
5
5
  * @example run();
6
- * @version 1.1.0
7
- * @date 2026-08-07
6
+ * @version 1.2.0
7
+ * @date 2026-08-12
8
8
  * @license MIT
9
9
  * @author Robert Willemelis <github.com/willi84>
10
10
  */
@@ -4,8 +4,8 @@
4
4
  * 🎯 A module to run setup tasks like release, init.
5
5
  * @module release
6
6
  * @example run();
7
- * @version 1.1.0
8
- * @date 2026-08-07
7
+ * @version 1.2.0
8
+ * @date 2026-08-12
9
9
  * @license MIT
10
10
  * @author Robert Willemelis <github.com/willi84>
11
11
  */
@@ -13,7 +13,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  const prompt_1 = require("../_shared/prompt/prompt");
14
14
  const init_1 = require("./init/init");
15
15
  const changes_1 = require("../_shared/changes/changes");
16
- const log_1 = require("@robert.tools/log");
16
+ const logger_1 = require("../_shared/logger/logger");
17
+ const messages_config_1 = require("./messages.config");
17
18
  const ASK_RELEASE = {
18
19
  question: 'Release (1 = patch, 2 = minor, 3 = major): ',
19
20
  answers: {
@@ -27,21 +28,30 @@ const VALID_ANSWERS = {
27
28
  major: ['major', 'maj', 'mj'],
28
29
  patch: ['patch', 'pat', 'p'],
29
30
  };
31
+ const ACTIONS = ['release', 'init', 'verbose'];
30
32
  (async () => {
31
33
  const start = new Date().getTime();
32
34
  const params = process.argv.slice(2);
33
35
  const cmd = params[0] || '';
34
- const paramsFinal = params.slice(1);
36
+ let paramsFinal = params.slice(1);
35
37
  const param = paramsFinal[0];
36
- log_1.LOG.INFO(paramsFinal.join('|'));
37
38
  const isValid = (0, init_1.hasValidParam)(param, VALID_ANSWERS);
38
- if (!isValid) {
39
- await (0, prompt_1.ask)(ASK_RELEASE);
39
+ const needsSemver = ACTIONS.includes(cmd);
40
+ if (needsSemver && !isValid) {
41
+ const newSemantic = await (0, prompt_1.ask)(ASK_RELEASE);
42
+ paramsFinal = [newSemantic, ...paramsFinal];
40
43
  }
44
+ else {
45
+ paramsFinal = ['verbose', ...paramsFinal.slice(1)];
46
+ }
47
+ // TODO: kein semver for verbose commands
41
48
  const result = await (0, init_1.run)(cmd, paramsFinal);
42
- result.changes.map((change) => {
43
- (0, changes_1.displayChanges)(change.changes, change.file);
44
- });
45
- log_1.LOG.OK(`✅ Done in ${new Date().getTime() - start}ms`);
49
+ for (const change in result.changes) {
50
+ const file = result.changes[change];
51
+ (0, changes_1.displayChanges)(file.updated, file.file);
52
+ }
53
+ const time = `${new Date().getTime() - start}`;
54
+ (0, logger_1.addLogItem)({ ...messages_config_1.MSG_DONE, param: { time } }, result.logs);
55
+ (0, logger_1.displayLogs)(result.logs);
46
56
  })();
47
57
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apps/index.ts"],"names":[],"mappings":";;AAEA;;;;;;;;GAQG;;AAEH,qDAA+C;AAC/C,sCAAiD;AACjD,wDAA4D;AAE5D,2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QAAQ,CAAC,GAAG,CAAC,CAAC;IAC1C,IAAI,WAAW,IAAI,CAAC,OAAO,EAAE,CAAC;QAC1B,MAAM,WAAW,GAAG,MAAM,IAAA,YAAG,EAAC,WAAW,CAAC,CAAC;QAC3C,WAAW,GAAG,CAAC,WAAW,EAAE,GAAG,WAAW,CAAC,CAAC;IAChD,CAAC;SAAM,CAAC;QACJ,WAAW,GAAG,CAAC,SAAS,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC;IACD,yCAAyC;IACzC,MAAM,MAAM,GAAG,MAAM,IAAA,UAAG,EAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAC3C,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACpC,IAAA,wBAAc,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;IAC/C,IAAA,mBAAU,EAAC,EAAE,GAAG,0BAAQ,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1D,IAAA,oBAAW,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { ID_MESSAGE } from '../../_shared/logger/logger.d';
2
+ export declare const msgNewName = "Overwrite name: {oldName} to {newName}";
3
+ export declare const msgDiffName = "Mismatch of names. local {local} vs remote {remote}";
4
+ export declare const msgOverwrite = "Overwrite local version from {from} to {to}";
5
+ export declare const msgNoRemote = "No remote version for package {name}. Set to {version}";
6
+ export declare const msgDiffVersion = "Mismatch of versions. local {local} vs remote {remote}";
7
+ export declare const MSG_NEW_NAME: ID_MESSAGE;
8
+ export declare const MSG_DIFF_NAME: ID_MESSAGE;
9
+ export declare const MSG_NO_REMOTE_VERSION: ID_MESSAGE;
10
+ export declare const MSG_DIFF_VERSION: ID_MESSAGE;
11
+ export declare const MSG_NEW_VERSION: ID_MESSAGE;
12
+ export declare const MSG_LATEST_VERSION: ID_MESSAGE;
13
+ export declare const MSG_NEXT_VERSION: ID_MESSAGE;
14
+ export declare const MSG_NAME: ID_MESSAGE;
15
+ export declare const MSG_LOCAL_NAME: ID_MESSAGE;
16
+ export declare const MSG_REMOTE_NAME: ID_MESSAGE;
17
+ export declare const MSG_ROOT: ID_MESSAGE;
18
+ export declare const MSG_CMD: ID_MESSAGE;
19
+ export declare const MSG_NO_VERBOSE: ID_MESSAGE;
20
+ export declare const MSG_TOO_MANY_FILES: ID_MESSAGE;
21
+ export declare const MSG_BLACKLIST: ID_MESSAGE;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MSG_BLACKLIST = exports.MSG_TOO_MANY_FILES = exports.MSG_NO_VERBOSE = exports.MSG_CMD = exports.MSG_ROOT = exports.MSG_REMOTE_NAME = exports.MSG_LOCAL_NAME = exports.MSG_NAME = exports.MSG_NEXT_VERSION = exports.MSG_LATEST_VERSION = exports.MSG_NEW_VERSION = exports.MSG_DIFF_VERSION = exports.MSG_NO_REMOTE_VERSION = exports.MSG_DIFF_NAME = exports.MSG_NEW_NAME = exports.msgDiffVersion = exports.msgNoRemote = exports.msgOverwrite = exports.msgDiffName = exports.msgNewName = void 0;
4
+ exports.msgNewName = `Overwrite name: {oldName} to {newName}`;
5
+ exports.msgDiffName = `Mismatch of names. local {local} vs remote {remote}`;
6
+ exports.msgOverwrite = `Overwrite local version from {from} to {to}`;
7
+ exports.msgNoRemote = `No remote version for package {name}. Set to {version}`;
8
+ exports.msgDiffVersion = `Mismatch of versions. local {local} vs remote {remote}`;
9
+ exports.MSG_NEW_NAME = { type: 'INFO', msg: exports.msgNewName };
10
+ exports.MSG_DIFF_NAME = { type: 'WARN', msg: exports.msgDiffName };
11
+ exports.MSG_NO_REMOTE_VERSION = {
12
+ type: 'INFO',
13
+ msg: exports.msgNoRemote,
14
+ tags: ['version', 'status'],
15
+ };
16
+ exports.MSG_DIFF_VERSION = {
17
+ type: 'WARN',
18
+ msg: exports.msgDiffVersion,
19
+ tags: ['version', 'status'],
20
+ };
21
+ exports.MSG_NEW_VERSION = {
22
+ type: 'WARN',
23
+ msg: exports.msgOverwrite,
24
+ tags: ['version', 'status'],
25
+ };
26
+ exports.MSG_LATEST_VERSION = {
27
+ type: 'DEBUG',
28
+ msg: 'Latest version: {version}',
29
+ tags: ['version', 'status'],
30
+ };
31
+ exports.MSG_NEXT_VERSION = {
32
+ type: 'DEBUG',
33
+ msg: 'New version: {version}',
34
+ tags: ['version', 'status'],
35
+ };
36
+ exports.MSG_NAME = {
37
+ type: 'DEBUG',
38
+ msg: 'Package name: {name}',
39
+ };
40
+ exports.MSG_LOCAL_NAME = {
41
+ type: 'DEBUG',
42
+ msg: 'Package name [local]: {name}',
43
+ tags: ['status'],
44
+ };
45
+ exports.MSG_REMOTE_NAME = {
46
+ type: 'DEBUG',
47
+ msg: 'Package name [remote]: {name}',
48
+ tags: ['status'],
49
+ };
50
+ exports.MSG_ROOT = {
51
+ type: 'DEBUG',
52
+ msg: 'Root: {root}',
53
+ tags: ['status'],
54
+ };
55
+ exports.MSG_CMD = {
56
+ type: 'INFO',
57
+ msg: 'run Command: {cmd} with {params}',
58
+ tags: ['all'],
59
+ };
60
+ exports.MSG_NO_VERBOSE = {
61
+ type: 'DEBUG',
62
+ msg: 'no verbose command: {verbose}',
63
+ tags: ['status'],
64
+ };
65
+ exports.MSG_TOO_MANY_FILES = {
66
+ type: 'FAIL',
67
+ msg: 'Too many files ({count}) to process.',
68
+ tags: ['all'],
69
+ };
70
+ exports.MSG_BLACKLIST = {
71
+ type: 'DEBUG',
72
+ msg: 'add test_data to blacklist',
73
+ tags: ['status'],
74
+ };
75
+ //# sourceMappingURL=init.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.config.js","sourceRoot":"","sources":["../../../src/apps/init/init.config.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,wCAAwC,CAAC;AACtD,QAAA,WAAW,GAAG,qDAAqD,CAAC;AACpE,QAAA,YAAY,GAAG,6CAA6C,CAAC;AAC7D,QAAA,WAAW,GAAG,wDAAwD,CAAC;AAEvE,QAAA,cAAc,GAAG,wDAAwD,CAAC;AAC1E,QAAA,YAAY,GAAe,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,kBAAU,EAAE,CAAC;AAC7D,QAAA,aAAa,GAAe,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,mBAAW,EAAE,CAAC;AAE/D,QAAA,qBAAqB,GAAe;IAC7C,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,mBAAW;IAChB,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;CAC9B,CAAC;AACW,QAAA,gBAAgB,GAAe;IACxC,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,sBAAc;IACnB,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;CAC9B,CAAC;AACW,QAAA,eAAe,GAAe;IACvC,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,oBAAY;IACjB,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;CAC9B,CAAC;AACW,QAAA,kBAAkB,GAAe;IAC1C,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,2BAA2B;IAChC,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;CAC9B,CAAC;AACW,QAAA,gBAAgB,GAAe;IACxC,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,wBAAwB;IAC7B,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;CAC9B,CAAC;AACW,QAAA,QAAQ,GAAe;IAChC,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,sBAAsB;CAC9B,CAAC;AACW,QAAA,cAAc,GAAe;IACtC,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,8BAA8B;IACnC,IAAI,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AACW,QAAA,eAAe,GAAe;IACvC,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,+BAA+B;IACpC,IAAI,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AACW,QAAA,QAAQ,GAAe;IAChC,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,cAAc;IACnB,IAAI,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AACW,QAAA,OAAO,GAAe;IAC/B,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,kCAAkC;IACvC,IAAI,EAAE,CAAC,KAAK,CAAC;CAChB,CAAC;AACW,QAAA,cAAc,GAAe;IACtC,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,+BAA+B;IACpC,IAAI,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AACW,QAAA,kBAAkB,GAAe;IAC1C,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,sCAAsC;IAC3C,IAAI,EAAE,CAAC,KAAK,CAAC;CAChB,CAAC;AACW,QAAA,aAAa,GAAe;IACrC,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,4BAA4B;IACjC,IAAI,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC"}
@@ -1,5 +1,6 @@
1
- import type { CHANGED } from '../../_shared/changes/changes.d';
2
- import type { INIT_OPTS, RESULT } from './init.d';
3
- export declare const init: (root: string, version: string, opts: INIT_OPTS) => CHANGED[];
1
+ import type { INIT_OPTS } from './init.d';
2
+ import type { FILE_CHANGES, RESULT } from '../../_shared/changes/changes.d';
3
+ export declare const updateResult: (result: RESULT, file_changes: FILE_CHANGES) => void;
4
+ export declare const init: (root: string, version: string, opts: INIT_OPTS, result: RESULT) => RESULT;
4
5
  export declare const run: (cmd: string, params?: string[]) => RESULT;
5
6
  export declare const hasValidParam: (param: string, validAnswers: Record<string, string[]>) => boolean;
@@ -1,38 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasValidParam = exports.run = exports.init = void 0;
3
+ exports.hasValidParam = exports.run = exports.init = exports.updateResult = void 0;
4
4
  const fs_1 = require("@robert.tools/fs");
5
- const log_1 = require("@robert.tools/log");
6
5
  const config_1 = require("../config");
7
6
  const changes_1 = require("../../_shared/changes/changes");
8
7
  const check_1 = require("../../_shared/check/check");
9
- const npm_1 = require("../../_shared/npm/npm");
10
- const git_1 = require("../../_shared/git/git");
11
8
  const shell_1 = require("../../_shared/shell/shell");
12
- const init = (root, version, opts) => {
13
- const isInitial = opts.hasOwnProperty('isInitial') ? opts.isInitial : false;
14
- const noSpec = opts.hasOwnProperty('noSpec') ? opts.noSpec : false;
9
+ const logger_1 = require("../../_shared/logger/logger");
10
+ const messages_config_1 = require("../messages.config");
11
+ const tools_1 = require("../../_shared/tools/tools");
12
+ const updateResult = (result, file_changes) => {
13
+ const { file } = file_changes;
14
+ if (!result.changes[file]) {
15
+ result.changes[file] = { file, updated: file_changes.updated };
16
+ }
17
+ else {
18
+ result.changes[file].updated = [
19
+ ...result.changes[file].updated,
20
+ ...file_changes.updated,
21
+ ];
22
+ }
23
+ result.logs = [...result.logs, ...file_changes.logs];
24
+ };
25
+ exports.updateResult = updateResult;
26
+ const init = (root, version, opts, result) => {
27
+ const isInitial = (0, tools_1.getProperty)(opts, 'isInitial', false);
28
+ const noSpec = (0, tools_1.getProperty)(opts, 'noSpec', false);
15
29
  // if root is not test_data
16
- const start = new Date().getTime();
17
30
  if (root.indexOf('test_data') === -1) {
18
31
  config_1.BLACKLIST.push('test_data');
19
- log_1.LOG.INFO(`add test_data to blacklist`);
32
+ (0, logger_1.addLogItem)(messages_config_1.MSG_BLACKLIST, result.logs);
20
33
  }
21
34
  let files = fs_1.FS.list(root, true, true, config_1.BLACKLIST);
22
35
  if (noSpec) {
23
36
  files = files.filter((file) => !file.endsWith('spec.ts'));
24
37
  }
25
- log_1.LOG.INFO(`version: ${version}`);
26
- log_1.LOG.INFO(`get ${files.length} files: ${new Date().getTime() - start}ms`);
27
- const items = isInitial ? (0, changes_1.getItems)(version) : [];
38
+ const _items = isInitial ? (0, changes_1.getItems)(version) : [];
39
+ const items = opts.items ? [...opts.items, ..._items] : _items;
28
40
  // avoid reading node_modules, .git etc by checking number of files
29
41
  if (files.length > config_1.MAX_FILES) {
30
- log_1.LOG.FAIL(`Too many files (${files.length}) to process.`);
31
- log_1.LOG.DEBUG(JSON.stringify(files, null, 2));
32
- return [];
42
+ const count = files.length.toString();
43
+ (0, logger_1.addLogItem)({ ...messages_config_1.MSG_TOO_MANY_FILES, param: { count } }, result.logs);
44
+ return result;
33
45
  }
34
46
  // replace placeholders
35
- const allChanges = [];
36
47
  const PROP_ITEMS = [
37
48
  {
38
49
  property: 'version',
@@ -49,55 +60,64 @@ const init = (root, version, opts) => {
49
60
  const hasFullPath = file.startsWith('~') || file.startsWith('/');
50
61
  const homeDir = (0, shell_1.getHomeDir)();
51
62
  const filePath = hasFullPath ? file : `${homeDir}/${file}`;
52
- (0, check_1.checkFile)(filePath, items, PROP_ITEMS, allChanges);
63
+ const file_changes = { logs: [], updated: [], file: filePath };
64
+ const doWrite = (0, tools_1.getProperty)(opts, 'doWrite', true);
65
+ (0, check_1.checkFile)(items, PROP_ITEMS, file_changes, doWrite);
66
+ (0, exports.updateResult)(result, file_changes);
53
67
  });
54
68
  // update jsdoc version
55
- return allChanges;
69
+ return result;
56
70
  };
57
71
  exports.init = init;
58
72
  const run = (cmd, params = []) => {
59
- const result = {
60
- changes: [],
61
- logs: [],
62
- };
73
+ const result = { changes: {}, logs: [] };
74
+ const LOGS = [];
75
+ const opts = {};
63
76
  const param = params[0];
77
+ opts.cmd = cmd;
78
+ opts.params = params;
64
79
  // get package name from package.json
65
- const repoRoot = (0, git_1.getRoot)();
66
- const packageName = (0, npm_1.getPackageName)(repoRoot);
67
- const isInit = cmd === 'init';
68
- log_1.LOG.OK(`run ${cmd}...`);
69
- const latest = (0, npm_1.getLatestVersion)(packageName, repoRoot);
70
- const localVersion = (0, npm_1.getLocalVersion)(packageName, repoRoot);
71
- if (latest !== localVersion) {
72
- result.logs.push({
73
- type: 'WARN',
74
- message: `Version mismatch for package ${packageName}: npm registry version is ${latest}, local package.json version is ${localVersion}`,
75
- });
76
- }
77
- const baseVersion = isInit ? localVersion : latest;
78
- const newVersion = (0, git_1.incrementVersion)(baseVersion, param);
79
- const opts = {};
80
+ const root = (0, check_1.checkBase)(cmd, opts, LOGS);
81
+ const pkgName = (0, check_1.checkPackageName)(root, opts, LOGS);
82
+ const packageName = pkgName.name;
83
+ // todo: do change
84
+ // TODO: wenn remote nicht 0.0.0 und aber immer noch default Name nicht wie remote name
80
85
  // special for setup
81
- if (packageName.indexOf('/setup') !== -1) {
86
+ if (pkgName.name.indexOf('/setup') !== -1) {
82
87
  opts.noSpec = true;
83
88
  if (params && params[1] && params[1] === 'all') {
84
89
  opts.noSpec = false;
85
90
  }
86
91
  }
87
- if (cmd === 'init') {
88
- opts.isInitial = true;
89
- }
90
- log_1.LOG.INFO(`run ${cmd} with param ${param} and version ${newVersion}`);
91
- log_1.LOG.OK(`latest version ${latest}, name: ${packageName}, root ${repoRoot}`);
92
+ const versions = (0, check_1.checkVersions)(packageName, root, param, LOGS);
93
+ const newVersion = versions.next;
94
+ // console.log(result.changes);
92
95
  switch (cmd) {
93
96
  case 'init':
94
- result.changes = (0, exports.init)(repoRoot, newVersion, opts);
97
+ opts.isInitial = true;
98
+ (0, exports.init)(root, newVersion, opts, result);
95
99
  break;
96
100
  case 'release':
97
101
  // TODO: check for changed files
98
- result.changes = (0, exports.init)(repoRoot, newVersion, opts);
102
+ (0, exports.init)(root, newVersion, opts, result);
103
+ break;
104
+ case 'verbose':
105
+ // TODO: check for changed files
106
+ opts.doWrite = false;
107
+ (0, exports.init)(root, newVersion, opts, result);
108
+ break;
109
+ }
110
+ result.logs = [...result.logs, ...LOGS];
111
+ const filterTags = [];
112
+ switch (cmd) {
113
+ case 'status':
114
+ filterTags.push('status');
115
+ break;
116
+ case 'version':
117
+ filterTags.push('version');
99
118
  break;
100
119
  }
120
+ result.logs = (0, logger_1.getFilteredLogsByTags)(result.logs, filterTags);
101
121
  return result;
102
122
  };
103
123
  exports.run = run;