Don’t use Moment.js

Plugins can still use Discord’s Moment.js with WebpackModules
This commit is contained in:
Samuel Elliott 2018-05-21 16:41:41 +01:00
parent 665c1d5fe4
commit cfaf581ae1
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
12 changed files with 13 additions and 24 deletions

View File

@ -11,7 +11,6 @@
import jQuery from 'jquery';
import lodash from 'lodash';
import Vue from 'vue';
import moment from 'moment';
export { jQuery as $ };
@ -29,11 +28,6 @@ export default class {
static get lodash() { return lodash }
static get _() { return this.lodash }
/**
* Moment
*/
static get moment() { return moment }
/**
* Vue
*/

View File

@ -34,7 +34,7 @@ module.exports = {
electron: 'window.require("electron")',
fs: 'window.require("fs")',
path: 'window.require("path")',
node_utils: 'window.require("util")',
util: 'window.require("util")',
sparkplug: 'require("../../core/dist/sparkplug")'
},
resolve: {

View File

@ -35,7 +35,7 @@ module.exports = {
electron: 'window.require("electron")',
fs: 'window.require("fs")',
path: 'window.require("path")',
node_utils: 'window.require("util")',
util: 'window.require("util")',
sparkplug: 'require("./sparkplug")'
},
resolve: {

View File

@ -9,8 +9,7 @@
*/
import { FileUtils } from './utils';
import moment from 'moment';
import node_utils from 'node_utils';
import node_utils from 'util';
export const logLevels = {
'log': 'log',
@ -60,7 +59,7 @@ export default class Logger {
}
static get timestamp() {
return moment().format('DD/MM/YY hh:mm:ss');
return (new Date()).toLocaleString('en-GB');
}
}

View File

@ -33,7 +33,7 @@
</template>
<script>
import ClientIPC from 'bdipc';
import { ClientIPC } from 'common';
import { remote } from 'electron';

View File

@ -23,7 +23,8 @@ module.exports = {
},
externals: {
electron: 'window.require("electron")',
fs: 'window.require("fs")'
fs: 'window.require("fs")',
util: 'window.require("util")'
},
resolve: {
alias: {

View File

@ -24,7 +24,8 @@ module.exports = {
},
externals: {
electron: 'window.require("electron")',
fs: 'window.require("fs")'
fs: 'window.require("fs")',
util: 'window.require("util")'
},
resolve: {
alias: {

5
package-lock.json generated
View File

@ -7951,11 +7951,6 @@
"minimist": "0.0.8"
}
},
"moment": {
"version": "2.22.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.22.1.tgz",
"integrity": "sha512-shJkRTSebXvsVqk56I+lkb2latjBs8I+pc2TzWc545y2iFnSjm7Wg0QMh+ZWcdSLQyGEau5jI8ocnmkyTgr9YQ=="
},
"move-concurrently": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",

View File

@ -16,7 +16,6 @@
},
"private": false,
"dependencies": {
"moment": "^2.22.1",
"nedb": "^1.8.0",
"node-sass": "^4.7.2"
},

View File

@ -1,6 +1,6 @@
module.exports = (Plugin, Api, Vendor) =>
module.exports = (Plugin, Api, Vendor) =>
const { $, moment } = Vendor;
const { $ } = Vendor;
const { Events } = Api;
const test = 'Testing';

View File

@ -1,6 +1,6 @@
module.exports = (Plugin, Api, Vendor) => {
const { $, moment } = Vendor;
const { $ } = Vendor;
const { Events, Logger } = Api;
return class extends Plugin {

View File

@ -1,6 +1,6 @@
module.exports = (Plugin, Api, Vendor, Dependencies) => {
const { $, moment, _ } = Vendor;
const { $, _ } = Vendor;
const { Events, Logger, InternalSettings, CssUtils } = Api;
return class extends Plugin {