angular-cn/scripts/ci/dart_experimental/pubspec_for_ddc.js
Yegor Jbanov 6b73d09ba1 chore(build): make experimental Dart build useful
Previously we grepped all hand-written Dart code and ran analyzer in strong mode against it.

Now we run it against transformed playground apps, which:

1. does not analyze unnecessary code (we primarily care about stuff that runs in the browser)
2. analyzes generated code, which does run in the browser and which we failed to analyze in the previous version of the build

Closes #6436
2016-01-13 21:09:55 +00:00

26 lines
678 B
JavaScript

// Removes dart2js from pubspec.yaml for faster building
// Usage: node pubspec_for_ddc.js --pubspec-file=PATH_TO_PUBSPEC_YAML
var fs = require('fs');
var yaml = require('js-yaml');
var yargs = require('yargs');
var pubspecFileOpt = 'pubspec-file';
var pubspecFile = yargs
.demand([pubspecFileOpt])
.argv[pubspecFileOpt];
var doc = yaml.safeLoad(fs.readFileSync(pubspecFile, 'utf8'));
var transformers = doc['transformers'];
if (transformers) {
transformers.forEach(function (transformer) {
var dart2js = transformer['\$dart2js'];
if (dart2js) {
dart2js['$exclude'] = [ 'web/**/*' ];
}
});
}
fs.writeFileSync(pubspecFile, yaml.safeDump(doc));