ampproject / ampproject/amphtml

I2I: Consolidate source code under `src/`

Open
#34,866 6 comments 0 reactions 0 assignees View on GitHub
INTENT TO IMPLEMENT Stale Type: DevX Type: Refactoring
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

In the earlier days of amp, the root directory was fairly sparse. "Top-level" directories like `3p`, `ads`, `builtins`, and `extensions` had separate functions, while `src` was synonymous with the AMP runtime. IIUC, one motivation for this at the time was so external contributors could easily view the repo and understand where to contribute an ad provider, 3p integration, or new component/extension.

Today, the root directory has dozens of config files and directories (`.babel-cache/`, `.circleci/`, `.codecov.yml`, `.css-cache/`, `.editorconfig`, `.eslintignore`, `.eslintplugin.js`, `.eslintrc.js`, `.git/`, `.gitattributes`, `.github/`, `.gitignore`, `.lando.yml`, `.lgtm.yml`, `.npmrc`, `.nyc_output/`, `.pre-closure-cache/`, `.prettierignore`, `.prettierrc`, `.renovaterc.json`, `.vscode/`), build/dist files, `node_modules`, `third_party`, and a handful of other directories containing tools, docs, and more.

More generally, I suspect if we re-created the repo today, we'd put all the source files under `src`, separate from built system, build files, documentation, and testing. Down the line, this can also allow for consolidation and simplification of some lint rules, presubmits, etc.

Contributor guide

Open the contributing guide

Research direction

Start by inventorying the root-level source directories named in the issue, including `3p`, `ads`, `builtins`, `extensions`, and `src`, alongside the listed build and presubmit configuration files. Define the target layout and the required build, lint, presubmit, and contributor workflows before attempting consolidation; the issue does not specify tests or a completion checklist.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.