Niedzielski has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/380675 )
Change subject: Chore: abbreviate configuration as "config" ...................................................................... Chore: abbreviate configuration as "config" Change-Id: Ic93de118aaff7ba76d4818c5b78a8d9a4b51204a --- M docs/development.md M src/common/pages/about.tsx M src/common/routers/route.ts R src/server/config.ts M src/server/index.tsx M webpack.config.ts 6 files changed, 26 insertions(+), 30 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/75/380675/1 diff --git a/docs/development.md b/docs/development.md index d7e34ef..f5aa109 100644 --- a/docs/development.md +++ b/docs/development.md @@ -129,6 +129,7 @@ Marvin uses the following abbreviations: +- Configuration => config - Parameters => params - Properties => props - Utilities => utils @@ -151,7 +152,7 @@ ## Environment variables -See [configuration](../src/server/configuration.ts). +See [configuration](../src/server/config.ts). ## Continuous integration diff --git a/src/common/pages/about.tsx b/src/common/pages/about.tsx index af73f3f..51efa42 100644 --- a/src/common/pages/about.tsx +++ b/src/common/pages/about.tsx @@ -20,9 +20,9 @@ componentDidMount() { // todo: figure out a common way across entry points for defining // configuration variables that common code could consume. The server has - // server specific vars in configuration.ts and this here for example are - // used only on DOM capable envs (componentDidMount will only fire on DOM - // capable environments). It would be ideal if we had a common place with + // server specific vars in config.ts and this here for example are used only + // on DOM capable envs (componentDidMount will only fire on DOM capable + // environments). It would be ideal if we had a common place with // configuration for common code. We need to also take into account UglifyJS // and the dead code elimination when using DefinePlugin, so that we can // leverage it to remove dev-only code in production builds diff --git a/src/common/routers/route.ts b/src/common/routers/route.ts index d05786d..fdfe631 100644 --- a/src/common/routers/route.ts +++ b/src/common/routers/route.ts @@ -23,10 +23,7 @@ requestProps?: (params: Params) => Promise<Props>; } -export interface RouteConfiguration< - Params extends RouteParams = {}, - Props = void -> { +export interface RouteConfig<Params extends RouteParams = {}, Props = void> { path: string; importModule: () => Promise<PageModule<Params, Props>>; chunkName: string; @@ -34,7 +31,7 @@ } export interface Route<Params extends RouteParams = {}, Props = void> - extends RouteConfiguration<Params, Props> { + extends RouteConfig<Params, Props> { status: number; /** Generates a URL from parameters. */ @@ -48,7 +45,7 @@ importModule, chunkName, status = 200 -}: RouteConfiguration<Params, Props>): Route<Params, Props> => ({ +}: RouteConfig<Params, Props>): Route<Params, Props> => ({ path, importModule, chunkName, diff --git a/src/server/configuration.ts b/src/server/config.ts similarity index 100% rename from src/server/configuration.ts rename to src/server/config.ts diff --git a/src/server/index.tsx b/src/server/index.tsx index cebf7ed..cc1551b 100644 --- a/src/server/index.tsx +++ b/src/server/index.tsx @@ -23,7 +23,7 @@ SERVER_PORT, SERVER_URL, WEBPACK_DEV_SERVER_URL -} from "./configuration"; +} from "./config"; import HTMLPage from "./components/html-page"; // The asset manifest built or the webpack-dev-server URL (which has no diff --git a/webpack.config.ts b/webpack.config.ts index c965af2..8fafd79 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -7,7 +7,7 @@ VERBOSE, WEBPACK_DEV_SERVER_PORT, WEBPACK_DEV_SERVER_URL -} from "./src/server/configuration"; +} from "./src/server/config"; const pkg = require("./package.json"); @@ -37,7 +37,7 @@ const PREACT = PRODUCTION ? "preact" : "preact/debug"; -const configuration: webpack.Configuration = { +const config: webpack.Configuration = { // Bundled outputs and their source inputs. For each entry, the source input // and any dependencies are compiled together into one chunk file output // except where split by the CommonsChunkPlugin. @@ -77,7 +77,7 @@ output: { // The filesystem base destination directory for the client entry point // chunk files given as an absolute path. All outputs specified in - // `configuration.entry` will be generated here. + // `config.entry` will be generated here. path: PATHS.public.output, // The base web request path for chunk files to appear in the asset @@ -87,7 +87,7 @@ // server. publicPath: PRODUCTION ? "/public/" : `${WEBPACK_DEV_SERVER_URL}/public/`, - // `configuration.entry` chunk filenames. e.g.: + // `config.entry` chunk filenames. e.g.: // // { // ... @@ -98,10 +98,9 @@ // ... // } // - // The property names are derived from `configuration.entry`. The values - // are derived from `configuration.output.publicPath` and - // `configuration.output.filename`. The manifest itself is generated by the - // assets-webpack-plugin. + // The property names are derived from `config.entry`. The values are + // derived from `config.output.publicPath` and `config.output.filename`. The + // manifest itself is generated by the assets-webpack-plugin. filename: CHUNK_FILENAME, // Dynamic dependency chunk filenames. e.g.: @@ -125,7 +124,7 @@ // // The properties are derived from directive comments inlined within the // imports like `/* webpackChunkName: "pages/home" */`. - // The values are derived from `configuration.output.publicPath` and + // The values are derived from `config.output.publicPath` and // `CHUNK_FILENAME`. The manifest itself is generated by the // assets-webpack-plugin. chunkFilename: CHUNK_FILENAME @@ -198,7 +197,7 @@ // See also // https://medium.com/webpack/predictable-long-term-caching-with-webpack-d3eee1d3fa31. -configuration.plugins = [ +config.plugins = [ new webpack.IgnorePlugin(/domino/), new webpack.DefinePlugin({ @@ -231,7 +230,7 @@ // them to a separate chunk improves the cacheability of a significant portion // of the client. This chunk changes whenever external dependencies change. new webpack.optimize.CommonsChunkPlugin({ - // This name should match `configuration.entry.vendor`. + // This name should match `config.entry.vendor`. name: "vendor", // Do not include common code identified from other entries. Only include @@ -257,7 +256,7 @@ // other file changes. See // https://webpack.js.org/plugins/commons-chunk-plugin/#manifest-file. new webpack.optimize.CommonsChunkPlugin({ - // This name should NOT match any `configuration.entry`. + // This name should NOT match any `config.entry`. name: "runtime" }) ]; @@ -299,12 +298,11 @@ // ... // } // - // The property names are derived from ` configuration.entry` and directive - // comments inlined within dynamic imports like - // `/* webpackChunkName: "pages/home" */`. The property values are derived - // from `configuration.output.publicPath` and either `CHUNK_FILENAME` or, for - // CSS only, `ExtractPluginOptions.filename`. - configuration.plugins.push( + // The property names are derived from ` config.entry` and directive comments + // inlined within dynamic imports like `/* webpackChunkName: "pages/home" */`. + // The property values are derived from `config.output.publicPath` and either + // `CHUNK_FILENAME` or, for CSS only, `ExtractPluginOptions.filename`. + config.plugins.push( new AssetsPlugin({ prettyPrint: VERBOSE, filename: "assets-manifest.json", @@ -313,4 +311,4 @@ ); } -export default configuration; +export default config; -- To view, visit https://gerrit.wikimedia.org/r/380675 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic93de118aaff7ba76d4818c5b78a8d9a4b51204a Gerrit-PatchSet: 1 Gerrit-Project: marvin Gerrit-Branch: master Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org> Gerrit-Reviewer: Sniedzielski <sniedziel...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits