magic-renamer 18.0.13 → 18.0.15

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
  THIS FILE IS GENERATED. THIS FILE IS GENERATED. THIS FILE IS GENERATED.
2
2
 
3
- Assets from this folder are being shipped with this npm package (magic-renamer@18.0.13)
3
+ Assets from this folder are being shipped with this npm package (magic-renamer@18.0.15)
4
4
  created from this project.
5
5
 
6
6
  THIS FILE IS GENERATED.THIS FILE IS GENERATED. THIS FILE IS GENERATED.
@@ -1 +1 @@
1
- {"version":3,"file":"magic-renamer.mjs","sources":["../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/rename-rule.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/magic-renamer.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/index.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/magic-renamer.ts"],"sourcesContent":["\n\nimport { Helpers } from 'tnp-helpers/browser';\nimport { _, UtilsString } from 'tnp-core/browser';\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\nexport class RenameRule {\n static from(pArgs: string): RenameRule[] {\n pArgs = pArgs.replace(/\\=\\>/g, '->');\n let args = pArgs.split(/(\\'|\\\")(\\ )+(\\'|\\\")/).filter(f => !!f) as string[];\n log.d('---- Rules ----');\n args.forEach(a => {\n log.d(a);\n });\n log.d('---------------');\n return args\n .filter(a => a.search('->') !== -1)\n .map(a => {\n const [from, to] = a.split('->');\n if (!from || !to) {\n Helpers.error(\n `Incorrect rule\n \"${from}\" -> \"${to}\"\n please follow pattern: 'test name -> my new name '`,\n false,\n true,\n );\n }\n return new RenameRule(from.trim(), to.trim());\n });\n }\n\n public readonly fromWhiteSpaceReplaced: string;\n public readonly toWhiteSpaceReplaced: string;\n constructor(\n public readonly from: string,\n public readonly to: string,\n ) {\n this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\\W/g, ' ');\n this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\\W/g, ' ');\n }\n\n applyTo(s: string): boolean {\n s = s.trim().toLowerCase().replace(/\\W/g, '');\n const res = s.search(this.from.replace(/\\W/g, '')) !== -1;\n return res;\n }\n\n toString = () => {\n return `${this.from} => ${this.to}`;\n };\n\n includes(orgString) {\n return !_.isUndefined(\n this.combinations.find(v => {\n const [from, to] = v;\n return orgString === to;\n }),\n );\n }\n\n get combinations() {\n const thisTo = this.toWhiteSpaceReplaced;\n const thisFrom = this.fromWhiteSpaceReplaced;\n return [\n\n [\n UtilsString.kebabCaseNoSplitNumbers(thisFrom),\n UtilsString.kebabCaseNoSplitNumbers(thisTo),\n ], // my-entity => hello1-kitty\n [_.kebabCase(thisFrom), _.kebabCase(thisTo)], // my-entity => hello-kitty\n [_.camelCase(thisFrom), _.camelCase(thisTo)], // myEntity => helloKitty\n [_.upperFirst(_.camelCase(thisFrom)), _.upperFirst(_.camelCase(thisTo))], // MyEntity => HelloKitty\n [_.snakeCase(thisFrom), _.snakeCase(thisTo)], // my_entity => hello_kitty\n [_.snakeCase(thisFrom).toUpperCase(), _.snakeCase(thisTo).toUpperCase()], // MY_ENTITY => HELLO_KITTY\n [_.startCase(thisFrom), _.startCase(thisTo)], // My Entity => Hello Kitty\n [_.upperCase(thisFrom), _.upperCase(thisTo)], // MY ENTITY => HELLO KITTY\n [_.lowerCase(thisFrom), _.lowerCase(thisTo)], // my entity => hello kitty\n [\n _.camelCase(thisFrom).toLocaleLowerCase(),\n _.camelCase(thisTo).toLocaleLowerCase(),\n ], // myentity => hellokitty\n ];\n }\n\n /**\n * @param orgString input string\n * @returns string with all possible combinations replaced\n */\n replaceInString(orgString: string): string {\n return this.replace({\n orgString,\n replaceallPossibliliteis: true,\n });\n }\n\n /**\n *\n * @param orgString (file name OR file content)\n * @param replaceallPossibliliteis when changin file notent (not name only)\n * @returns\n */\n replace(options: {\n /**\n * file name for debugging\n */\n fileName?: string;\n orgString: string;\n replaceallPossibliliteis?: boolean;\n }) {\n let { fileName, orgString, replaceallPossibliliteis } = options;\n replaceallPossibliliteis = !!replaceallPossibliliteis;\n const combinations = this.combinations;\n for (let index = 0; index < combinations.length; index++) {\n const v = combinations[index];\n let [from, to] = v;\n if (orgString.search(from) !== -1) {\n const regex = new RegExp(Helpers.escapeStringForRegEx(from));\n log.i(`apply! \"${regex.source}\" to file ${fileName} => \"${to}\"`);\n orgString = orgString.replace(\n new RegExp(Helpers.escapeStringForRegEx(from), 'g'),\n to,\n );\n if (!replaceallPossibliliteis) {\n return orgString;\n }\n }\n }\n return orgString;\n }\n}\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/rename-rule.ts","\n\n\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n\nexport class MagicRenamer {\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n}\n\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/magic-renamer.ts","\n\nexport * from './rename-rule';\nexport * from './magic-renamer';\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/index.ts","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["log"],"mappings":";;;;AAKA,MAAMA,KAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;MAE5C,UAAU,CAAA;IACrB,OAAO,IAAI,CAAC,KAAa,EAAA;QACvB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACrC,QAAA,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAa,CAAC;AAC3E,QAAAA,KAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;AACzB,QAAA,IAAI,CAAC,OAAO,CAAC,CAAC,IAAG;AACf,YAAAA,KAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACX,SAAC,CAAC,CAAC;AACH,QAAAA,KAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;A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AAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;AACjC,gBAAA,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7D,gBAAAA,KAAG,CAAC,CAAC,CAAC,CAAA,QAAA,EAAW,KAAK,CAAC,MAAM,CAAA,UAAA,EAAa,QAAQ,CAAA,KAAA,EAAQ,EAAE,CAAA,CAAA,CAAG,CAAC,CAAC;gBACjE,SAAS,GAAG,SAAS,CAAC,OAAO,CAC3B,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EACnD,EAAE,CACH,CAAC;gBACF,IAAI,CAAC,wBAAwB,EAAE;AAC7B,oBAAA,OAAO,SAAS,CAAC;iBAClB;aACF;SACF;AACD,QAAA,OAAO,SAAS,CAAC;KAClB;AACF,CAAA;AAEA,CAAC;AAAA,CAAC,EAAE,EAAE;;ACjIP,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;AAEzD;AACA;AACA;AACA;AACA;MAIa,YAAY,CAAA;AA+JxB,CAAA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGC,CAAC;AAAA,CAAC,EAAE,EAAE;;;ACjMN,CAAC;AAAA,CAAC,EAAE,EAAE;;ACLP;;AAEG;;;;"}
1
+ {"version":3,"file":"magic-renamer.mjs","sources":["../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/rename-rule.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/magic-renamer.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/index.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/magic-renamer.ts"],"sourcesContent":["\n\nimport { Helpers } from 'tnp-helpers/browser';\nimport { _, UtilsString } from 'tnp-core/browser';\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\nexport class RenameRule {\n static from(pArgs: string): RenameRule[] {\n pArgs = pArgs.replace(/\\=\\>/g, '->');\n let args = pArgs.split(/(\\'|\\\")(\\ )+(\\'|\\\")/).filter(f => !!f) as string[];\n log.d('---- Rules ----');\n args.forEach(a => {\n log.d(a);\n });\n log.d('---------------');\n return args\n .filter(a => a.search('->') !== -1)\n .map(a => {\n const [from, to] = a.split('->');\n if (!from || !to) {\n Helpers.error(\n `Incorrect rule\n \"${from}\" -> \"${to}\"\n please follow pattern: 'test name -> my new name '`,\n false,\n true,\n );\n }\n return new RenameRule(from.trim(), to.trim());\n });\n }\n\n public readonly fromWhiteSpaceReplaced: string;\n public readonly toWhiteSpaceReplaced: string;\n constructor(\n public readonly from: string,\n public readonly to: string,\n ) {\n this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\\W/g, ' ');\n this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\\W/g, ' ');\n }\n\n applyTo(s: string): boolean {\n s = s.trim().toLowerCase().replace(/\\W/g, '');\n const res = s.search(this.from.replace(/\\W/g, '')) !== -1;\n return res;\n }\n\n toString = () => {\n return `${this.from} => ${this.to}`;\n };\n\n includes(orgString) {\n return !_.isUndefined(\n this.combinations.find(v => {\n const [from, to] = v;\n return orgString === to;\n }),\n );\n }\n\n get combinations() {\n const thisTo = this.toWhiteSpaceReplaced;\n const thisFrom = this.fromWhiteSpaceReplaced;\n return [\n\n [\n UtilsString.kebabCaseNoSplitNumbers(thisFrom),\n UtilsString.kebabCaseNoSplitNumbers(thisTo),\n ], // my-entity => hello1-kitty\n [_.kebabCase(thisFrom), _.kebabCase(thisTo)], // my-entity => hello-kitty\n [_.camelCase(thisFrom), _.camelCase(thisTo)], // myEntity => helloKitty\n [_.upperFirst(_.camelCase(thisFrom)), _.upperFirst(_.camelCase(thisTo))], // MyEntity => HelloKitty\n [_.snakeCase(thisFrom), _.snakeCase(thisTo)], // my_entity => hello_kitty\n [_.snakeCase(thisFrom).toUpperCase(), _.snakeCase(thisTo).toUpperCase()], // MY_ENTITY => HELLO_KITTY\n [_.startCase(thisFrom), _.startCase(thisTo)], // My Entity => Hello Kitty\n [_.upperCase(thisFrom), _.upperCase(thisTo)], // MY ENTITY => HELLO KITTY\n [_.lowerCase(thisFrom), _.lowerCase(thisTo)], // my entity => hello kitty\n [\n _.camelCase(thisFrom).toLocaleLowerCase(),\n _.camelCase(thisTo).toLocaleLowerCase(),\n ], // myentity => hellokitty\n ];\n }\n\n /**\n * @param orgString input string\n * @returns string with all possible combinations replaced\n */\n replaceInString(orgString: string): string {\n return this.replace({\n orgString,\n replaceallPossibliliteis: true,\n });\n }\n\n /**\n *\n * @param orgString (file name OR file content)\n * @param replaceallPossibliliteis when changin file notent (not name only)\n * @returns\n */\n replace(options: {\n /**\n * file name for debugging\n */\n fileName?: string;\n orgString: string;\n replaceallPossibliliteis?: boolean;\n }) {\n let { fileName, orgString, replaceallPossibliliteis } = options;\n replaceallPossibliliteis = !!replaceallPossibliliteis;\n const combinations = this.combinations;\n for (let index = 0; index < combinations.length; index++) {\n const v = combinations[index];\n let [from, to] = v;\n if (orgString.search(from) !== -1) {\n const regex = new RegExp(Helpers.escapeStringForRegEx(from));\n log.i(`apply! \"${regex.source}\" to file ${fileName} => \"${to}\"`);\n orgString = orgString.replace(\n new RegExp(Helpers.escapeStringForRegEx(from), 'g'),\n to,\n );\n if (!replaceallPossibliliteis) {\n return orgString;\n }\n }\n }\n return orgString;\n }\n}\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/rename-rule.ts","\n\n\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n\nexport class MagicRenamer {\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n}\n\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/magic-renamer.ts","\n\nexport * from './rename-rule';\nexport * from './magic-renamer';\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/index.ts","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"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N;AAAC,CAAC,EAAE,EAAE;;ACLP;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"magic-renamer.mjs","sources":["../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/rename-rule.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/magic-renamer.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/index.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/magic-renamer.ts"],"sourcesContent":["\n\nimport { Helpers } from 'tnp-helpers/browser';\nimport { _, UtilsString } from 'tnp-core/browser';\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\nexport class RenameRule {\n static from(pArgs: string): RenameRule[] {\n pArgs = pArgs.replace(/\\=\\>/g, '->');\n let args = pArgs.split(/(\\'|\\\")(\\ )+(\\'|\\\")/).filter(f => !!f) as string[];\n log.d('---- Rules ----');\n args.forEach(a => {\n log.d(a);\n });\n log.d('---------------');\n return args\n .filter(a => a.search('->') !== -1)\n .map(a => {\n const [from, to] = a.split('->');\n if (!from || !to) {\n Helpers.error(\n `Incorrect rule\n \"${from}\" -> \"${to}\"\n please follow pattern: 'test name -> my new name '`,\n false,\n true,\n );\n }\n return new RenameRule(from.trim(), to.trim());\n });\n }\n\n public readonly fromWhiteSpaceReplaced: string;\n public readonly toWhiteSpaceReplaced: string;\n constructor(\n public readonly from: string,\n public readonly to: string,\n ) {\n this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\\W/g, ' ');\n this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\\W/g, ' ');\n }\n\n applyTo(s: string): boolean {\n s = s.trim().toLowerCase().replace(/\\W/g, '');\n const res = s.search(this.from.replace(/\\W/g, '')) !== -1;\n return res;\n }\n\n toString = () => {\n return `${this.from} => ${this.to}`;\n };\n\n includes(orgString) {\n return !_.isUndefined(\n this.combinations.find(v => {\n const [from, to] = v;\n return orgString === to;\n }),\n );\n }\n\n get combinations() {\n const thisTo = this.toWhiteSpaceReplaced;\n const thisFrom = this.fromWhiteSpaceReplaced;\n return [\n\n [\n UtilsString.kebabCaseNoSplitNumbers(thisFrom),\n UtilsString.kebabCaseNoSplitNumbers(thisTo),\n ], // my-entity => hello1-kitty\n [_.kebabCase(thisFrom), _.kebabCase(thisTo)], // my-entity => hello-kitty\n [_.camelCase(thisFrom), _.camelCase(thisTo)], // myEntity => helloKitty\n [_.upperFirst(_.camelCase(thisFrom)), _.upperFirst(_.camelCase(thisTo))], // MyEntity => HelloKitty\n [_.snakeCase(thisFrom), _.snakeCase(thisTo)], // my_entity => hello_kitty\n [_.snakeCase(thisFrom).toUpperCase(), _.snakeCase(thisTo).toUpperCase()], // MY_ENTITY => HELLO_KITTY\n [_.startCase(thisFrom), _.startCase(thisTo)], // My Entity => Hello Kitty\n [_.upperCase(thisFrom), _.upperCase(thisTo)], // MY ENTITY => HELLO KITTY\n [_.lowerCase(thisFrom), _.lowerCase(thisTo)], // my entity => hello kitty\n [\n _.camelCase(thisFrom).toLocaleLowerCase(),\n _.camelCase(thisTo).toLocaleLowerCase(),\n ], // myentity => hellokitty\n ];\n }\n\n /**\n * @param orgString input string\n * @returns string with all possible combinations replaced\n */\n replaceInString(orgString: string): string {\n return this.replace({\n orgString,\n replaceallPossibliliteis: true,\n });\n }\n\n /**\n *\n * @param orgString (file name OR file content)\n * @param replaceallPossibliliteis when changin file notent (not name only)\n * @returns\n */\n replace(options: {\n /**\n * file name for debugging\n */\n fileName?: string;\n orgString: string;\n replaceallPossibliliteis?: boolean;\n }) {\n let { fileName, orgString, replaceallPossibliliteis } = options;\n replaceallPossibliliteis = !!replaceallPossibliliteis;\n const combinations = this.combinations;\n for (let index = 0; index < combinations.length; index++) {\n const v = combinations[index];\n let [from, to] = v;\n if (orgString.search(from) !== -1) {\n const regex = new RegExp(Helpers.escapeStringForRegEx(from));\n log.i(`apply! \"${regex.source}\" to file ${fileName} => \"${to}\"`);\n orgString = orgString.replace(\n new RegExp(Helpers.escapeStringForRegEx(from), 'g'),\n to,\n );\n if (!replaceallPossibliliteis) {\n return orgString;\n }\n }\n }\n return orgString;\n }\n}\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/rename-rule.ts","\n\n\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n\nexport class MagicRenamer {\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n}\n\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/magic-renamer.ts","\n\nexport * from './rename-rule';\nexport * from './magic-renamer';\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/index.ts","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["log"],"mappings":";;;;AAKA,MAAMA,KAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;MAE5C,UAAU,CAAA;IACrB,OAAO,IAAI,CAAC,KAAa,EAAA;QACvB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACrC,QAAA,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAa,CAAC;AAC3E,QAAAA,KAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;AACzB,QAAA,IAAI,CAAC,OAAO,CAAC,CAAC,IAAG;AACf,YAAAA,KAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACX,SAAC,CAAC,CAAC;AACH,QAAAA,KAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;AACzB,QAAA,OAAO,IAAI;AACR,aAAA,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;aAClC,GAAG,CAAC,CAAC,IAAG;AACP,YAAA,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACjC,YAAA,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE;gBAChB,OAA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,CAAC,CAAC;gBACjE,SAAS,GAAG,SAAS,CAAC,OAAO,CAC3B,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EACnD,EAAE,CACH,CAAC;gBACF,IAAI,CAAC,wBAAwB,EAAE;AAC7B,oBAAA,OAAO,SAAS,CAAC;iBAClB;aACF;SACF;AACD,QAAA,OAAO,SAAS,CAAC;KAClB;AACF,CAAA;AAEA,CAAC;AAAA,CAAC,EAAE,EAAE;;ACjIP,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;AAEzD;AACA;AACA;AACA;AACA;MAIa,YAAY,CAAA;AA+JxB,CAAA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGC,CAAC;AAAA,CAAC,EAAE,EAAE;;;ACjMN,CAAC;AAAA,CAAC,EAAE,EAAE;;ACLP;;AAEG;;;;"}
1
+ {"version":3,"file":"magic-renamer.mjs","sources":["../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/rename-rule.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/magic-renamer.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/index.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/magic-renamer.ts"],"sourcesContent":["\n\nimport { Helpers } from 'tnp-helpers/browser';\nimport { _, UtilsString } from 'tnp-core/browser';\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\nexport class RenameRule {\n static from(pArgs: string): RenameRule[] {\n pArgs = pArgs.replace(/\\=\\>/g, '->');\n let args = pArgs.split(/(\\'|\\\")(\\ )+(\\'|\\\")/).filter(f => !!f) as string[];\n log.d('---- Rules ----');\n args.forEach(a => {\n log.d(a);\n });\n log.d('---------------');\n return args\n .filter(a => a.search('->') !== -1)\n .map(a => {\n const [from, to] = a.split('->');\n if (!from || !to) {\n Helpers.error(\n `Incorrect rule\n \"${from}\" -> \"${to}\"\n please follow pattern: 'test name -> my new name '`,\n false,\n true,\n );\n }\n return new RenameRule(from.trim(), to.trim());\n });\n }\n\n public readonly fromWhiteSpaceReplaced: string;\n public readonly toWhiteSpaceReplaced: string;\n constructor(\n public readonly from: string,\n public readonly to: string,\n ) {\n this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\\W/g, ' ');\n this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\\W/g, ' ');\n }\n\n applyTo(s: string): boolean {\n s = s.trim().toLowerCase().replace(/\\W/g, '');\n const res = s.search(this.from.replace(/\\W/g, '')) !== -1;\n return res;\n }\n\n toString = () => {\n return `${this.from} => ${this.to}`;\n };\n\n includes(orgString) {\n return !_.isUndefined(\n this.combinations.find(v => {\n const [from, to] = v;\n return orgString === to;\n }),\n );\n }\n\n get combinations() {\n const thisTo = this.toWhiteSpaceReplaced;\n const thisFrom = this.fromWhiteSpaceReplaced;\n return [\n\n [\n UtilsString.kebabCaseNoSplitNumbers(thisFrom),\n UtilsString.kebabCaseNoSplitNumbers(thisTo),\n ], // my-entity => hello1-kitty\n [_.kebabCase(thisFrom), _.kebabCase(thisTo)], // my-entity => hello-kitty\n [_.camelCase(thisFrom), _.camelCase(thisTo)], // myEntity => helloKitty\n [_.upperFirst(_.camelCase(thisFrom)), _.upperFirst(_.camelCase(thisTo))], // MyEntity => HelloKitty\n [_.snakeCase(thisFrom), _.snakeCase(thisTo)], // my_entity => hello_kitty\n [_.snakeCase(thisFrom).toUpperCase(), _.snakeCase(thisTo).toUpperCase()], // MY_ENTITY => HELLO_KITTY\n [_.startCase(thisFrom), _.startCase(thisTo)], // My Entity => Hello Kitty\n [_.upperCase(thisFrom), _.upperCase(thisTo)], // MY ENTITY => HELLO KITTY\n [_.lowerCase(thisFrom), _.lowerCase(thisTo)], // my entity => hello kitty\n [\n _.camelCase(thisFrom).toLocaleLowerCase(),\n _.camelCase(thisTo).toLocaleLowerCase(),\n ], // myentity => hellokitty\n ];\n }\n\n /**\n * @param orgString input string\n * @returns string with all possible combinations replaced\n */\n replaceInString(orgString: string): string {\n return this.replace({\n orgString,\n replaceallPossibliliteis: true,\n });\n }\n\n /**\n *\n * @param orgString (file name OR file content)\n * @param replaceallPossibliliteis when changin file notent (not name only)\n * @returns\n */\n replace(options: {\n /**\n * file name for debugging\n */\n fileName?: string;\n orgString: string;\n replaceallPossibliliteis?: boolean;\n }) {\n let { fileName, orgString, replaceallPossibliliteis } = options;\n replaceallPossibliliteis = !!replaceallPossibliliteis;\n const combinations = this.combinations;\n for (let index = 0; index < combinations.length; index++) {\n const v = combinations[index];\n let [from, to] = v;\n if (orgString.search(from) !== -1) {\n const regex = new RegExp(Helpers.escapeStringForRegEx(from));\n log.i(`apply! \"${regex.source}\" to file ${fileName} => \"${to}\"`);\n orgString = orgString.replace(\n new RegExp(Helpers.escapeStringForRegEx(from), 'g'),\n to,\n );\n if (!replaceallPossibliliteis) {\n return orgString;\n }\n }\n }\n return orgString;\n }\n}\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/rename-rule.ts","\n\n\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n\nexport class MagicRenamer {\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n}\n\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/magic-renamer.ts","\n\nexport * from './rename-rule';\nexport * from './magic-renamer';\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/index.ts","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["log"],"mappings":";;;;AAKA,MAAMA,KAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC;MAE3C,UAAU,CAAA;IACrB,OAAO,IAAI,CAAC,KAAa,EAAA;QACvB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;AACpC,QAAA,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,MAAM,CA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K,CAAC;AAC7B,YAAA,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC;YAClB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;AACjC,gBAAA,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAC5D,gBAAAA,KAAG,CAAC,CAAC,CAAC,CAAA,QAAA,EAAW,KAAK,CAAC,MAAM,CAAA,UAAA,EAAa,QAAQ,CAAA,KAAA,EAAQ,EAAE,CAAA,CAAA,CAAG,CAAC;gBAChE,SAAS,GAAG,SAAS,CAAC,OAAO,CAC3B,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EACnD,EAAE,CACH;gBACD,IAAI,CAAC,wBAAwB,EAAE;AAC7B,oBAAA,OAAO,SAAS;;;;AAItB,QAAA,OAAO,SAAS;;AAEnB;AAEA;AAAC,CAAC,EAAE,EAAE;;ACjIP,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC;AAExD;AACA;AACA;AACA;AACA;MAIa,YAAY,CAAA;AA+JxB;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGC;AAAC,CAAC,EAAE,EAAE;;;ACjMN;AAAC,CAAC,EAAE,EAAE;;ACLP;;AAEG;;;;"}
package/package.json CHANGED
@@ -39,17 +39,17 @@
39
39
  "workerPlugins": {}
40
40
  },
41
41
  "name": "magic-renamer",
42
- "version": "18.0.13",
42
+ "version": "18.0.15",
43
43
  "bin": {
44
44
  "magic-renamer": "bin/magic-renamer",
45
45
  "magic-renamer-debug": "bin/magic-renamer-debug"
46
46
  },
47
47
  "license": "UNLICENSED",
48
48
  "dependencies": {
49
- "tnp-helpers": "~18.0.13"
49
+ "tnp-helpers": "~18.0.15"
50
50
  },
51
51
  "devDependencies": {},
52
52
  "private": false,
53
- "lastBuildTagHash": "3688ed8df25f0fd576a5ea854baae09ec5317ade",
53
+ "lastBuildTagHash": "4d4d26181f8f55b5a21ce69e43ff7c03f7d9fdbc",
54
54
  "main": "dist/app.electron.js"
55
55
  }
@@ -43,14 +43,14 @@
43
43
  "workerPlugins": {}
44
44
  },
45
45
  "name": "magic-renamer",
46
- "version": "18.0.13",
46
+ "version": "18.0.15",
47
47
  "bin": {
48
48
  "magic-renamer": "bin/magic-renamer",
49
49
  "magic-renamer-debug": "bin/magic-renamer-debug"
50
50
  },
51
51
  "license": "UNLICENSED",
52
52
  "dependencies": {
53
- "tnp-helpers": "~18.0.13"
53
+ "tnp-helpers": "~18.0.15"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@angular-builders/custom-webpack": "~18.0.0",
@@ -109,6 +109,7 @@
109
109
  "@types/chokidar": "2.1.3",
110
110
  "@types/dateformat": "1.0.1",
111
111
  "@types/diff": "5.2.1",
112
+ "@types/dockerode": "3.3.32",
112
113
  "@types/express": "4.17.21",
113
114
  "@types/express-fileupload": "1.5.0",
114
115
  "@types/fs-extra": "7.0.0",
@@ -131,6 +132,7 @@
131
132
  "@types/semver": "7.5.8",
132
133
  "@types/systeminformation": "3.54.1",
133
134
  "@types/vinyl": "2.0.12",
135
+ "@types/wait-on": "5.3.4",
134
136
  "@types/watch": "1.0.6",
135
137
  "@typescript-eslint/eslint-plugin": "8.0.1",
136
138
  "@typescript-eslint/parser": "8.0.1",
@@ -141,7 +143,7 @@
141
143
  "angular-resize-event": "3.2.0",
142
144
  "animate.css": "4.1.1",
143
145
  "app-root-path": "3.1.0",
144
- "axios": "1.7.3",
146
+ "axios": "1.7.7",
145
147
  "base32": "0.0.7",
146
148
  "bcryptjs": "2.4.3",
147
149
  "body-parser": "1.20.2",
@@ -149,6 +151,7 @@
149
151
  "buffer-shims": "1.0.0",
150
152
  "bun": "1.1.22",
151
153
  "callsite-record": "4.1.5",
154
+ "cfonts": "3.3.0",
152
155
  "chai": "4.5.0",
153
156
  "chalk": "2.3.2",
154
157
  "check-node-version": "3.2.0",
@@ -158,6 +161,7 @@
158
161
  "class-transformer": "0.5.1",
159
162
  "class-validator": "0.14.1",
160
163
  "cli-highlight": "2.1.11",
164
+ "columnify": "1.6.0",
161
165
  "command-exists": "1.2.2",
162
166
  "compression": "1.7.4",
163
167
  "concurrently": "8.2.2",
@@ -172,6 +176,7 @@
172
176
  "dateformat": "3.0.3",
173
177
  "detect-mocha": "0.1.0",
174
178
  "diff": "4.0.2",
179
+ "dockerode": "4.0.2",
175
180
  "electron": "25.2.0",
176
181
  "electron-builder": "24.4.0",
177
182
  "electron-debug": "3.2.0",
@@ -210,13 +215,13 @@
210
215
  "image-focus": "1.2.1",
211
216
  "immer": "10.0.2",
212
217
  "immutable": "4.3.7",
213
- "incremental-compiler": "~18.0.13",
218
+ "incremental-compiler": "~18.0.15",
214
219
  "inquirer": "7.3.3",
215
220
  "inquirer-autocomplete-prompt": "1.4.0",
216
221
  "inquirer-autocomplete-standalone": "0.8.1",
217
222
  "inquirer-select-pro": "1.0.0-alpha.7",
218
223
  "is-elevated": "3.0.0",
219
- "isomorphic-region-loader": "~18.0.13",
224
+ "isomorphic-region-loader": "~18.0.15",
220
225
  "istanbul-instrumenter-loader": "3.0.1",
221
226
  "jest": "29.7.0",
222
227
  "jest-date-mock": "1.0.10",
@@ -227,8 +232,8 @@
227
232
  "joi": "17.13.3",
228
233
  "jscodeshift": "0.6.3",
229
234
  "json-stringify-safe": "5.0.1",
230
- "json10": "~18.0.13",
231
- "json10-writer": "~18.0.13",
235
+ "json10": "~18.0.15",
236
+ "json10-writer": "~18.0.15",
232
237
  "json5": "2.2.3",
233
238
  "json5-writer": "0.2.0",
234
239
  "jszip": "3.10.1",
@@ -237,9 +242,9 @@
237
242
  "localforage": "1.10.0",
238
243
  "lockfile": "1.0.4",
239
244
  "lodash": "4.17.21",
240
- "lodash-walk-object": "~18.0.13",
245
+ "lodash-walk-object": "~18.0.15",
241
246
  "lowdb": "7.0.1",
242
- "magic-renamer": "~18.0.12",
247
+ "magic-renamer": "~18.0.14",
243
248
  "material-design-icons": "3.0.1",
244
249
  "method-override": "2.3.10",
245
250
  "minimist": "1.2.8",
@@ -250,11 +255,11 @@
250
255
  "ng-in-viewport": "16.1.0",
251
256
  "ng-lock": "18.0.1",
252
257
  "ng-packagr": "18.1.0",
253
- "ng-talkback": "~18.0.11",
254
- "ng2-logger": "~18.0.15",
258
+ "ng-talkback": "~18.0.13",
259
+ "ng2-logger": "~18.0.17",
255
260
  "ng2-pdfjs-viewer": "18.0.0",
256
- "ng2-rest": "~18.0.12",
257
- "ng2-rest-swagger-generator": "18.0.9",
261
+ "ng2-rest": "~18.0.14",
262
+ "ng2-rest-swagger-generator": "18.0.11",
258
263
  "ngx-ace-wrapper": "17.0.0",
259
264
  "ngx-editor": "17.5.4",
260
265
  "ngx-highlightjs": "12.0.0",
@@ -268,7 +273,7 @@
268
273
  "ngx-scrolltop": "18.0.0",
269
274
  "ngx-store": "3.1.1",
270
275
  "ngx-typed-js": "2.1.1",
271
- "node-cli-tester": "~18.0.11",
276
+ "node-cli-tester": "~18.0.13",
272
277
  "node-localstorage": "2.1.6",
273
278
  "node-notifier": "10.0.1",
274
279
  "node-polyfill-webpack-plugin": "2.0.1",
@@ -284,6 +289,7 @@
284
289
  "path-to-regexp": "6.2.2",
285
290
  "pica": "9.0.1",
286
291
  "playwright": "1.43.1",
292
+ "pm2": "5.4.3",
287
293
  "portfinder": "1.0.21",
288
294
  "prettier": "3.3.3",
289
295
  "prettier-eslint": "16.3.0",
@@ -298,7 +304,7 @@
298
304
  "q": "1.5.1",
299
305
  "rallax.js": "2.0.4",
300
306
  "randomcolor": "0.5.3",
301
- "record-replay-req-res-scenario": "~18.0.11",
307
+ "record-replay-req-res-scenario": "~18.0.13",
302
308
  "reflect-metadata": "0.2.2",
303
309
  "rimraf": "2.6.2",
304
310
  "rxjs": "~7.8.1",
@@ -310,22 +316,22 @@
310
316
  "socket.io-client": "4.7.5",
311
317
  "sort-package-json": "1.11.0",
312
318
  "sql.js": "1.8.0",
313
- "static-columns": "~18.0.13",
319
+ "static-columns": "~18.0.15",
314
320
  "string-similarity": "4.0.4",
315
321
  "sudo-block": "3.0.0",
316
322
  "supertest": "7.0.0",
317
323
  "sweetalert2": "11.7.32",
318
324
  "systeminformation": "3.45.7",
319
325
  "taon": "^18",
320
- "taon-storage": "18.0.11",
321
- "taon-type-sql": "18.0.12",
322
- "taon-typeorm": "18.0.11",
326
+ "taon-storage": "18.0.23",
327
+ "taon-type-sql": "18.0.14",
328
+ "taon-typeorm": "18.0.13",
323
329
  "task.js": "0.1.5",
324
330
  "threads": "1.7.0",
325
- "tnp": "~18.0.12",
326
- "tnp-config": "~18.0.15",
327
- "tnp-core": "~18.0.37",
328
- "tnp-models": "~18.0.14",
331
+ "tnp": "~18.0.14",
332
+ "tnp-config": "~18.0.17",
333
+ "tnp-core": "~18.0.40",
334
+ "tnp-models": "~18.0.16",
329
335
  "ts-debug": "1.3.0",
330
336
  "ts-json-schema-generator": "2.3.0-next.5",
331
337
  "ts-loader": "2.3.1",
@@ -337,16 +343,16 @@
337
343
  "typedoc": "0.26.5",
338
344
  "typedoc-plugin-markdown": "4.2.3",
339
345
  "typescript": "~5.5.4",
340
- "typescript-class-helpers": "~18.0.14",
346
+ "typescript-class-helpers": "~18.0.16",
341
347
  "typescript-formatter": "~7.2.2",
342
348
  "typescript-string-enums": "~1.0.0",
343
349
  "underscore": "1.13.7",
344
350
  "uuid": "10.0.0",
345
351
  "validator": "13.5.2",
346
352
  "video.js": "8.3.0",
347
- "vpn-split": "~18.0.11",
353
+ "vpn-split": "~18.0.13",
348
354
  "vscode": "1.1.37",
349
- "wait-on": "7.0.1",
355
+ "wait-on": "8.0.1",
350
356
  "watch": "1.0.2",
351
357
  "webpack": "~5.80",
352
358
  "webpack-dev-middleware": "~6.1.3",
@@ -355,18 +361,18 @@
355
361
  "zone.js": "~0.13.0"
356
362
  },
357
363
  "private": false,
358
- "lastBuildTagHash": "3688ed8df25f0fd576a5ea854baae09ec5317ade",
364
+ "lastBuildTagHash": "4d4d26181f8f55b5a21ce69e43ff7c03f7d9fdbc",
359
365
  "main": "dist/app.electron.js"
360
366
  },
361
367
  "build": {
362
- "number": 292,
363
- "date": "2024-11-08T17:08:32.000Z",
364
- "hash": "91e2a310fb675cc500cb9731bd608a668965d1af"
368
+ "number": 294,
369
+ "date": "2024-11-17T06:56:52.000Z",
370
+ "hash": "714ec36d1ade5cee426d9b08a78c67511fcbdabf"
365
371
  },
366
372
  "currentProjectName": "magic-renamer",
367
373
  "currentProjectGenericName": "magic-renamer",
368
374
  "currentProjectType": "isomorphic-lib",
369
- "currentFrameworkVersion": "18.0.12",
375
+ "currentFrameworkVersion": "18.0.14",
370
376
  "isStandaloneProject": true,
371
377
  "isSmartContainer": false,
372
378
  "pathesTsconfig": "\"paths\": {\"magic-renamer\":[\"./src/lib\"],\"magic-renamer/*\":[\"./src/lib/*\"]},",
@@ -1 +1 @@
1
- {"version":3,"file":"magic-renamer.mjs","sources":["../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/lib/rename-rule.ts","../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/lib/magic-renamer.ts","../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/lib/index.ts","../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/magic-renamer.ts"],"sourcesContent":["\n\nimport { Helpers } from 'tnp-helpers/websql';\nimport { _, UtilsString } from 'tnp-core/websql';\nimport { Log, Level } from 'ng2-logger/websql';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\nexport class RenameRule {\n static from(pArgs: string): RenameRule[] {\n pArgs = pArgs.replace(/\\=\\>/g, '->');\n let args = pArgs.split(/(\\'|\\\")(\\ )+(\\'|\\\")/).filter(f => !!f) as string[];\n log.d('---- Rules ----');\n args.forEach(a => {\n log.d(a);\n });\n log.d('---------------');\n return args\n .filter(a => a.search('->') !== -1)\n .map(a => {\n const [from, to] = a.split('->');\n if (!from || !to) {\n Helpers.error(\n `Incorrect rule\n \"${from}\" -> \"${to}\"\n please follow pattern: 'test name -> my new name '`,\n false,\n true,\n );\n }\n return new RenameRule(from.trim(), to.trim());\n });\n }\n\n public readonly fromWhiteSpaceReplaced: string;\n public readonly toWhiteSpaceReplaced: string;\n constructor(\n public readonly from: string,\n public readonly to: string,\n ) {\n this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\\W/g, ' ');\n this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\\W/g, ' ');\n }\n\n applyTo(s: string): boolean {\n s = s.trim().toLowerCase().replace(/\\W/g, '');\n const res = s.search(this.from.replace(/\\W/g, '')) !== -1;\n return res;\n }\n\n toString = () => {\n return `${this.from} => ${this.to}`;\n };\n\n includes(orgString) {\n return !_.isUndefined(\n this.combinations.find(v => {\n const [from, to] = v;\n return orgString === to;\n }),\n );\n }\n\n get combinations() {\n const thisTo = this.toWhiteSpaceReplaced;\n const thisFrom = this.fromWhiteSpaceReplaced;\n return [\n\n [\n UtilsString.kebabCaseNoSplitNumbers(thisFrom),\n UtilsString.kebabCaseNoSplitNumbers(thisTo),\n ], // my-entity => hello1-kitty\n [_.kebabCase(thisFrom), _.kebabCase(thisTo)], // my-entity => hello-kitty\n [_.camelCase(thisFrom), _.camelCase(thisTo)], // myEntity => helloKitty\n [_.upperFirst(_.camelCase(thisFrom)), _.upperFirst(_.camelCase(thisTo))], // MyEntity => HelloKitty\n [_.snakeCase(thisFrom), _.snakeCase(thisTo)], // my_entity => hello_kitty\n [_.snakeCase(thisFrom).toUpperCase(), _.snakeCase(thisTo).toUpperCase()], // MY_ENTITY => HELLO_KITTY\n [_.startCase(thisFrom), _.startCase(thisTo)], // My Entity => Hello Kitty\n [_.upperCase(thisFrom), _.upperCase(thisTo)], // MY ENTITY => HELLO KITTY\n [_.lowerCase(thisFrom), _.lowerCase(thisTo)], // my entity => hello kitty\n [\n _.camelCase(thisFrom).toLocaleLowerCase(),\n _.camelCase(thisTo).toLocaleLowerCase(),\n ], // myentity => hellokitty\n ];\n }\n\n /**\n * @param orgString input string\n * @returns string with all possible combinations replaced\n */\n replaceInString(orgString: string): string {\n return this.replace({\n orgString,\n replaceallPossibliliteis: true,\n });\n }\n\n /**\n *\n * @param orgString (file name OR file content)\n * @param replaceallPossibliliteis when changin file notent (not name only)\n * @returns\n */\n replace(options: {\n /**\n * file name for debugging\n */\n fileName?: string;\n orgString: string;\n replaceallPossibliliteis?: boolean;\n }) {\n let { fileName, orgString, replaceallPossibliliteis } = options;\n replaceallPossibliliteis = !!replaceallPossibliliteis;\n const combinations = this.combinations;\n for (let index = 0; index < combinations.length; index++) {\n const v = combinations[index];\n let [from, to] = v;\n if (orgString.search(from) !== -1) {\n const regex = new RegExp(Helpers.escapeStringForRegEx(from));\n log.i(`apply! \"${regex.source}\" to file ${fileName} => \"${to}\"`);\n orgString = orgString.replace(\n new RegExp(Helpers.escapeStringForRegEx(from), 'g'),\n to,\n );\n if (!replaceallPossibliliteis) {\n return orgString;\n }\n }\n }\n return orgString;\n }\n}\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/rename-rule.ts","\n\n\nimport { Log, Level } from 'ng2-logger/websql';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n\nexport class MagicRenamer {\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n}\n\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/magic-renamer.ts","\n\nexport * from './rename-rule';\nexport * from './magic-renamer';\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/index.ts","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["log"],"mappings":";;;;AAKA,MAAMA,KAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;MAE5C,UAAU,CAAA;IACrB,OAAO,IAAI,CAAC,KAAa,EAAA;QACvB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACrC,QAAA,IAAI,IAAI,GAAG,KAAK,C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AAC,EAAE,EAAE;;;ACjMN,CAAC;AAAA,CAAC,EAAE,EAAE;;ACLP;;AAEG;;;;"}
1
+ {"version":3,"file":"magic-renamer.mjs","sources":["../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/lib/rename-rule.ts","../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/lib/magic-renamer.ts","../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/lib/index.ts","../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/magic-renamer.ts"],"sourcesContent":["\n\nimport { Helpers } from 'tnp-helpers/websql';\nimport { _, UtilsString } from 'tnp-core/websql';\nimport { Log, Level } from 'ng2-logger/websql';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\nexport class RenameRule {\n static from(pArgs: string): RenameRule[] {\n pArgs = pArgs.replace(/\\=\\>/g, '->');\n let args = pArgs.split(/(\\'|\\\")(\\ )+(\\'|\\\")/).filter(f => !!f) as string[];\n log.d('---- Rules ----');\n args.forEach(a => {\n log.d(a);\n });\n log.d('---------------');\n return args\n .filter(a => a.search('->') !== -1)\n .map(a => {\n const [from, to] = a.split('->');\n if (!from || !to) {\n Helpers.error(\n `Incorrect rule\n \"${from}\" -> \"${to}\"\n please follow pattern: 'test name -> my new name '`,\n false,\n true,\n );\n }\n return new RenameRule(from.trim(), to.trim());\n });\n }\n\n public readonly fromWhiteSpaceReplaced: string;\n public readonly toWhiteSpaceReplaced: string;\n constructor(\n public readonly from: string,\n public readonly to: string,\n ) {\n this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\\W/g, ' ');\n this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\\W/g, ' ');\n }\n\n applyTo(s: string): boolean {\n s = s.trim().toLowerCase().replace(/\\W/g, '');\n const res = s.search(this.from.replace(/\\W/g, '')) !== -1;\n return res;\n }\n\n toString = () => {\n return `${this.from} => ${this.to}`;\n };\n\n includes(orgString) {\n return !_.isUndefined(\n this.combinations.find(v => {\n const [from, to] = v;\n return orgString === to;\n }),\n );\n }\n\n get combinations() {\n const thisTo = this.toWhiteSpaceReplaced;\n const thisFrom = this.fromWhiteSpaceReplaced;\n return [\n\n [\n UtilsString.kebabCaseNoSplitNumbers(thisFrom),\n UtilsString.kebabCaseNoSplitNumbers(thisTo),\n ], // my-entity => hello1-kitty\n [_.kebabCase(thisFrom), _.kebabCase(thisTo)], // my-entity => hello-kitty\n [_.camelCase(thisFrom), _.camelCase(thisTo)], // myEntity => helloKitty\n [_.upperFirst(_.camelCase(thisFrom)), _.upperFirst(_.camelCase(thisTo))], // MyEntity => HelloKitty\n [_.snakeCase(thisFrom), _.snakeCase(thisTo)], // my_entity => hello_kitty\n [_.snakeCase(thisFrom).toUpperCase(), _.snakeCase(thisTo).toUpperCase()], // MY_ENTITY => HELLO_KITTY\n [_.startCase(thisFrom), _.startCase(thisTo)], // My Entity => Hello Kitty\n [_.upperCase(thisFrom), _.upperCase(thisTo)], // MY ENTITY => HELLO KITTY\n [_.lowerCase(thisFrom), _.lowerCase(thisTo)], // my entity => hello kitty\n [\n _.camelCase(thisFrom).toLocaleLowerCase(),\n _.camelCase(thisTo).toLocaleLowerCase(),\n ], // myentity => hellokitty\n ];\n }\n\n /**\n * @param orgString input string\n * @returns string with all possible combinations replaced\n */\n replaceInString(orgString: string): string {\n return this.replace({\n orgString,\n replaceallPossibliliteis: true,\n });\n }\n\n /**\n *\n * @param orgString (file name OR file content)\n * @param replaceallPossibliliteis when changin file notent (not name only)\n * @returns\n */\n replace(options: {\n /**\n * file name for debugging\n */\n fileName?: string;\n orgString: string;\n replaceallPossibliliteis?: boolean;\n }) {\n let { fileName, orgString, replaceallPossibliliteis } = options;\n replaceallPossibliliteis = !!replaceallPossibliliteis;\n const combinations = this.combinations;\n for (let index = 0; index < combinations.length; index++) {\n const v = combinations[index];\n let [from, to] = v;\n if (orgString.search(from) !== -1) {\n const regex = new RegExp(Helpers.escapeStringForRegEx(from));\n log.i(`apply! \"${regex.source}\" to file ${fileName} => \"${to}\"`);\n orgString = orgString.replace(\n new RegExp(Helpers.escapeStringForRegEx(from), 'g'),\n to,\n );\n if (!replaceallPossibliliteis) {\n return orgString;\n }\n }\n }\n return orgString;\n }\n}\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/rename-rule.ts","\n\n\nimport { Log, Level } from 'ng2-logger/websql';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n\nexport class MagicRenamer {\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n}\n\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/magic-renamer.ts","\n\nexport * from './rename-rule';\nexport * from './magic-renamer';\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/index.ts","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["log"],"mappings":";;;;AAKA,MAAMA,KAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC;MAE3C,UAAU,CAAA;IACrB,OAAO,IAAI,CAAC,KAAa,EAAA;QACvB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;AACpC,QAAA,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAa;AAC1E,QAAAA,KAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC;AACxB,QAAA,IAAI,CAAC,OAAO,CAAC,CAAC,IAAG;AACf,YAAAA,KAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACV,SAAC,CAAC;AACF,QAAAA,KAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC;AACxB,QAAA,OAAO;AACJ,aAAA,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACjC,GAAG,CAAC,CAAC,IAAG;AACP,YAAA,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;AAChC,YAAA,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE;gBAChB,OAAO,CAAC,KAAK,CACX,CAAA;AAC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