Convert constants.js to commonjs

This commit is contained in:
Pavel Djundik 2019-12-18 00:10:50 +02:00
parent 86341f063c
commit 4a345eb6d9
11 changed files with 15 additions and 10 deletions

View file

@ -9,6 +9,7 @@
# Ignore client folder as it's being built into public/ folder
# except for the specified files which are used by the server
client/**
!client/js/constants.js
!client/js/helpers/ircmessageparser/findLinks.js
!client/js/helpers/ircmessageparser/cleanIrcMessage.js
!client/index.html.tpl

View file

@ -10,8 +10,8 @@
</template>
<script>
const constants = require("../js/constants");
import throttle from "lodash/throttle";
import constants from "../js/constants";
import storage from "../js/localStorage";
import Sidebar from "./Sidebar.vue";

View file

@ -68,12 +68,12 @@
</template>
<script>
const constants = require("../js/constants");
import dayjs from "dayjs";
import Username from "./Username.vue";
import LinkPreview from "./LinkPreview.vue";
import ParsedMessage from "./ParsedMessage.vue";
import MessageTypes from "./MessageTypes";
import constants from "../js/constants";
MessageTypes.ParsedMessage = ParsedMessage;
MessageTypes.LinkPreview = LinkPreview;

View file

@ -18,7 +18,7 @@
</template>
<script>
import constants from "../js/constants";
const constants = require("../js/constants");
import Message from "./Message.vue";
export default {

View file

@ -56,7 +56,7 @@
<script>
require("intersection-observer");
import constants from "../js/constants";
const constants = require("../js/constants");
import clipboard from "../js/clipboard";
import socket from "../js/socket";
import Message from "./Message.vue";

View file

@ -1,11 +1,12 @@
"use strict";
const constants = require("./constants");
import Mousetrap from "mousetrap";
import {Textcomplete, Textarea} from "textcomplete";
import fuzzy from "fuzzy";
import emojiMap from "./helpers/simplemap.json";
import constants from "./constants";
import store from "./store";
export default enableAutocomplete;

View file

@ -26,7 +26,8 @@ const timeFormats = {
msgWithSeconds: "HH:mm:ss",
};
export default {
// This file is required by server, can't use es6 export
module.exports = {
colorCodeMap,
commands: [],
condensedTypes,

View file

@ -1,5 +1,7 @@
"use strict";
const constants = require("./constants");
import Vue from "vue";
import VueRouter from "vue-router";
@ -12,7 +14,6 @@ import Help from "../components/Windows/Help.vue";
import Changelog from "../components/Windows/Changelog.vue";
import NetworkEdit from "../components/Windows/NetworkEdit.vue";
import RoutedChat from "../components/RoutedChat.vue";
import constants from "./constants";
import store from "./store";
const router = new VueRouter({

View file

@ -1,4 +1,4 @@
import constants from "../constants";
const constants = require("../constants");
import socket from "../socket";
socket.on("commands", function(commands) {

View file

@ -1,12 +1,13 @@
"use strict";
const constants = require("./constants");
import Vue from "vue";
import store from "./store";
import App from "../components/App.vue";
import localetime from "./helpers/localetime";
import storage from "./localStorage";
import {router, navigate} from "./router";
import constants from "./constants";
import socket from "./socket";
Vue.filter("localetime", localetime);

View file

@ -1,7 +1,7 @@
"use strict";
const expect = require("chai").expect;
const constants = require("../../../client/js/constants").default;
const constants = require("../../../client/js/constants");
describe("client-side constants", function() {
describe(".colorCodeMap", function() {