Split remaining large Sass files by responsibility
All checks were successful
Deploy Sokko G / deploy (push) Successful in 16s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 16s
This commit is contained in:
parent
a0d7e80a1a
commit
fcabbe8029
37 changed files with 3248 additions and 3103 deletions
|
|
@ -7,6 +7,10 @@ async function readJoinedStyles(paths) {
|
|||
return (await Promise.all(paths.map((path) => readFile(path, "utf8")))).join("\n");
|
||||
}
|
||||
|
||||
function countLines(source) {
|
||||
return source.trimEnd().split("\n").length;
|
||||
}
|
||||
|
||||
test("style entrypoint and theme layers are wired", async () => {
|
||||
const styles = await readFile("website/src/styles/main.scss", "utf8");
|
||||
const styleNebula = await readFile("website/src/styles/_nebula.scss", "utf8");
|
||||
|
|
@ -20,8 +24,19 @@ test("style entrypoint and theme layers are wired", async () => {
|
|||
"website/src/styles/home/_shared.scss",
|
||||
"website/src/styles/home/_onboarding.scss",
|
||||
"website/src/styles/home/_library.scss",
|
||||
"website/src/styles/home/library/_page.scss",
|
||||
"website/src/styles/home/library/_summary.scss",
|
||||
"website/src/styles/home/library/_toc.scss",
|
||||
"website/src/styles/home/library/_tool-cards.scss",
|
||||
"website/src/styles/home/library/_examples.scss",
|
||||
"website/src/styles/home/library/_previews.scss",
|
||||
"website/src/styles/home/_story.scss",
|
||||
"website/src/styles/home/_about.scss",
|
||||
"website/src/styles/home/about/_page.scss",
|
||||
"website/src/styles/home/about/_story.scss",
|
||||
"website/src/styles/home/about/_contribute.scss",
|
||||
"website/src/styles/home/about/_tools.scss",
|
||||
"website/src/styles/home/about/_reminders.scss",
|
||||
"website/src/styles/home/_stats.scss"
|
||||
]);
|
||||
const styleToolboxesEntry = await readFile("website/src/styles/_toolboxes.scss", "utf8");
|
||||
|
|
@ -52,6 +67,29 @@ test("style entrypoint and theme layers are wired", async () => {
|
|||
"website/src/styles/toolboxes/combos/_hold.scss"
|
||||
]);
|
||||
const styleToolboxImages = await readFile("website/src/styles/toolboxes/_images.scss", "utf8");
|
||||
const styleToolboxGoalTree = await readJoinedStyles([
|
||||
"website/src/styles/toolboxes/_goal-tree.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_editor.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_view.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_nodes.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_node-card.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_node-content.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_node-actions.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_node-drag.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_node-responsive.scss"
|
||||
]);
|
||||
const styleToolboxCalendar = await readJoinedStyles([
|
||||
"website/src/styles/toolboxes/_calendar.scss",
|
||||
"website/src/styles/toolboxes/calendar/_base.scss",
|
||||
"website/src/styles/toolboxes/calendar/_form.scss",
|
||||
"website/src/styles/toolboxes/calendar/_form-layout.scss",
|
||||
"website/src/styles/toolboxes/calendar/_date-picker.scss",
|
||||
"website/src/styles/toolboxes/calendar/_event-controls.scss",
|
||||
"website/src/styles/toolboxes/calendar/_form-actions.scss",
|
||||
"website/src/styles/toolboxes/calendar/_week.scss",
|
||||
"website/src/styles/toolboxes/calendar/_month.scss",
|
||||
"website/src/styles/toolboxes/calendar/_responsive.scss"
|
||||
]);
|
||||
const styleToolboxSharedControls = await readJoinedStyles([
|
||||
"website/src/styles/toolboxes/_shared-controls.scss",
|
||||
"website/src/styles/toolboxes/shared-controls/_selects.scss",
|
||||
|
|
@ -60,8 +98,22 @@ test("style entrypoint and theme layers are wired", async () => {
|
|||
"website/src/styles/toolboxes/shared-controls/_mix-tags.scss",
|
||||
"website/src/styles/toolboxes/shared-controls/_entries.scss"
|
||||
]);
|
||||
const styleOverlays = await readFile("website/src/styles/_overlays.scss", "utf8");
|
||||
const styleIcons = await readFile("website/src/styles/_icons.scss", "utf8");
|
||||
const styleOverlays = await readJoinedStyles([
|
||||
"website/src/styles/_overlays.scss",
|
||||
"website/src/styles/overlays/_image-viewer.scss",
|
||||
"website/src/styles/overlays/_drawers.scss",
|
||||
"website/src/styles/overlays/_modals.scss",
|
||||
"website/src/styles/overlays/_notifications.scss",
|
||||
"website/src/styles/overlays/_tool-add.scss"
|
||||
]);
|
||||
const styleIcons = await readJoinedStyles([
|
||||
"website/src/styles/_icons.scss",
|
||||
"website/src/styles/icons/_base.scss",
|
||||
"website/src/styles/icons/_navigation.scss",
|
||||
"website/src/styles/icons/_toolbox.scss",
|
||||
"website/src/styles/icons/_actions.scss",
|
||||
"website/src/styles/icons/_equipment.scss"
|
||||
]);
|
||||
const styleGames = await readJoinedStyles([
|
||||
"website/src/styles/_games.scss",
|
||||
"website/src/styles/games/_home-cards.scss",
|
||||
|
|
@ -114,6 +166,12 @@ test("style entrypoint and theme layers are wired", async () => {
|
|||
assert.match(styleToolboxTable, /\.table-module/);
|
||||
assert.match(styleToolboxTable, /\.table-cell-input\.is-selected/);
|
||||
assert.match(styleToolboxTable, /\.table-cell-input\.is-move-target/);
|
||||
assert.match(styleToolboxGoalTree, /\.goal-tree-node-card/);
|
||||
assert.match(styleToolboxGoalTree, /\.goal-tree-node-content-row/);
|
||||
assert.match(styleToolboxGoalTree, /\.goal-tree-node.is-drop-target/);
|
||||
assert.match(styleToolboxCalendar, /\.calendar-event-form/);
|
||||
assert.match(styleToolboxCalendar, /\.calendar-month-date-picker/);
|
||||
assert.match(styleToolboxCalendar, /\.calendar-alert-mode-switch/);
|
||||
assert.match(styleToolboxSharedControls, /\.notepad-toolbar-button\.danger/);
|
||||
assert.match(styleToolboxLayout, /\.toolbox-icon-picker/);
|
||||
assert.match(styleToolboxLayout, /\.toolbox-game-icon/);
|
||||
|
|
@ -165,3 +223,58 @@ test("style entrypoint and theme layers are wired", async () => {
|
|||
assert.match(styleOverlays, /overscroll-behavior: contain/);
|
||||
assert.match(styleResponsive, /@media \(max-width: 760px\)/);
|
||||
});
|
||||
|
||||
test("large sass files stay split by stable responsibility", async () => {
|
||||
const orchestrators = [
|
||||
"website/src/styles/home/_library.scss",
|
||||
"website/src/styles/home/_about.scss",
|
||||
"website/src/styles/_overlays.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_nodes.scss",
|
||||
"website/src/styles/_icons.scss",
|
||||
"website/src/styles/toolboxes/calendar/_form.scss"
|
||||
];
|
||||
const partials = [
|
||||
"website/src/styles/home/library/_page.scss",
|
||||
"website/src/styles/home/library/_summary.scss",
|
||||
"website/src/styles/home/library/_toc.scss",
|
||||
"website/src/styles/home/library/_tool-cards.scss",
|
||||
"website/src/styles/home/library/_examples.scss",
|
||||
"website/src/styles/home/library/_previews.scss",
|
||||
"website/src/styles/home/about/_page.scss",
|
||||
"website/src/styles/home/about/_story.scss",
|
||||
"website/src/styles/home/about/_contribute.scss",
|
||||
"website/src/styles/home/about/_tools.scss",
|
||||
"website/src/styles/home/about/_reminders.scss",
|
||||
"website/src/styles/overlays/_image-viewer.scss",
|
||||
"website/src/styles/overlays/_drawers.scss",
|
||||
"website/src/styles/overlays/_modals.scss",
|
||||
"website/src/styles/overlays/_notifications.scss",
|
||||
"website/src/styles/overlays/_tool-add.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_node-card.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_node-content.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_node-actions.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_node-drag.scss",
|
||||
"website/src/styles/toolboxes/goal-tree/_node-responsive.scss",
|
||||
"website/src/styles/icons/_base.scss",
|
||||
"website/src/styles/icons/_navigation.scss",
|
||||
"website/src/styles/icons/_toolbox.scss",
|
||||
"website/src/styles/icons/_actions.scss",
|
||||
"website/src/styles/icons/_equipment.scss",
|
||||
"website/src/styles/toolboxes/calendar/_form-layout.scss",
|
||||
"website/src/styles/toolboxes/calendar/_date-picker.scss",
|
||||
"website/src/styles/toolboxes/calendar/_event-controls.scss",
|
||||
"website/src/styles/toolboxes/calendar/_form-actions.scss"
|
||||
];
|
||||
|
||||
for (const path of orchestrators) {
|
||||
const source = await readFile(path, "utf8");
|
||||
assert.ok(source.startsWith("// Rôle :"), `${path} must keep a role header`);
|
||||
assert.ok(countLines(source) <= 120, `${path} should remain an orchestrator`);
|
||||
}
|
||||
|
||||
for (const path of partials) {
|
||||
const source = await readFile(path, "utf8");
|
||||
assert.ok(source.startsWith("// Rôle :"), `${path} must keep a role header`);
|
||||
assert.ok(countLines(source) <= 300, `${path} should stay scoped to one responsibility`);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue