浏览代码

All CLI options were renamed to `kebab-case` format

sanex3339 7 年之前
父节点
当前提交
03ad37ad2b
共有 6 个文件被更改,包括 62 次插入61 次删除
  1. 1 0
      CHANGELOG.md
  2. 22 22
      README.md
  3. 0 0
      dist/index.js
  4. 1 1
      package.json
  5. 25 25
      src/cli/JavaScriptObfuscatorCLI.ts
  6. 13 13
      test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts

+ 1 - 0
CHANGELOG.md

@@ -2,6 +2,7 @@ Change Log
 ===
 ===
 v0.13.0
 v0.13.0
 ---
 ---
+* **Breaking change:** all CLI options were renamed to `kebab-case` format (`--disableConsoleOutout` -> `--disable-console-output`)
 * Implemented custom `mangle` option algorithm without `esmangle`; fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/110
 * Implemented custom `mangle` option algorithm without `esmangle`; fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/110
 
 
 v0.12.5
 v0.12.5

+ 22 - 22
README.md

@@ -199,10 +199,10 @@ If the destination path is not specified with the `--output` option, obfuscated
 
 
 Examples:
 Examples:
 ```sh
 ```sh
-javascript-obfuscator samples/sample.js --compact true --selfDefending false
+javascript-obfuscator samples/sample.js --compact true --self-defending false
 // creates a new file samples/sample-obfuscated.js
 // creates a new file samples/sample-obfuscated.js
 
 
-javascript-obfuscator samples/sample.js --output output/output.js --compact true --selfDefending false
+javascript-obfuscator samples/sample.js --output output/output.js --compact true --self-defending false
 // creates a new file output/output.js
 // creates a new file output/output.js
 ```
 ```
 
 
@@ -284,30 +284,30 @@ Following options are available for the JS Obfuscator:
 
 
     --compact <boolean>
     --compact <boolean>
     --config <string>
     --config <string>
-    --controlFlowFlattening <boolean>
-    --controlFlowFlatteningThreshold <number>
-    --deadCodeInjection <boolean>
-    --deadCodeInjectionThreshold <number>
-    --debugProtection <boolean>
-    --debugProtectionInterval <boolean>
-    --disableConsoleOutput <boolean>
-    --domainLock '<list>' (comma separated)
+    --control-flow-flattening <boolean>
+    --control-flow-flattening-threshold <number>
+    --dead-code-njection <boolean>
+    --dead-code-injection-threshold <number>
+    --debug-protection <boolean>
+    --debug-protection-interval <boolean>
+    --disable-console-output <boolean>
+    --domain-lock '<list>' (comma separated)
     --log <boolean>
     --log <boolean>
     --mangle <boolean>
     --mangle <boolean>
-    --renameGlobals <boolean>
-    --reservedNames '<list>' (comma separated)
-    --rotateStringArray <boolean>
+    --rename-globals <boolean>
+    --reserved-names '<list>' (comma separated)
+    --rotate-string-array <boolean>
     --seed <number>
     --seed <number>
-    --selfDefending <boolean>
-    --sourceMap <boolean>
-    --sourceMapBaseUrl <string>
-    --sourceMapFileName <string>
-    --sourceMapMode <string> [inline, separate]
-    --stringArray <boolean>
-    --stringArrayEncoding <boolean|string> [true, false, base64, rc4]
-    --stringArrayThreshold <number>
+    --self-defending <boolean>
+    --source-map <boolean>
+    --source-map-base-url <string>
+    --source-map-file-name <string>
+    --source-map-mode <string> [inline, separate]
+    --string-array <boolean>
+    --string-array-encoding <boolean|string> [true, false, base64, rc4]
+    --string-array-threshold <number>
     --target <string> [browser, extension, node]
     --target <string> [browser, extension, node]
-    --unicodeEscapeSequence <boolean>
+    --unicode-escape-sequence <boolean>
 ```
 ```
 
 
 ### `compact`
 ### `compact`

文件差异内容过多而无法显示
+ 0 - 0
dist/index.js


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "javascript-obfuscator",
   "name": "javascript-obfuscator",
