mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
* add samples_index to web/ directory Co-authored-by: Thea Flowers <theaflowers@google.com> * add pub_get.dart script * build sample index in peanut post build * re-generate sample index with web demos * print more details in peanut_post_build.dart * add images for demos * run generator * update README * add animations and provider shopper as symlinks * add links to symlinked web demos * use relative paths * update cookbook images, urls, and description CSS * use relative URL for navbar link * unstage HTML files * .gitignore generated HTML files * add margin to toolbar * rename escape functions * add and update copyright headers Co-authored-by: Thea Flowers <theaflowers@google.com>
65 lines
1.7 KiB
Dart
65 lines
1.7 KiB
Dart
// Copyright 2020 The Flutter team. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:path/path.dart' as p;
|
|
import 'common.dart';
|
|
|
|
const _ansiGreen = 32;
|
|
const _ansiRed = 31;
|
|
const _ansiMagenta = 35;
|
|
|
|
void main() async {
|
|
final packageDirs = _listPackageDirs(Directory.current)
|
|
.map((path) => p.relative(path, from: Directory.current.path))
|
|
.toList();
|
|
|
|
print('Package dirs:\n${packageDirs.map((path) => ' $path').join('\n')}');
|
|
|
|
final results = <bool>[];
|
|
for (var i = 0; i < packageDirs.length; i++) {
|
|
final dir = packageDirs[i];
|
|
logWrapped(_ansiMagenta, '\n$dir (${i + 1} of ${packageDirs.length})');
|
|
results.add(await run(dir, 'flutter', [
|
|
'pub',
|
|
'pub',
|
|
'upgrade',
|
|
'--no-precompile',
|
|
]));
|
|
results.add(await run(
|
|
dir,
|
|
'dartanalyzer',
|
|
['--fatal-infos', '--fatal-warnings', '.'],
|
|
));
|
|
_printStatus(results);
|
|
}
|
|
|
|
if (results.any((v) => !v)) {
|
|
exitCode = 1;
|
|
}
|
|
}
|
|
|
|
void _printStatus(List<bool> results) {
|
|
var successCount = results.where((t) => t).length;
|
|
var success = (successCount == results.length);
|
|
var pct = 100 * successCount / results.length;
|
|
|
|
logWrapped(success ? _ansiGreen : _ansiRed,
|
|
'$successCount of ${results.length} (${pct.toStringAsFixed(2)}%)');
|
|
}
|
|
|
|
Iterable<String> _listPackageDirs(Directory dir) sync* {
|
|
if (File('${dir.path}/pubspec.yaml').existsSync()) {
|
|
yield dir.path;
|
|
} else {
|
|
for (var subDir in dir
|
|
.listSync(followLinks: true)
|
|
.whereType<Directory>()
|
|
.where((d) => !Uri.file(d.path).pathSegments.last.startsWith('.'))) {
|
|
yield* _listPackageDirs(subDir);
|
|
}
|
|
}
|
|
}
|