-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance, debug, and clean up scripts for CSS migration (BL-12857)
- Loading branch information
1 parent
d20da5c
commit 6908abb
Showing
5 changed files
with
250 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,35 @@ | ||
In Bloom 5.7, we introduce a modernized, parameterized page layout CSS system, known as "Appearance". This new system conflicts with the arbitrary custom css that was used in prior Bloom versions, mostly in the area of margins. | ||
|
||
As of this writing, we are only looking at `customBookStyles.css`, but `customCollectionsStyles.css` have the same problem. | ||
As of this writing, we are looking at both `customBookStyles.css` and `customCollectionsStyles.css`, but not handling having both files with content, and not really dealing with `customCollectionStyles.css` being a collection wide settings file. | ||
|
||
When Bloom encounters a pre-5.7 book with a `customBookStyles.css` that would conflict with the new system, it goes into a kind of "safe mode" that keeps things working by using a legacy `basePage.css`. Better, though, is to migrate the old css to the new system. Conceivably, a reliable program could be written to do this automatically. However at the moment what we do is to write the migrations using the utilities here, and then have a dev evaluate individual migrations and then copy them over to the shipping Bloom. So when Bloom encounters one of these books, we may already have a tested migration for it. | ||
|
||
# How to use this system | ||
|
||
⚠️ Be careful what you commit to an open source repo. We do not want to expose emails or other private data. | ||
|
||
1. As of this writing, bun only works on linux. If you are on windows, just install Windows Subsystem for Linux (not as big of a deal as it sounds), then run in a WSL terminal in VSCODE. | ||
1. As of this writing, bun works only on linux. If you are on windows, just install Windows Subsystem for Linux (not as big of a deal as it sounds), then run in a WSL terminal in VSCODE. | ||
|
||
1. Get [bun](https://bun.sh/) installed | ||
2. Get [bun](https://bun.sh/) installed | ||
|
||
1. Install dependencies: `bun install` | ||
|
||
1. Download all the `customBookStyles.css` from blorg | ||
3. Choose (or create) a folder for working with CSS files and download all the `customBookStyles.css` and `customCollectionStyles.css` files from bloomlibrary.org. This will take some time. | ||
|
||
`./some-path/BloomBulkDownloader.exe --include "*/*/custom*Styles.css" --syncfolder ./output/downloads --bucket production customBookStyles-files` | ||
|
||
4. Download all the `meta.json` files from bloomlibrary.org. Again, this will take some time. | ||
|
||
`./some-path/BloomBulkDownloader.exe --include "*/*/meta.json" --syncfolder ./output/downloads --bucket production customBookStyles-files` | ||
|
||
Each of the following take an optional argument that will limit the number of records processed. | ||
|
||
5. Process those, grouping them into bins of duplicate stylesheets | ||
5. Process those, grouping them into bins of duplicate stylesheets | ||
|
||
`bun run group-stylesheets.ts 13` | ||
`bun run /path-to/group-stylesheets.ts 13` | ||
|
||
1. Process those groups, discarding ones that don't need migration | ||
6. Process those groups, discarding ones that don't need migration | ||
|
||
`bun run filter-stylesheets.ts 7` | ||
`bun run /path-to/filter-stylesheets.ts 7` | ||
|
||
1. Create draft migration files for each one | ||
7. Create draft migration files for each one | ||
|
||
`bun run create-migrations.ts 3` | ||
`bun run /path-to/create-migrations.ts 3` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.