Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize build, Platform Parity #112

Merged
merged 80 commits into from
Feb 3, 2020
Merged

Modernize build, Platform Parity #112

merged 80 commits into from
Feb 3, 2020

Conversation

sgtcoolguy
Copy link
Contributor

@sgtcoolguy sgtcoolguy commented Sep 26, 2019

Description:

  • Use SDK 8.2.1.GA to build (need to use an 8_2_X branch build for now)
  • Add apidocs
  • add unit tests
  • Add danger.JS to PRs
  • fixes to build with SDK 8+
  • set up package.json
  • validate apidocs
  • Add more supported formats (and new constants to module/docs)
  • Move iOS back to ZXing (https://github.com/zxingify/zxingify-objc) from AVFoundation
  • Support passing along decoding hints
  • Added lots of development/workflow tweaks (husky, lint-staged, clang-format linting/formatting of source, conventional commit enforcement)
  • Bump major version and denote breaking changes in CHANGELOG.md

@build
Copy link

build commented Sep 26, 2019

Warnings
⚠️

🔍 Can't find junit reports at ./TESTS-*.xml, skipping generating JUnit Report.

Messages
📖

💾 Here are the artifacts produced:

📖 🎉 - congrats on your new release

Dependencies with modified semantic versioning:

@commitlint/cli

Author: Mario Nebl

Description: Lint your commit messages

Homepage: https://github.com/conventional-changelog/commitlint#readme

Createdover 2 years ago
Last Updated19 days ago
LicenseMIT
Maintainers4
Releases60
Direct Dependencies@commitlint/format, @commitlint/lint, @commitlint/load, @commitlint/read, babel-polyfill, chalk, get-stdin, lodash, meow, resolve-from and resolve-global
Keywordsconventional-changelog, commitlint and cli
README

Lint commit messages

@commitlint/cli

Getting started

npm install --save-dev @commitlint/cli @commitlint/config-angular
echo "module.exports = {extends: ['@commitlint/config-angular']};" > commitlint.config.js

Consult docs/cli for comprehensive documentation.

@commitlint/config-conventional

Author: Mario Nebl

Description: Shareable commitlint config enforcing conventional commits

Homepage: https://github.com/conventional-changelog/commitlint#readme

Createdabout 2 years ago
Last Updatedabout 1 month ago
LicenseMIT
Maintainers4
Releases27
Direct Dependenciesconventional-changelog-conventionalcommits
Keywordsconventional-changelog, commitlint, commitlint-config and angular
README

Lint your conventional commits

@commitlint/config-conventional

Shareable commitlint config enforcing conventional commits.
Use with @commitlint/cli and @commitlint/prompt-cli.

⚠️
IMPORTANT This is a direct replacement for @commitlint/config-angular prior to version 4. config-angular diverged from the conventional commit convention as of version 5. See #146 for details.

Getting started

npm install --save-dev @commitlint/config-conventional @commitlint/cli
echo "module.exports = {extends: ['@commitlint/config-conventional']};" > commitlint.config.js

Rules

Problems

The following rules are considered problems for @commitlint/config-conventional and will yield a non-zero exit code when not met.

Consult docs/rules for a list of available rules.

type-enum

  • condition: type is found in value

  • rule: always

  • value

    [
      'build',
      'ci',
      'chore',
      'docs',
      'feat',
      'fix',
      'perf',
      'refactor',
      'revert',
      'style',
      'test'
    ]
echo "foo: some message" # fails
echo "fix: some message" # passes

type-case

  • description: type is in case value
  • rule: always
  • value
      'lowerCase'
echo "FIX: some message" # fails
echo "fix: some message" # passes

type-empty

  • condition: type is empty
  • rule: never
echo ": some message" # fails
echo "fix: some message" # passes

scope-case

  • condition: scope is in case value
  • rule: always
  'lowerCase'
echo "fix(SCOPE): some message" # fails
echo "fix(scope): some message" # passes

subject-case

  • condition: subject is in one of the cases ['sentence-case', 'start-case', 'pascal-case', 'upper-case']
  • rule: never
echo "fix(SCOPE): Some message" # fails
echo "fix(SCOPE): Some Message" # fails
echo "fix(SCOPE): SomeMessage" # fails
echo "fix(SCOPE): SOMEMESSAGE" # fails
echo "fix(scope): some message" # passes
echo "fix(scope): some Message" # passes

subject-empty

  • condition: subject is empty
  • rule: never
echo "fix:" # fails
echo "fix: some message" # passes

subject-full-stop

  • condition: subject ends with value
  • rule: never
  • value
  '.'
echo "fix: some message." # fails
echo "fix: some message" # passes

header-max-length

  • condition: header has value or less characters
  • rule: always
  • value
  72
echo "fix: some message that is way too long and breaks the line max-length by several characters" # fails
echo "fix: some message" # passes

@seadub/clang-format-lint

Author: Christopher Williams

Description: Validate and/or fix formatting of files via clang-format

Homepage: https://github.com/sgtcoolguy/clang-format-lint#readme

Created4 months ago
Last Updated4 months ago
LicenseMIT
Maintainers1
Releases2
Direct Dependenciescommander, glob and p-limit
Keywordsclang, clang-format and lint
README

clang-format-lint

A very simple wrapper around the clang-format npm package/binary.

Intended to be used to either validate existing files, or automatically fix the formatting on them.

Usage:

npx clang-format-lint [--fix] [--exec-limit [limit]] glob[ glob]*

e.g. To check if your source files match your formatting rules:

npx clang-format-lint android/src/**/*.java

e.g. To ensure your source files match your formatting rules:

npx clang-format-lint --fix android/src/**/*.java

New dependencies added: @commitlint/cli, @commitlint/config-conventional, @seadub/clang-format-lint, clang-format, commitizen, fs-extra, husky, lint-staged and titanium-docgen.

commitizen

Author: Jim Cummins

Description: Git commit, but play nice with conventions.

Homepage: https://github.com/commitizen/cz-cli

Createdalmost 5 years ago
Last Updated7 months ago
LicenseMIT
Maintainers5
Releases64
Direct Dependenciescachedir, cz-conventional-changelog, dedent, detect-indent, find-node-modules, find-root, fs-extra, glob, inquirer, is-utf8, lodash, minimist, shelljs, strip-bom and strip-json-comments
Keywordscommit, pretty, format, conventional changelog and commitizen
This README is too long to show.

fs-extra

Author: JP Richardson

Description: fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.

Homepage: https://github.com/jprichardson/node-fs-extra

Createdabout 8 years ago
Last Updated16 days ago
LicenseMIT
Maintainers3
Releases86
Direct Dependenciesgraceful-fs, jsonfile and universalify
Keywordsfs, file, file system, copy, directory, extra, mkdirp, mkdir, mkdirs, recursive, json, read, write, extra, delete, remove, touch, create, text, output and move
README

Node.js: fs-extra

fs-extra adds file system methods that aren't included in the native fs module and adds promise support to the fs methods. It also uses graceful-fs to prevent EMFILE errors. It should be a drop in replacement for fs.

npm Package
License
build status
windows Build status
downloads per month
Coverage Status
JavaScript Style Guide

Why?

I got tired of including mkdirp, rimraf, and ncp in most of my projects.

Installation

npm install fs-extra

Usage

fs-extra is a drop in replacement for native fs. All methods in fs are attached to fs-extra. All fs methods return promises if the callback isn't passed.

You don't ever need to include the original fs module again:

const fs = require('fs') // this is no longer necessary

you can now do this:

const fs = require('fs-extra')

or if you prefer to make it clear that you're using fs-extra and not fs, you may want
to name your fs variable fse like so:

const fse = require('fs-extra')

you can also keep both, but it's redundant:

const fs = require('fs')
const fse = require('fs-extra')

Sync vs Async vs Async/Await

Most methods are async by default. All async methods will return a promise if the callback isn't passed.

Sync methods on the other hand will throw if an error occurs.

Also Async/Await will throw an error if one occurs.

Example:

const fs = require('fs-extra')

// Async with promises:
fs.copy('/tmp/myfile', '/tmp/mynewfile')
  .then(() => console.log('success!'))
  .catch(err => console.error(err))

// Async with callbacks:
fs.copy('/tmp/myfile', '/tmp/mynewfile', err => {
  if (err) return console.error(err)
  console.log('success!')
})

// Sync:
try {
  fs.copySync('/tmp/myfile', '/tmp/mynewfile')
  console.log('success!')
} catch (err) {
  console.error(err)
}

// Async/Await:
async function copyFiles () {
  try {
    await fs.copy('/tmp/myfile', '/tmp/mynewfile')
    console.log('success!')
  } catch (err) {
    console.error(err)
  }
}

copyFiles()

Methods

Async

Sync

NOTE: You can still use the native Node.js methods. They are promisified and copied over to fs-extra. See notes on fs.read() & fs.write()

What happened to walk() and walkSync()?

They were removed from fs-extra in v2.0.0. If you need the functionality, walk and walkSync are available as separate packages, klaw and klaw-sync.

Third Party

TypeScript

If you like TypeScript, you can use fs-extra with it: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra

File / Directory Watching

If you want to watch for changes to files or directories, then you should use chokidar.

Obtain Filesystem (Devices, Partitions) Information

fs-filesystem allows you to read the state of the filesystem of the host on which it is run. It returns information about both the devices and the partitions (volumes) of the system.

Misc.

Hacking on fs-extra

Wanna hack on fs-extra? Great! Your help is needed! fs-extra is one of the most depended upon Node.js packages. This project
uses JavaScript Standard Style - if the name or style choices bother you,
you're gonna have to get over it :) If standard is good enough for npm, it's good enough for fs-extra.

js-standard-style

What's needed?

  • First, take a look at existing issues. Those are probably going to be where the priority lies.
  • More tests for edge cases. Specifically on different platforms. There can never be enough tests.
  • Improve test coverage. See coveralls output for more info.

Note: If you make any big changes, you should definitely file an issue for discussion first.

Running the Test Suite

fs-extra contains hundreds of tests.

  • npm run lint: runs the linter (standard)
  • npm run unit: runs the unit tests
  • npm test: runs both the linter and the tests

Windows

If you run the tests on the Windows and receive a lot of symbolic link EPERM permission errors, it's
because on Windows you need elevated privilege to create symbolic links. You can add this to your Windows's
account by following the instructions here: http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7
However, I didn't have much luck doing this.

Since I develop on Mac OS X, I use VMWare Fusion for Windows testing. I create a shared folder that I map to a drive on Windows.
I open the Node.js command prompt and run as Administrator. I then map the network drive running the following command:

net use z: "\\vmware-host\Shared Folders"

I can then navigate to my fs-extra directory and run the tests.

Naming

I put a lot of thought into the naming of these functions. Inspired by @coolaj86's request. So he deserves much of the credit for raising the issue. See discussion(s) here:

First, I believe that in as many cases as possible, the Node.js naming schemes should be chosen. However, there are problems with the Node.js own naming schemes.

For example, fs.readFile() and fs.readdir(): the F is capitalized in File and the d is not capitalized in dir. Perhaps a bit pedantic, but they should still be consistent. Also, Node.js has chosen a lot of POSIX naming schemes, which I believe is great. See: fs.mkdir(), fs.rmdir(), fs.chown(), etc.

We have a dilemma though. How do you consistently name methods that perform the following POSIX commands: cp, cp -r, mkdir -p, and rm -rf?

My perspective: when in doubt, err on the side of simplicity. A directory is just a hierarchical grouping of directories and files. Consider that for a moment. So when you want to copy it or remove it, in most cases you'll want to copy or remove all of its contents. When you want to create a directory, if the directory that it's suppose to be contained in does not exist, then in most cases you'll want to create that too.

So, if you want to remove a file or a directory regardless of whether it has contents, just call fs.remove(path). If you want to copy a file or a directory whether it has contents, just call fs.copy(source, destination). If you want to create a directory regardless of whether its parent directories exist, just call fs.mkdirs(path) or fs.mkdirp(path).

Credit

fs-extra wouldn't be possible without using the modules from the following authors:

License

Licensed under MIT

Copyright (c) 2011-2017 JP Richardson

husky

Author: Typicode

Description: Prevents bad commit or push (git hooks, pre-commit/precommit, pre-push/prepush, post-merge/postmerge and all that stuff...)

Homepage: https://github.com/typicode/husky#readme

Createdover 5 years ago
Last Updated11 days ago
LicenseMIT
Maintainers1
Releases150
Direct Dependencieschalk, ci-info, compare-versions, cosmiconfig, find-versions, opencollective-postinstall, pkg-dir, please-upgrade-node, slash and which-pm-runs
Keywordsgit, hook, hooks, pre-commit, precommit, post-commit, postcommit, pre-push, prepush, post-merge, postmerge, test and lint
This README is too long to show.

lint-staged

Author: Andrey Okonetchnikov

Description: Lint files staged by git

Homepage: https://github.com/okonet/lint-staged#readme

Createdabout 4 years ago
Last Updated4 days ago
LicenseMIT
Maintainers1
Releases139
Direct Dependencieschalk, commander, cosmiconfig, debug, dedent, execa, listr, log-symbols, micromatch, normalize-path, please-upgrade-node, string-argv and stringify-object
Keywordslint, git, staged, eslint, prettier, stylelint, code, quality, check, format and validate
This README is too long to show.

titanium-docgen

Author: Axway Appcelerator

Description: Generates Titanium API documentation in different formats

Homepage: https://github.com/appcelerator/docs-devkit#readme

Created6 months ago
Last Updatedabout 2 months ago
LicenseApache-2.0
Maintainers1
Releases10
Direct Dependenciescolors, ejs, js-yaml, markdown-it and node-appc
Keywordstitanium, docgen, documentation and docs
README

titanium-docgen

Generates Titanium API documentation in different formats

Installation

npm i titanium-docgen -D

Usage

node docgen [--addon-docs <PATH_TO_YAML_FILES] [--css <CSS_FILE>] [--format <EXPORT_FORMAT>] [--output <OUTPUT_DIRECTORY>] <PATH_TO_YAML_FILES>

For a description of each option. run docgen --help.

Supported formats

Format Description
addon
changes
html HTML files for the official docs at https://docs.appcelerator.com
jsca JSCA content assist metadata
jsduck https://github.com/senchalabs/jsduck
json JSON metadata file
json-raw Same as json, but with no pre-rendered markdown
modulehtml
parity
solr Solr search index
typescript TypeScript type definition file

clang-format

Author: Unknown

Description: node wrapper around clang-format

Homepage: https://github.com/angular/clang-format#readme

Createdalmost 5 years ago
Last Updated7 days ago
LicenseApache-2.0
Maintainers3
Releases65
Direct Dependenciesasync, glob and resolve
README

Build Status

clang-format

node.js module which wraps the native clang-format executable.

From the command-line:

$ npm install -g clang-format
$ clang-format -help

If your platform isn't yet supported, you can create the native binary from
the latest upstream clang sources, make sure it is stripped and optimized
(should be about 1.4MB as of mid-2015) and send a pull request to add it.

Checking formatting

Ensuring that changes to your code are properly formatted is an important part
of your development workflow. Note that the check-clang-format and
git-clang-format commands require Python to be globally available.

We recommend using a git pre-commit hook. You can configure this as follows:

  1. add a precommit script to your package.json file:

    "scripts": {
        "precommit": "check-clang-format"
    }

    By default, the user gets an error instructing them to run
    ./node_modules/.bin/git-clang-format. You may find it more ergonomic to set
    up a package.json script, eg.
    "scripts": { "format": "git-clang-format" }

    In this case, add a second argument to the "precommit" script, giving the
    error you'd like to print for users, eg.

    "precommit": "check-clang-format \"yarn format\""

  2. Add a devDependency on the husky package, which will add a
    .git/hooks/pre-commit script, which in turn triggers the precommit
    package.json script to run whenever someone adds a commit in this repository:

    $ yarn add -D husky

    or

    npm install --save-dev husky

Why do this in a pre-commit hook? For one thing, it's faster to run
clang-format only on the changed files, especially as the repository grows.
Also, this lets you upgrade clang-format or change your settings without
needing to re-format the entire repository, while still enforcing that later
changes follow the new style.

Globbing files

$ clang-format --glob=folder/**/*.js

This will run clang-format once per file result, and show the total
formatted files at the end.
See node-glob for globbing semantics.

Compiling clang-format

For Linux, compile a statically linked MinSizeRel build:

cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_BUILD_STATIC=true ..
ninja clang-format

For Mac OS X, static linking is not required.

Windows

Windows snapshot builds to include in the release can be found at the
LLVM website.

Configure with:

cmake -G "Visual Studio 12" -DCMAKE_BUILD_TYPE=MinSizeRel ..

In the generated Visual Studio project, search for the clang-format binary in
the Solution Explorer window, right click and choose Build.

Generated by 🚫 dangerJS against 15e62e6

@m1ga
Copy link
Contributor

m1ga commented Sep 26, 2019

@sgtcoolguy another option would be moving the Android part to https://firebase.google.com/docs/ml-kit/android/read-barcodes as a library. Not sure about the performance or other advantages. But it is supported by google so it might have a better support on phones

Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Android LGTM!

Copy link
Contributor

@vijaysingh-axway vijaysingh-axway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address mentioned comments. Other iOS changes looks good.

ios/Classes/TiBarcodeViewController.m Outdated Show resolved Hide resolved
ios/Classes/TiBarcodeViewController.m Outdated Show resolved Hide resolved
@garymathews
Copy link
Contributor

Pushed changes to remove commented code. Tested the provided example on both Android and iOS. Barcodes scan fine.

Merging.

@garymathews garymathews merged commit 72590be into master Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants