From 346fe03aefc585f564f113d76a426819a75ffe12 Mon Sep 17 00:00:00 2001 From: Sergey Volkov Date: Wed, 28 Oct 2020 21:59:32 +0300 Subject: [PATCH 1/5] Revert "Mention our desire to convert the codebase to JS." This reverts commit 3444983a1833b7208e0a59089214f42694b6192b. Signed-off-by: Sergey Volkov --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index d8c9c8e1..8fe775ab 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # adbkit -_**Interested in helping to convert the CoffeeScript codebase to plain JavaScript? [Help us](https://github.com/openstf/adbkit/issues/48)!**_ - **adbkit** is a pure [Node.js][nodejs] client for the [Android Debug Bridge][adb-site] server. It can be used either as a library in your own application, or simply as a convenient utility for playing with your device. Most of the `adb` command line tool's functionality is supported (including pushing/pulling files, installing APKs and processing logs), with some added functionality such as being able to generate touch/key events and take screenshots. Some shims are provided for older devices, but we have not and will not test anything below Android 2.3. From b32f1acbfdd16d408fabdeee9b198279ea73d120 Mon Sep 17 00:00:00 2001 From: Sergey Volkov Date: Wed, 28 Oct 2020 22:03:15 +0300 Subject: [PATCH 2/5] Update tasks/keycode.js Signed-off-by: Sergey Volkov --- tasks/keycode.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tasks/keycode.js b/tasks/keycode.js index 51b63df9..7d76edaa 100644 --- a/tasks/keycode.js +++ b/tasks/keycode.js @@ -24,16 +24,16 @@ const req = https.request(original, function (res) { let match; const code = raw.toString(); const date = new Date().toUTCString(); - const coffee = []; - coffee.push('// Generated by `npm run keycode` on ' + date); - coffee.push('// KeyEvent.java Copyright (C) 2006 The Android Open Source Project'); - coffee.push(''); - coffee.push('export = {'); + const typescript = []; + typescript.push('// Generated by `npm run keycode` on ' + date); + typescript.push('// KeyEvent.java Copyright (C) 2006 The Android Open Source Project'); + typescript.push(''); + typescript.push('export = {'); while ((match = regex.exec(code))) { - coffee.push(`\t${match[1]}: ${match[2]},`); + typescript.push(`\t${match[1]}: ${match[2]},`); } - coffee.push('};\n'); - fs.writeFileSync(file, coffee.join('\n')); + typescript.push('};\n'); + fs.writeFileSync(file, typescript.join('\n')); console.log('File ' + file + ' created'); }); }); From 0cf196ab8c94754805cfdefe003b148158d4601b Mon Sep 17 00:00:00 2001 From: Sergey Volkov Date: Wed, 28 Oct 2020 22:05:30 +0300 Subject: [PATCH 3/5] Update README.md Signed-off-by: Sergey Volkov --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 8fe775ab..bd1c0545 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,6 @@ npm install --save adbkit We use [debug][node-debug], and our debug namespace is `adb`. Some of the dependencies may provide debug output of their own. To see the debug output, set the `DEBUG` environment variable. For example, run your program with `DEBUG=adb:* node app.js`. -Note that even though the module is written in [CoffeeScript][coffeescript], only the compiled JavaScript is published to [NPM][npm], which means that it can easily be used with pure JavaScript codebases, too. - ### Examples The examples may be a bit verbose, but that's because we're trying to keep them as close to real-life code as possible, with flow control and error handling taken care of. @@ -1106,7 +1104,6 @@ See [LICENSE](LICENSE). Copyright © The OpenSTF Project. All Rights Reserved. [nodejs]: -[coffeescript]: [npm]: [adb-js]: [adb-site]: From 37b9362338399c28318c45933f1d0b179a0d590a Mon Sep 17 00:00:00 2001 From: Sergey Volkov Date: Wed, 28 Oct 2020 22:10:57 +0300 Subject: [PATCH 4/5] Run eslint on "npm test" Signed-off-by: Sergey Volkov --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 687ae640..994b1064 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "compile": "tsc -p .", "lint": "eslint ./ --ext .ts", "format": "eslint ./ --fix --ext .ts", - "test": "mocha --reporter spec --colors --recursive" + "test": "npm run lint && mocha --reporter spec --colors --recursive" }, "dependencies": { "@devicefarmer/adbkit-logcat": "^1.1.0", From 75af0e812f1f4a250f7d63740779c6f67183919c Mon Sep 17 00:00:00 2001 From: Sergey Volkov Date: Wed, 28 Oct 2020 22:10:20 +0300 Subject: [PATCH 5/5] Remove last coffee references Signed-off-by: Sergey Volkov --- .editorconfig | 4 - CONTRIBUTING.md | 2 +- Gruntfile.coffee | 82 -------------------- test/adb/command/host-transport/uninstall.js | 2 - 4 files changed, 1 insertion(+), 89 deletions(-) delete mode 100644 Gruntfile.coffee diff --git a/.editorconfig b/.editorconfig index 3dcde622..15bf5856 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,10 +17,6 @@ indent_size = 2 indent_style = space indent_size = 2 -[*.coffee] -indent_style = space -indent_size = 2 - [*.md] indent_style = space indent_size = 2 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 50ebccc1..15312f10 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,7 @@ We are happy to accept any contributions that make sense and respect the rules l * **Do** use feature branches. * **Do** conform to existing coding style so that your contribution fits in. * **Do** use [EditorConfig] to enforce our [whitespace rules](.editorconfig). If your editor is not supported, enforce the settings manually. -* **Do** run `npm test` for CoffeeLint, JSONLint and unit test coverage. +* **Do** run `npm test` for ESLint and unit test coverage. * **Do not** touch the `version` field in [package.json](package.json). * **Do not** commit any generated files, unless already in the repo. If absolutely necessary, explain why. * **Do not** create any top level files or directories. If absolutely necessary, explain why and update [.npmignore](.npmignore). diff --git a/Gruntfile.coffee b/Gruntfile.coffee deleted file mode 100644 index 9d072fc9..00000000 --- a/Gruntfile.coffee +++ /dev/null @@ -1,82 +0,0 @@ -module.exports = (grunt) -> - - grunt.initConfig - pkg: require './package' - coffee: - src: - options: - bare: true - noHeader: true - expand: true - cwd: 'src' - src: '**/*.coffee' - dest: 'lib' - ext: '.js' - index: - src: 'index.coffee' - dest: 'index.js' - clean: - lib: - src: 'lib' - index: - src: 'index.js' - coffeelint: - options: - indentation: - level: 'ignore' - no_backticks: - level: 'ignore' - src: - src: '<%= coffee.src.cwd %>/<%= coffee.src.src %>' - index: - src: '<%= coffee.index.src %>' - test: - src: 'test/**/*.coffee' - tasks: - src: 'tasks/**/*.coffee' - gruntfile: - src: 'Gruntfile.coffee' - jsonlint: - packagejson: - src: 'package.json' - watch: - src: - files: '<%= coffee.src.cwd %>/<%= coffee.src.src %>' - tasks: ['coffeelint:src', 'test'] - index: - files: '<%= coffee.index.src %>' - tasks: ['coffeelint:index', 'test'] - test: - files: '<%= coffeelint.test.src %>', - tasks: ['coffeelint:test', 'test'] - gruntfile: - files: '<%= coffeelint.gruntfile.src %>' - tasks: ['coffeelint:gruntfile'] - packagejson: - files: '<%= jsonlint.packagejson.src %>' - tasks: ['jsonlint:packagejson'] - exec: - mocha: - options: [ - '--compilers coffee:coffee-script/register' - '--reporter spec' - '--colors' - '--recursive' - ], - cmd: './node_modules/.bin/mocha <%= exec.mocha.options.join(" ") %>' - keycode: - generate: - dest: 'src/adb/keycode.coffee' - - grunt.loadNpmTasks 'grunt-contrib-clean' - grunt.loadNpmTasks 'grunt-contrib-coffee' - grunt.loadNpmTasks 'grunt-coffeelint' - grunt.loadNpmTasks 'grunt-jsonlint' - grunt.loadNpmTasks 'grunt-contrib-watch' - grunt.loadNpmTasks 'grunt-notify' - grunt.loadNpmTasks 'grunt-exec' - grunt.loadTasks './tasks' - - grunt.registerTask 'test', ['jsonlint', 'coffeelint', 'exec:mocha'] - grunt.registerTask 'build', ['coffee'] - grunt.registerTask 'default', ['test'] diff --git a/test/adb/command/host-transport/uninstall.js b/test/adb/command/host-transport/uninstall.js index 8c9d63a9..9d52758f 100644 --- a/test/adb/command/host-transport/uninstall.js +++ b/test/adb/command/host-transport/uninstall.js @@ -86,7 +86,6 @@ describe('UninstallCommand', function() { cmd = new UninstallCommand(conn); setImmediate(function() { conn.socket.causeRead(Protocol.OKAY); - // coffeelint: disable=max_line_length conn.socket.causeRead(` Exception occurred while dumping: java.lang.IllegalArgumentException: Unknown package: foo @@ -103,7 +102,6 @@ java.lang.IllegalArgumentException: Unknown package: foo at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2387) at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3019) at android.os.Binder.execTransact(Binder.java:565)`); - // coffeelint: enable=max_line_length return conn.socket.causeEnd(); }); return cmd.execute('foo').then(function() {