MetaMask / MetaMask/metamask-module-template

Automate synchronization across repos that use this

Open
#101 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
31
Forks
18
Avg merge
11h 39m
Merged PRs (30d)
1

Description

When we make changes to this repo, we need to go into each of our other repos and add those changes to them as well. This is time-consuming and error-prone work, as it must be done manually. Automating such changes would ensure that all of our repos match the template.

In addition, our repos were created at different times and may be in various states of change. It is entirely possible that some repos do not match the template 100%, and currently, we have no way of knowing.

To address this, we should add a script to this repo which lints a project for consistency between that project and this template. If there are any files which are missing, or if there are any major differences in known files that are missing, then the script should report an error. Additionally there should be a --fix option similar to ESLint which will apply any changes which are auto-fixable. Then we can run this script across all of our projects (locally).

Note that we can make the script somewhat intelligent when it comes to certain kinds of files:

  • For configuration files which contain JSON or JSON-compatible objects (package.json, GitHub workflow files, etc.), we can determine a difference between objects rather than difference between lines.
  • For configuration files which export objects (.eslintrc.js, etc.) we may have to write a codemod to parse the AST of the file, read the object being exported, determine a difference between objects, update the AST, then generate a new file.
  • For text-based files we could do a diff. If the diff applies cleanly then the file is autofixable, if not then the developer would have to apply that diff manually.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by mapping the proposed synchronization script and the repository states it must compare. Review the named package.json, GitHub workflow, and .eslintrc.js examples, along with the --fix behavior and JSON, AST, and text-diff approaches. Done means the script can report missing or materially different files and apply changes that are safely autofixable across local projects.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.