From ef1b927861f9a949aed20341144ffb5bfd42f038 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 19 Sep 2022 11:22:21 +1000 Subject: Removing the web client --- javascript/server/.eslintrc.js | 5 - javascript/server/index.js | 30 --- javascript/server/mocks/packages.js | 397 ------------------------------------ 3 files changed, 432 deletions(-) delete mode 100644 javascript/server/.eslintrc.js delete mode 100644 javascript/server/index.js delete mode 100644 javascript/server/mocks/packages.js (limited to 'javascript/server') diff --git a/javascript/server/.eslintrc.js b/javascript/server/.eslintrc.js deleted file mode 100644 index 1147d29..0000000 --- a/javascript/server/.eslintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - env: { - node: true - } -}; diff --git a/javascript/server/index.js b/javascript/server/index.js deleted file mode 100644 index 330a75c..0000000 --- a/javascript/server/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/* eslint-env node */ -'use strict'; - -//https://discuss.emberjs.com/t/how-to-disable-http-mock-server-within-environment-config-file/6660/9 - -//To use http mocks from server/mocks for testing: -//ember server -//To use real server: -//ember server --proxy=http://localhost:8080/ - -function usingProxy() { - return !!process.argv.filter(function (arg) { - return arg.indexOf('--proxy') === 0; - }).length; -} - -module.exports = function(app) { - if (usingProxy()) { return; } - - const globSync = require('glob').sync; - const mocks = globSync('./mocks/**/*.js', { cwd: __dirname }).map(require); - const proxies = globSync('./proxies/**/*.js', { cwd: __dirname }).map(require); - - // Log proxy requests - const morgan = require('morgan'); - app.use(morgan('dev')); - - mocks.forEach(route => route(app)); - proxies.forEach(route => route(app)); -}; diff --git a/javascript/server/mocks/packages.js b/javascript/server/mocks/packages.js deleted file mode 100644 index 0a60cf3..0000000 --- a/javascript/server/mocks/packages.js +++ /dev/null @@ -1,397 +0,0 @@ -/* eslint-env node */ -'use strict'; - -const packages = [ - { - "versions": [ - "0.1.0.0" - ], - "name": "test-package" - } -]; - -const testPackage = { - "directoryTree": { - "tag": "Dir", - "contents": [ - { - "tag": "File", - "path": "Setup.hs", - "isHaskellModule": false, - "name": "Setup.hs" - }, - { - "tag": "File", - "path": "stack-8.0.2.yaml", - "isHaskellModule": false, - "name": "stack-8.0.2.yaml" - }, - { - "tag": "File", - "path": "stack.yaml", - "isHaskellModule": false, - "name": "stack.yaml" - }, - { - "tag": "Dir", - "contents": [ - { - "tag": "File", - "path": "src/Lib.hs", - "isHaskellModule": true, - "name": "Lib.hs" - }, - { - "tag": "File", - "path": "src/Types.hs", - "isHaskellModule": true, - "name": "Types.hs" - } - ], - "name": "src" - }, - { - "tag": "Dir", - "contents": [ - { - "tag": "File", - "path": "app/Main.hs", - "isHaskellModule": true, - "name": "Main.hs" - } - ], - "name": "app" - }, - { - "tag": "Dir", - "contents": [ - { - "tag": "File", - "path": "test/Spec.hs", - "isHaskellModule": true, - "name": "Spec.hs" - } - ], - "name": "test" - }, - { - "tag": "File", - "path": "package.yaml", - "isHaskellModule": false, - "name": "package.yaml" - }, - { - "tag": "File", - "path": "test-package.cabal", - "isHaskellModule": false, - "name": "test-package.cabal" - } - ], - "name": "test-package" - }, - "modules": { - "app/Main.hs": [], - "src/Types.hs": [], - "test/Spec.hs": [], - "src/Lib.hs": [] - }, - "id": "test-package-0.1.0.0" -}; - -const testModuleInfo = { - "occurrences": { - "3-8-11": { - "sort": { - "tag": "ModuleId", - "contents": { - "packageId": { - "name": "test-package", - "version": "0.1.0.0" - }, - "tag": "ApproximateLocation", - "moduleName": "Lib", - "name": "Lib", - "componentId": "exe-test-package-exe", - "entity": "Mod" - } - }, - "description": "ImportDecl" - }, - "6-8-16": { - "internalId": "4", - "sort": { - "tag": "ValueId" - }, - "description": "HsVar" - }, - "5-1-5": { - "internalId": "0", - "sort": { - "tag": "ValueId" - }, - "description": "TypeSig" - }, - "5-9-11": { - "internalId": "2", - "sort": { - "tag": "TypeId" - }, - "description": "HsTyVar" - }, - "6-1-5": { - "isBinder": true, - "internalId": "0", - "sort": { - "tag": "ValueId" - }, - "description": "Match" - }, - "5-12-14": { - "internalId": "3", - "sort": { - "tag": "TypeId" - }, - "description": "HsTupleTy" - } - }, - "identifiers": { - "7": { - "isExported": false, - "idType": { - "components": [ - { - "tag": "TyCon", - "name": "RuntimeRep", - "internalId": "6" - } - ] - }, - "locationInfo": { - "packageId": { - "name": "ghc-prim", - "version": "0.5.1.1" - }, - "tag": "ApproximateLocation", - "haddockAnchorId": "LiftedRep", - "moduleName": "GHC.Types", - "name": "LiftedRep", - "componentId": "lib", - "entity": "Val" - }, - "nameSpace": "DataName", - "internalId": "7", - "sort": "External", - "occName": "LiftedRep", - "externalId": "ghc-prim-0.5.1.1|GHC.Types|Val|LiftedRep", - "demangledOccName": "LiftedRep" - }, - "0": { - "isExported": true, - "idType": { - "components": [ - { - "tag": "TyCon", - "name": "IO", - "internalId": "2" - }, - { - "tag": "Text", - "contents": " ()" - } - ] - }, - "locationInfo": { - "packageId": { - "name": "test-package", - "version": "0.1.0.0" - }, - "tag": "ExactLocation", - "moduleName": "Main", - "startLine": 6, - "endLine": 6, - "modulePath": "app/Main.hs", - "startColumn": 1, - "endColumn": 5 - }, - "nameSpace": "VarName", - "internalId": "0", - "details": "VanillaId", - "sort": "External", - "occName": "main", - "externalId": "test-package-0.1.0.0|Main|Val|main", - "demangledOccName": "main" - }, - "4": { - "isExported": false, - "idType": { - "components": [ - { - "tag": "TyCon", - "name": "IO", - "internalId": "2" - }, - { - "tag": "Text", - "contents": " ()" - } - ] - }, - "doc": "

