@ethlete/components 1.0.0-next.63 ā 1.0.0-next.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +336 -0
- package/fesm2022/ethlete-components.mjs +7698 -4988
- package/fesm2022/ethlete-components.mjs.map +1 -1
- package/generators/generators.json +40 -0
- package/generators/migrate-bracket-default-cards/bracket-default-cards.js +67 -0
- package/generators/migrate-bracket-default-cards/migration.js +63 -0
- package/generators/migrate-bracket-default-cards/schema.json +26 -0
- package/generators/migrate-bracket-ethlete-renames/bracket-ethlete-renames.js +15 -0
- package/generators/migrate-bracket-ethlete-renames/migration.js +31 -0
- package/generators/migrate-bracket-ethlete-renames/schema.json +26 -0
- package/generators/migrate-chart-baseline-y/chart-baseline-y.js +10 -0
- package/generators/migrate-chart-baseline-y/migration.js +41 -0
- package/generators/migrate-chart-baseline-y/schema.json +26 -0
- package/generators/migrate-grid-engine-internals/grid-engine-internals.js +43 -0
- package/generators/migrate-grid-engine-internals/migration.js +11 -0
- package/generators/migrate-grid-engine-internals/schema.json +26 -0
- package/generators/migrate-overlay-fullscreen-animation/migration.js +11 -0
- package/generators/migrate-overlay-fullscreen-animation/overlay-fullscreen-animation.js +16 -0
- package/generators/migrate-overlay-fullscreen-animation/schema.json +26 -0
- package/generators/migrate-overlay-nav-tab-imports/migration.js +35 -0
- package/generators/migrate-overlay-nav-tab-imports/overlay-nav-tab-imports.js +25 -0
- package/generators/migrate-overlay-nav-tab-imports/schema.json +26 -0
- package/generators/migrate-stream-default-components/migration.js +86 -0
- package/generators/migrate-stream-default-components/schema.json +26 -0
- package/generators/migrate-stream-default-components/stream-default-components.js +111 -0
- package/generators/migrate-youtube-player-slot-directive/migration.js +11 -0
- package/generators/migrate-youtube-player-slot-directive/schema.json +26 -0
- package/generators/migrate-youtube-player-slot-directive/youtube-player-slot-directive.js +12 -0
- package/generators/removed-exports/removed-exports.js +154 -0
- package/generators/removed-exports/run-removed-exports-migration.js +48 -0
- package/migrations.json +64 -0
- package/package.json +2 -2
- package/types/ethlete-components.d.ts +3768 -3269
|
@@ -5,11 +5,26 @@
|
|
|
5
5
|
"schema": "./component/schema.json",
|
|
6
6
|
"description": "Scaffold a component domain following the three-tier architecture (folder layout, headless + default split, styles, spec, stories, docs page, barrel wiring)"
|
|
7
7
|
},
|
|
8
|
+
"migrate-bracket-default-cards": {
|
|
9
|
+
"factory": "./migrate-bracket-default-cards/migration",
|
|
10
|
+
"schema": "./migrate-bracket-default-cards/schema.json",
|
|
11
|
+
"description": "Spread BRACKET_DEFAULT_CARDS into provideBracketConfig and report brackets without one"
|
|
12
|
+
},
|
|
13
|
+
"migrate-bracket-ethlete-renames": {
|
|
14
|
+
"factory": "./migrate-bracket-ethlete-renames/migration",
|
|
15
|
+
"schema": "./migrate-bracket-ethlete-renames/schema.json",
|
|
16
|
+
"description": "Rename generateTournamentModeFormEthleteRounds to generateTournamentModeFromEthleteRounds"
|
|
17
|
+
},
|
|
8
18
|
"migrate-query-error-labels": {
|
|
9
19
|
"factory": "./migrate-query-error-labels/migration",
|
|
10
20
|
"schema": "./migrate-query-error-labels/schema.json",
|
|
11
21
|
"description": "Find query-error usage affected by the English-only label default and report where German must be re-opted-in"
|
|
12
22
|
},
|
|
23
|
+
"migrate-overlay-nav-tab-imports": {
|
|
24
|
+
"factory": "./migrate-overlay-nav-tab-imports/migration",
|
|
25
|
+
"schema": "./migrate-overlay-nav-tab-imports/schema.json",
|
|
26
|
+
"description": "Add OVERLAY_NAV_TAB_IMPORTS where a NAV_TAB_IMPORTS component renders et-overlay-nav-tab-link"
|
|
27
|
+
},
|
|
13
28
|
"migrate-rich-text-editor-floating-toolbar": {
|
|
14
29
|
"factory": "./migrate-rich-text-editor-floating-toolbar/migration",
|
|
15
30
|
"schema": "./migrate-rich-text-editor-floating-toolbar/schema.json",
|
|
@@ -25,6 +40,31 @@
|
|
|
25
40
|
"schema": "./migrate-rich-text-editor-tools/schema.json",
|
|
26
41
|
"description": "Find rich text editor usage that loses the heading, quote, code-block and link tools and report where to re-opt-in"
|
|
27
42
|
},
|
|
43
|
+
"migrate-stream-default-components": {
|
|
44
|
+
"factory": "./migrate-stream-default-components/migration",
|
|
45
|
+
"schema": "./migrate-stream-default-components/schema.json",
|
|
46
|
+
"description": "Spread STREAM_DEFAULT_COMPONENTS into provideStreamConfig and report stream slots without one"
|
|
47
|
+
},
|
|
48
|
+
"migrate-youtube-player-slot-directive": {
|
|
49
|
+
"factory": "./migrate-youtube-player-slot-directive/migration",
|
|
50
|
+
"schema": "./migrate-youtube-player-slot-directive/schema.json",
|
|
51
|
+
"description": "Remove YoutubePlayerSlotDirective and YOUTUBE_PLAYER_SLOT_TOKEN, and mark the uses it cannot remove"
|
|
52
|
+
},
|
|
53
|
+
"migrate-chart-baseline-y": {
|
|
54
|
+
"factory": "./migrate-chart-baseline-y/migration",
|
|
55
|
+
"schema": "./migrate-chart-baseline-y/schema.json",
|
|
56
|
+
"description": "Rename the removed chart-grid baselineY alias to baseline"
|
|
57
|
+
},
|
|
58
|
+
"migrate-grid-engine-internals": {
|
|
59
|
+
"factory": "./migrate-grid-engine-internals/migration",
|
|
60
|
+
"schema": "./migrate-grid-engine-internals/schema.json",
|
|
61
|
+
"description": "Remove the grid engine internals from @ethlete/components imports and mark their uses"
|
|
62
|
+
},
|
|
63
|
+
"migrate-overlay-fullscreen-animation": {
|
|
64
|
+
"factory": "./migrate-overlay-fullscreen-animation/migration",
|
|
65
|
+
"schema": "./migrate-overlay-fullscreen-animation/schema.json",
|
|
66
|
+
"description": "Remove the overlay fullscreen animation internals from @ethlete/components imports and mark their uses"
|
|
67
|
+
},
|
|
28
68
|
"icons": {
|
|
29
69
|
"factory": "./icons/generator",
|
|
30
70
|
"schema": "./icons/schema.json",
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const USAGE_MARKERS = [
|
|
2
|
+
/<et-bracket[\s/>]/,
|
|
3
|
+
/<et-bracket-rounds-list[\s/>]/,
|
|
4
|
+
/\bBRACKET_IMPORTS\b/,
|
|
5
|
+
/\bBRACKET_ROUNDS_LIST_IMPORTS\b/,
|
|
6
|
+
/\bBracketComponent\b/,
|
|
7
|
+
/\bBracketRoundsListComponent\b/,
|
|
8
|
+
];
|
|
9
|
+
const COMPONENTS_IMPORT = /import\s*\{([^}]*)\}\s*from\s*['"]@ethlete\/components['"]/g;
|
|
10
|
+
const lineOf = (content, index) => content.slice(0, index).split('\n').length;
|
|
11
|
+
const taskId = (filePath, line) => `bracket-default-cards--${filePath.replace(/[^a-zA-Z0-9]+/g, '-')}-${line}`;
|
|
12
|
+
/**
|
|
13
|
+
* Spreads `BRACKET_DEFAULT_CARDS` first into every literal `provideBracketConfig` call, so a card the
|
|
14
|
+
* config names itself still wins, and reports each call whose config is not a literal.
|
|
15
|
+
*/
|
|
16
|
+
export const scanBracketDefaultCardsInFile = (filePath, content) => {
|
|
17
|
+
const usesBracket = USAGE_MARKERS.some((marker) => marker.test(content));
|
|
18
|
+
const hasConfig = content.includes('provideBracketConfig(');
|
|
19
|
+
const tasks = [];
|
|
20
|
+
const importStatement = [...content.matchAll(COMPONENTS_IMPORT)].find((match) => /\bprovideBracketConfig\b/.test(match[1] ?? ''));
|
|
21
|
+
if (!importStatement || content.includes('BRACKET_DEFAULT_CARDS')) {
|
|
22
|
+
return { next: null, usesBracket, hasConfig, tasks };
|
|
23
|
+
}
|
|
24
|
+
let rewrote = false;
|
|
25
|
+
const next = content.replace(/provideBracketConfig\(\s*(\{\s*\}|\{\s*|\)|[^\s{)])/g, (call, opening, index) => {
|
|
26
|
+
if (opening === ')') {
|
|
27
|
+
rewrote = true;
|
|
28
|
+
return 'provideBracketConfig({ ...BRACKET_DEFAULT_CARDS })';
|
|
29
|
+
}
|
|
30
|
+
if (opening.startsWith('{')) {
|
|
31
|
+
rewrote = true;
|
|
32
|
+
return opening.endsWith('}')
|
|
33
|
+
? 'provideBracketConfig({ ...BRACKET_DEFAULT_CARDS }'
|
|
34
|
+
: 'provideBracketConfig({ ...BRACKET_DEFAULT_CARDS, ';
|
|
35
|
+
}
|
|
36
|
+
const line = lineOf(content, index);
|
|
37
|
+
const argument = content.slice(index + call.length - 1).match(/^[^)\n]*/)?.[0] ?? '';
|
|
38
|
+
tasks.push({
|
|
39
|
+
id: taskId(filePath, line),
|
|
40
|
+
file: filePath,
|
|
41
|
+
line,
|
|
42
|
+
message: `\`provideBracketConfig(${argument})\` is not a literal the migration can edit. Spread \`BRACKET_DEFAULT_CARDS\` into it unless it names every card itself.`,
|
|
43
|
+
});
|
|
44
|
+
return call;
|
|
45
|
+
});
|
|
46
|
+
if (!rewrote)
|
|
47
|
+
return { next: null, usesBracket, hasConfig, tasks };
|
|
48
|
+
const rewrittenImport = importStatement[0].replace('{', '{ BRACKET_DEFAULT_CARDS,');
|
|
49
|
+
const importIndex = next.indexOf(importStatement[0]);
|
|
50
|
+
return {
|
|
51
|
+
next: next.slice(0, importIndex) + rewrittenImport + next.slice(importIndex + importStatement[0].length),
|
|
52
|
+
usesBracket,
|
|
53
|
+
hasConfig,
|
|
54
|
+
tasks,
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export const bracketUsageTask = (filePath, content) => {
|
|
58
|
+
const index = Math.min(...USAGE_MARKERS.map((marker) => content.search(marker)).filter((position) => position >= 0));
|
|
59
|
+
const line = lineOf(content, index);
|
|
60
|
+
return {
|
|
61
|
+
id: taskId(filePath, line),
|
|
62
|
+
file: filePath,
|
|
63
|
+
line,
|
|
64
|
+
message: 'Renders a bracket, but the app has no `provideBracketConfig`, so no card is registered.',
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=bracket-default-cards.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { formatFiles } from '@nx/devkit';
|
|
2
|
+
import { createMigrationScope } from '../migrate-query-error-labels/migration-scope.js';
|
|
3
|
+
import { bracketUsageTask, scanBracketDefaultCardsInFile } from './bracket-default-cards.js';
|
|
4
|
+
export const BRACKET_DEFAULT_CARDS_REPORT_PATH = 'bracket-default-cards-migration-tasks.md';
|
|
5
|
+
const renderReport = (tasks) => [
|
|
6
|
+
'# Bracket default cards migration tasks',
|
|
7
|
+
'',
|
|
8
|
+
'The shipped bracket cards are opt-in. A bracket whose match or round header card nothing names throws',
|
|
9
|
+
'`ET3414`. The migration spread `BRACKET_DEFAULT_CARDS` into every literal `provideBracketConfig` call; the',
|
|
10
|
+
'sites below need it by hand. Add once, app-wide or on the component that renders the bracket:',
|
|
11
|
+
'',
|
|
12
|
+
'```ts',
|
|
13
|
+
"import { BRACKET_DEFAULT_CARDS, provideBracketConfig } from '@ethlete/components';",
|
|
14
|
+
'',
|
|
15
|
+
'provideBracketConfig({ ...BRACKET_DEFAULT_CARDS });',
|
|
16
|
+
'```',
|
|
17
|
+
'',
|
|
18
|
+
'A bracket that binds cards of its own needs nothing. Delete this file when done.',
|
|
19
|
+
'',
|
|
20
|
+
...tasks.map((task) => [`## \`${task.id}\``, '', `- ${task.file}:${task.line}`, `- ${task.message}`, ''].join('\n')),
|
|
21
|
+
].join('\n');
|
|
22
|
+
export default async function migrateBracketDefaultCards(tree, schema) {
|
|
23
|
+
console.log('\nš Spreading BRACKET_DEFAULT_CARDS into provideBracketConfig...');
|
|
24
|
+
const scope = createMigrationScope(tree, schema);
|
|
25
|
+
console.log(` Scope: ${scope.describe()}`);
|
|
26
|
+
const changed = [];
|
|
27
|
+
const tasks = [];
|
|
28
|
+
const usages = [];
|
|
29
|
+
let hasConfig = false;
|
|
30
|
+
scope.visit(tree, (filePath) => {
|
|
31
|
+
if (!/\.(ts|html)$/.test(filePath) || filePath.endsWith('.d.ts'))
|
|
32
|
+
return;
|
|
33
|
+
const content = tree.read(filePath, 'utf-8');
|
|
34
|
+
if (!content)
|
|
35
|
+
return;
|
|
36
|
+
const result = scanBracketDefaultCardsInFile(filePath, content);
|
|
37
|
+
hasConfig ||= result.hasConfig;
|
|
38
|
+
tasks.push(...result.tasks);
|
|
39
|
+
if (result.usesBracket)
|
|
40
|
+
usages.push(bracketUsageTask(filePath, content));
|
|
41
|
+
if (result.next !== null) {
|
|
42
|
+
tree.write(filePath, result.next);
|
|
43
|
+
changed.push(filePath);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const report = hasConfig ? tasks : [...tasks, ...usages];
|
|
47
|
+
if (report.length > 0) {
|
|
48
|
+
tree.write(BRACKET_DEFAULT_CARDS_REPORT_PATH, renderReport(report));
|
|
49
|
+
}
|
|
50
|
+
if (!schema.skipFormat) {
|
|
51
|
+
await formatFiles(tree);
|
|
52
|
+
}
|
|
53
|
+
if (changed.length > 0) {
|
|
54
|
+
console.log(`\nā
Spread BRACKET_DEFAULT_CARDS in ${changed.length} file(s).`);
|
|
55
|
+
}
|
|
56
|
+
if (report.length > 0) {
|
|
57
|
+
console.log(`\nā ļø ${report.length} site(s) need the default cards by hand ā see ${BRACKET_DEFAULT_CARDS_REPORT_PATH}.`);
|
|
58
|
+
}
|
|
59
|
+
else if (changed.length === 0) {
|
|
60
|
+
console.log('\nā
Nothing to do.');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "migrate-bracket-default-cards",
|
|
4
|
+
"title": "Spread BRACKET_DEFAULT_CARDS into provideBracketConfig and report brackets without one",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"projects": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"items": { "type": "string" },
|
|
10
|
+
"description": "Nx projects to scan. Defaults to every project in the workspace.",
|
|
11
|
+
"alias": "project"
|
|
12
|
+
},
|
|
13
|
+
"include": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": { "type": "string" },
|
|
16
|
+
"description": "Path prefixes to scan, relative to the workspace root (e.g. 'apps/shop'). Unioned with `projects`.",
|
|
17
|
+
"alias": "includePath"
|
|
18
|
+
},
|
|
19
|
+
"skipFormat": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Skip formatting files after migration",
|
|
22
|
+
"default": false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": []
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const BRACKET_ETHLETE_RENAMES = {
|
|
2
|
+
generateTournamentModeFormEthleteRounds: 'generateTournamentModeFromEthleteRounds',
|
|
3
|
+
};
|
|
4
|
+
const IMPORTS_COMPONENTS = /from\s+['"]@ethlete\/components['"]/;
|
|
5
|
+
/** Returns the file with every renamed bracket export replaced, or `null` when nothing changed. */
|
|
6
|
+
export const renameBracketEthleteExportsInFile = (content) => {
|
|
7
|
+
if (!IMPORTS_COMPONENTS.test(content))
|
|
8
|
+
return null;
|
|
9
|
+
let next = content;
|
|
10
|
+
for (const [oldName, newName] of Object.entries(BRACKET_ETHLETE_RENAMES)) {
|
|
11
|
+
next = next.replace(new RegExp(`\\b${oldName}\\b`, 'g'), newName);
|
|
12
|
+
}
|
|
13
|
+
return next === content ? null : next;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=bracket-ethlete-renames.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { formatFiles } from '@nx/devkit';
|
|
2
|
+
import { createMigrationScope } from '../migrate-query-error-labels/migration-scope.js';
|
|
3
|
+
import { renameBracketEthleteExportsInFile } from './bracket-ethlete-renames.js';
|
|
4
|
+
export default async function migrateBracketEthleteRenames(tree, schema) {
|
|
5
|
+
console.log('\nš Renaming generateTournamentModeFormEthleteRounds to generateTournamentModeFromEthleteRounds...');
|
|
6
|
+
const scope = createMigrationScope(tree, schema);
|
|
7
|
+
console.log(` Scope: ${scope.describe()}`);
|
|
8
|
+
const changed = [];
|
|
9
|
+
scope.visit(tree, (filePath) => {
|
|
10
|
+
if (!filePath.endsWith('.ts') || filePath.endsWith('.d.ts'))
|
|
11
|
+
return;
|
|
12
|
+
const content = tree.read(filePath, 'utf-8');
|
|
13
|
+
if (!content)
|
|
14
|
+
return;
|
|
15
|
+
const next = renameBracketEthleteExportsInFile(content);
|
|
16
|
+
if (next === null)
|
|
17
|
+
return;
|
|
18
|
+
tree.write(filePath, next);
|
|
19
|
+
changed.push(filePath);
|
|
20
|
+
});
|
|
21
|
+
if (!schema.skipFormat) {
|
|
22
|
+
await formatFiles(tree);
|
|
23
|
+
}
|
|
24
|
+
if (changed.length > 0) {
|
|
25
|
+
console.log(`\nā
Renamed the export in ${changed.length} file(s).`);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
console.log('\nā
Nothing to do.');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "migrate-bracket-ethlete-renames",
|
|
4
|
+
"title": "Rename generateTournamentModeFormEthleteRounds to generateTournamentModeFromEthleteRounds",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"projects": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"items": { "type": "string" },
|
|
10
|
+
"description": "Nx projects to scan. Defaults to every project in the workspace.",
|
|
11
|
+
"alias": "project"
|
|
12
|
+
},
|
|
13
|
+
"include": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": { "type": "string" },
|
|
16
|
+
"description": "Path prefixes to scan, relative to the workspace root (e.g. 'apps/shop'). Unioned with `projects`.",
|
|
17
|
+
"alias": "includePath"
|
|
18
|
+
},
|
|
19
|
+
"skipFormat": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Skip formatting files after migration",
|
|
22
|
+
"default": false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": []
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const COMPONENTS_IMPORT = /from\s*['"]@ethlete\/components(?:\/[^'"]*)?['"]/;
|
|
2
|
+
const BASELINE_Y = /(\.\s*)baselineY\b/g;
|
|
3
|
+
export const TEMPLATE_URL = /templateUrl\s*:\s*['"]([^'"]+)['"]/g;
|
|
4
|
+
export const importsEthleteComponents = (content) => COMPONENTS_IMPORT.test(content);
|
|
5
|
+
/** Returns the source or template with every `.baselineY` renamed to `.baseline`, or `null` when there is none. */
|
|
6
|
+
export const renameBaselineY = (content) => {
|
|
7
|
+
const next = content.replace(BASELINE_Y, '$1baseline');
|
|
8
|
+
return next === content ? null : next;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=chart-baseline-y.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { formatFiles, joinPathFragments } from '@nx/devkit';
|
|
2
|
+
import { dirname } from 'node:path/posix';
|
|
3
|
+
import { createMigrationScope } from '../migrate-query-error-labels/migration-scope.js';
|
|
4
|
+
import { importsEthleteComponents, renameBaselineY, TEMPLATE_URL } from './chart-baseline-y.js';
|
|
5
|
+
export default async function migrateChartBaselineY(tree, schema) {
|
|
6
|
+
console.log('\nš Renaming the removed chart-grid baselineY alias to baseline...');
|
|
7
|
+
const scope = createMigrationScope(tree, schema);
|
|
8
|
+
console.log(` Scope: ${scope.describe()}`);
|
|
9
|
+
const changed = [];
|
|
10
|
+
const write = (filePath, content) => {
|
|
11
|
+
const next = renameBaselineY(content);
|
|
12
|
+
if (next === null)
|
|
13
|
+
return;
|
|
14
|
+
tree.write(filePath, next);
|
|
15
|
+
changed.push(filePath);
|
|
16
|
+
};
|
|
17
|
+
scope.visit(tree, (filePath) => {
|
|
18
|
+
if (!filePath.endsWith('.ts') || filePath.endsWith('.d.ts'))
|
|
19
|
+
return;
|
|
20
|
+
const content = tree.read(filePath, 'utf-8');
|
|
21
|
+
if (!content || !importsEthleteComponents(content))
|
|
22
|
+
return;
|
|
23
|
+
for (const match of content.matchAll(TEMPLATE_URL)) {
|
|
24
|
+
const templatePath = joinPathFragments(dirname(filePath), match[1] ?? '');
|
|
25
|
+
const template = tree.read(templatePath, 'utf-8');
|
|
26
|
+
if (template !== null)
|
|
27
|
+
write(templatePath, template);
|
|
28
|
+
}
|
|
29
|
+
write(filePath, content);
|
|
30
|
+
});
|
|
31
|
+
if (!schema.skipFormat) {
|
|
32
|
+
await formatFiles(tree);
|
|
33
|
+
}
|
|
34
|
+
if (changed.length > 0) {
|
|
35
|
+
console.log(`\nā
Renamed baselineY in ${changed.length} file(s).`);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.log('\nā
Nothing to do.');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "migrate-chart-baseline-y",
|
|
4
|
+
"title": "Rename the removed chart-grid baselineY alias to baseline",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"projects": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"items": { "type": "string" },
|
|
10
|
+
"description": "Nx projects to scan. Defaults to every project in the workspace.",
|
|
11
|
+
"alias": "project"
|
|
12
|
+
},
|
|
13
|
+
"include": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": { "type": "string" },
|
|
16
|
+
"description": "Path prefixes to scan, relative to the workspace root (e.g. 'apps/shop'). Unioned with `projects`.",
|
|
17
|
+
"alias": "includePath"
|
|
18
|
+
},
|
|
19
|
+
"skipFormat": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Skip formatting files after migration",
|
|
22
|
+
"default": false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": []
|
|
26
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const NAMES = [
|
|
2
|
+
'PixelRect',
|
|
3
|
+
'GridGeometry',
|
|
4
|
+
'ResizeSpanBounds',
|
|
5
|
+
'computeGeometry',
|
|
6
|
+
'spanWidth',
|
|
7
|
+
'spanHeight',
|
|
8
|
+
'positionToPixelRect',
|
|
9
|
+
'rowsToPixelHeight',
|
|
10
|
+
'pixelRectsEqual',
|
|
11
|
+
'positionsEqual',
|
|
12
|
+
'SNAP_HYSTERESIS',
|
|
13
|
+
'hysteresisRound',
|
|
14
|
+
'resizeSpanBounds',
|
|
15
|
+
'clampResizeRect',
|
|
16
|
+
'snapResizeSpan',
|
|
17
|
+
'projectDragCell',
|
|
18
|
+
'FindCollisionOptions',
|
|
19
|
+
'AutoPlaceOptions',
|
|
20
|
+
'ClampPositionOptions',
|
|
21
|
+
'ResolveCollisionsOptions',
|
|
22
|
+
'RowFloors',
|
|
23
|
+
'CompactLayoutOptions',
|
|
24
|
+
'itemsCollide',
|
|
25
|
+
'findCollision',
|
|
26
|
+
'compactLayout',
|
|
27
|
+
'autoPlace',
|
|
28
|
+
'clampPosition',
|
|
29
|
+
'resolveCollisions',
|
|
30
|
+
'computeGridHeight',
|
|
31
|
+
'MapLayoutOptions',
|
|
32
|
+
'resolveBreakpoint',
|
|
33
|
+
'mapLayoutToBreakpoint',
|
|
34
|
+
'AutoScrollPointer',
|
|
35
|
+
'AutoScroller',
|
|
36
|
+
'findScrollableAncestor',
|
|
37
|
+
'createAutoScroller',
|
|
38
|
+
];
|
|
39
|
+
export const GRID_ENGINE_INTERNALS_REMOVALS = NAMES.map((name) => ({
|
|
40
|
+
name,
|
|
41
|
+
todo: `${name} is no longer exported; the grid layout engine is internal. Use the GridComponent inputs and outputs, createGridAdapter, or serializeGridLayout / deserializeGridLayout instead.`,
|
|
42
|
+
}));
|
|
43
|
+
//# sourceMappingURL=grid-engine-internals.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { runRemovedExportsMigration, } from '../removed-exports/run-removed-exports-migration.js';
|
|
2
|
+
import { GRID_ENGINE_INTERNALS_REMOVALS } from './grid-engine-internals.js';
|
|
3
|
+
export const GRID_ENGINE_INTERNALS_REPORT_PATH = 'grid-engine-internals-migration-tasks.md';
|
|
4
|
+
export default async function migrateGridEngineInternals(tree, schema) {
|
|
5
|
+
await runRemovedExportsMigration(tree, schema, {
|
|
6
|
+
title: 'Removing the grid engine internals from @ethlete/components',
|
|
7
|
+
removed: GRID_ENGINE_INTERNALS_REMOVALS,
|
|
8
|
+
reportPath: GRID_ENGINE_INTERNALS_REPORT_PATH,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "migrate-grid-engine-internals",
|
|
4
|
+
"title": "Remove the grid engine internals from @ethlete/components and mark the uses it cannot remove",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"projects": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"items": { "type": "string" },
|
|
10
|
+
"description": "Nx projects to scan. Defaults to every project in the workspace.",
|
|
11
|
+
"alias": "project"
|
|
12
|
+
},
|
|
13
|
+
"include": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": { "type": "string" },
|
|
16
|
+
"description": "Path prefixes to scan, relative to the workspace root (e.g. 'apps/shop'). Unioned with `projects`.",
|
|
17
|
+
"alias": "includePath"
|
|
18
|
+
},
|
|
19
|
+
"skipFormat": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Skip formatting files after migration",
|
|
22
|
+
"default": false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": []
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { runRemovedExportsMigration, } from '../removed-exports/run-removed-exports-migration.js';
|
|
2
|
+
import { OVERLAY_FULLSCREEN_ANIMATION_REMOVALS } from './overlay-fullscreen-animation.js';
|
|
3
|
+
export const OVERLAY_FULLSCREEN_ANIMATION_REPORT_PATH = 'overlay-fullscreen-animation-migration-tasks.md';
|
|
4
|
+
export default async function migrateOverlayFullscreenAnimation(tree, schema) {
|
|
5
|
+
await runRemovedExportsMigration(tree, schema, {
|
|
6
|
+
title: 'Removing the overlay fullscreen animation internals from @ethlete/components',
|
|
7
|
+
removed: OVERLAY_FULLSCREEN_ANIMATION_REMOVALS,
|
|
8
|
+
reportPath: OVERLAY_FULLSCREEN_ANIMATION_REPORT_PATH,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const NAMES = [
|
|
2
|
+
'ViewportTransformData',
|
|
3
|
+
'FullscreenAnimationCancellable',
|
|
4
|
+
'FullscreenAnimationState',
|
|
5
|
+
'FullscreenAnimationDeps',
|
|
6
|
+
'cleanupFullscreenAnimationStyles',
|
|
7
|
+
'startFullscreenEnterAnimation',
|
|
8
|
+
'startFullscreenLeaveAnimation',
|
|
9
|
+
'cleanupFullscreenAnimation',
|
|
10
|
+
'abortFullscreenAnimation',
|
|
11
|
+
];
|
|
12
|
+
export const OVERLAY_FULLSCREEN_ANIMATION_REMOVALS = NAMES.map((name) => ({
|
|
13
|
+
name,
|
|
14
|
+
todo: `${name} is no longer exported; the full-screen morph animation is internal to fullScreenDialogOverlayStrategy. Configure the strategy instead of driving the animation yourself.`,
|
|
15
|
+
}));
|
|
16
|
+
//# sourceMappingURL=overlay-fullscreen-animation.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "migrate-overlay-fullscreen-animation",
|
|
4
|
+
"title": "Remove the overlay fullscreen animation internals from @ethlete/components and mark the uses it cannot remove",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"projects": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"items": { "type": "string" },
|
|
10
|
+
"description": "Nx projects to scan. Defaults to every project in the workspace.",
|
|
11
|
+
"alias": "project"
|
|
12
|
+
},
|
|
13
|
+
"include": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": { "type": "string" },
|
|
16
|
+
"description": "Path prefixes to scan, relative to the workspace root (e.g. 'apps/shop'). Unioned with `projects`.",
|
|
17
|
+
"alias": "includePath"
|
|
18
|
+
},
|
|
19
|
+
"skipFormat": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Skip formatting files after migration",
|
|
22
|
+
"default": false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": []
|
|
26
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { formatFiles, joinPathFragments } from '@nx/devkit';
|
|
2
|
+
import { dirname } from 'node:path/posix';
|
|
3
|
+
import { createMigrationScope } from '../migrate-query-error-labels/migration-scope.js';
|
|
4
|
+
import { addOverlayNavTabImportsToFile, TEMPLATE_URL } from './overlay-nav-tab-imports.js';
|
|
5
|
+
export default async function migrateOverlayNavTabImports(tree, schema) {
|
|
6
|
+
console.log('\nš Adding OVERLAY_NAV_TAB_IMPORTS where a NAV_TAB_IMPORTS component renders et-overlay-nav-tab-link...');
|
|
7
|
+
const scope = createMigrationScope(tree, schema);
|
|
8
|
+
console.log(` Scope: ${scope.describe()}`);
|
|
9
|
+
const changed = [];
|
|
10
|
+
scope.visit(tree, (filePath) => {
|
|
11
|
+
if (!filePath.endsWith('.ts') || filePath.endsWith('.d.ts'))
|
|
12
|
+
return;
|
|
13
|
+
const content = tree.read(filePath, 'utf-8');
|
|
14
|
+
if (!content?.includes('NAV_TAB_IMPORTS'))
|
|
15
|
+
return;
|
|
16
|
+
const templates = [...content.matchAll(TEMPLATE_URL)]
|
|
17
|
+
.map((match) => tree.read(joinPathFragments(dirname(filePath), match[1] ?? ''), 'utf-8'))
|
|
18
|
+
.filter((template) => template !== null);
|
|
19
|
+
const next = addOverlayNavTabImportsToFile(content, templates);
|
|
20
|
+
if (next === null)
|
|
21
|
+
return;
|
|
22
|
+
tree.write(filePath, next);
|
|
23
|
+
changed.push(filePath);
|
|
24
|
+
});
|
|
25
|
+
if (!schema.skipFormat) {
|
|
26
|
+
await formatFiles(tree);
|
|
27
|
+
}
|
|
28
|
+
if (changed.length > 0) {
|
|
29
|
+
console.log(`\nā
Added OVERLAY_NAV_TAB_IMPORTS in ${changed.length} file(s).`);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
console.log('\nā
Nothing to do.');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const COMPONENTS_IMPORT = /import\s*\{([^}]*)\}\s*from\s*['"]@ethlete\/components['"]/g;
|
|
2
|
+
const NAV_TAB_IMPORTS = /\bNAV_TAB_IMPORTS\b/;
|
|
3
|
+
const OVERLAY_LINK = 'et-overlay-nav-tab-link';
|
|
4
|
+
export const TEMPLATE_URL = /templateUrl\s*:\s*['"]([^'"]+)['"]/g;
|
|
5
|
+
/**
|
|
6
|
+
* Returns the file with `OVERLAY_NAV_TAB_IMPORTS` added next to every `NAV_TAB_IMPORTS`, or `null` when the
|
|
7
|
+
* file does not import `NAV_TAB_IMPORTS` from `@ethlete/components` or none of its templates renders an
|
|
8
|
+
* `et-overlay-nav-tab-link`.
|
|
9
|
+
*/
|
|
10
|
+
export const addOverlayNavTabImportsToFile = (content, externalTemplates) => {
|
|
11
|
+
if (content.includes('OVERLAY_NAV_TAB_IMPORTS'))
|
|
12
|
+
return null;
|
|
13
|
+
const importStatement = [...content.matchAll(COMPONENTS_IMPORT)].find((match) => NAV_TAB_IMPORTS.test(match[1] ?? '') && !/\bNAV_TAB_IMPORTS\s+as\b/.test(match[1] ?? ''));
|
|
14
|
+
if (!importStatement || importStatement.index === undefined)
|
|
15
|
+
return null;
|
|
16
|
+
if (!content.includes(OVERLAY_LINK) && !externalTemplates.some((template) => template.includes(OVERLAY_LINK))) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const start = importStatement.index;
|
|
20
|
+
const end = start + importStatement[0].length;
|
|
21
|
+
const rewrittenImport = importStatement[0].replace(NAV_TAB_IMPORTS, 'NAV_TAB_IMPORTS, OVERLAY_NAV_TAB_IMPORTS');
|
|
22
|
+
const addNextToUsage = (code) => code.replace(/(\.\.\.)?\bNAV_TAB_IMPORTS\b/g, (_, spread) => `${spread ?? ''}NAV_TAB_IMPORTS, ${spread ?? ''}OVERLAY_NAV_TAB_IMPORTS`);
|
|
23
|
+
return addNextToUsage(content.slice(0, start)) + rewrittenImport + addNextToUsage(content.slice(end));
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=overlay-nav-tab-imports.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "migrate-overlay-nav-tab-imports",
|
|
4
|
+
"title": "Add OVERLAY_NAV_TAB_IMPORTS where a NAV_TAB_IMPORTS component renders et-overlay-nav-tab-link",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"projects": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"items": { "type": "string" },
|
|
10
|
+
"description": "Nx projects to scan. Defaults to every project in the workspace.",
|
|
11
|
+
"alias": "project"
|
|
12
|
+
},
|
|
13
|
+
"include": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": { "type": "string" },
|
|
16
|
+
"description": "Path prefixes to scan, relative to the workspace root (e.g. 'apps/shop'). Unioned with `projects`.",
|
|
17
|
+
"alias": "includePath"
|
|
18
|
+
},
|
|
19
|
+
"skipFormat": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Skip formatting files after migration",
|
|
22
|
+
"default": false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": []
|
|
26
|
+
}
|