[clean up][s]: removed outdated apollo server mocks and config module which is now replaced by next.config.js.
Also, removed all leftover and not used packages and npm scripts.
This commit is contained in:
@@ -1,25 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const nconf = require('nconf');
|
|
||||||
require('dotenv').config({ path: process.env.DOTENV_PATH || '.env' });
|
|
||||||
|
|
||||||
nconf.argv().env();
|
|
||||||
|
|
||||||
nconf.use('memory');
|
|
||||||
|
|
||||||
const dms = (process.env.DMS || 'http://mock.ckan').replace(/\/?$/, '');
|
|
||||||
const cms = (process.env.CMS || 'http://mock.cms').replace(/\/?$/, '');
|
|
||||||
|
|
||||||
// This is the object that you want to override in your own local config
|
|
||||||
nconf.defaults({
|
|
||||||
env: process.env.NODE_ENV || 'development',
|
|
||||||
debug: process.env.DEBUG || false,
|
|
||||||
DMS: dms,
|
|
||||||
CMS: cms,
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
get: nconf.get.bind(nconf),
|
|
||||||
set: nconf.set.bind(nconf),
|
|
||||||
reset: nconf.reset.bind(nconf),
|
|
||||||
};
|
|
||||||
@@ -32,7 +32,6 @@ const restLink = new RestLink({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function createApolloClient() {
|
function createApolloClient() {
|
||||||
const { publicRuntimeConfig } = getConfig();
|
|
||||||
return new ApolloClient({
|
return new ApolloClient({
|
||||||
link: restLink,
|
link: restLink,
|
||||||
cache: new InMemoryCache(),
|
cache: new InMemoryCache(),
|
||||||
|
|||||||
30
mock/.gitignore
vendored
30
mock/.gitignore
vendored
@@ -1,30 +0,0 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
/.pnp
|
|
||||||
.pnp.js
|
|
||||||
|
|
||||||
# testing
|
|
||||||
/coverage
|
|
||||||
|
|
||||||
# next.js
|
|
||||||
/.next/
|
|
||||||
/out/
|
|
||||||
|
|
||||||
# production
|
|
||||||
/build
|
|
||||||
|
|
||||||
# misc
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# debug
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
|
|
||||||
# local env files
|
|
||||||
.env.local
|
|
||||||
.env.development.local
|
|
||||||
.env.test.local
|
|
||||||
.env.production.local
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
const { GraphQLScalarType } = require('graphql');
|
|
||||||
const { ApolloServer } = require('apollo-server');
|
|
||||||
const { makeExecutableSchema } = require('graphql-tools');
|
|
||||||
const { importSchema } = require('graphql-import');
|
|
||||||
const typeDefs = importSchema('./schema.graphql');
|
|
||||||
|
|
||||||
const gdp = {
|
|
||||||
name: 'gdp',
|
|
||||||
title: 'Country, Regional and World GDP (Gross Domestic Product)',
|
|
||||||
notes:
|
|
||||||
'Country, regional and world GDP in current US Dollars ($). Regional means collections of countries e.g. Europe & Central Asia. Data is sourced from the World Bank and turned into a standard normalized CSV.',
|
|
||||||
resources: [
|
|
||||||
{
|
|
||||||
name: 'gdp',
|
|
||||||
id: 'gdp',
|
|
||||||
title: 'GDP data',
|
|
||||||
format: 'csv',
|
|
||||||
created: '2019-03-07T12:00:36.273495',
|
|
||||||
last_modified: '2020-05-07T12:00:36.273495',
|
|
||||||
datastore_active: false,
|
|
||||||
url: 'http://mock.filestore/gdp.csv',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
organization: {
|
|
||||||
title: 'World Bank',
|
|
||||||
name: 'world-bank',
|
|
||||||
description:
|
|
||||||
'The World Bank is an international financial institution that provides loans and grants to the governments of poorer countries for the purpose of pursuing capital projects.',
|
|
||||||
created: '2019-03-07T11:51:13.758844',
|
|
||||||
image_url:
|
|
||||||
'https://github.com/datahq/frontend/raw/master/public/img/avatars/world-bank.jpg',
|
|
||||||
},
|
|
||||||
metadata_created: '2019-03-07T11:56:19.696257',
|
|
||||||
metadata_modified: '2019-03-07T12:03:58.817280',
|
|
||||||
};
|
|
||||||
|
|
||||||
const population = {
|
|
||||||
name: 'population',
|
|
||||||
title: 'World population data',
|
|
||||||
notes:
|
|
||||||
'Population figures for countries, regions (e.g. Asia) and the world. Data comes originally from World Bank and has been converted into standard CSV.',
|
|
||||||
resources: [
|
|
||||||
{
|
|
||||||
name: 'population',
|
|
||||||
id: 'population',
|
|
||||||
title: 'Population data',
|
|
||||||
format: 'csv',
|
|
||||||
created: '2019-03-07T12:00:36.273495',
|
|
||||||
last_modified: '2020-05-07T12:00:36.273495',
|
|
||||||
datastore_active: true,
|
|
||||||
url: 'http://mock.filestore/population.csv',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
organization: {
|
|
||||||
title: 'World Bank',
|
|
||||||
name: 'world-bank',
|
|
||||||
description:
|
|
||||||
'The World Bank is an international financial institution that provides loans and grants to the governments of poorer countries for the purpose of pursuing capital projects.',
|
|
||||||
created: '2019-03-07T11:51:13.758844',
|
|
||||||
image_url:
|
|
||||||
'https://github.com/datahq/frontend/raw/master/public/img/avatars/world-bank.jpg',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const datapackages = [gdp, population];
|
|
||||||
|
|
||||||
const resolvers = {
|
|
||||||
Query: {
|
|
||||||
search: (parent, { query }) => ({
|
|
||||||
success: true,
|
|
||||||
result: {
|
|
||||||
count: 2,
|
|
||||||
sort: 'score desc, metadata_modified desc',
|
|
||||||
facets: {},
|
|
||||||
results: datapackages,
|
|
||||||
search_facets: {},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const schema = makeExecutableSchema({
|
|
||||||
typeDefs,
|
|
||||||
resolvers,
|
|
||||||
});
|
|
||||||
|
|
||||||
const server = new ApolloServer({
|
|
||||||
schema,
|
|
||||||
mocks: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
server.listen().then(({ url }) => {
|
|
||||||
console.log(`🚀 Server ready at ${url}`);
|
|
||||||
});
|
|
||||||
3089
mock/package-lock.json
generated
3089
mock/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "mock",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"start": "nodemon index.js",
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"apollo-server": "^2.15.0",
|
|
||||||
"graphql": "^15.1.0",
|
|
||||||
"graphql-import": "^1.0.2"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"nodemon": "^2.0.2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
type Query {
|
|
||||||
search(query: SearchQuery!): Response!
|
|
||||||
}
|
|
||||||
|
|
||||||
type Query {
|
|
||||||
dataset(id: String!): DatasetResponse!
|
|
||||||
}
|
|
||||||
|
|
||||||
input SearchQuery {
|
|
||||||
q: String!
|
|
||||||
}
|
|
||||||
|
|
||||||
type Response {
|
|
||||||
success: Boolean!
|
|
||||||
result: Result!
|
|
||||||
}
|
|
||||||
|
|
||||||
type DatasetResponse {
|
|
||||||
success: Boolean!
|
|
||||||
result: Package!
|
|
||||||
}
|
|
||||||
|
|
||||||
type Result {
|
|
||||||
count: Int!
|
|
||||||
sort: String!
|
|
||||||
facets: String!
|
|
||||||
search_facets: String!
|
|
||||||
results: [Package!]!
|
|
||||||
}
|
|
||||||
|
|
||||||
type Package {
|
|
||||||
name: String!
|
|
||||||
title: String!
|
|
||||||
notes: String!
|
|
||||||
resources: [Resource!]!
|
|
||||||
organization: Organization!
|
|
||||||
metadata_created: String!
|
|
||||||
metadata_modified: String!
|
|
||||||
}
|
|
||||||
|
|
||||||
type Resource {
|
|
||||||
name: String!
|
|
||||||
id: String!
|
|
||||||
title: String!
|
|
||||||
format: String!
|
|
||||||
created: String!
|
|
||||||
last_modified: String!
|
|
||||||
datastore_active: Boolean!
|
|
||||||
url: String!
|
|
||||||
}
|
|
||||||
|
|
||||||
type Organization {
|
|
||||||
name: String!
|
|
||||||
title: String!
|
|
||||||
description: String!
|
|
||||||
created: String!
|
|
||||||
image_url: String!
|
|
||||||
}
|
|
||||||
10
package.json
10
package.json
@@ -3,9 +3,6 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"mock": "npm start --prefix mock",
|
|
||||||
"dev-mock": "GRAPHQL_ENDPOINT=\"http://localhost:4000/\" run-p dev mock",
|
|
||||||
"postinstall": "npm install --prefix mock",
|
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
@@ -20,20 +17,15 @@
|
|||||||
"@apollo/react-hooks": "^3.1.5",
|
"@apollo/react-hooks": "^3.1.5",
|
||||||
"apollo-cache-inmemory": "^1.6.6",
|
"apollo-cache-inmemory": "^1.6.6",
|
||||||
"apollo-client": "^2.6.10",
|
"apollo-client": "^2.6.10",
|
||||||
"apollo-datasource-rest": "^0.9.2",
|
|
||||||
"apollo-link": "^1.2.14",
|
"apollo-link": "^1.2.14",
|
||||||
"apollo-link-http": "^1.5.17",
|
|
||||||
"apollo-link-rest": "^0.8.0-beta.0",
|
"apollo-link-rest": "^0.8.0-beta.0",
|
||||||
"apollo-link-schema": "^1.2.5",
|
|
||||||
"bytes": "^3.1.0",
|
"bytes": "^3.1.0",
|
||||||
"graphql": "^15.1.0",
|
"graphql": "^15.1.0",
|
||||||
"graphql-anywhere": "^4.2.7",
|
"graphql-anywhere": "^4.2.7",
|
||||||
"graphql-tag": "^2.10.3",
|
"graphql-tag": "^2.10.3",
|
||||||
"graphql-tools": "^6.0.10",
|
|
||||||
"markdown-it": "^11.0.0",
|
"markdown-it": "^11.0.0",
|
||||||
"next": "9.4.2",
|
"next": "9.4.2",
|
||||||
"qs": "^6.9.4",
|
"qs": "^6.9.4",
|
||||||
"querystring": "^0.2.0",
|
|
||||||
"react": "16.13.1",
|
"react": "16.13.1",
|
||||||
"react-dom": "16.13.1",
|
"react-dom": "16.13.1",
|
||||||
"slugify": "^1.4.0"
|
"slugify": "^1.4.0"
|
||||||
@@ -45,11 +37,9 @@
|
|||||||
"@types/react": "^16.9.35",
|
"@types/react": "^16.9.35",
|
||||||
"babel-jest": "^26.0.1",
|
"babel-jest": "^26.0.1",
|
||||||
"babel-plugin-graphql-tag": "^2.5.0",
|
"babel-plugin-graphql-tag": "^2.5.0",
|
||||||
"dotenv": "^8.2.0",
|
|
||||||
"husky": ">=4",
|
"husky": ">=4",
|
||||||
"jest": "^26.0.1",
|
"jest": "^26.0.1",
|
||||||
"lint-staged": ">=10",
|
"lint-staged": ">=10",
|
||||||
"nconf": "^0.10.0",
|
|
||||||
"nock": "^12.0.3",
|
"nock": "^12.0.3",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"postcss-preset-env": "^6.7.0",
|
"postcss-preset-env": "^6.7.0",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { GetServerSideProps } from 'next';
|
import { GetServerSideProps } from 'next';
|
||||||
import { useQuery } from '@apollo/react-hooks';
|
import { useQuery } from '@apollo/react-hooks';
|
||||||
import { initializeApollo } from '../../../lib/apolloClient';
|
import { initializeApollo } from '../../../lib/apolloClient';
|
||||||
import config from '../../../config';
|
|
||||||
import utils from '../../../utils';
|
import utils from '../../../utils';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import Nav from '../../../components/home/Nav';
|
import Nav from '../../../components/home/Nav';
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { GetServerSideProps } from 'next';
|
|||||||
import gql from 'graphql-tag';
|
import gql from 'graphql-tag';
|
||||||
import { useQuery } from '@apollo/react-hooks';
|
import { useQuery } from '@apollo/react-hooks';
|
||||||
import { initializeApollo } from '../../../../../lib/apolloClient';
|
import { initializeApollo } from '../../../../../lib/apolloClient';
|
||||||
import config from '../../../../../config';
|
|
||||||
import utils from '../../../../../utils';
|
import utils from '../../../../../utils';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import Nav from '../../../../../components/home/Nav';
|
import Nav from '../../../../../components/home/Nav';
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { GetServerSideProps } from 'next';
|
import { GetServerSideProps } from 'next';
|
||||||
import { initializeApollo } from '../lib/apolloClient';
|
import { initializeApollo } from '../lib/apolloClient';
|
||||||
import config from '../config';
|
|
||||||
import utils from '../utils';
|
import utils from '../utils';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import Nav from '../components/home/Nav';
|
import Nav from '../components/home/Nav';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const { URL } = require('url');
|
const { URL } = require('url');
|
||||||
const bytes = require('bytes');
|
const bytes = require('bytes');
|
||||||
const slugify = require('slugify');
|
const slugify = require('slugify');
|
||||||
const config = require('../config');
|
const config = require('../next.config.js');
|
||||||
|
|
||||||
module.exports.ckanToDataPackage = function (descriptor) {
|
module.exports.ckanToDataPackage = function (descriptor) {
|
||||||
// Make a copy
|
// Make a copy
|
||||||
|
|||||||
Reference in New Issue
Block a user