-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump Node version and dependencies, compile assets
Adopt Wikimedia eslint config Add .editorconfig Prepare 5.2.0 release
- Loading branch information
1 parent
404e33c
commit eb30720
Showing
17 changed files
with
8,871 additions
and
11,166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# https://EditorConfig.org | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
# 4-char tab indentation | ||
[*.{js,json}] | ||
indent_style = tab | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,24 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es6": true | ||
}, | ||
"extends": [ | ||
"airbnb-base" | ||
], | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly", | ||
"$": "readonly", | ||
"mw": "readonly", | ||
"MoreMenu": "writable" | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 9 | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": "src/*.js" | ||
} | ||
], | ||
"rules": { | ||
"indent": ["error", 4], | ||
"max-len": ["error", {"code": 120}], | ||
"no-bitwise": "off", | ||
"no-param-reassign": "off", | ||
"arrow-parens": ["error", "as-needed"], | ||
"newline-per-chained-call": "off", | ||
"yoda": ["error", "always", {"onlyEquality": true}], | ||
"comma-dangle": ["error", "always-multiline"], | ||
"func-names": "off" | ||
} | ||
"env": { | ||
"browser": true, | ||
"es6": true | ||
}, | ||
"extends": [ | ||
"wikimedia/client/es6", | ||
"wikimedia/mediawiki", | ||
"wikimedia/jquery" | ||
], | ||
"globals": { | ||
"MoreMenu": "writable", | ||
"process": "readonly" | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 9 | ||
}, | ||
"rules": { | ||
"es-x/no-rest-spread-properties": "off", | ||
"mediawiki/class-doc": "off", | ||
"no-bitwise": "off", | ||
"no-jquery/no-global-selector": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
16.20.0 | ||
18.17.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,48 @@ | ||
/* eslint-disable max-len */ | ||
|
||
/** | ||
* Based on https://github.com/wikimedia-gadgets/twinkle/blob/master/scripts/server.js (CC BY-SA 3.0) | ||
* | ||
* Starts a local server so you can test your code by importing the src/ directory from your local. | ||
* Starts a local server, so you can test your code by importing the src/ directory from your local. | ||
* To use, run "node bin/server.js", then in your https://meta.wikimedia.org/wiki/Special:MyPage/global.js, | ||
* add the following: | ||
* mw.loader.using(['mediawiki.user', 'mediawiki.util', 'mediawiki.api', 'mediawiki.Title'], function () { | ||
* mw.loader.load('http://localhost:5501/dist/MoreMenu.messages.en.js'); | ||
* mw.loader.load('http://localhost:5501/src/MoreMenu.user.js'); | ||
* mw.loader.load('http://localhost:5501/src/MoreMenu.page.js'); | ||
* mw.loader.load('http://localhost:5501/src/MoreMenu.js'); | ||
* }); | ||
* mw.loader.using( [ 'mediawiki.user', 'mediawiki.util', 'mediawiki.api', 'mediawiki.Title' ], () => { | ||
* mw.loader.load( 'http://localhost:5501/dist/MoreMenu.messages.en.js' ); | ||
* mw.loader.load( 'http://localhost:5501/src/MoreMenu.user.js' ); | ||
* mw.loader.load( 'http://localhost:5501/src/MoreMenu.page.js' ); | ||
* mw.loader.load( 'http://localhost:5501/src/MoreMenu.js' ); | ||
* } ); | ||
*/ | ||
|
||
const http = require('http'); | ||
const fs = require('fs'); | ||
const http = require( 'http' ); | ||
const fs = require( 'fs' ); | ||
|
||
const server = http.createServer((request, response) => { | ||
const filePath = `.${request.url}`; | ||
let contentType; | ||
if (request.url.endsWith('.js')) { | ||
contentType = 'text/javascript'; | ||
} else if (request.url.endsWith('.css')) { | ||
contentType = 'text/css'; | ||
} else { | ||
contentType = 'text/plain'; | ||
} | ||
fs.readFile(filePath, (error, content) => { | ||
if (error) { | ||
response.end(`Oops, something went wrong: ${error.code} ..\n`); | ||
} else { | ||
response.writeHead(200, { 'Content-Type': contentType }); | ||
response.end(content, 'utf-8'); | ||
} | ||
}); | ||
}); | ||
const server = http.createServer( ( request, response ) => { | ||
const filePath = `.${ request.url }`; | ||
let contentType; | ||
if ( request.url.endsWith( '.js' ) ) { | ||
contentType = 'text/javascript'; | ||
} else if ( request.url.endsWith( '.css' ) ) { | ||
contentType = 'text/css'; | ||
} else { | ||
contentType = 'text/plain'; | ||
} | ||
// eslint-disable-next-line security/detect-non-literal-fs-filename | ||
fs.readFile( filePath, ( error, content ) => { | ||
if ( error ) { | ||
response.end( `Oops, something went wrong: ${ error.code } ..\n` ); | ||
} else { | ||
response.writeHead( 200, { 'Content-Type': contentType } ); | ||
response.end( content, 'utf-8' ); | ||
} | ||
} ); | ||
} ); | ||
|
||
const hostname = '127.0.0.1'; | ||
// eslint-disable-next-line no-restricted-globals | ||
const port = isNaN(Number(process.argv[2])) ? '5501' : process.argv[2]; | ||
|
||
server.listen(port, hostname, () => { | ||
// eslint-disable-next-line no-console | ||
console.log(`Server running at http://${hostname}:${port}/`); | ||
}); | ||
const port = isNaN( Number( process.argv[ 2 ] ) ) ? '5501' : process.argv[ 2 ]; | ||
|
||
server.listen( port, hostname, () => { | ||
// eslint-disable-next-line no-console | ||
console.log( `Server running at http://${ hostname }:${ port }/` ); | ||
} ); |
Oops, something went wrong.