Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Relevant Epic: https://github.com/openedx/axim-engineering/issues/23

tl;dr: Openedx NPM Packages are currently under the @edx scope and owned by a user shared with 2U. We want to move it to a scope called @openedx that is managed by Axim while leaving behind any packages that are 2U specific.

Move Plan

https://docs.google.com/spreadsheets/d/13hAbxdVrUC9eQuEDqJyQ0tdnab1x6niLOrKf6ViOvWg/edit#gid=0

How-Tos

How to Move from the @edx scope to the @openedx scope

  1. Update the docs in the repo that you’re updating. It will be a PR like this: https://github.com/openedx/paragon/pull/2744/files

  2. Ensure that the PR has been published to the old package and the latest docs reflect the changes we expect.

  3. Make a PR to move the package to the new scope. It will probably look like this: https://github.com/openedx/paragon/pull/2745

  4. Ensure that the new package is published and looks correct.

  5. Add a new post here on discourse. Look at some of the earlier posts for examples.

  6. Update the spreadsheet above with the date when the move occurred.

How to Update all the places where the package is referenced

Once the repo has moved, we need to update all the repos that reference the old package in their package.json so that it uses the new package. We’ll also need to update code that imports the old package to import the new package.

  1. Use repo-tools to clone the whole openedx org locally.

    pip install git+https://github.com/openedx/repo-tools.git@master
    export GITHUB_TOKEN=....
    clone_org openedx --username <your_github_username> --token $GITHUB_TOKE
  2. Find all the repos that are referencing the old package name.

    # rg '@edx/paragon' **/package.json -l | awk -F/ '{ print $1 }' | sort -u > paragon_upgrade.repos
    rg '<your_package_name_here>' **/package.json -l | awk -F/ '{ print $1 }' | sort -u > old_scope.repos
  3. Review the list and make sure it looks okay.

  4. Run something like the following to update all the references to the old package. Maybe run it on just one or two repos to start with before you run it on everything.

    #!/usr/bin/env zsh
    
    cat <<EOF > paragon_upgrade.message
    chore: Update to the new version of paragon in the new scope.
    
    Part of https://github.com/openedx/axim-engineering/issues/23
    
    This replaces the `@edx/paragon` packag to point to the `paragon` package at
    the `openedx` scope(`@openedx/paragon`). Imports have been updated to use the
    same locations in the new package.
    EOF
    
    
    
    for i in `cat paragon_upgrade.repos | grep -v "^#"`;
    do ;
    	cd $i;
    	echo `pwd`;
    	git checkout -b feanil/update_paragon_dependency;
    	perl -pi -e "s#\"\@edx/paragon\": \"([\^~>=]{,2})?\d+\.\d+\.\d+\"#\"\@openedx/paragon\": \"21.5.7\"#" package.json
    	nvm use;
    	npm install;
    
    	rg "@import ['\"]~?@edx/paragon" -l | xargs -I{} perl -pi -e "s#\@import ([\'\"])(\~)?\@edx/paragon#\@import \1\2\@openedx/paragon#" {}
    	rg "from ['\"]~?@edx/paragon" -l | xargs -I{} perl -pi -e "s#from ([\'\"])(\~)?\@edx/paragon#from \1\2\@openedx/paragon#" {}
    
    	git commit -a -F /home/feanil/src/openedx/paragon_upgrade.message;
    	# create a draft PR
    	gh pr create -f -d && gh pr view --web;
    	cd /home/feanil/src/openedx;
    	break;
    done;
    

  • No labels