Skip to content

Commit 69dcfa1

Browse files
committed
chore: clean-up
1 parent 4c4526e commit 69dcfa1

36 files changed

+78
-100
lines changed

.editorconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ indent_style = tab
8686
[*.{f,f.txt}]
8787
indent_style = space
8888
indent_size = 2
89-
insert_final_newline = false
89+
insert_final_newline = true
9090

9191
# Set properties for shell files:
9292
[*.{sh,sh.txt}]
@@ -121,7 +121,7 @@ indent_style = tab
121121
[*.{md,md.txt}]
122122
indent_style = space
123123
indent_size = 4
124-
trim_trailing_whitespace = false
124+
trim_trailing_whitespace = true
125125

126126
# Set properties for `usage.txt` files:
127127
[usage.txt]

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,4 @@ jsconfig.json
168168

169169
# Sublime Text #
170170
################
171-
*.sublime-workspace
171+
*.sublime-workspace

.npmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ package-lock = false
2525
shrinkwrap = false
2626

2727
# Disable automatically "saving" dependencies on install:
28-
save = false
28+
save = false

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ BUILD_FOLDER ?= js
6666
# Define filename extension conventions (keep in alphabetical order):
6767
CSS_FILENAME_EXT ?= css
6868

69-
# Define Node paths: (WARNING: we cannot use an absolute path here because of Webpack which only allows relative paths)
70-
NODE_PATH ?= ./node_modules/@stdlib/stdlib/lib/node_modules
69+
# Define Node paths:
70+
NODE_PATH ?=
7171

7272

7373
# DEPENDENCIES #
7474

75-
include $(TOOLS_MAKE_DIR)/Makefile
75+
include $(TOOLS_MAKE_DIR)/Makefile

etc/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This directory contains configuration files.
3838

3939
## Notes
4040

41-
* Configuration files for external tools and environments should be placed in subdirectories. The subdirectory name should correspond to the name of the tool or environment.
41+
- Configuration files for external tools and environments should be placed in subdirectories. The subdirectory name should correspond to the name of the tool or environment.
4242

4343
</section>
4444

@@ -50,4 +50,4 @@ This directory contains configuration files.
5050

5151
</section>
5252

53-
<!-- /.links -->
53+
<!-- /.links -->

etc/esbuild/build.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@
1818

1919
'use strict';
2020

21-
2221
// MODULES //
2322

2423
var esbuild = require( 'esbuild' );
25-
var config = require( './config' );
24+
var config = require( './config.js' );
2625

2726

2827
// MAIN //
2928

