-
Notifications
You must be signed in to change notification settings - Fork 0
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(amplify migration): script to perform Netlify to Amplify Migration #55
Conversation
Nit: change to for clarity
btw do we need to update |
good question! don't need to update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we seem to be lacking a tsconfig
here; can just rip from isomer.
@seaerchin I am inclined not to add a |
we use by not specifying a to avoid unpleasant surprises in the future, it's best to still specify. the easiest one is per the {
"extends": "ts-node/node16/tsconfig.json",
// Or install directly with `npm i -D @tsconfig/node16`
"extends": "@tsconfig/node16/tsconfig.json",
} |
Fair point @seaerchin! added them here 363d9ab |
|
||
function readCsvFile(): Promise<[string, string][]> { | ||
// read file list-of-repos.csv | ||
const filePath = path.join(__dirname, "list-of-repos.csv"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason why we're not letting the users specify the csv directly using the cli?
if this is only to be used by you, it's ok but otherwise is the script itself idempotent? (seems like hor so should be ok)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, updated here: 66708a6
otherwise is the script itself idempotent?
hmm no leh, got quite a number of side effects. (eg. creation of amplify apps, sql commands written to db). The goal of this script was never idempotency tho.
to be truly idempotent, we would need to talk to the db, which can be tackled in a seperate PR ya
breaks if these are not removed :(
Problem
Currently, in the conversion scripts, we have scripts to add a trailing slash at the end of the permalinks. The main functionality of it is to change
permalink: some/path
topermalink: some/path/
in our relevant .md files. More info here.However, the creation of the application in Amplify is not automated. Additionally, the changing of URLs from capitalisation to small casing is not tackled.
TLDR, this script will
permalink: some/LINK/with-no-slash
topermalink: some/link/with-no-slash/
and store them in a list<a href="some/LINK/with-no-slash"></a>
to<a href="some/link/with-no-slash"></a>
[click me](some/LINK/with-no-slash)
to[click me](some/link/with-no-slash)
Known limitations:
Currently, this script is using a regex pattern to parse markdown. I have added some cases that is covers below, but there might be edge cases that are not tackled. Note: I tried to use Markdown-it , but it seems to have some quirks. (eg. it changes all instances of
'
to"
and it seemed like more work to get it to work T.T)This script not directly talking to sql database. As a result, user id is manually hardcoded, and there a need to copy paste sql commands into prod db. Since this migration is only run once per site, I think we shouldnt over-engineer an API endpoint for something that we are not maintaining in the long run. When we do introduce backend in this script, we can modify this limiation.
Testing
Since this is infrastructure changes, it is more challenging to test this and capture all edge cases (esp considering the existence of v1 sites). Here is an example of the changes that a repo would go through when being run by the script.