Commit b67cdf5b authored by aleclofabbro's avatar aleclofabbro

removed .graphql files refereces from build scripts

parent 7b9329f0
......@@ -41,8 +41,6 @@ yarn.lock
.env.development.local
.env.test.local
.env.production.local
src/fragmentTypes.json
src/mn-constants.tsx
# sentry
sentry.tsx
......
{
schema: {
files: "src/graphql/main/team.moodle.net_schema.graphql"
},
query: {
files: [ /* define file paths which you'd like the gql parser to watch and give autocomplete suggestions for */
{
match: ['src/**/*.ts', 'src/**/*.tsx'], // match multiple extensions
parser: ['EmbeddedQueryParser', { startTag: 'gql`', endTag: '`' }], // parse any query inside gql template literal
},
{
match: 'ui/src/**/*.js', // for js
parser: ['EmbeddedQueryParser', { startTag: 'Relay\\.QL`', endTag: '`' }], // parse Relay syntax
isRelay: true,
},
{
match: 'src/**/!(*.client).graphql',
parser: 'QueryParser',
},
],
},
}
\ No newline at end of file
projects:
team:
schemaPath: src/graphql/main/team.moodle.net_schema.graphql
includes: ["src/**/!(*.client).graphql"]
extensions:
endpoints:
default: https://team.moodle.net/api/graphql
src/fragmentTypes.json
\ No newline at end of file
......@@ -84,7 +84,7 @@ module.exports = {
// https://github.com/facebookincubator/create-react-app/issues/290
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx', '.tsx', '.ts', '.graphql'],
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx', '.tsx', '.ts'],
alias: {
'~': paths.appSrc
},
......@@ -126,10 +126,6 @@ module.exports = {
// match the requirements. When no loader matches it will fall
// back to the "file" loader at the end of the loader list.
oneOf: [
{
test: /\.graphql$/,
loader: require.resolve('graphql-tag/loader'),
},
// "url" loader works like "file" loader except that it embeds assets
// smaller than specified limit in bytes as data URLs to avoid requests.
// A missing `test` is equivalent to a match.
......
......@@ -80,7 +80,7 @@ module.exports = {
// https://github.com/facebookincubator/create-react-app/issues/290
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx', '.tsx', '.ts', '.graphql'],
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx', '.tsx', '.ts'],
alias: {
'~': paths.appSrc,
},
......@@ -123,10 +123,6 @@ module.exports = {
// match the requirements. When no loader matches it will fall
// back to the "file" loader at the end of the loader list.
oneOf: [
{
test: /\.graphql$/,
loader: require.resolve('graphql-tag/loader'),
},
// "url" loader works just like "file" loader but it also embeds
// assets smaller than specified size as data URLs to avoid requests.
{
......
......@@ -12,9 +12,7 @@ process.on('unhandledRejection', err => {
// Ensure environment variables are read.
require('../config/env');
const fetch = require('node-fetch');
const fs = require('fs');
const url = process.env.REACT_APP_GRAPHQL_ENDPOINT
const chalk = require('chalk');
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
......@@ -57,47 +55,6 @@ if (process.env.HOST) {
console.log(`Learn more here: ${chalk.yellow('http://bit.ly/2mwWSwH')}`);
console.log();
}
console.log('eh hooo')
console.log(url)
console.log(process.env.REACT_APP_GRAPHQL_ENDPOINT)
fetch(`${url}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
variables: {},
query: `
{
__schema {
types {
kind
name
possibleTypes {
name
}
}
}
}
`,
}),
})
.then(result => result.json())
.then(result => {
// here we're filtering out any type information unrelated to unions or interfaces
const filteredData = result.data.__schema.types.filter(
type => type.possibleTypes !== null,
);
result.data.__schema.types = filteredData;
console.log(result.data)
fs.writeFile('./src/fragmentTypes.json', JSON.stringify(result.data), err => {
if (err) {
console.error('Error writing fragmentTypes file', err);
} else {
console.log(result.data)
console.log('Fragment types successfully extracted!');
}
});
})
.catch(err => console.error(err));
// We attempt to use the default port but if it is busy, we offer the user to
......
{"__schema":{"types":[{"kind":"UNION","name":"ActivityContext","possibleTypes":[{"name":"Collection"},{"name":"Comment"},{"name":"Community"},{"name":"Flag"},{"name":"Follow"},{"name":"Like"},{"name":"Resource"},{"name":"User"}]},{"kind":"UNION","name":"FollowContext","possibleTypes":[{"name":"Collection"},{"name":"Community"},{"name":"Thread"},{"name":"User"}]},{"kind":"UNION","name":"FlagContext","possibleTypes":[{"name":"Collection"},{"name":"Comment"},{"name":"Community"},{"name":"Resource"},{"name":"User"}]},{"kind":"UNION","name":"FeatureContext","possibleTypes":[{"name":"Collection"},{"name":"Community"}]},{"kind":"UNION","name":"DeleteContext","possibleTypes":[{"name":"Collection"},{"name":"Comment"},{"name":"Community"},{"name":"Feature"},{"name":"Flag"},{"name":"Follow"},{"name":"Like"},{"name":"Resource"},{"name":"Thread"},{"name":"User"}]},{"kind":"UNION","name":"ThreadContext","possibleTypes":[{"name":"Collection"},{"name":"Community"},{"name":"Flag"},{"name":"Resource"}]},{"kind":"UNION","name":"LikeContext","possibleTypes":[{"name":"Collection"},{"name":"Comment"},{"name":"Community"},{"name":"Resource"},{"name":"User"}]}]}}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment