magic-renamer 21.0.98 → 21.0.100

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 (84) hide show
  1. package/VERIFIED-BUILD-DATA.jsonc +3 -3
  2. package/browser/package.json +1 -1
  3. package/browser-prod/package.json +1 -1
  4. package/full-dts/build-info._auto-generated_.d.ts +1 -1
  5. package/lib/build-info._auto-generated_.d.ts +1 -1
  6. package/lib/build-info._auto-generated_.js +1 -1
  7. package/lib/build-info._auto-generated_.js.map +1 -1
  8. package/lib/package.json +1 -1
  9. package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
  10. package/lib-esm/lib/build-info._auto-generated_.js +1 -1
  11. package/lib-esm/lib/build-info._auto-generated_.js.map +1 -1
  12. package/lib-prod/build-info._auto-generated_.d.ts +1 -1
  13. package/lib-prod/build-info._auto-generated_.js +1 -1
  14. package/lib-prod/build-info._auto-generated_.js.map +1 -1
  15. package/lib-prod/package.json +1 -1
  16. package/package.json +1 -1
  17. package/ts-source/browser-code/build-info._auto-generated_.ts +18 -0
  18. package/ts-source/browser-code/index._auto-generated_.ts +12 -0
  19. package/ts-source/browser-code/index.scss +11 -0
  20. package/ts-source/browser-code/index.ts +15 -0
  21. package/ts-source/browser-code/lib-info.md +8 -0
  22. package/ts-source/browser-code/magic-renamer-data.ts +17 -0
  23. package/ts-source/browser-code/magic-renamer.ts +20 -0
  24. package/ts-source/browser-code/migrations/index.ts +13 -0
  25. package/ts-source/browser-code/migrations/migrations-info.md +6 -0
  26. package/ts-source/browser-code/migrations/migrations_index._auto-generated_.ts +12 -0
  27. package/ts-source/browser-code/rename-rule.ts +171 -0
  28. package/ts-source/browser-code/start.ts +16 -0
  29. package/ts-source/browser-code-prod/build-info._auto-generated_.split-namespaces.json +4 -0
  30. package/ts-source/browser-code-prod/build-info._auto-generated_.ts +18 -0
  31. package/ts-source/browser-code-prod/index._auto-generated_.split-namespaces.json +4 -0
  32. package/ts-source/browser-code-prod/index._auto-generated_.ts +12 -0
  33. package/ts-source/browser-code-prod/index.scss +11 -0
  34. package/ts-source/browser-code-prod/index.split-namespaces.json +4 -0
  35. package/ts-source/browser-code-prod/index.ts +15 -0
  36. package/ts-source/browser-code-prod/lib-info.md +8 -0
  37. package/ts-source/browser-code-prod/magic-renamer-data.split-namespaces.json +4 -0
  38. package/ts-source/browser-code-prod/magic-renamer-data.ts +17 -0
  39. package/ts-source/browser-code-prod/magic-renamer.split-namespaces.json +4 -0
  40. package/ts-source/browser-code-prod/magic-renamer.ts +20 -0
  41. package/ts-source/browser-code-prod/migrations/index.split-namespaces.json +4 -0
  42. package/ts-source/browser-code-prod/migrations/index.ts +13 -0
  43. package/ts-source/browser-code-prod/migrations/migrations-info.md +6 -0
  44. package/ts-source/browser-code-prod/migrations/migrations_index._auto-generated_.split-namespaces.json +4 -0
  45. package/ts-source/browser-code-prod/migrations/migrations_index._auto-generated_.ts +12 -0
  46. package/ts-source/browser-code-prod/rename-rule.split-namespaces.json +4 -0
  47. package/ts-source/browser-code-prod/rename-rule.ts +171 -0
  48. package/ts-source/browser-code-prod/start.split-namespaces.json +4 -0
  49. package/ts-source/browser-code-prod/start.ts +16 -0
  50. package/ts-source/websql-code/build-info._auto-generated_.ts +18 -0
  51. package/ts-source/websql-code/index._auto-generated_.ts +12 -0
  52. package/ts-source/websql-code/index.scss +11 -0
  53. package/ts-source/websql-code/index.ts +15 -0
  54. package/ts-source/websql-code/lib-info.md +8 -0
  55. package/ts-source/websql-code/magic-renamer-data.ts +17 -0
  56. package/ts-source/websql-code/magic-renamer.ts +20 -0
  57. package/ts-source/websql-code/migrations/index.ts +13 -0
  58. package/ts-source/websql-code/migrations/migrations-info.md +6 -0
  59. package/ts-source/websql-code/migrations/migrations_index._auto-generated_.ts +12 -0
  60. package/ts-source/websql-code/rename-rule.ts +171 -0
  61. package/ts-source/websql-code/start.ts +16 -0
  62. package/ts-source/websql-code-prod/build-info._auto-generated_.split-namespaces.json +4 -0
  63. package/ts-source/websql-code-prod/build-info._auto-generated_.ts +18 -0
  64. package/ts-source/websql-code-prod/index._auto-generated_.split-namespaces.json +4 -0
  65. package/ts-source/websql-code-prod/index._auto-generated_.ts +12 -0
  66. package/ts-source/websql-code-prod/index.scss +11 -0
  67. package/ts-source/websql-code-prod/index.split-namespaces.json +4 -0
  68. package/ts-source/websql-code-prod/index.ts +15 -0
  69. package/ts-source/websql-code-prod/lib-info.md +8 -0
  70. package/ts-source/websql-code-prod/magic-renamer-data.split-namespaces.json +4 -0
  71. package/ts-source/websql-code-prod/magic-renamer-data.ts +17 -0
  72. package/ts-source/websql-code-prod/magic-renamer.split-namespaces.json +4 -0
  73. package/ts-source/websql-code-prod/magic-renamer.ts +20 -0
  74. package/ts-source/websql-code-prod/migrations/index.split-namespaces.json +4 -0
  75. package/ts-source/websql-code-prod/migrations/index.ts +13 -0
  76. package/ts-source/websql-code-prod/migrations/migrations-info.md +6 -0
  77. package/ts-source/websql-code-prod/migrations/migrations_index._auto-generated_.split-namespaces.json +4 -0
  78. package/ts-source/websql-code-prod/migrations/migrations_index._auto-generated_.ts +12 -0
  79. package/ts-source/websql-code-prod/rename-rule.split-namespaces.json +4 -0
  80. package/ts-source/websql-code-prod/rename-rule.ts +171 -0
  81. package/ts-source/websql-code-prod/start.split-namespaces.json +4 -0
  82. package/ts-source/websql-code-prod/start.ts +16 -0
  83. package/websql/package.json +1 -1
  84. package/websql-prod/package.json +1 -1