someFunc documentation

", - "locationInfo": { - "packageId": { - "name": "test-package", - "version": "0.1.0.0" - }, - "tag": "ExactLocation", - "moduleName": "Lib", - "startLine": 9, - "endLine": 9, - "modulePath": "src/Lib.hs", - "startColumn": 1, - "endColumn": 9 - }, - "nameSpace": "VarName", - "internalId": "4", - "details": "VanillaId", - "sort": "External", - "occName": "someFunc", - "externalId": "test-package-0.1.0.0|Lib|Val|someFunc", - "demangledOccName": "someFunc" - }, - "2": { - "isExported": false, - "idType": { - "components": [ - { - "tag": "Text", - "contents": "* -> *" - } - ] - }, - "locationInfo": { - "packageId": { - "name": "ghc-prim", - "version": "0.5.1.1" - }, - "tag": "ApproximateLocation", - "haddockAnchorId": "IO", - "moduleName": "GHC.Types", - "name": "IO", - "componentId": "lib", - "entity": "Typ" - }, - "nameSpace": "TcClsName", - "internalId": "2", - "sort": "External", - "occName": "IO", - "externalId": "ghc-prim-0.5.1.1|GHC.Types|Typ|IO", - "demangledOccName": "IO" - }, - "5": { - "isExported": false, - "idType": { - "components": [ - { - "tag": "TyCon", - "name": "RuntimeRep", - "internalId": "6" - }, - { - "tag": "Text", - "contents": " -> *" - } - ] - }, - "locationInfo": { - "packageId": { - "name": "ghc-prim", - "version": "0.5.1.1" - }, - "tag": "ApproximateLocation", - "haddockAnchorId": "TYPE", - "moduleName": "GHC.Prim", - "name": "TYPE", - "componentId": "lib", - "entity": "Typ" - }, - "nameSpace": "TcClsName", - "internalId": "5", - "sort": "External", - "occName": "TYPE", - "externalId": "ghc-prim-0.5.1.1|GHC.Prim|Typ|TYPE", - "demangledOccName": "TYPE" - }, - "3": { - "isExported": false, - "idType": { - "components": [ - { - "tag": "Text", - "contents": "*" - } - ] - }, - "locationInfo": { - "packageId": { - "name": "ghc-prim", - "version": "0.5.1.1" - }, - "tag": "ApproximateLocation", - "haddockAnchorId": "-40--41-", - "moduleName": "GHC.Tuple", - "name": "()", - "componentId": "lib", - "entity": "Typ" - }, - "nameSpace": "TcClsName", - "internalId": "3", - "sort": "External", - "occName": "()", - "externalId": "ghc-prim-0.5.1.1|GHC.Tuple|Typ|()", - "demangledOccName": "()" - } - }, - "name": "Main", - "sourceCodeHtml": "
1module Main where
2
3import Lib
4
5main :: IO ()
6main = someFunc
7
8
", - "id": "app/Main.hs", - "declarations": [ - { - "isExported": true, - "lineNumber": 6, - "declType": { - "components": [ - { - "tag": "TyCon", - "name": "IO", - "internalId": "2" - }, - { - "tag": "Text", - "contents": " ()" - } - ] - }, - "name": "main", - "sort": "ValD" - } - ] -}; - -module.exports = function(app) { - const express = require('express'); - let packagesRouter = express.Router(); - - packagesRouter.get('/api/packages', function(req, res) { - res.send(packages); - }); - - packagesRouter.get('/files/test-package-0.1.0.0/.haskell-code-explorer/packageInfo.json', function(req, res) { - res.send(testPackage); - }); - - packagesRouter.get('/files/test-package-0.1.0.0/.haskell-code-explorer/app%252FMain.hs.json', function(req, res) { - res.send(testModuleInfo); - }); - - app.use('/', packagesRouter); -}; -- cgit v1.2.3