From fa2b10a2e7ee2641381aa4cc318cf40d777a0f1e Mon Sep 17 00:00:00 2001 From: joakin Date: Mon, 13 Feb 2017 15:02:18 +0100 Subject: [PATCH] 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 --- .gitattributes | 3 +- Gruntfile.js | 2 +- README.md | 8 +++- ...05-frontend-sources-directory-structure.md | 43 ++++++++++++++++++ resources/dist/index.js.map | Bin 162188 -> 161356 bytes {build/ext.popups => src}/actionTypes.js | 0 {build/ext.popups => src}/actions.js | 0 {build/ext.popups => src}/changeListener.js | 0 .../changeListeners/eventLogging.js | 0 .../changeListeners/footerLink.js | 0 .../changeListeners/index.js | 0 .../changeListeners/linkTitle.js | 0 .../changeListeners/render.js | 0 .../changeListeners/settings.js | 0 .../changeListeners/syncUserSettings.js | 0 {build/ext.popups => src}/checkin.js | 0 {build/ext.popups => src}/counts.js | 0 {build/ext.popups => src}/gateway/index.js | 0 .../ext.popups => src}/gateway/mediawiki.js | 0 {build/ext.popups => src}/gateway/rest.js | 0 {build/ext.popups => src}/index.js | 0 {build/ext.popups => src}/isEnabled.js | 0 {build/ext.popups => src}/pageVisibility.js | 0 {build/ext.popups => src}/popups.js | 0 {build/ext.popups => src}/preview/index.js | 0 {build/ext.popups => src}/preview/model.js | 0 {build/ext.popups => src}/previewBehavior.js | 0 {build/ext.popups => src}/processLinks.js | 0 .../reducers/eventLogging.js | 0 {build/ext.popups => src}/reducers/index.js | 0 .../ext.popups => src}/reducers/nextState.js | 0 {build/ext.popups => src}/reducers/preview.js | 0 .../ext.popups => src}/reducers/settings.js | 0 {build/ext.popups => src}/renderer.js | 0 {build/ext.popups => src}/schema.js | 0 {build/ext.popups => src}/settingsDialog.js | 0 {build/ext.popups => src}/userSettings.js | 0 {build/ext.popups => src}/wait.js | 0 webpack.config.js | 2 +- 39 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 doc/adr/0005-frontend-sources-directory-structure.md rename {build/ext.popups => src}/actionTypes.js (100%) rename {build/ext.popups => src}/actions.js (100%) rename {build/ext.popups => src}/changeListener.js (100%) rename {build/ext.popups => src}/changeListeners/eventLogging.js (100%) rename {build/ext.popups => src}/changeListeners/footerLink.js (100%) rename {build/ext.popups => src}/changeListeners/index.js (100%) rename {build/ext.popups => src}/changeListeners/linkTitle.js (100%) rename {build/ext.popups => src}/changeListeners/render.js (100%) rename {build/ext.popups => src}/changeListeners/settings.js (100%) rename {build/ext.popups => src}/changeListeners/syncUserSettings.js (100%) rename {build/ext.popups => src}/checkin.js (100%) rename {build/ext.popups => src}/counts.js (100%) rename {build/ext.popups => src}/gateway/index.js (100%) rename {build/ext.popups => src}/gateway/mediawiki.js (100%) rename {build/ext.popups => src}/gateway/rest.js (100%) rename {build/ext.popups => src}/index.js (100%) rename {build/ext.popups => src}/isEnabled.js (100%) rename {build/ext.popups => src}/pageVisibility.js (100%) rename {build/ext.popups => src}/popups.js (100%) rename {build/ext.popups => src}/preview/index.js (100%) rename {build/ext.popups => src}/preview/model.js (100%) rename {build/ext.popups => src}/previewBehavior.js (100%) rename {build/ext.popups => src}/processLinks.js (100%) rename {build/ext.popups => src}/reducers/eventLogging.js (100%) rename {build/ext.popups => src}/reducers/index.js (100%) rename {build/ext.popups => src}/reducers/nextState.js (100%) rename {build/ext.popups => src}/reducers/preview.js (100%) rename {build/ext.popups => src}/reducers/settings.js (100%) rename {build/ext.popups => src}/renderer.js (100%) rename {build/ext.popups => src}/schema.js (100%) rename {build/ext.popups => src}/settingsDialog.js (100%) rename {build/ext.popups => src}/userSettings.js (100%) rename {build/ext.popups => src}/wait.js (100%) diff --git a/.gitattributes b/.gitattributes index 69043ca7e..fd5634c8e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ -resources/ext.popups/index.js -diff -whitespace -resources/ext.popups/index.js.map -diff -whitespace +resources/dist/** -diff -whitespace diff --git a/Gruntfile.js b/Gruntfile.js index 07d85d5ce..d72501d52 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -23,7 +23,7 @@ module.exports = function ( grunt ) { ] }, all: [ - 'build/**', + 'src/**', 'resources/ext.popups/*.js', 'resources/ext.popups/**/*.js', '!resources/dist/index.js', diff --git a/README.md b/README.md index ad060bb5b..f0a9e9138 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/doc/adr/0005-frontend-sources-directory-structure.md b/doc/adr/0005-frontend-sources-directory-structure.md new file mode 100644 index 000000000..07b631fac --- /dev/null +++ b/doc/adr/0005-frontend-sources-directory-structure.md @@ -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. diff --git a/resources/dist/index.js.map b/resources/dist/index.js.map index d6e947a973292688363d350f628f9a4149f927cc..383869c54d4450427f58403034b1dc0582aade5b 100644 GIT binary patch delta 770 zcmeDA%z5Sw=Y%}w;-ciq57?AJ^u&!S+(1e{F}Wl&Kd*T5Mn+k%v=pNzm=0z%2Gc7y z%T3MT~?5A>12Lp4X}b@pw8SxxW4HuI$-nC6H8Ld6DwiPpZ;E#Q55blUsf$% zkSUqPu6c<`IjJdd?fY2O*g-PoiJ6lFIpx4c6%?hGWu}(HjGCOtrUiEXY&IQEklLcu zl+xtM35;q;yw{AnU^QXv24H#`yB?D40Vd7K54d?Y^K%@j07*|@tHda^`ENrxGuTT7 z`30o~#nTz}7)3WPXkk%84tS8L$mR>n!kIuCH=D0)WCSx#th&enW~|(NhZ)3}e2-CK zddyKq!Oh3E^Ra_PG?-+kv*-aug!aFMXy-p<%nH^ObX*pqz5cw3AaaC2T=C#RDlb@F z=(~?>Nbv%ZE&6(Z4J_;QXD!&2?f+RAFM(~?{*ayVpEyWz`+IrDWe~BYN{m+A5HVfG z>tL>`9w*hSr_BnF|-$NIS1|GoX4^Zd{GpL3qKE2XzL zN{99GuB6r*3Gh_HAB)D4F|nWOJw?n2{0)t)*H#oqMxHew`|R@;=LOX6uzrP~(~Jby z#Wm$1yb?3nT5*}GF)%t^C)~^;FiS@HRD{=Xi`sD z%|-ZZExTX{Nzu;^R{=KEZhkc^T+EA2W^By}^R_00PI~}hr@axOWyG0}Aibc&%#llCAVlmS=k0ezwOfA^>g3^l6=J4ZU{)wDmK5@!f zCZmp*Da_FdhEpOp;Fh5qeKru5ZwBfPAYC0dSPe`ltR}Rme*Sul8|mCKRm#DMON5WV zJj!iDI+M*?lpmcwSpvCYmb`NF=}!g`x%K>r0#pQ9P5S;4x#Y!HUr|nm=G$F+z)j&E z)gDbR%%)O~f8aYnR+g=-JAh7Y