1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
Description: get rid of the dep on fast-glob and prettier
Author: Julien Puydt
Forwarded: Debian-specific
--- a/src/utils/comment.ts
+++ b/src/utils/comment.ts
@@ -1,5 +1,4 @@
import * as l10n from 'mdn-data/l10n/css.json';
-import { format } from 'prettier';
import { IExtendedProperty } from '../data/patches';
import { getCompats } from '../utils/compat';
import { warn } from './logger';
@@ -83,19 +82,12 @@
const versions = [chrome, firefox, safari, edge, ie];
rows.push(
- ...format(
- [
'| Chrome | Firefox | Safari | Edge | IE |',
'| :---: | :---: | :---: | :---: | :---: |',
'| ' + versions.map(version => version[0] || '').join(' | ') + ' |',
versions.some(version => !!version[1])
? '| ' + versions.map(version => version[1] || '').join(' | ') + ' |'
: '',
- ].join('\n'),
- { parser: 'markdown' },
- )
- .trim()
- .split('\n'),
BLANK_ROW,
);
--- a/build.ts
+++ b/build.ts
@@ -1,6 +1,5 @@
import * as chokidar from 'chokidar';
import * as path from 'path';
-import * as prettier from 'prettier';
import { FLOW_FILENAME, TYPESCRIPT_FILENAME, writeFileAsync } from './utils';
import { runCLI } from 'jest';
@@ -39,10 +38,7 @@
console.info('Generating...');
const { unformattedFlow, unformattedTypescript } = await create();
console.info('Formatting...');
- const [flow, typescript] = await Promise.all([
- format(unformattedFlow, 'flow'),
- format(unformattedTypescript, 'typescript'),
- ]);
+ const [flow, typescript] = await Promise.all([unformattedFlow, unformattedTypescript]);
console.info(`Writing files...`);
await Promise.all([writeFileAsync(FLOW_FILENAME, flow), writeFileAsync(TYPESCRIPT_FILENAME, typescript)]);
console.info('Testing...');
@@ -61,16 +57,6 @@
return { unformattedFlow: await generateFlow(), unformattedTypescript: await generateTypescript() };
}
-async function format(output: string, parser: prettier.BuiltInParserName) {
- const options = await prettier.resolveConfig(path.join(__dirname, '.prettierrc'));
- return prettier.format(output, {
- ...options,
- printWidth: 180,
- singleQuote: false,
- parser,
- });
-}
-
function testing() {
return runCLI({ testMatch: ['**/__tests__/dist.*.ts'], runInBand: true } as any, [__dirname]);
}
--- a/src/collections/attributes.ts
+++ b/src/collections/attributes.ts
@@ -1,4 +1,4 @@
-import * as glob from 'fast-glob';
+import * as glob from 'glob';
import * as rawGlobalAttributes from 'mdn-browser-compat-data/html/global_attributes.json';
import { hasType, ResolvedType, Type, TypeType } from '../syntax/typer';
import { alternativeAttributes } from '../utils/compat';
|