Browse Source

Convert constants.js to commonjs

pull/3603/head
Pavel Djundik 2 years ago
parent
commit
4a345eb6d9
  1. 1
      .npmignore
  2. 2
      client/components/App.vue
  3. 2
      client/components/Message.vue
  4. 2
      client/components/MessageCondensed.vue
  5. 2
      client/components/MessageList.vue
  6. 3
      client/js/autocompletion.js
  7. 3
      client/js/constants.js
  8. 3
      client/js/router.js
  9. 2
      client/js/socket-events/commands.js
  10. 3
      client/js/vue.js
  11. 2
      test/client/js/constantsTest.js

1
.npmignore

@ -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

2
client/components/App.vue

@ -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";

2
client/components/Message.vue

@ -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;

2
client/components/MessageCondensed.vue

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

2
client/components/MessageList.vue

@ -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";

3
client/js/autocompletion.js

@ -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;

3
client/js/constants.js

@ -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,

3
client/js/router.js

@ -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({

2
client/js/socket-events/commands.js

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

3
client/js/vue.js

@ -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);

2
test/client/js/constantsTest.js

@ -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() {

Loading…
Cancel
Save