mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 15:16:50 +00:00
Hygiene: Move build/ext.popups/ to src/
This way, src contains sources, and dist contains distribution files. Also, add some documentation about the folders in the README and an adr. Change-Id: Ie0b9f6475b8423b90e927633d883bde3cd5d5e4d
This commit is contained in:
parent
c593ed3502
commit
fa2b10a2e7
3
.gitattributes
vendored
3
.gitattributes
vendored
|
@ -1,2 +1 @@
|
|||
resources/ext.popups/index.js -diff -whitespace
|
||||
resources/ext.popups/index.js.map -diff -whitespace
|
||||
resources/dist/** -diff -whitespace
|
||||
|
|
|
@ -23,7 +23,7 @@ module.exports = function ( grunt ) {
|
|||
]
|
||||
},
|
||||
all: [
|
||||
'build/**',
|
||||
'src/**',
|
||||
'resources/ext.popups/*.js',
|
||||
'resources/ext.popups/**/*.js',
|
||||
'!resources/dist/index.js',
|
||||
|
|
|
@ -6,7 +6,13 @@ what it does.
|
|||
## Development
|
||||
|
||||
Popups uses an asset bundler so when developing for the extension you'll need
|
||||
to run a script to assemble the frontend assets. So, after an `npm install`:
|
||||
to run a script to assemble the frontend assets.
|
||||
|
||||
You can find the frontend source files in `src/`, the compiled sources in
|
||||
`resources/dist/`, and other frontend assets managed by resource loader in
|
||||
`resources/*`.
|
||||
|
||||
After an `npm install`:
|
||||
|
||||
* `npm start` Will run the bundler in watch mode, re-assembling the files on
|
||||
file change.
|
||||
|
|
43
doc/adr/0005-frontend-sources-directory-structure.md
Normal file
43
doc/adr/0005-frontend-sources-directory-structure.md
Normal file
|
@ -0,0 +1,43 @@
|
|||
# 1. Frontend sources directory structure
|
||||
|
||||
Date: 14/02/2017
|
||||
|
||||
## Status
|
||||
|
||||
Accepted
|
||||
|
||||
## Context
|
||||
|
||||
With the addition of a frontend bundler, there are now assets that are the
|
||||
source, and assets that are for distribution.
|
||||
|
||||
Before, all assets were distribution ones stored in `resources/`, just
|
||||
a configurable convention used by the Reading Web team for using MediaWiki's
|
||||
ResourceLoader.
|
||||
|
||||
In order to facilitate the CI checks and understanding where sources are and
|
||||
where compiled sources are, we need to chose two distinct paths for storing
|
||||
sources and distribution files.
|
||||
|
||||
## Decision
|
||||
|
||||
After some discussion, because of ease of understanding to the wider
|
||||
development community and the good mapping between the name and what they
|
||||
contain, we chose to:
|
||||
|
||||
* Put unbundled frontend sources in `src/`.
|
||||
* Put bundled distribution files in `dist/` under `resources/` in
|
||||
`resources/dist/`.
|
||||
* Files directly distributed by ResourceLoader remain under `resources/*` to
|
||||
follow Reading Web Team's conventions around assets used by ResourceLoader.
|
||||
|
||||
## Consequences
|
||||
|
||||
* Frontend sources will be under `src/`.
|
||||
* After `npm start` or `npm run build` the bundled sources will be under
|
||||
`resources/dist`.
|
||||
* Jenkins will check in continuous integration that the sources under `src/`
|
||||
are actually compiled when commited under `resources/dist`.
|
||||
* If the `src` path where to become inconvenient because we wanted to add other
|
||||
types of sources in it, we'll move the frontend assets to `src/js` or
|
||||
something more specific.
|
BIN
resources/dist/index.js.map
vendored
BIN
resources/dist/index.js.map
vendored
Binary file not shown.
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
filename: '/[name].js'
|
||||
},
|
||||
entry: {
|
||||
index: './build/ext.popups/index.js'
|
||||
index: './src/index.js'
|
||||
},
|
||||
devtool: 'source-map'
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue