Completely refactor build system (#205)
authorRaphael von der Grün <>
Thu, 18 Jul 2019 11:15:08 +0000 (13:15 +0200)
committerGitHub <>
Thu, 18 Jul 2019 11:15:08 +0000 (13:15 +0200)
Completely refactor build system (#205)

The goals of this refactoring are the following:

- Improve code quality of the build system
- Prepare code base for adding code coverage
- Prepare code base for exposing the build system as a package export,
  so platforms can build their `cordova.js` during their build (or
  creation) process. This would make the JS build using coho obsolete.
- Prepare code base to remove dependency on Grunt

The build process now lives under `build-tools` (was `tasks`). It does
not depend on Grunt anymore but is written in plain Node.js.

The original Grunt interface for building (as used by coho) was
preserved and is implemented in `Gruntfile.js` using the new build
system. The `platformName` option and support for getting platform paths
from the `cordova-platforms` key in `package.json` have been removed
from the Grunt interface, but neither of those are used in coho.

The logic that is specific to the test build has been extracted from
the rest of the build. It now lives in `test/build.js` and is run
automatically during `npm test`.

The following dependencies have been added:

- execa
- fs-extra
- globby

I have taken extra care to preserve the exact format of the built file.
This means that the correctness of the refactoring can be verified by
simply diffing the build artifacts in `pkg` created with and without
this change.
21 files changed:
build-tools/build.js [new file with mode: 0644]
build-tools/bundle.js [new file with mode: 0644]
build-tools/common.js [new file with mode: 0644]
build-tools/index.js [new file with mode: 0644]
build-tools/modules.js [new file with mode: 0644]
build-tools/scripts.js [new file with mode: 0644]
tasks/compile.js [deleted file]
tasks/lib/bundle.js [deleted file]
tasks/lib/collect-files.js [deleted file]
tasks/lib/compute-commit-id.js [deleted file]
tasks/lib/copy-props.js [deleted file]
tasks/lib/get-module-id.js [deleted file]
tasks/lib/packager.js [deleted file]
tasks/lib/strip-header.js [deleted file]
tasks/lib/write-contents.js [deleted file]
tasks/lib/write-module.js [deleted file]
tasks/lib/write-script.js [deleted file]
tasks/templates/LICENSE-for-js-file.txt [deleted file]
test/build.js [new file with mode: 0755]