3029
/**
31-
* Builds the website using esbuild.
30+
* Builds the website.
3231
*
3332
* @async
3433
* @throws {Error} build failure
34+
* @returns {Promise} promise which resolves upon building the website
3535
*/
3636
async function main() {
3737
try {

etc/esbuild/config.js

+19-21
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,32 @@
1818

1919
'use strict';
2020

21-
2221
// MODULES //
2322

24-
var path = require( 'path' );
25-
26-
27-
// VARIABLES //
23+
var resolve = require( 'path' ).resolve;
2824

29-
var SRC_DIR = path.resolve( __dirname, '../../src' );
30-
var BUILD_DIR = path.resolve( __dirname, '../../public/js' );
3125

26+
// MAIN //
3227

33-
// EXPORTS //
34-
35-
module.exports = {
36-
entryPoints: [
37-
SRC_DIR + '/index.jsx'
28+
var config = {
29+
'entryPoints': [
30+
resolve( __dirname, '../../src/index.jsx' )
3831
],
39-
bundle: true,
40-
outfile: BUILD_DIR + '/bundle.js',
41-
minify: true,
42-
sourcemap: false,
43-
target: 'es2015',
44-
jsxFactory: 'h',
45-
jsxFragment: 'Fragment',
46-
jsxImportSource: 'preact',
47-
alias: {
32+
'bundle': true,
33+
'outfile': resolve( __dirname, '../../public/js/bundle.js' ),
34+
'minify': true,
35+
'sourcemap': false,
36+
'target': 'es2015',
37+
'jsxFactory': 'h',
38+
'jsxFragment': 'Fragment',
39+
'jsxImportSource': 'preact',
40+
'alias': {
4841
'react': 'preact/compat',
4942
'react-dom': 'preact/compat'
5043
}
5144
};
45+
46+
47+
// EXPORTS //
48+
49+
module.exports = config;

lib/server/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ limitations under the License.
1818
1919
-->
2020

21-
# Test code coverage Server
21+
# Server
2222

23-
> Create an HTTP server for serving test code coverage.
23+
> HTTP server for serving test code coverage.

lib/server/lib/defaults.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"address": "127.0.0.1",
3-
"latest": "",
43
"logger": false,
54
"port": 0,
65
"prefix": "/",
@@ -11,9 +10,6 @@
1110
"app": {
1211
"title": "Test Code Coverage | stdlib",
1312
"description": "Test code coverage website for stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing.",
14-
"theme": "",
15-
"mode": "default",
16-
"exampleSyntax": "es5",
17-
"prevNextNavigation": "alphabetical"
13+
"theme": ""
1814
}
1915
}

lib/server/lib/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
/**
2222
* Create an HTTP server for serving test code coverage.
2323
*
24-
* @module @stdlib/_tools/docs/www-test-code-coverage/server
24+
* @module @stdlib/www-test-coverage-server
2525
*
2626
* @example
27-
* var httpServer = require( '@stdlib/_tools/docs/www-test-code-coverage/server' );
27+
* var httpServer = require( '@stdlib/www-test-coverage-server' );
2828
* var App = require( 'my-app' );
2929
*
3030
* var opts = {
@@ -51,4 +51,4 @@ var main = require( './main.js' );
5151

5252
// EXPORTS //
5353

54-
module.exports = main;
54+
module.exports = main;

lib/server/lib/main.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ var validate = require( './validate.js' );
4343
* @param {Options} [options] - server options
4444
* @param {string} [options.address="127.0.0.1"] - server address
4545
* @param {string} [options.hostname] - server hostname
46-
* @param {string} [options.latest=""] - latest version (e.g., `v0.0.90`)
4746
* @param {(boolean|string)} [options.logger=false] - either a boolean indicating whether to enable logging or a log level
4847
* @param {NonNegativeInteger} [options.port=0] - server port
4948
* @param {(string|StringArray)} [options.prefix="/"] - URL path prefix(es) used to create a virtual mount path(s) for static directories
@@ -142,16 +141,15 @@ function httpServer( options ) {
142141

143142
// Decorate route handler `this` contexts with additional functionality:
144143
f.decorate( 'rootDir', opts.root );
145-
f.decorate( 'latestVersion', opts.latest );
146144

147145
// Decorate each `request` object with a `locals` object for passing along intermediate results within middleware handlers:
148146
f.decorateRequest( 'locals', null );
149147

150148
// Register a plugin for serving static files:
151149
f.register( fastifyStatic, {
152-
root: opts.root,
153-
prefix: opts.prefix,
154-
wildcard: true,
150+
'root': opts.root,
151+
'prefix': opts.prefix,
152+
'wildcard': true
155153
});
156154

157155
// Register routes:

lib/server/lib/node_modules/middleware-sequence/index.js

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/server/lib/node_modules/middleware/error/index.js

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/server/lib/routes/home/home.js

+3-12
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,8 @@
1616
* limitations under the License.
1717
*/
1818

19-
/* eslint-disable no-invalid-this */
20-
2119
'use strict';
2220

23-
2421
// MAIN //
2522

2623
/**
@@ -32,26 +29,20 @@
3229
* @returns {void}
3330
*/
3431
function handler( request, reply ) {
35-
var version;
3632
var url;
3733

38-
// Set version
39-
version = this.latestVersion;
40-
request.log.info( 'Version: %s', version );
41-
42-
// Handle URL and add version path
4334
url = request.url;
44-
if ( url[url.length - 1] !== '/' ) {
35+
if ( url[ url.length-1 ] !== '/' ) {
4536
url += '/';
4637
}
47-
url += version;
4838
request.log.info( 'Resolved URL: %s', request.url );
4939

50-
// Send the HTML shell to the client
40+
// Send the HTML shell to the client:
5141
reply.type( 'text/html' );
5242
reply.sendFile( 'index.html' );
5343
}
5444

45+
5546
// EXPORTS //
5647

5748
module.exports = handler;

lib/server/lib/routes/home/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var handler = require( './main.js' );
2727
// MAIN //
2828

2929
/**
30-
* Defines a route handler for returning a shell-app for test coverage website landing page.
30+
* Defines a route handler for returning a shell-app for a landing page.
3131
*
3232
* @private
3333
* @returns {Object} route declaration

lib/server/lib/routes/home/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ var handler = middleware( steps, onError );
4848

4949
// EXPORTS //
5050

51-
module.exports = handler;
51+
module.exports = handler;

lib/server/lib/routes/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
'use strict';
2020

21-
2221
// MODULES //
2322

2423
var home = require( './home' );

lib/server/lib/validate.js

+10-17
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ var format = require( '@stdlib/string/format' );
3939
* @param {Options} options - function options
4040
* @param {string} [options.address] - server address
4141
* @param {string} [options.hostname] - server hostname
42-
* @param {string} [options.latest] - latest version
4342
* @param {(boolean|string)} [options.logger] - either boolean indicating whether to enable logging or a log level
4443
* @param {NonNegativeInteger} [options.port] - server port
4544
* @param {(string|StringArray)} [options.prefix] - URL path prefix(es) used to create a virtual mount path(s) for static directories
@@ -67,19 +66,13 @@ function validate( opts, options ) {
6766
if ( hasOwnProp( options, 'address' ) ) {
6867
opts.address = options.address;
6968
if ( !isString( opts.address ) ) {
70-
return new TypeError( format( 'invalid option. `address` option must be a string. Option: `%s`.', opts.address ) );
69+
return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'address', opts.address ) );
7170
}
7271
}
7372
if ( hasOwnProp( options, 'hostname' ) ) {
7473
opts.hostname = options.hostname;
7574
if ( !isString( opts.hostname ) ) {
76-
return new TypeError( format( 'invalid option. `hostname` option must be a string. Option: `%s`.', opts.hostname ) );
77-
}
78-
}
79-
if ( hasOwnProp( options, 'latest' ) ) {
80-
opts.latest = options.latest;
81-
if ( !isString( opts.latest ) ) {
82-
return new TypeError( format( 'invalid option. `latest` option must be a string. Option: `%s`.', opts.latest ) );
75+
return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'hostname', opts.hostname ) );
8376
}
8477
}
8578
if ( hasOwnProp( options, 'logger' ) ) {
@@ -89,43 +82,43 @@ function validate( opts, options ) {
8982
'level': opts.logger
9083
};
9184
} else if ( !isBoolean( opts.logger ) ) {
92-
return new TypeError( format( 'invalid option. `logger` option must be either a boolean or a string. Option: `%s`.', opts.logger ) );
85+
return new TypeError( format( 'invalid option. `%s` option must be either a boolean or a string. Option: `%s`.', 'logger', opts.logger ) );
9386
}
9487
}
9588
if ( hasOwnProp( options, 'port' ) ) {
9689
opts.port = options.port;
9790
if ( !isNonNegativeInteger( opts.port ) ) {
98-
return new TypeError( format( 'invalid option. `port` must be a nonnegative integer. Option: `%s`.', opts.port ) );
91+
return new TypeError( format( 'invalid option. `%s` must be a nonnegative integer. Option: `%s`.', 'port', opts.port ) );
9992
}
10093
}
10194
if ( hasOwnProp( options, 'prefix' ) ) {
10295
opts.prefix = options.prefix;
10396
if ( !isString( opts.prefix ) && !isStringArray( opts.prefix ) ) {
104-
return new TypeError( format( 'invalid option. `prefix` option must be either a string or an array of strings. Option: `%s`.', opts.prefix ) );
97+
return new TypeError( format( 'invalid option. `%s` option must be either a string or an array of strings. Option: `%s`.', 'prefix', opts.prefix ) );
10598
}
10699
}
107100
if ( hasOwnProp( options, 'root' ) ) {
108101
opts.root = options.root;
109102
if ( !isString( opts.root ) ) {
110-
return new TypeError( format( 'invalid option. `root` option must be a string. Option: `%s`.', opts.root ) );
103+
return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'root', opts.root ) );
111104
}
112105
}
113106
if ( hasOwnProp( options, 'static' ) ) {
114107
opts.static = options.static;
115108
if ( !isString( opts.static ) && !isStringArray( opts.static ) ) {
116-
return new TypeError( format( 'invalid option. `static` option must be either a string or an array of strings. Option: `%s`.', opts.static ) );
109+
return new TypeError( format( 'invalid option. `%s` option must be either a string or an array of strings. Option: `%s`.', 'static', opts.static ) );
117110
}
118111
}
119112
if ( hasOwnProp( options, 'trustProxy' ) ) {
120113
opts.trustProxy = options.trustProxy;
121114
if ( !isBoolean( opts.trustProxy ) ) {
122-
return new TypeError( format( 'invalid option. `trustProxy` option must be a boolean. Option: `%s`.', opts.trustProxy ) );
115+
return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'trustProxy', opts.trustProxy ) );
123116
}
124117
}
125118
if ( hasOwnProp( options, 'ignoreTrailingSlash' ) ) {
126119
opts.ignoreTrailingSlash = options.ignoreTrailingSlash;
127120
if ( !isBoolean( opts.ignoreTrailingSlash ) ) {
128-
return new TypeError( format( 'invalid option. `ignoreTrailingSlash` option must be a boolean. Option: `%s`.', opts.ignoreTrailingSlash ) );
121+
return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'ignoreTrailingSlash', opts.ignoreTrailingSlash ) );
129122
}
130123
}
131124
return null;
@@ -134,4 +127,4 @@ function validate( opts, options ) {
134127

135128
// EXPORTS //
136129

137-
module.exports = validate;
130+
module.exports = validate;

0 commit comments

Comments
 (0)