gh-cli-for-education / gh-edu

A pluggable extension of gh-cli to assist educators and students using GitHub Education
https://github.com/gh-cli-for-education/TFG-2122-Cristo-Garcia-Gonzalez
3 stars 0 forks source link

improvement to keep the configuration file in a separated user repo #12

Open crguezl opened 2 years ago

crguezl commented 2 years ago

Improvement to keep the configuration file in a separated user repo

The current code in file config.ts is to check if the file exist and otherwise to create a minimal file from the template:


export let config: configType;
if (!fs.existsSync(configPath)) {
  console.log("No config file detected");
  console.log("Creating new config...");
  fs.copyFileSync(__dirname + "/../utils/config.template.json", configPath, fs.constants.COPYFILE_EXCL);
}

Alternative to explore:

  1. if (!fs.existsSync(configPath)) {
    1. try to see if there is a repo github-user/gh-edu-profile in GitHub and if so
    2. get the config file config.json from there by cloning the repo,
    3. make a symbolic link to the config file
    4. otherwise, if there is no gh-edu-profile repo at GH
      1. make a folder gh-edu-profile in the extension folder
      2. copy the minimal template to gh-edu-profile
      3. make a symbolic link to the just created config file
      4. create the github repo github-user/gh-edu-profile and push the config file

It is a lot of work

GGCristo commented 2 years ago

b8aa6085f6336f23154e653714aa87da27c2af7f