website/scripts/docsmg/README.md
This CLI tool is used to generate a mapping file (migratefile) that is then used by the tool to migrate .md, .mdx, and images file from their current structure into a new structure.
Use this migration tool to:
netlify.toml file to add redirect entries for all migrated files.rustup update. $HOME/.cargo/envcargo install --git https://github.com/goauthentik/authentik --bin docsmg/website directory, create a file named docsmg.env with the entry of MIGRATE_PATH=./docs.docsmg generate >> migratefilemigratefile and insert the path you want to move them to after the arrow; ex path/to/move/from/file.md -> path/to/move/to/file.md Note: make sure to put spaces on either side of the arrow or that line won't be recognizeddocsmg migratedocsmg unmigrate; Note: DO NOT edit the migrate file in between steps 3 and 4migratefile)Navigate to the authentik/website dir.
Generate a migratefile with docsmg generate | sort >> migratefile.
You can also just run docsmg generate | sort to see the output in the terminal, before writing it to a file.
:::info The new migratefile will be created in the /website dir.
:::
Edit the migratefile to add the target directory paths in the new structure for each entry.
For each file listed in migratefile insert the path you want to move them to.
EXAMPLE: path/to/move/from/file.md -> path/to/move/to/file.md
Note: make sure to put spaces on either side of the arrow or that line won't be recognized.
docsmg migrate.:::info
After you have run migrate, you cannot run it again or you will get a panic error... because the files have already been moved.
:::
docsmg unmigrate.
Note: DO NOT edit the migratefile file before running unmigrate.migratefile file and then using the docsmg migrate command until you are satisfied with the result.sidebar.js fileBecause the structure is completely changed, you will need to modify/reconstruct the navigation bar.
To test the internal links, navigate up a level to authentik and then run make docs-watch.
docsmg generate command pulls all of the files in the repo (even non-docs files), then check that:
docsmg.env exists/websiteMIGRATE_PATH=./docs