UNPKG

816 BPlain TextView Raw
1/**
2 * @license
3 * Copyright (c) 2018 Google Inc. All rights reserved.
4 * This code may only be used under the BSD style license found at
5 * http://polymer.github.io/LICENSE.txt
6 * Code distributed by Google as part of this project is also
7 * subject to an additional IP rights grant found at
8 * http://polymer.github.io/PATENTS.txt
9 */
10
11import {DEFAULT_CONFIG_FILENAME, readConfigFile, resolveConfigs} from './cli';
12import {formatFiles, getFilesToFormat} from './format';
13
14export async function run() {
15 const [defaultConfig, userConfig] = await Promise.all(
16 [readConfigFile(DEFAULT_CONFIG_FILENAME), readConfigFile()]);
17
18 const activeConfig = resolveConfigs(defaultConfig, userConfig);
19 const filesToFormat = await getFilesToFormat(activeConfig);
20 await formatFiles(filesToFormat, activeConfig.style);
21}