Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(scripts): add diff:flat script #25352

Draft
wants to merge 54 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
a921242
chore(scripts): add flat-diff
caugner Nov 14, 2024
b503acc
chore(flat-diff): flatten arrays
caugner Nov 15, 2024
0f315ca
chore(flat-diff): convert notes to array
caugner Nov 15, 2024
3e7c008
chore(flat-diff): improve HTML rendering
caugner Nov 15, 2024
d86cd73
fix(diff-flat): show booleans
caugner Nov 15, 2024
871bcbc
enhance(flat-diff): hide new mirror
caugner Nov 15, 2024
777eacf
enhance(flat-diff): arrayify support statements
caugner Nov 18, 2024
37cc7fb
enhance(flat-diff): stringify flags
caugner Nov 18, 2024
f0fbc35
style: fix lints
caugner Nov 18, 2024
cf432c7
enhance(diff-flat): add --group option
caugner Nov 18, 2024
86bed0b
fix(flat-diff): group values by browser and field
caugner Nov 18, 2024
8e6e181
enhance(diff-flat): align suffix
caugner Nov 18, 2024
3642e18
enhance(diff-flat): group groups
caugner Nov 18, 2024
c10c106
fix(diff-flat): print grouped values before keys
caugner Nov 18, 2024
700fe48
enhance(diff-flat): annotate flags
caugner Nov 18, 2024
08db344
enhance(diff-flat): merge versions + prefix/flags/altname
caugner Nov 18, 2024
118405a
enhance(diff-flat): improve group formatting
caugner Nov 18, 2024
0eb3d60
enhance(diff-flat): collapse groups + order by value
caugner Nov 18, 2024
5611d24
enhance(diff-flat): omit "__compat"/"support" + trailing placeholder
caugner Nov 18, 2024
7f17aa7
enhance(flat-diff): join tags
caugner Nov 18, 2024
7fdbe60
enhance(diff-flat): diff value again
caugner Nov 19, 2024
3712dfb
fix(diff-flat): split at footnotes
caugner Nov 19, 2024
a069adc
refactor(diff-flat): inline print()
caugner Nov 19, 2024
06bfed8
enhance(diff-flat): print refs in context
caugner Nov 19, 2024
c845b50
chore(deps-dev): add strip-ansi 7.1.0
caugner Nov 19, 2024
879d074
fix(diff-flat): sort ignoring ANSI escape codes
caugner Nov 19, 2024
645d3b6
enhance(diff-flat): serialize status
caugner Nov 19, 2024
e1173cd
fix(diff-flat): improve word splitting
caugner Nov 19, 2024
6bb510d
fix(diff-flat): remove inverse key sort
caugner Nov 19, 2024
8f45778
fix(diff-flat): call diffKeys() with correct order
caugner Nov 19, 2024
612cfd4
enhance(diff-flat): add mirror option
caugner Nov 21, 2024
c90361d
chore(diff-flat): add workaround for running from flat-diff branch
caugner Nov 21, 2024
26a156d
enhance(diff-flat): fetch if ref not available
caugner Nov 21, 2024
ae89f2d
fixup! chore(diff-flat): add workaround for running from flat-diff br…
caugner Nov 21, 2024
d70d279
enhance(diff-flat): support pr number
caugner Nov 21, 2024
b6647b7
fix(flat-diff): always try to fetch from remote
caugner Nov 21, 2024
ff2b173
refactor(utils): move {exec, execAsync,spawn}()
caugner Nov 21, 2024
12650ba
enhance(diff-flat): fetch and resolve head/base
caugner Nov 21, 2024
a85e673
enhance(diff-flat): support fork:branch ref
caugner Nov 21, 2024
2082fcd
refactor(diff-flat): extract gitFetch() + gitRevParse()
caugner Nov 21, 2024
3780a92
fix(diff-flat): support different remote name
caugner Nov 21, 2024
d7d4ce5
fix(diff-flat): suppress fetch output
caugner Nov 21, 2024
40bcfc3
enhance(diff-flat): align non-grouped values
caugner Nov 21, 2024
1757ec1
Revert "enhance(diff-flat): align non-grouped values"
caugner Nov 21, 2024
9c2d12e
fix(diff-flat): print refs after ungrouped values
caugner Nov 21, 2024
90e442a
enhance(diff-flat): support added/deleted files
caugner Nov 21, 2024
1db936f
enhane(diff-flat): add transform option
caugner Nov 21, 2024
a96d491
fix(diff-flat): omit "+" after non-real support
caugner Nov 21, 2024
b704d2a
enhance(diff-flat): use natural sort
caugner Nov 21, 2024
d96c5c6
fix(diff-flat): hide only initial false/mirror values
caugner Nov 21, 2024
04b1833
fix(diff-flat): improve version range formatting
caugner Nov 25, 2024
0e5a01e
enhance(diff-flat): use version_last
caugner Nov 25, 2024
343095d
chore(flat-diff): enable grouping by default
caugner Dec 6, 2024
b7e53de
chore(deps): run `npm install`
caugner Dec 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
265 changes: 115 additions & 150 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"cli-progress": "^3.12.0",
"compare-versions": "~6.1.0",
"deep-diff": "~1.0.2",
"diff": "^7.0.0",
"es-main": "~1.3.0",
"eslint": "~8.57.0",
"eslint-config-standard": "~17.1.0",
Expand All @@ -88,6 +89,7 @@
"ora": "~8.1.0",
"prettier": "~3.4.0",
"sinon": "^19.0.1",
"strip-ansi": "^7.1.0",
"tempy": "^3.1.0",
"ts-node": "~10.9.1",
"typescript": "~5.7.2",
Expand All @@ -99,6 +101,7 @@
"save-git-history": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/save-git-history.ts",
"prepare": "(husky || true) && npm run gentypes && npm run build",
"diff": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/diff.ts",
"diff:flat": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/diff-flat.ts",
"unittest": "NODE_ENV=test c8 mocha index.test.ts --recursive \"{,!(node_modules)/**}/*.test.ts\"",
"coverage": "c8 report -r lcov && open-cli coverage/lcov-report/index.html",
"format": "eslint . && prettier --check . && tsc --noEmit",
Expand Down
14 changes: 2 additions & 12 deletions scripts/diff-features.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
/* This file is a part of @mdn/browser-compat-data
* See LICENSE file for more information. */

import { exec, execSync } from 'node:child_process';
import { execSync } from 'node:child_process';
import fs from 'node:fs';
import { promisify } from 'node:util';
import path from 'node:path';

import esMain from 'es-main';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { temporaryDirectoryTask } from 'tempy';

/**
* Executes a command asynchronously.
* @param command The command to execute asynchronously.
* @returns The output of the command.
*/
const execAsync = async (command: string): Promise<string> => {
const result = await promisify(exec)(command, { encoding: 'utf-8' });

return result.stdout.trim();
};
import { execAsync } from '../utils/index.js';

/**
* Compare two references and print diff as Markdown or JSON
Expand Down
Loading
Loading