Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw error when run jss start using FETCH_WITH=GraphQL #920

Merged
merged 3 commits into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"build:client": "cross-env-shell ng build --prod --deploy-url $npm_package_config_sitecoreDistPath/browser/ --output-path=$npm_package_config_buildArtifactsPath/browser/",
"build:server": "cross-env-shell ng run <%- appName %>:server:production --output-path=$npm_package_config_buildArtifactsPath/server --output-hashing=none --bundle-dependencies true",
"postbuild:server": "move-cli ./dist/server/main.js ./dist/server.bundle.js && del-cli ./dist/server",
"bootstrap": "ts-node --project src/tsconfig.webpack-server.json scripts/bootstrap.ts",
"bootstrap": "set \"FETCH_WITH=<%- fetchWith %>\" && ts-node --project src/tsconfig.webpack-server.json scripts/bootstrap.ts",
addy-pathania marked this conversation as resolved.
Show resolved Hide resolved
"graphql:update": "ts-node --project src/tsconfig.webpack-server.json ./scripts/update-graphql-fragment-data.ts"
},
"private": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const projects = require('../angular.json').projects;

const disconnected = process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED;

if (disconnected && process.env.FETCH_WITH === 'GraphQL') {
addy-pathania marked this conversation as resolved.
Show resolved Hide resolved
throw new Error("GraphQL requests to Dictionary and Layout service are not supported in disconnected mode.")
}

/*
CONFIG GENERATION
Generates the /src/environments/environment.ts file which contains runtime configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const disconnected = process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED;
const port = process.env.PORT || 3000;
const configOverride: { [key: string]: string } = {};
if (disconnected) {
if (process.env.FETCH_WITH === 'GraphQL') {
addy-pathania marked this conversation as resolved.
Show resolved Hide resolved
throw new Error('GraphQL requests to Dictionary and Layout service are not supported in disconnected mode.')
}
configOverride.sitecoreApiHost = `http://localhost:${port}`;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"build:client": "cross-env-shell PUBLIC_URL=$npm_package_config_sitecoreDistPath \"react-scripts build\"",
"build:client:rendering-host": "cross-env-shell PUBLIC_URL=$npm_package_config_tunnelUrl \"react-scripts build\"",
"build:server": "cross-env-shell NODE_ENV=production \"webpack --config server/server.webpack.config.js\"",
"bootstrap": "node scripts/bootstrap.js",
"bootstrap": "set \"FETCH_WITH=<%- fetchWith %>\" && node scripts/bootstrap.js",
addy-pathania marked this conversation as resolved.
Show resolved Hide resolved
"graphql:update": "node -r @babel/register ./scripts/update-graphql-fragment-data.js",
"test": "react-scripts test --env=jsdom",
"lint": "eslint ./src/**/*.js ./sitecore/definitions/**/*.js ./scripts/**/*.js ./server/**/*.js ./data/**/*.yml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const configGenerator = require('./generate-config');

const disconnected = process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED;

if (disconnected && process.env.FETCH_WITH === 'GraphQL') {
addy-pathania marked this conversation as resolved.
Show resolved Hide resolved
throw new Error("GraphQL requests to Dictionary and Layout service are not supported in disconnected mode.")
}

/*
CONFIG GENERATION
Generates the /src/temp/config.js file which contains runtime configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"start:watch-components": "node scripts/generate-component-factory.js --watch",
"build:client": "cross-env-shell BUILD_TARGET_ENV=client PUBLIC_URL=$npm_package_config_sitecoreDistPath \"vue-cli-service build\"",
"build:server": "cross-env-shell BUILD_TARGET_ENV=server \"vue-cli-service build --no-clean\"",
"bootstrap": "node scripts/bootstrap.js",
"bootstrap": "set \"FETCH_WITH=<%- fetchWith %>\" &&node scripts/bootstrap.js",
addy-pathania marked this conversation as resolved.
Show resolved Hide resolved
"graphql:update": "cross-env-shell VUE_CLI_BABEL_TRANSPILE_MODULES=true VUE_CLI_BABEL_TARGET_NODE=true \"node -r @babel/register ./scripts/update-graphql-fragment-data.js\"",
"lint": "vue-cli-service lint ./src/**/*.vue ./src/**/*.js ./sitecore/definitions/**/*.js ./scripts/**/*.js ./server/**/*.js ./data/**/*.yml"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const vueConfig = require('../vue.config');

const disconnected = process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED;

if (disconnected && process.env.FETCH_WITH === 'GraphQL') {
addy-pathania marked this conversation as resolved.
Show resolved Hide resolved
throw new Error("GraphQL requests to Dictionary and Layout service are not supported in disconnected mode.")
}

/*
CONFIG GENERATION
Generates the /src/temp/config.js file which contains runtime configuration
Expand Down