mirror of
https://github.com/strapi/strapi.git
synced 2025-09-19 05:23:05 +00:00
Merge pull request #2518 from abdonrd/fix-gae-deploy
Avoid write files if not development environment
This commit is contained in:
commit
04a11ac18f
@ -1,6 +1,7 @@
|
||||
{
|
||||
"host": "localhost",
|
||||
"port": "${process.env.PORT || 1337}",
|
||||
"production": true,
|
||||
"proxy": {
|
||||
"enabled": false
|
||||
},
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"host": "localhost",
|
||||
"port": "${process.env.PORT || 1337}",
|
||||
"production": true,
|
||||
"proxy": {
|
||||
"enabled": false
|
||||
},
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user