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",
|
"host": "localhost",
|
||||||
"port": "${process.env.PORT || 1337}",
|
"port": "${process.env.PORT || 1337}",
|
||||||
|
"production": true,
|
||||||
"proxy": {
|
"proxy": {
|
||||||
"enabled": false
|
"enabled": false
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
"port": "${process.env.PORT || 1337}",
|
"port": "${process.env.PORT || 1337}",
|
||||||
|
"production": true,
|
||||||
"proxy": {
|
"proxy": {
|
||||||
"enabled": false
|
"enabled": false
|
||||||
},
|
},
|
||||||
|
@ -266,8 +266,10 @@ module.exports = {
|
|||||||
resolvers,
|
resolvers,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Write schema.
|
if (!strapi.config.currentEnvironment.server.production) {
|
||||||
this.writeGenerateSchema(graphql.printSchema(schema));
|
// Write schema.
|
||||||
|
this.writeGenerateSchema(graphql.printSchema(schema));
|
||||||
|
}
|
||||||
|
|
||||||
// Remove custom scaler (like Upload);
|
// Remove custom scaler (like Upload);
|
||||||
typeDefs = Types.removeCustomScalar(typeDefs, resolvers);
|
typeDefs = Types.removeCustomScalar(typeDefs, resolvers);
|
||||||
|
@ -438,8 +438,10 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
// Disable auto-reload.
|
// Disable auto-reload.
|
||||||
strapi.reload.isWatching = false;
|
strapi.reload.isWatching = false;
|
||||||
// Rewrite actions.json file.
|
if (!strapi.config.currentEnvironment.server.production) {
|
||||||
fs.writeFileSync(actionsPath, JSON.stringify({ actions: data }), 'utf8');
|
// Rewrite actions.json file.
|
||||||
|
fs.writeFileSync(actionsPath, JSON.stringify({ actions: data }), 'utf8');
|
||||||
|
}
|
||||||
// Set value to AST to avoid restart.
|
// Set value to AST to avoid restart.
|
||||||
_.set(strapi.plugins['users-permissions'], 'config.actions', data);
|
_.set(strapi.plugins['users-permissions'], 'config.actions', data);
|
||||||
// Disable auto-reload.
|
// Disable auto-reload.
|
||||||
|
@ -88,12 +88,18 @@ module.exports = async function() {
|
|||||||
return;
|
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
|
// arrange system directories
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
fs.remove(sourcePath),
|
fs.remove(sourcePath),
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const existBuildPath = await fs.pathExists(buildPath);
|
|
||||||
if (existBuildPath) {
|
if (existBuildPath) {
|
||||||
await fs.remove(buildPath);
|
await fs.remove(buildPath);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user