-  "version": "0.13.0-dev.0",
+  "version": "0.13.0-dev.1",
   "description": "JavaScript obfuscator",
   "description": "JavaScript obfuscator",
   "keywords": [
   "keywords": [
     "obfuscator",
     "obfuscator",

+ 25 - 25
src/cli/JavaScriptObfuscatorCLI.ts

@@ -199,42 +199,42 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
                 'Name of js / json config file'
                 'Name of js / json config file'
             )
             )
             .option(
             .option(
-                '--controlFlowFlattening <boolean>',
+                '--control-flow-flattening <boolean>',
                 'Enables control flow flattening',
                 'Enables control flow flattening',
                 BooleanSanitizer
                 BooleanSanitizer
             )
             )
             .option(
             .option(
-                '--controlFlowFlatteningThreshold <number>',
+                '--control-flow-flattening-threshold <number>',
                 'The probability that the control flow flattening transformation will be applied to the node',
                 'The probability that the control flow flattening transformation will be applied to the node',
                 parseFloat
                 parseFloat
             )
             )
             .option(
             .option(
-                '--deadCodeInjection <boolean>',
+                '--dead-code-injection <boolean>',
                 'Enables dead code injection',
                 'Enables dead code injection',
                 BooleanSanitizer
                 BooleanSanitizer
             )
             )
             .option(
             .option(
-                '--deadCodeInjectionThreshold <number>',
+                '--dead-code-injection-threshold <number>',
                 'The probability that the dead code injection transformation will be applied to the node',
                 'The probability that the dead code injection transformation will be applied to the node',
                 parseFloat
                 parseFloat
             )
             )
             .option(
             .option(
-                '--debugProtection <boolean>',
+                '--debug-protection <boolean>',
                 'Disable browser Debug panel (can cause DevTools enabled browser freeze)',
                 'Disable browser Debug panel (can cause DevTools enabled browser freeze)',
                 BooleanSanitizer
                 BooleanSanitizer
             )
             )
             .option(
             .option(
-                '--debugProtectionInterval <boolean>',
+                '--debug-protection-interval <boolean>',
                 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)',
                 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)',
                 BooleanSanitizer
                 BooleanSanitizer
             )
             )
             .option(
             .option(
-                '--disableConsoleOutput <boolean>',
+                '--disable-console-output <boolean>',
                 'Allow console.log, console.info, console.error and console.warn messages output into browser console',
                 'Allow console.log, console.info, console.error and console.warn messages output into browser console',
                 BooleanSanitizer
                 BooleanSanitizer
             )
             )
             .option(
             .option(
-                '--domainLock <list> (comma separated, without whitespaces)',
+                '--domain-lock <list> (comma separated, without whitespaces)',
                 'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)',
                 'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)',
                 ArraySanitizer
                 ArraySanitizer
             )
             )
@@ -247,16 +247,16 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
                 BooleanSanitizer
                 BooleanSanitizer
             )
             )
             .option(
             .option(
-                '--reservedNames <list> (comma separated, without whitespaces)',
+                '--reserved-names <list> (comma separated, without whitespaces)',
                 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)',
                 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)',
                 ArraySanitizer
                 ArraySanitizer
             )
             )
             .option(
             .option(
-                '--renameGlobals <boolean>', 'Allows to enable obfuscation of global variable and function names with declaration.',
+                '--rename-globals <boolean>', 'Allows to enable obfuscation of global variable and function names with declaration.',
                 BooleanSanitizer
                 BooleanSanitizer
             )
             )
             .option(
             .option(
-                '--rotateStringArray <boolean>', 'Disable rotation of unicode array values during obfuscation',
+                '--rotate-string-array <boolean>', 'Disable rotation of unicode array values during obfuscation',
                 BooleanSanitizer
                 BooleanSanitizer
             )
             )
             .option(
             .option(
@@ -265,40 +265,40 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
                 parseFloat
                 parseFloat
             )
             )
             .option(
             .option(
-                '--selfDefending <boolean>',
+                '--self-defending <boolean>',
                 'Disables self-defending for obfuscated code',
                 'Disables self-defending for obfuscated code',
                 BooleanSanitizer
                 BooleanSanitizer
             )
             )
             .option(
             .option(
-                '--sourceMap <boolean>',
+                '--source-map <boolean>',
                 'Enables source map generation',
                 'Enables source map generation',
                 BooleanSanitizer
                 BooleanSanitizer
             )
             )
             .option(
             .option(
-                '--sourceMapBaseUrl <string>',
-                'Sets base url to the source map import url when `--sourceMapMode=separate`'
+                '--source-map-base-url <string>',
+                'Sets base url to the source map import url when `--source-map-mode=separate`'
             )
             )
             .option(
             .option(
-                '--sourceMapFileName <string>',
-                'Sets file name for output source map when `--sourceMapMode=separate`'
+                '--source-map-file-name <string>',
+                'Sets file name for output source map when `--source-map-mode=separate`'
             )
             )
             .option(
             .option(
-                '--sourceMapMode <string> [inline, separate]',
+                '--source-map-mode <string> [inline, separate]',
                 'Specify source map output mode',
                 'Specify source map output mode',
                 SourceMapModeSanitizer
                 SourceMapModeSanitizer
             )
             )
             .option(
             .option(
-                '--stringArray <boolean>',
+                '--string-array <boolean>',
                 'Disables gathering of all literal strings into an array and replacing every literal string with an array call',
                 'Disables gathering of all literal strings into an array and replacing every literal string with an array call',
                 BooleanSanitizer
                 BooleanSanitizer
             )
             )
             .option(
             .option(
-                '--stringArrayEncoding <boolean|string> [true, false, base64, rc4]',
+                '--string-array-encoding <boolean|string> [true, false, base64, rc4]',
                 'Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed',
                 'Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed',
                 StringArrayEncodingSanitizer
                 StringArrayEncodingSanitizer
             )
             )
             .option(
             .option(
-                '--stringArrayThreshold <number>',
+                '--string-array-threshold <number>',
                 'The probability that the literal string will be inserted into stringArray (Default: 0.8, Min: 0, Max: 1)',
                 'The probability that the literal string will be inserted into stringArray (Default: 0.8, Min: 0, Max: 1)',
                 parseFloat
                 parseFloat
             )
             )