@@ -0,0 +1,6 @@
1
+ THIS FILE IS GENERATED - DO NOT MODIFY
2
+
3
+ This folder is only for storing migration files with auto-generated names.
4
+
5
+ THIS FILE IS GENERATED - DO NOT MODIFY
6
+
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,12 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,171 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { Level, Log__NS__create, Log__NS__disableAllLogs, Log__NS__disableAllLogsPermanetly, Log__NS__enableAllLogs, Log__NS__onlyLevel, Log__NS__onlyModules, Log__NS__setGlobalLevel, Log__NS__settings } from 'ng2-logger/browser-prod';
14
+ import { Helpers__NS___fixCommand, Helpers__NS__ActionInstance, Helpers__NS__actionStarted, Helpers__NS__bigMaxBuffer, Helpers__NS__checkProcess, Helpers__NS__cleanExit, Helpers__NS__clearConsole, Helpers__NS__command, Helpers__NS__commandOutputAsString, Helpers__NS__commandOutputAsStringAsync, Helpers__NS__contain, Helpers__NS__createFolder, Helpers__NS__createSymLink, Helpers__NS__error, Helpers__NS__execute, Helpers__NS__exists, Helpers__NS__filesFrom, Helpers__NS__foldersFrom, Helpers__NS__getFilesFrom, Helpers__NS__getFoldersFrom, Helpers__NS__getIsBrowser, Helpers__NS__getIsElectron, Helpers__NS__getIsNode, Helpers__NS__getIsRunningInGitBash, Helpers__NS__getIsSupportedTaonTerminal, Helpers__NS__getIsVerboseMode, Helpers__NS__getIsVerboseModeOrTnp, Helpers__NS__getIsWebSQL, Helpers__NS__getIsWsl, Helpers__NS__getStdio, Helpers__NS__hideNodeWarnings, Helpers__NS__info, Helpers__NS__isBlob, Helpers__NS__isBuffer, Helpers__NS__isClass, Helpers__NS__isExistedSymlink, Helpers__NS__isFile, Helpers__NS__isFolder, Helpers__NS__isRunningInDocker, Helpers__NS__isRunningInLinuxGraphicsCapableEnvironment, Helpers__NS__isSymlinkFileExitedOrUnexisted, Helpers__NS__isSymlinkThatMatchesUrl, Helpers__NS__isUnexistedLink, Helpers__NS__killOnPort, Helpers__NS__killProcess, Helpers__NS__killProcessByPort, Helpers__NS__linksToFolderFrom, Helpers__NS__linksToFoldersFrom, Helpers__NS__log, Helpers__NS__logError, Helpers__NS__logInfo, Helpers__NS__logProc, Helpers__NS__logSuccess, Helpers__NS__logTaskDone, Helpers__NS__logTaskStarted, Helpers__NS__logWarn, Helpers__NS__mediaTypeFromSrc, Helpers__NS__mkdirp, Helpers__NS__modifyLineByLine, Helpers__NS__msgCacheClear, Helpers__NS__openFolderInFileExplorer, Helpers__NS__parse, Helpers__NS__pathContainLink, Helpers__NS__questionYesNo, Helpers__NS__readFile, Helpers__NS__readJson, Helpers__NS__readJson5, Helpers__NS__readJsonC, Helpers__NS__relative, Helpers__NS__remove, Helpers__NS__removeEmptyLineFromString, Helpers__NS__removeFileIfExists, Helpers__NS__removeFolderIfExists, Helpers__NS__removeIfExists, Helpers__NS__removeSlashAtBegin, Helpers__NS__removeSlashAtEnd, Helpers__NS__removeSymlinks, Helpers__NS__renderError, Helpers__NS__replaceLinesInFile, Helpers__NS__run, Helpers__NS__runAsyncIn, Helpers__NS__runSyncIn, Helpers__NS__runSyncOrAsync, Helpers__NS__sleep, Helpers__NS__stopApplication, Helpers__NS__stringify, Helpers__NS__success, Helpers__NS__taskDone, Helpers__NS__taskStarted, Helpers__NS__throwError, Helpers__NS__timeout, Helpers__NS__tryCatchError, Helpers__NS__tryReadFile, Helpers__NS__tryRemoveDir, Helpers__NS__values, Helpers__NS__wait, Helpers__NS__warn, Helpers__NS__writeFile, Helpers__NS__writeJson, Helpers__NS__writeJson5, Helpers__NS__writeJsonC, Utils__NS__camelize, Utils__NS__css__NS__numValue, Utils__NS__escapeStringForRegEx, Utils__NS__fullDate, Utils__NS__fullDateTime, Utils__NS__getFreePort, Utils__NS__removeChalkSpecialChars, Utils__NS__requireUncached, Utils__NS__sortKeys, Utils__NS__uniqArray, Utils__NS__wait, Utils__NS__waitMilliseconds } from 'tnp-core/browser-prod';
15
+ import { ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLeafObject, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith, UtilsString__NS__kebabCaseNoSplitNumbers, UtilsString__NS__listDiff } from 'tnp-core/browser-prod';
16
+ const log = Log__NS__create('rename-rule', Level.WARN, Level.ERROR);
17
+ export class RenameRule {
18
+ static from(pArgs: string): RenameRule[] {
19
+ pArgs = pArgs.replace(/\=\>/g, '->');
20
+ let args = pArgs.split(/(\'|\")(\ )+(\'|\")/).filter(f => !!f) as string[];
21
+ log.d('---- Rules ----');
22
+ args.forEach(a => {
23
+ log.d(a);
24
+ });
25
+ log.d('---------------');
26
+ return args
27
+ .filter(a => a.search('->') !== -1)
28
+ .map(a => {
29
+ const [from, to] = a.split('->');
30
+ if (!from || !to) {
31
+ Helpers__NS__error(`Incorrect rule
32
+ "${from}" -> "${to}"
33
+ please follow pattern: 'test name -> my new name '`, false, true);
34
+ }
35
+ return new RenameRule(from.trim(), to.trim());
36
+ });
37
+ }
38
+ public readonly fromWhiteSpaceReplaced: string;
39
+ public readonly toWhiteSpaceReplaced: string;
40
+ constructor(public readonly from: string, public readonly to: string) {
41
+ this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\W/g, ' ');
42
+ this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\W/g, ' ');
43
+ }
44
+ applyTo(s: string): boolean {
45
+ s = s.trim().toLowerCase().replace(/\W/g, '');
46
+ const res = s.search(this.from.replace(/\W/g, '')) !== -1;
47
+ return res;
48
+ }
49
+ toString = () => {
50
+ return `${this.from} => ${this.to}`;
51
+ };
52
+ includes(orgString) {
53
+ return !___NS__isUndefined(this.combinationsData(true).combinationsAll.find(v => {
54
+ const [from, to] = v;
55
+ return orgString === to;
56
+ }));
57
+ }
58
+ combinationsData(getAll = false): {
59
+ isWeakFrom: boolean;
60
+ combinationsAll?: string[][];
61
+ combinationsInClass?: string[][];
62
+ combinationsInTemplate?: string[][];
63
+ } {
64
+ const thisTo = this.toWhiteSpaceReplaced;
65
+ const thisFrom = this.fromWhiteSpaceReplaced;
66
+ const isWeakFrom = ___NS__kebabCase(thisFrom).split('-').length <= 1;
67
+ if (isWeakFrom && !getAll) {
68
+ return {
69
+ isWeakFrom,
70
+ combinationsInTemplate: [
71
+ [___NS__upperCase(thisFrom), ___NS__snakeCase(thisTo).toUpperCase()],
72
+ [
73
+ ___NS__upperFirst(___NS__camelCase(thisFrom)),
74
+ ___NS__upperFirst(___NS__camelCase(thisTo)),
75
+ ],
76
+ ['"' + ___NS__camelCase(thisFrom) + '.', '"' + ___NS__camelCase(thisTo) + '.'],
77
+ [
78
+ UtilsString__NS__kebabCaseNoSplitNumbers(thisFrom),
79
+ UtilsString__NS__kebabCaseNoSplitNumbers(thisTo),
80
+ ],
81
+ ],
82
+ combinationsInClass: [
83
+ [
84
+ ___NS__upperFirst(___NS__camelCase(thisFrom)),
85
+ ___NS__upperFirst(___NS__camelCase(thisTo)),
86
+ ],
87
+ [___NS__upperCase(thisFrom), ___NS__snakeCase(thisTo).toUpperCase()],
88
+ [___NS__camelCase(thisFrom), ___NS__camelCase(thisTo)],
89
+ ],
90
+ };
91
+ }
92
+ return {
93
+ isWeakFrom: false,
94
+ combinationsAll: [
95
+ [
96
+ UtilsString__NS__kebabCaseNoSplitNumbers(thisFrom),
97
+ UtilsString__NS__kebabCaseNoSplitNumbers(thisTo),
98
+ ],
99
+ [___NS__kebabCase(thisFrom), ___NS__kebabCase(thisTo)],
100
+ [___NS__camelCase(thisFrom), ___NS__camelCase(thisTo)],
101
+ [
102
+ ___NS__upperFirst(___NS__camelCase(thisFrom)),
103
+ ___NS__upperFirst(___NS__camelCase(thisTo)),
104
+ ],
105
+ [___NS__snakeCase(thisFrom), ___NS__snakeCase(thisTo)],
106
+ [
107
+ ___NS__snakeCase(thisFrom).toUpperCase(),
108
+ ___NS__snakeCase(thisTo).toUpperCase(),
109
+ ],
110
+ [___NS__startCase(thisFrom), ___NS__startCase(thisTo)],
111
+ [___NS__upperCase(thisFrom), ___NS__upperCase(thisTo)],
112
+ [___NS__lowerCase(thisFrom), ___NS__lowerCase(thisTo)],
113
+ [
114
+ ___NS__camelCase(thisFrom).toLocaleLowerCase(),
115
+ ___NS__camelCase(thisTo).toLocaleLowerCase(),
116
+ ],
117
+ ],
118
+ };
119
+ }
120
+ replaceInString(orgString: string): string {
121
+ return this.replace({
122
+ orgString,
123
+ replaceAllPossibilities: true,
124
+ });
125
+ }
126
+ replace(options: {
127
+ fileName?: string;
128
+ orgString: string;
129
+ replaceAllPossibilities?: boolean;
130
+ }) {
131
+ let { fileName, orgString, replaceAllPossibilities } = options;
132
+ if (typeof orgString !== 'string') {
133
+ Helpers__NS__log({ orgString });
134
+ Helpers__NS__warn(`[magic-renamer][not a string] fielname ${fileName}`);
135
+ return orgString;
136
+ }
137
+ replaceAllPossibilities = !!replaceAllPossibilities;
138
+ const combinationsData = this.combinationsData();
139
+ if (combinationsData.isWeakFrom) {
140
+ const lines = orgString.split('\n');
141
+ for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
142
+ const line = lines[lineIndex];
143
+ let combinations = combinationsData.combinationsInTemplate;
144
+ if (line.includes('inject(')) {
145
+ combinations = combinationsData.combinationsInClass;
146
+ }
147
+ for (let combinationIndex = 0; combinationIndex < combinations.length; combinationIndex++) {
148
+ let [from, to] = combinations[combinationIndex];
149
+ lines[lineIndex] = lines[lineIndex].replace(new RegExp(Utils__NS__escapeStringForRegEx(from), 'g'), to);
150
+ }
151
+ }
152
+ orgString = lines.join('\n');
153
+ }
154
+ else {
155
+ const combinations = combinationsData.combinationsAll;
156
+ for (let combinationIndex = 0; combinationIndex < combinations.length; combinationIndex++) {
157
+ const combination = combinations[combinationIndex];
158
+ let [from, to] = combination;
159
+ if (orgString.search(from) !== -1) {
160
+ const regex = new RegExp(Utils__NS__escapeStringForRegEx(from));
161
+ log.i(`apply! "${regex.source}" to file ${fileName} => "${to}"`);
162
+ orgString = orgString.replace(new RegExp(Utils__NS__escapeStringForRegEx(from), 'g'), to);
163
+ if (!replaceAllPossibilities) {
164
+ return orgString;
165
+ }
166
+ }
167
+ }
168
+ }
169
+ return orgString;
170
+ }
171
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,16 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { MagicRenamer } from './magic-renamer';
14
+ export async function start(argsv: string[]): Promise<void> {
15
+ return (void 0);
16
+ }
@@ -0,0 +1,18 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ export const BUILD_FRAMEWORK_CLI_NAME = 'tnp';
14
+ export const APP_ID = 'com.domain.example.magic-renamer';
15
+ export const BUILD_BASE_HREF = '';
16
+ export const PROJECT_NPM_NAME = 'magic-renamer';
17
+ export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
18
+ export const CURRENT_PACKAGE_VERSION = '21.0.100';
@@ -0,0 +1,12 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
@@ -0,0 +1,11 @@
1
+ /* ============================================================================
2
+
3
+ - TAON READONLY SOURCE
4
+ - DO NOT MODIFY THIS FILE.
5
+ - Changes may be overwritten.
6
+ - Use command: taon build:lib:watch
7
+ inside magic-renamer project repository
8
+ for watch development of third party modules like this.
9
+
10
+ * ========================================================================== */
11
+
@@ -0,0 +1,15 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ export * from './rename-rule';
14
+ export * from './magic-renamer';
15
+ export * from './start';
@@ -0,0 +1,8 @@
1
+ THIS FILE IS GENERATED - DO NOT MODIFY
2
+
3
+ This folder is an entry point for npm Angular/NodeJS library
4
+
5
+ DON'T USE STUFF FROM PARENT FOLDER app.* FILES HERE (except src/migrations/** files).
6
+
7
+ THIS FILE IS GENERATED - DO NOT MODIFY
8
+
@@ -0,0 +1,17 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { path } from "tnp-core/websql";
14
+ export const toDebug = [];
15
+ export function shouldDebug(filePath: string) {
16
+ return toDebug.includes(path.basename(filePath));
17
+ }
@@ -0,0 +1,20 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { Log, Level } from 'ng2-logger/websql';
14
+ import { _, path, fse, glob, crossPlatformPath, fg, Utils, dotTaonFolder, dotTnpFolder, UtilsFilesFoldersSync, UtilsFilesFolders, } from 'tnp-core/websql';
15
+ import { Helpers } from 'tnp-core/websql';
16
+ import { shouldDebug } from './magic-renamer-data';
17
+ import { RenameRule } from './rename-rule';
18
+ const log = Log.create('magic-renemer', Level.WARN, Level.ERROR);
19
+ export class MagicRenamer {
20
+ }
@@ -0,0 +1,13 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ export * from './migrations_index._auto-generated_';
@@ -0,0 +1,6 @@
1
+ THIS FILE IS GENERATED - DO NOT MODIFY
2
+
3
+ This folder is only for storing migration files with auto-generated names.
4
+
5
+ THIS FILE IS GENERATED - DO NOT MODIFY
6
+
@@ -0,0 +1,12 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
@@ -0,0 +1,171 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { Log, Level } from 'ng2-logger/websql';
14
+ import { Helpers, Utils } from 'tnp-core/websql';
15
+ import { _, UtilsString } from 'tnp-core/websql';
16
+ const log = Log.create('rename-rule', Level.WARN, Level.ERROR);
17
+ export class RenameRule {
18
+ static from(pArgs: string): RenameRule[] {
19
+ pArgs = pArgs.replace(/\=\>/g, '->');
20
+ let args = pArgs.split(/(\'|\")(\ )+(\'|\")/).filter(f => !!f) as string[];
21
+ log.d('---- Rules ----');
22
+ args.forEach(a => {
23
+ log.d(a);
24
+ });
25
+ log.d('---------------');
26
+ return args
27
+ .filter(a => a.search('->') !== -1)
28
+ .map(a => {
29
+ const [from, to] = a.split('->');
30
+ if (!from || !to) {
31
+ Helpers.error(`Incorrect rule
32
+ "${from}" -> "${to}"
33
+ please follow pattern: 'test name -> my new name '`, false, true);
34
+ }
35
+ return new RenameRule(from.trim(), to.trim());
36
+ });
37
+ }
38
+ public readonly fromWhiteSpaceReplaced: string;
39
+ public readonly toWhiteSpaceReplaced: string;
40
+ constructor(public readonly from: string, public readonly to: string) {
41
+ this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\W/g, ' ');
42
+ this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\W/g, ' ');
43
+ }
44
+ applyTo(s: string): boolean {
45
+ s = s.trim().toLowerCase().replace(/\W/g, '');
46
+ const res = s.search(this.from.replace(/\W/g, '')) !== -1;
47
+ return res;
48
+ }
49
+ toString = () => {
50
+ return `${this.from} => ${this.to}`;
51
+ };
52
+ includes(orgString) {
53
+ return !_.isUndefined(this.combinationsData(true).combinationsAll.find(v => {
54
+ const [from, to] = v;
55
+ return orgString === to;
56
+ }));
57
+ }
58
+ combinationsData(getAll = false): {
59
+ isWeakFrom: boolean;
60
+ combinationsAll?: string[][];
61
+ combinationsInClass?: string[][];
62
+ combinationsInTemplate?: string[][];
63
+ } {
64
+ const thisTo = this.toWhiteSpaceReplaced;
65
+ const thisFrom = this.fromWhiteSpaceReplaced;
66
+ const isWeakFrom = _.kebabCase(thisFrom).split('-').length <= 1;
67
+ if (isWeakFrom && !getAll) {
68
+ return {
69
+ isWeakFrom,
70
+ combinationsInTemplate: [
71
+ [_.upperCase(thisFrom), _.snakeCase(thisTo).toUpperCase()],
72
+ [
73
+ _.upperFirst(_.camelCase(thisFrom)),
74
+ _.upperFirst(_.camelCase(thisTo)),
75
+ ],
76
+ ['"' + _.camelCase(thisFrom) + '.', '"' + _.camelCase(thisTo) + '.'],
77
+ [
78
+ UtilsString.kebabCaseNoSplitNumbers(thisFrom),
79
+ UtilsString.kebabCaseNoSplitNumbers(thisTo),
80
+ ],
81
+ ],
82
+ combinationsInClass: [
83
+ [
84
+ _.upperFirst(_.camelCase(thisFrom)),
85
+ _.upperFirst(_.camelCase(thisTo)),
86
+ ],
87
+ [_.upperCase(thisFrom), _.snakeCase(thisTo).toUpperCase()],
88
+ [_.camelCase(thisFrom), _.camelCase(thisTo)],
89
+ ],
90
+ };
91
+ }
92
+ return {
93
+ isWeakFrom: false,
94
+ combinationsAll: [
95
+ [
96
+ UtilsString.kebabCaseNoSplitNumbers(thisFrom),
97
+ UtilsString.kebabCaseNoSplitNumbers(thisTo),
98
+ ],
99
+ [_.kebabCase(thisFrom), _.kebabCase(thisTo)],
100
+ [_.camelCase(thisFrom), _.camelCase(thisTo)],
101
+ [
102
+ _.upperFirst(_.camelCase(thisFrom)),
103
+ _.upperFirst(_.camelCase(thisTo)),
104
+ ],
105
+ [_.snakeCase(thisFrom), _.snakeCase(thisTo)],
106
+ [
107
+ _.snakeCase(thisFrom).toUpperCase(),
108
+ _.snakeCase(thisTo).toUpperCase(),
109
+ ],
110
+ [_.startCase(thisFrom), _.startCase(thisTo)],
111
+ [_.upperCase(thisFrom), _.upperCase(thisTo)],
112
+ [_.lowerCase(thisFrom), _.lowerCase(thisTo)],
113
+ [
114
+ _.camelCase(thisFrom).toLocaleLowerCase(),
115
+ _.camelCase(thisTo).toLocaleLowerCase(),
116
+ ],
117
+ ],
118
+ };
119
+ }
120
+ replaceInString(orgString: string): string {
121
+ return this.replace({
122
+ orgString,
123
+ replaceAllPossibilities: true,
124
+ });
125
+ }
126
+ replace(options: {
127
+ fileName?: string;
128
+ orgString: string;
129
+ replaceAllPossibilities?: boolean;
130
+ }) {
131
+ let { fileName, orgString, replaceAllPossibilities } = options;
132
+ if (typeof orgString !== 'string') {
133
+ Helpers.log({ orgString });
134
+ Helpers.warn(`[magic-renamer][not a string] fielname ${fileName}`);
135
+ return orgString;
136
+ }
137
+ replaceAllPossibilities = !!replaceAllPossibilities;
138
+ const combinationsData = this.combinationsData();
139
+ if (combinationsData.isWeakFrom) {
140
+ const lines = orgString.split('\n');
141
+ for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
142
+ const line = lines[lineIndex];
143
+ let combinations = combinationsData.combinationsInTemplate;
144
+ if (line.includes('inject(')) {
145
+ combinations = combinationsData.combinationsInClass;
146
+ }
147
+ for (let combinationIndex = 0; combinationIndex < combinations.length; combinationIndex++) {
148
+ let [from, to] = combinations[combinationIndex];
149
+ lines[lineIndex] = lines[lineIndex].replace(new RegExp(Utils.escapeStringForRegEx(from), 'g'), to);
150
+ }
151
+ }
152
+ orgString = lines.join('\n');
153
+ }
154
+ else {
155
+ const combinations = combinationsData.combinationsAll;
156
+ for (let combinationIndex = 0; combinationIndex < combinations.length; combinationIndex++) {
157
+ const combination = combinations[combinationIndex];
158
+ let [from, to] = combination;
159
+ if (orgString.search(from) !== -1) {
160
+ const regex = new RegExp(Utils.escapeStringForRegEx(from));
161
+ log.i(`apply! "${regex.source}" to file ${fileName} => "${to}"`);
162
+ orgString = orgString.replace(new RegExp(Utils.escapeStringForRegEx(from), 'g'), to);
163
+ if (!replaceAllPossibilities) {
164
+ return orgString;
165
+ }
166
+ }
167
+ }
168
+ }
169
+ return orgString;
170
+ }
171
+ }
@@ -0,0 +1,16 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { MagicRenamer } from './magic-renamer';
14
+ export async function start(argsv: string[]): Promise<void> {
15
+ return (void 0);
16
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,18 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ export const BUILD_FRAMEWORK_CLI_NAME = 'tnp';
14
+ export const APP_ID = 'com.domain.example.magic-renamer';
15
+ export const BUILD_BASE_HREF = '';
16
+ export const PROJECT_NPM_NAME = 'magic-renamer';
17
+ export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
18
+ export const CURRENT_PACKAGE_VERSION = '21.0.100';
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,12 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
@@ -0,0 +1,11 @@
1
+ /* ============================================================================
2
+
3
+ - TAON READONLY SOURCE
4
+ - DO NOT MODIFY THIS FILE.
5
+ - Changes may be overwritten.
6
+ - Use command: taon build:lib:watch
7
+ inside magic-renamer project repository
8
+ for watch development of third party modules like this.
9
+
10
+ * ========================================================================== */
11
+
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,15 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside magic-renamer project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ export * from './rename-rule';
14
+ export * from './magic-renamer';
15
+ export * from './start';