Merge pull request #2518 from abdonrd/fix-gae-deploy

Avoid write files if not development environment
This commit is contained in:
Jim LAURIE 2019-01-09 15:55:36 +01:00 committed by GitHub
commit 04a11ac18f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 5 deletions

View File

@ -1,6 +1,7 @@
{
"host": "localhost",
"port": "${process.env.PORT || 1337}",
"production": true,
"proxy": {
"enabled": false
},

View File

@ -1,6 +1,7 @@
{
"host": "localhost",
"port": "${process.env.PORT || 1337}",
"production": true,
"proxy": {
"enabled": false
},

View File

@ -266,8 +266,10 @@ module.exports = {
resolvers,
});
// Write schema.
this.writeGenerateSchema(graphql.printSchema(schema));
if (!strapi.config.currentEnvironment.server.production) {
// Write schema.
this.writeGenerateSchema(graphql.printSchema(schema));
}
// Remove custom scaler (like Upload);
typeDefs = Types.removeCustomScalar(typeDefs, resolvers);

View File

@ -438,8 +438,10 @@ module.exports = {
try {
// Disable auto-reload.
strapi.reload.isWatching = false;
// Rewrite actions.json file.
fs.writeFileSync(actionsPath, JSON.stringify({ actions: data }), 'utf8');
if (!strapi.config.currentEnvironment.server.production) {
// Rewrite actions.json file.
fs.writeFileSync(actionsPath, JSON.stringify({ actions: data }), 'utf8');
}
// Set value to AST to avoid restart.
_.set(strapi.plugins['users-permissions'], 'config.actions', data);
// Disable auto-reload.

View File

@ -88,12 +88,18 @@ module.exports = async function() {
return;
}
const existBuildPath = await fs.pathExists(buildPath);
if (strapi.config.currentEnvironment.server.production && existBuildPath) {
return;
} else if (strapi.config.currentEnvironment.server.production && !existBuildPath) {
console.log('The plugins.json file is missing and the front-end cannot work without it. Please, create it first at development environment.');
}
// arrange system directories
await Promise.all([
fs.remove(sourcePath),
(async () => {
const existBuildPath = await fs.pathExists(buildPath);
if (existBuildPath) {
await fs.remove(buildPath);
} else {