@@ -308,7 +308,7 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
                 ObfuscationTargetSanitizer
                 ObfuscationTargetSanitizer
             )
             )
             .option(
             .option(
-                '--unicodeEscapeSequence <boolean>',
+                '--unicode-escape-sequence <boolean>',
                 'Allows to enable/disable string conversion to unicode escape sequence',
                 'Allows to enable/disable string conversion to unicode escape sequence',
                 BooleanSanitizer
                 BooleanSanitizer
             )
             )
@@ -318,9 +318,9 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
     private configureHelp (): void {
     private configureHelp (): void {
         this.commands.on('--help', () => {
         this.commands.on('--help', () => {
             console.log('  Examples:\n');
             console.log('  Examples:\n');
-            console.log('    %> javascript-obfuscator input_file_name.js --compact true --selfDefending false');
-            console.log('    %> javascript-obfuscator input_file_name.js --output output_file_name.js --compact true --selfDefending false');
-            console.log('    %> javascript-obfuscator input_directory_name --compact true --selfDefending false');
+            console.log('    %> javascript-obfuscator input_file_name.js --compact true --self-defending false');
+            console.log('    %> javascript-obfuscator input_file_name.js --output output_file_name.js --compact true --self-defending false');
+            console.log('    %> javascript-obfuscator input_directory_name --compact true --self-defending false');
             console.log('');
             console.log('');
         });
         });
     }
     }

+ 13 - 13
test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts

@@ -40,7 +40,7 @@ describe('JavaScriptObfuscatorCLI', function (): void {
                         outputFilePath,
                         outputFilePath,
                         '--compact',
                         '--compact',
                         'true',
                         'true',
-                        '--selfDefending',
+                        '--self-defending',
                         '0'
                         '0'
                     ]);
                     ]);
 
 
@@ -192,9 +192,9 @@ describe('JavaScriptObfuscatorCLI', function (): void {
                             outputFilePath,
                             outputFilePath,
                             '--compact',
                             '--compact',
                             'true',
                             'true',
-                            '--selfDefending',
+                            '--self-defending',
                             '0',
                             '0',
-                            '--sourceMap',
+                            '--source-map',
                             'true'
                             'true'
                         ]);
                         ]);
 
 
@@ -243,11 +243,11 @@ describe('JavaScriptObfuscatorCLI', function (): void {
                             outputFilePath,
                             outputFilePath,
                             '--compact',
                             '--compact',
                             'true',
                             'true',
-                            '--selfDefending',
+                            '--self-defending',
                             '0',
                             '0',
-                            '--sourceMap',
+                            '--source-map',
                             'true',
                             'true',
-                            '--sourceMapBaseUrl',
+                            '--source-map-base-url',
                             'http://localhost:9000/'
                             'http://localhost:9000/'
                         ]);
                         ]);
 
 
@@ -300,11 +300,11 @@ describe('JavaScriptObfuscatorCLI', function (): void {
                             outputFilePath,
                             outputFilePath,
                             '--compact',
                             '--compact',
                             'true',
                             'true',
-                            '--selfDefending',
+                            '--self-defending',
                             '0',
                             '0',
-                            '--sourceMap',
+                            '--source-map',
                             'true',
                             'true',
-                            '--sourceMapFileName',
+                            '--source-map-file-name',
                             sourceMapFileName
                             sourceMapFileName
                         ]);
                         ]);
 
 
@@ -353,11 +353,11 @@ describe('JavaScriptObfuscatorCLI', function (): void {
                         outputFilePath,
                         outputFilePath,
                         '--compact',
                         '--compact',
                         'true',
                         'true',
-                        '--selfDefending',
+                        '--self-defending',
                         '0',
                         '0',
-                        '--sourceMap',
+                        '--source-map',
                         'true',
                         'true',
-                        '--sourceMapMode',
+                        '--source-map-mode',
                         'inline'
                         'inline'
                     ]);
                     ]);
 
 
@@ -493,7 +493,7 @@ describe('JavaScriptObfuscatorCLI', function (): void {
                     outputFilePath,
                     outputFilePath,
                     '--config',
                     '--config',
                     configFilePath,
                     configFilePath,
-                    '--sourceMap',
+                    '--source-map',
                     'false',
                     'false',
                 ]);
                 ]);
 
 

部分文件因为文件数量过多而无法显示