Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion etc/webpack/config.js → etc/webpack/api-docs/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@

'use strict';

// ===== //

// The following content can be edited...

var resolve = require( 'path' ).resolve;
var BUNDLE_REPORT_PATH = resolve( __dirname, '..', '..', '..', 'build', 'bundle_report.html' );


// == DO NOT EDIT == //

// The following content likely should not be edited...

const isWsl = require('is-wsl');
const path = require('path');
const webpack = require('webpack');
Expand Down Expand Up @@ -470,7 +482,7 @@ module.exports = function(webpackEnv) {
new BundleAnalyzerPlugin({
'analyzerMode': 'static',
'openAnalyzer': false,
'reportFilename': path.resolve( __dirname, '..', '..', 'build', 'bundle_report.html' )
'reportFilename': BUNDLE_REPORT_PATH
}),

// Generates an `index.html` file with the <script> injected.
Expand Down
15 changes: 14 additions & 1 deletion etc/webpack/dev_server.js → etc/webpack/api-docs/dev_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,21 @@
* SOFTWARE.
*/

/* eslint-disable */

'use strict';

// ===== //

// The following content can be edited...

var INDEX_HTML = 'docs/api/index.html';


// == DO NOT EDIT == //

// The following content likely should not be edited...

const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
Expand Down Expand Up @@ -57,7 +70,7 @@ module.exports = function( proxy ) {
// Paths with dots should still use the history fallback.
// See https://github.com/facebook/create-react-app/issues/387.
disableDotRule: true,
index: 'docs/api/index.html'
index: INDEX_HTML
},
static: false,
hot: true,
Expand Down
4 changes: 4 additions & 0 deletions etc/webpack/env.js → etc/webpack/api-docs/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
* SOFTWARE.
*/

/* eslint-disable */

// Note: this file should likely not need to be edited.

'use strict';

const fs = require('fs');
Expand Down
4 changes: 4 additions & 0 deletions etc/webpack/modules.js → etc/webpack/api-docs/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
* SOFTWARE.
*/

/* eslint-disable */

// Note: this file should likely not need to be edited.

'use strict';

const fs = require('fs');
Expand Down
34 changes: 26 additions & 8 deletions etc/webpack/paths.js → etc/webpack/api-docs/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,26 @@
* SOFTWARE.
*/

/* eslint-disable */

'use strict';

// ===== //

// The following content can be edited...

var PUBLIC_URL = 'https://stdlib.io';
var MOUNT_PATH = 'public/docs/api';
var SERVE_PATH = '/docs/api/';
var SRC_PATH = 'src/api-docs';
var SRC_PATH_HTML = SRC_PATH+'/index.html';
var SRC_PATH_INDEX = SRC_PATH+'/index';


// == DO NOT EDIT == //

// The following content likely should not be edited...

const path = require('path');
const fs = require('fs');

Expand Down Expand Up @@ -62,17 +80,17 @@ const resolveModule = (resolveFn, filePath) => {
// config after eject: we're in ./config/
module.exports = {
dotenv: resolveApp('.env'),
appPath: resolveApp('public/docs/api'),
appBuild: resolveApp('public/docs/api'),
appPublic: resolveApp('public/docs/api'),
appHtml: resolveApp('src/index.html'),
appIndexJs: resolveModule(resolveApp, 'src/index'),
appPath: resolveApp(MOUNT_PATH),
appBuild: resolveApp(MOUNT_PATH),
appPublic: resolveApp(MOUNT_PATH),
appHtml: resolveApp(SRC_PATH_HTML),
appIndexJs: resolveModule(resolveApp, SRC_PATH_INDEX),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
appSrc: resolveApp(SRC_PATH),
appJsConfig: resolveApp('jsconfig.json'),
appNodeModules: resolveApp('node_modules'),
publicUrl: 'https://stdlib.io',
servedPath: '/docs/api/'
publicUrl: PUBLIC_URL,
servedPath: SERVE_PATH
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,22 @@
* SOFTWARE.
*/

/* eslint-disable */

'use strict';

// ===== //

// The following content can be edited...

var SERVE_PATH = '/docs/api/';
var SERVE_PATH_HTML = SERVE_PATH+'index.html';


// == DO NOT EDIT == //

// The following content likely should not be edited...

// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development';
process.env.NODE_ENV = 'development';
Expand Down Expand Up @@ -121,8 +135,8 @@ checkBrowsers(paths.appPath, isInteractive)
return req.url;
}
// Let webpack dev server handle SPA routes that start with /docs/api/
if (req.headers.accept && req.headers.accept.indexOf('html') !== -1 && req.url.startsWith('/docs/api/')) {
return '/docs/api/index.html';
if (req.headers.accept && req.headers.accept.indexOf('html') !== -1 && req.url.startsWith(SERVE_PATH)) {
return SERVE_PATH_HTML;
}
// Proxy API requests to backend
return null;
Expand Down
Loading