node-cli-tester 21.0.18 → 21.0.19

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-cli-tester/browser",
3
- "version": "21.0.18",
3
+ "version": "21.0.19",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-cli-tester/browser-prod",
3
- "version": "21.0.18",
3
+ "version": "21.0.19",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0"
@@ -21,4 +21,4 @@ export declare const CURRENT_PACKAGE_TAON_VERSION = "v21";
21
21
  /**
22
22
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
23
23
  */
24
- export declare const CURRENT_PACKAGE_VERSION = "21.0.18";
24
+ export declare const CURRENT_PACKAGE_VERSION = "21.0.19";
@@ -25,6 +25,6 @@ exports.CURRENT_PACKAGE_TAON_VERSION = 'v21';
25
25
  /**
26
26
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
27
27
  */
28
- exports.CURRENT_PACKAGE_VERSION = '21.0.18';
28
+ exports.CURRENT_PACKAGE_VERSION = '21.0.19';
29
29
  // THIS FILE IS GENERATED - DO NOT MODIFY
30
30
  //# sourceMappingURL=build-info._auto-generated_.js.map
package/lib/package.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "node-cli-tester/lib",
3
- "version": "21.0.18"
3
+ "version": "21.0.19"
4
4
  }
@@ -1,76 +1,73 @@
1
- import { path, ___NS__first } from "tnp-core/lib-prod";
2
- import { Helpers__NS__exists, Helpers__NS__foldersFrom, Helpers__NS__isFolder, Helpers__NS__log, Helpers__NS__mkdirp, Helpers__NS__readFile, Helpers__NS__removeFolderIfExists, Helpers__NS__writeFile, HelpersTaon__NS__checksum, HelpersTaon__NS__copy, HelpersTaon__NS__copyFile } from "tnp-helpers/lib-prod";
3
- class BaseProjectStructure {
4
- constructor(cwd) {
5
- this.cwd = cwd;
6
- }
7
- static BASE_STRUCTURES_FOLDER = "base-structures";
8
- get baseStructureHash() {
9
- return path.basename(this.cwd);
10
- }
11
- get projectPathBasename() {
12
- return ___NS__first(path.basename(this.cwd).split("__"));
13
- }
14
- copyto(destinationCwd, basename) {
15
- HelpersTaon__NS__copy(
16
- this.cwd,
17
- path.join(destinationCwd, basename ? basename : this.projectPathBasename)
18
- );
19
- }
20
- static allBaseStructures(cwd) {
21
- const folderPath = path.join(cwd, this.BASE_STRUCTURES_FOLDER);
22
- return Helpers__NS__foldersFrom(folderPath).map(
23
- (f) => new BaseProjectStructure(f)
24
- );
25
- }
26
- static generate(project) {
27
- const that = this;
28
- const orgCwd = path.join(project.location);
29
- const files = [];
30
- const filesWithoutLinks = files.filter((f) => !f.relativeLinkFrom);
31
- let hash = files.length.toString();
32
- for (let index = 0; index < filesWithoutLinks.length; index++) {
33
- const file = filesWithoutLinks[index];
34
- const abasolutePAth = path.join(orgCwd, file.relativePath);
35
- hash += (file.relativePath.length + 1).toString() + (Helpers__NS__isFolder(abasolutePAth) ? "" : (Helpers__NS__readFile(abasolutePAth)?.length + 1).toString());
1
+ //#region imports
2
+ import { path, ___NS__first } from 'tnp-core/lib-prod';
3
+ import { Helpers__NS__exists, Helpers__NS__foldersFrom, Helpers__NS__isFolder, Helpers__NS__log, Helpers__NS__mkdirp, Helpers__NS__readFile, Helpers__NS__removeFolderIfExists, Helpers__NS__writeFile, HelpersTaon__NS__checksum, HelpersTaon__NS__copy, HelpersTaon__NS__copyFile } from 'tnp-helpers/lib-prod';
4
+ //#endregion
5
+ export class BaseProjectStructure {
6
+ static { this.BASE_STRUCTURES_FOLDER = 'base-structures'; }
7
+ get baseStructureHash() {
8
+ return path.basename(this.cwd);
36
9
  }
37
- hash = `${project.name}__${HelpersTaon__NS__checksum(hash)}`;
38
- return {
39
- insideIfNotExists(destinationCwd) {
40
- const destStruct = path.join(
41
- destinationCwd,
42
- that.BASE_STRUCTURES_FOLDER,
43
- hash
44
- );
45
- if (Helpers__NS__exists(destStruct)) {
46
- Helpers__NS__log(`Base structure with name: ${hash}`);
47
- return hash;
48
- }
49
- Helpers__NS__removeFolderIfExists(destStruct);
10
+ get projectPathBasename() {
11
+ return ___NS__first(path.basename(this.cwd).split('__'));
12
+ }
13
+ constructor(cwd) {
14
+ this.cwd = cwd;
15
+ }
16
+ copyto(destinationCwd, basename) {
17
+ HelpersTaon__NS__copy(this.cwd, path.join(destinationCwd, basename ? basename : this.projectPathBasename));
18
+ }
19
+ static allBaseStructures(cwd) {
20
+ const folderPath = path.join(cwd, this.BASE_STRUCTURES_FOLDER);
21
+ return Helpers__NS__foldersFrom(folderPath).map(f => new BaseProjectStructure(f));
22
+ }
23
+ static generate(project) {
24
+ const that = this;
25
+ const orgCwd = path.join(project.location);
26
+ const files = []; //= project.forEmptyStructure();
27
+ const filesWithoutLinks = files.filter(f => !f.relativeLinkFrom);
28
+ let hash = files.length.toString();
50
29
  for (let index = 0; index < filesWithoutLinks.length; index++) {
51
- const file = filesWithoutLinks[index];
52
- const orgPath = path.join(orgCwd, file.relativePath);
53
- const destPath = path.join(destStruct, file.relativePath);
54
- Helpers__NS__mkdirp(path.dirname(destPath));
55
- if (Helpers__NS__isFolder(orgPath)) {
56
- if (file.includeContent) {
57
- HelpersTaon__NS__copy(orgPath, destPath);
58
- } else {
59
- Helpers__NS__mkdirp(destPath);
60
- }
61
- } else {
62
- if (file.includeContent) {
63
- HelpersTaon__NS__copyFile(orgPath, destPath);
64
- } else {
65
- Helpers__NS__writeFile(destPath, "");
66
- }
67
- }
30
+ const file = filesWithoutLinks[index];
31
+ const abasolutePAth = path.join(orgCwd, file.relativePath);
32
+ hash +=
33
+ (file.relativePath.length + 1).toString() +
34
+ (Helpers__NS__isFolder(abasolutePAth)
35
+ ? ''
36
+ : (Helpers__NS__readFile(abasolutePAth)?.length + 1).toString());
68
37
  }
69
- return hash;
70
- }
71
- };
72
- }
38
+ hash = `${project.name}__${HelpersTaon__NS__checksum(hash)}`;
39
+ return {
40
+ insideIfNotExists(destinationCwd) {
41
+ const destStruct = path.join(destinationCwd, that.BASE_STRUCTURES_FOLDER, hash);
42
+ if (Helpers__NS__exists(destStruct)) {
43
+ Helpers__NS__log(`Base structure with name: ${hash}`);
44
+ return hash;
45
+ }
46
+ Helpers__NS__removeFolderIfExists(destStruct);
47
+ for (let index = 0; index < filesWithoutLinks.length; index++) {
48
+ const file = filesWithoutLinks[index];
49
+ const orgPath = path.join(orgCwd, file.relativePath);
50
+ const destPath = path.join(destStruct, file.relativePath);
51
+ Helpers__NS__mkdirp(path.dirname(destPath));
52
+ if (Helpers__NS__isFolder(orgPath)) {
53
+ if (file.includeContent) {
54
+ HelpersTaon__NS__copy(orgPath, destPath);
55
+ }
56
+ else {
57
+ Helpers__NS__mkdirp(destPath);
58
+ }
59
+ }
60
+ else {
61
+ if (file.includeContent) {
62
+ HelpersTaon__NS__copyFile(orgPath, destPath);
63
+ }
64
+ else {
65
+ Helpers__NS__writeFile(destPath, '');
66
+ }
67
+ }
68
+ }
69
+ return hash;
70
+ },
71
+ };
72
+ }
73
73
  }
74
- export {
75
- BaseProjectStructure
76
- };
@@ -1,14 +1,26 @@
1
- const BUILD_FRAMEWORK_CLI_NAME = "tnp";
2
- const APP_ID = "com.domain.example.node-cli-tester";
3
- const BUILD_BASE_HREF = "";
4
- const PROJECT_NPM_NAME = "node-cli-tester";
5
- const CURRENT_PACKAGE_TAON_VERSION = "v21";
6
- const CURRENT_PACKAGE_VERSION = "21.0.18";
7
- export {
8
- APP_ID,
9
- BUILD_BASE_HREF,
10
- BUILD_FRAMEWORK_CLI_NAME,
11
- CURRENT_PACKAGE_TAON_VERSION,
12
- CURRENT_PACKAGE_VERSION,
13
- PROJECT_NPM_NAME
14
- };
1
+ // THIS FILE IS GENERATED - DO NOT MODIFY
2
+ /**
3
+ * Autogenerated by current cli tool
4
+ */
5
+ export const BUILD_FRAMEWORK_CLI_NAME = 'tnp';
6
+ /**
7
+ * This value can be change in taon.jsonc (appId)
8
+ */
9
+ export const APP_ID = 'com.domain.example.node-cli-tester';
10
+ /**
11
+ * Autogenerated by current cli tool
12
+ */
13
+ export const BUILD_BASE_HREF = '';
14
+ /**
15
+ * This value can be change in taon.jsonc (overrideNpmName)
16
+ */
17
+ export const PROJECT_NPM_NAME = 'node-cli-tester';
18
+ /**
19
+ * Taon version from you project taon.json
20
+ */
21
+ export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
22
+ /**
23
+ * Autogenerated by current cli tool. Use *tnp release* to bump version.
24
+ */
25
+ export const CURRENT_PACKAGE_VERSION = '21.0.19';
26
+ // THIS FILE IS GENERATED - DO NOT MODIFY
@@ -1,123 +1,110 @@
1
- import { path, ___NS__isUndefined, ___NS__kebabCase } from "tnp-core/lib-prod";
2
- import { config } from "tnp-core/lib-prod";
3
- import { Helpers__NS__createSymLink, Helpers__NS__exists, Helpers__NS__foldersFrom, Helpers__NS__mkdirp, Helpers__NS__readJson, Helpers__NS__writeFile } from "tnp-helpers/lib-prod";
4
- import { MetaMd } from "./meta-content-md.backend";
5
- import { CLASS } from "typescript-class-helpers/lib-prod";
6
- class CliTest {
7
- //#endregion
8
- //#endregion
9
- //#region constructor / init
10
- constructor(cwd, testName) {
11
- this.cwd = cwd;
12
- this.testName = testName;
13
- cwd = cwd.endsWith(CliTest.NAME_FOR_CLI_TESTS_FOLDER) ? cwd.replace(CliTest.NAME_FOR_CLI_TESTS_FOLDER, "") : cwd;
14
- this.cwd = cwd;
15
- this.testDirnamePath = path.join(
16
- cwd,
17
- CliTest.NAME_FOR_CLI_TESTS_FOLDER,
18
- ___NS__kebabCase(this.testName)
19
- );
20
- const pathToTempEnvs = path.join(cwd, config.folder.tmpTestsEnvironments);
21
- const pathToEnvs = path.join(cwd, config.folder.testsEnvironments);
22
- Helpers__NS__createSymLink(pathToTempEnvs, pathToEnvs, {
23
- continueWhenExistedFolderDoesntExists: true
24
- });
25
- if (Helpers__NS__exists(this.firedev_jsonc)) {
26
- const testNameFromPJ5 = Helpers__NS__readJson(this.firedev_jsonc, {}, true).description;
27
- if (testNameFromPJ5) {
28
- testName = testNameFromPJ5;
29
- this.testName = testName;
30
- }
1
+ //#region imports
2
+ import { path, ___NS__isUndefined, ___NS__kebabCase } from 'tnp-core/lib-prod';
3
+ import { config } from 'tnp-core/lib-prod';
4
+ import { Helpers__NS__createSymLink, Helpers__NS__exists, Helpers__NS__foldersFrom, Helpers__NS__mkdirp, Helpers__NS__readJson, Helpers__NS__writeFile } from 'tnp-helpers/lib-prod';
5
+ import { MetaMd } from './meta-content-md.backend';
6
+ import { CLASS } from 'typescript-class-helpers/lib-prod';
7
+ //#endregion
8
+ export class CliTest {
9
+ static { this.NAME_FOR_CLI_TESTS_FOLDER = 'src/tests/tests-cli'; }
10
+ //#region singleton / static inst
11
+ static { this.instances = {}; }
12
+ static allFrom(cwd) {
13
+ const folderWithTests = path.join(cwd, this.NAME_FOR_CLI_TESTS_FOLDER);
14
+ const folders = Helpers__NS__foldersFrom(folderWithTests);
15
+ const tests = folders.map(f => CliTest.from(f)).filter(f => !!f);
16
+ return tests;
31
17
  }
32
- }
33
- static NAME_FOR_CLI_TESTS_FOLDER = "src/tests/tests-cli";
34
- testDirnamePath;
35
- //#region singleton / static inst
36
- static instances = {};
37
- static allFrom(cwd) {
38
- const folderWithTests = path.join(
39
- cwd,
40
- this.NAME_FOR_CLI_TESTS_FOLDER
41
- );
42
- const folders = Helpers__NS__foldersFrom(folderWithTests);
43
- const tests = folders.map((f) => CliTest.from(f)).filter((f) => !!f);
44
- return tests;
45
- }
46
- static getBy(cwd, timeHash) {
47
- return this.allFrom(cwd).find((c) => !___NS__isUndefined(c.metaMd.all.find((c2) => c2.readonlyMetaJson.timeHash === timeHash)));
48
- }
49
- static from(cwd, testName) {
50
- if (!testName) {
51
- testName = path.basename(cwd);
52
- cwd = path.dirname(cwd);
18
+ static getBy(cwd, timeHash) {
19
+ return this.allFrom(cwd).find(c => !___NS__isUndefined(c.metaMd.all.find(c => c.readonlyMetaJson.timeHash === timeHash)));
53
20
  }
54
- if (!CliTest.instances[cwd]) {
55
- CliTest.instances[cwd] = {};
21
+ static from(cwd, testName) {
22
+ if (!testName) {
23
+ testName = path.basename(cwd);
24
+ cwd = path.dirname(cwd);
25
+ }
26
+ if (!CliTest.instances[cwd]) {
27
+ CliTest.instances[cwd] = {};
28
+ }
29
+ if (!CliTest.instances[cwd][testName]) {
30
+ CliTest.instances[cwd][testName] = new CliTest(cwd, testName);
31
+ }
32
+ return CliTest.instances[cwd][testName];
56
33
  }
57
- if (!CliTest.instances[cwd][testName]) {
58
- CliTest.instances[cwd][testName] = new CliTest(cwd, testName);
34
+ //#endregion
35
+ //#region getters
36
+ //#region getters / meta md
37
+ get metaMd() {
38
+ const that = this;
39
+ return {
40
+ get all() {
41
+ return MetaMd.allInstancesFrom(that.testDirnamePath);
42
+ },
43
+ async add(originalFilePath, baseCwd, NodeCliTestrClass) {
44
+ await MetaMd.preserveFiles(originalFilePath, that.testDirnamePath, baseCwd, NodeCliTestrClass.foundProjectsFn, that.cwd);
45
+ }
46
+ };
59
47
  }
60
- return CliTest.instances[cwd][testName];
61
- }
62
- //#endregion
63
- //#region getters
64
- //#region getters / meta md
65
- get metaMd() {
66
- const that = this;
67
- return {
68
- get all() {
69
- return MetaMd.allInstancesFrom(that.testDirnamePath);
70
- },
71
- async add(originalFilePath, baseCwd, NodeCliTestrClass) {
72
- await MetaMd.preserveFiles(
73
- originalFilePath,
74
- that.testDirnamePath,
75
- baseCwd,
76
- NodeCliTestrClass.foundProjectsFn,
77
- that.cwd
78
- );
79
- }
80
- };
81
- }
82
- //#endregion
83
- //#region getters / pathes
84
- get firedev_jsonc() {
85
- return path.join(this.testDirnamePath, config.file.firedev_jsonc);
86
- }
87
- get packageJsonPath() {
88
- return path.join(this.testDirnamePath, config.file.package_json);
89
- }
90
- get gitignorePath() {
91
- return path.join(this.testDirnamePath, config.file._gitignore);
92
- }
93
- get specTsPath() {
94
- return path.join(this.testDirnamePath, `${___NS__kebabCase(this.testName)}.spec.ts`);
95
- }
96
- //#endregion
97
- //#region public api
98
- //#region regenerate
99
- async regenerateFiles() {
100
- if (!Helpers__NS__exists(this.testDirnamePath)) {
101
- Helpers__NS__mkdirp(this.testDirnamePath);
48
+ //#endregion
49
+ //#region getters / pathes
50
+ get firedev_jsonc() {
51
+ return path.join(this.testDirnamePath, config.file.firedev_jsonc);
52
+ }
53
+ get packageJsonPath() {
54
+ return path.join(this.testDirnamePath, config.file.package_json);
55
+ }
56
+ get gitignorePath() {
57
+ return path.join(this.testDirnamePath, config.file._gitignore);
58
+ }
59
+ get specTsPath() {
60
+ return path.join(this.testDirnamePath, `${___NS__kebabCase(this.testName)}.spec.ts`);
61
+ }
62
+ //#endregion
63
+ //#endregion
64
+ //#region constructor / init
65
+ constructor(cwd, testName) {
66
+ this.cwd = cwd;
67
+ this.testName = testName;
68
+ cwd = cwd.endsWith(CliTest.NAME_FOR_CLI_TESTS_FOLDER) ? cwd.replace(CliTest.NAME_FOR_CLI_TESTS_FOLDER, '') : cwd;
69
+ this.cwd = cwd;
70
+ this.testDirnamePath = path.join(cwd, CliTest.NAME_FOR_CLI_TESTS_FOLDER, ___NS__kebabCase(this.testName));
71
+ const pathToTempEnvs = path.join(cwd, config.folder.tmpTestsEnvironments);
72
+ const pathToEnvs = path.join(cwd, config.folder.testsEnvironments);
73
+ Helpers__NS__createSymLink(pathToTempEnvs, pathToEnvs, {
74
+ continueWhenExistedFolderDoesntExists: true
75
+ });
76
+ if (Helpers__NS__exists(this.firedev_jsonc)) {
77
+ const testNameFromPJ5 = Helpers__NS__readJson(this.firedev_jsonc, {}, true).description;
78
+ if (testNameFromPJ5) {
79
+ testName = testNameFromPJ5;
80
+ this.testName = testName;
81
+ }
82
+ }
102
83
  }
103
- this.regeneratePackageJson5();
104
- let TestTemplatesClass = CLASS.getBy("TestTemplates");
105
- if (!TestTemplatesClass) {
106
- TestTemplatesClass = await (await import("./spec-templates.backend")).TestTemplates;
84
+ //#endregion
85
+ //#region public api
86
+ //#region regenerate
87
+ async regenerateFiles() {
88
+ if (!Helpers__NS__exists(this.testDirnamePath)) {
89
+ Helpers__NS__mkdirp(this.testDirnamePath);
90
+ }
91
+ this.regeneratePackageJson5();
92
+ let TestTemplatesClass = CLASS.getBy('TestTemplates');
93
+ if (!TestTemplatesClass) {
94
+ TestTemplatesClass = await (await import('./spec-templates.backend')).TestTemplates;
95
+ }
96
+ TestTemplatesClass.regenerateSpecTs(this.specTsPath, this.testName);
97
+ this.regenerateGitIgnore();
107
98
  }
108
- TestTemplatesClass.regenerateSpecTs(this.specTsPath, this.testName);
109
- this.regenerateGitIgnore();
110
- }
111
- //#endregion
112
- //#endregion
113
- //#region private methods
114
- //#region regenerate package json 5
115
- regeneratePackageJson5() {
116
- if (!Helpers__NS__exists(this.firedev_jsonc)) {
117
- Helpers__NS__writeFile(
118
- this.firedev_jsonc,
119
- //#region content of package.json5
120
- `{
99
+ //#endregion
100
+ //#endregion
101
+ //#region private methods
102
+ //#region regenerate package json 5
103
+ regeneratePackageJson5() {
104
+ if (!Helpers__NS__exists(this.firedev_jsonc)) {
105
+ Helpers__NS__writeFile(this.firedev_jsonc,
106
+ //#region content of package.json5
107
+ `{
121
108
  // generated from basename
122
109
  "name": "${___NS__kebabCase(this.testName)}",
123
110
  "description": "${this.testName}",
@@ -126,17 +113,16 @@ class CliTest {
126
113
  },
127
114
  "version": "0.0.0",
128
115
  }`
129
- //#endregion
130
- );
116
+ //#endregion
117
+ );
118
+ }
131
119
  }
132
- }
133
- //#endregion
134
- //#region regenerate gitignore
135
- regenerateGitIgnore() {
136
- Helpers__NS__writeFile(
137
- this.gitignorePath,
138
- //#region content of .gitignore
139
- `
120
+ //#endregion
121
+ //#region regenerate gitignore
122
+ regenerateGitIgnore() {
123
+ Helpers__NS__writeFile(this.gitignorePath,
124
+ //#region content of .gitignore
125
+ `
140
126
  /**/*.*
141
127
  !/.gitignore
142
128
  !/${path.basename(this.specTsPath)}
@@ -145,12 +131,7 @@ class CliTest {
145
131
  !/*.md
146
132
 
147
133
  `
148
- //#endregion
149
- );
150
- }
151
- //#endregion
152
- //#endregion
134
+ //#endregion
135
+ );
136
+ }
153
137
  }
154
- export {
155
- CliTest
156
- };