From 29d799810c0eeb3cb367a9ea8a4c8276e7976424 Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Wed, 12 Jun 2019 17:46:45 +0200 Subject: [PATCH 1/8] init --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000..4633300281 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,4 @@ +deploy: + variables: + COMMIT: $CI_COMMIT_SHA + trigger: strapi/strapi-testing-deployer From 34f56ee937198456d582d1421cd362b8cc2ad63d Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Wed, 12 Jun 2019 18:17:38 +0200 Subject: [PATCH 2/8] trying stuff --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4633300281..9319698719 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,5 @@ deploy: + stage: deploy variables: COMMIT: $CI_COMMIT_SHA trigger: strapi/strapi-testing-deployer From 03d6f55b937e6ec0c45adc2ef77e33566259a682 Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Wed, 12 Jun 2019 18:29:03 +0200 Subject: [PATCH 3/8] Use curl trigger --- .gitlab-ci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9319698719..b2a571b98d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,10 @@ -deploy: +trigger_deploy: stage: deploy - variables: - COMMIT: $CI_COMMIT_SHA - trigger: strapi/strapi-testing-deployer + script: + - curl -X POST + --form "token=$TRIGGER_TOKEN" + --form "ref=master" + --form "variables[UPSTREAM_COMMIT_SHA]=$CI_COMMIT_SHA" + https://gitlab.com/api/v4/projects/12825884/trigger/pipeline + # only: + # - develop From dd9182dfa2bcb4c4eda884265473e6d300160c1f Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Wed, 12 Jun 2019 21:57:49 +0200 Subject: [PATCH 4/8] Enable on develop only --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b2a571b98d..06ed5905eb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,5 +6,5 @@ trigger_deploy: --form "ref=master" --form "variables[UPSTREAM_COMMIT_SHA]=$CI_COMMIT_SHA" https://gitlab.com/api/v4/projects/12825884/trigger/pipeline - # only: - # - develop + only: + - develop From 5baa505a9f6f793ebd098b3bacfd4a249d7e09f4 Mon Sep 17 00:00:00 2001 From: Derrick Mehaffy Date: Sat, 15 Jun 2019 05:58:45 -0700 Subject: [PATCH 5/8] Update NPM Badge on Readme to Beta --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b48b4280a..958fc1e933 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@

- NPM Version + NPM Version Monthly download on NPM From 8144e7b5bd7435291fee572aaf70667e39565cac Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Fri, 14 Jun 2019 22:41:13 +0200 Subject: [PATCH 6/8] Allow different envrionment names --- .../__tests__/check-reserved-filename.test.js | 27 ++++++++++++++ .../lib/load/check-reserved-filename.js | 27 ++++++++++++++ packages/strapi/lib/load/load-config-files.js | 35 +++---------------- packages/strapi/lib/load/load-files.js | 2 ++ packages/strapi/package.json | 1 + 5 files changed, 62 insertions(+), 30 deletions(-) create mode 100644 packages/strapi/lib/load/__tests__/check-reserved-filename.test.js create mode 100644 packages/strapi/lib/load/check-reserved-filename.js diff --git a/packages/strapi/lib/load/__tests__/check-reserved-filename.test.js b/packages/strapi/lib/load/__tests__/check-reserved-filename.test.js new file mode 100644 index 0000000000..7ac7a1202e --- /dev/null +++ b/packages/strapi/lib/load/__tests__/check-reserved-filename.test.js @@ -0,0 +1,27 @@ +const checkReservedFilename = require('../check-reserved-filename'); + +describe('check-reserved-filename', () => { + const table = [ + // matches + ['config/functions.json', true], + ['config/functions/bootstrapi.js', true], + ['config/layout.json', true], + ['config/hook.json', true], + ['config/middleware.json', true], + ['config/environments/test/database.json', true], + ['config/environments/development/request.json', true], + ['config/environments/production/server.json', true], + ['config/environments/staging/response.json', true], + ['config/environments/qa/security.json', true], + + // dont match + ['config/application.json', false], + ['config/custom.json', false], + ['config/environments/qa/custom.json', false], + ['config/environments/qa/other.json', false], + ]; + + test.each(table)('Path %s should return %s', (path, expected) => { + expect(checkReservedFilename(path)).toBe(expected); + }); +}); diff --git a/packages/strapi/lib/load/check-reserved-filename.js b/packages/strapi/lib/load/check-reserved-filename.js new file mode 100644 index 0000000000..30b309fd91 --- /dev/null +++ b/packages/strapi/lib/load/check-reserved-filename.js @@ -0,0 +1,27 @@ +'use strict'; + +const _ = require('lodash'); +const minimatch = require('minimatch'); + +const envMatcher = new minimatch.Minimatch( + 'config/environments/*/+(request|database|server|security|response).+(json|js)' +); + +// files to load with filename key +const prefixedPaths = [ + 'functions', + 'policies', + 'locales', + 'hook', + 'middleware', + 'language', + 'queries', + 'layout', +]; + +module.exports = function checkReservedFilenames(file) { + if (envMatcher.match(file)) return true; + return _.some(prefixedPaths, e => file.indexOf(`config/${e}`) >= 0) + ? true + : false; +}; diff --git a/packages/strapi/lib/load/load-config-files.js b/packages/strapi/lib/load/load-config-files.js index 80813fc04d..1fcbf87507 100644 --- a/packages/strapi/lib/load/load-config-files.js +++ b/packages/strapi/lib/load/load-config-files.js @@ -1,6 +1,8 @@ -const _ = require('lodash'); +'use strict'; + const loadFiles = require('./load-files'); const requireFileAndParse = require('./require-file-parse'); +const checkReservedFilename = require('./check-reserved-filename'); /** * @param {string} dir - directory from which to load configs @@ -9,38 +11,11 @@ const requireFileAndParse = require('./require-file-parse'); const laodConfigFiles = (dir, pattern = 'config/**/*.+(js|json)') => loadFiles(dir, pattern, { requireFn: requireFileAndParse, - shouldUseFileNameAsKey, + shouldUseFileNameAsKey: checkReservedFilename, globArgs: { // used to load .init.json at first startup - dot: true + dot: true, }, }); -const shouldUseFileNameAsKey = file => { - return _.some(prefixedPaths, e => file.indexOf(`config/${e}`) >= 0) - ? true - : false; -}; - -// files to load with filename key -const prefixedPaths = [ - ...['staging', 'production', 'development'].reduce((acc, env) => { - return acc.concat( - `environments/${env}/database`, - `environments/${env}/security`, - `environments/${env}/request`, - `environments/${env}/response`, - `environments/${env}/server` - ); - }, []), - 'functions', - 'policies', - 'locales', - 'hook', - 'middleware', - 'language', - 'queries', - 'layout', -]; - module.exports = laodConfigFiles; diff --git a/packages/strapi/lib/load/load-files.js b/packages/strapi/lib/load/load-files.js index bbcaddf19f..eb6bb75d00 100644 --- a/packages/strapi/lib/load/load-files.js +++ b/packages/strapi/lib/load/load-files.js @@ -1,3 +1,5 @@ +'use strict'; + const path = require('path'); const glob = require('./glob'); const _ = require('lodash'); diff --git a/packages/strapi/package.json b/packages/strapi/package.json index ef78e1551f..15636cd86e 100644 --- a/packages/strapi/package.json +++ b/packages/strapi/package.json @@ -38,6 +38,7 @@ "koa-session": "^5.5.1", "koa-static": "^4.0.1", "lodash": "^4.17.5", + "minimatch": "^3.0.4", "node-fetch": "^1.7.3", "node-machine-id": "^1.1.10", "node-schedule": "^1.2.0", From 7b3737c90c6b77ec8baf52d5ba46b1385ba0513d Mon Sep 17 00:00:00 2001 From: ta7sudan Date: Mon, 17 Jun 2019 00:02:27 +0800 Subject: [PATCH 7/8] fix(strapi-plugin-users-permissions): fix when connecting to marketplace error cause app crash --- .../services/UsersPermissions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js index cb4f06be29..481c265da2 100644 --- a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js +++ b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js @@ -130,7 +130,7 @@ module.exports = { }, }, (err, response, body) => { - if (response.statusCode !== 200 || err) { + if (err || response.statusCode !== 200) { return resolve([]); } From 54fbe9cf0f3b32cf243188832b0d5d02a34a2d8c Mon Sep 17 00:00:00 2001 From: Fred Rivett Date: Fri, 14 Jun 2019 15:36:55 +0100 Subject: [PATCH 8/8] Fix wording of welcome text The wording here is important as it's one of the first things the user sees of the Strapi project having set it up, and it didn't quite make sense (though everyone will understand what's meant to be said). Tweaking this will improve the initial user experience of Strapi. --- packages/strapi-admin/admin/src/translations/en.json | 2 +- .../strapi-helper-plugin/lib/src/testUtils/commonTrads.json | 2 +- test/config/front/testUtils/commonTrads.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/strapi-admin/admin/src/translations/en.json b/packages/strapi-admin/admin/src/translations/en.json index 5fb8b81988..74a4a7b663 100644 --- a/packages/strapi-admin/admin/src/translations/en.json +++ b/packages/strapi-admin/admin/src/translations/en.json @@ -41,7 +41,7 @@ "app.components.HomePage.support.link": "GET YOUR T-SHIRT NOW", "app.components.HomePage.welcome": "Welcome on board!", "app.components.HomePage.welcome.again": "Welcome ", - "app.components.HomePage.welcomeBlock.content": "We are happy to have you as one of community member. We are constantly looking for feedback so feel free to send us DM on ", + "app.components.HomePage.welcomeBlock.content": "We are happy to have you as part of the community. We are constantly looking for feedback so feel free to send us DM on ", "app.components.HomePage.welcomeBlock.content.again": "We hope you are making progress on your project... Feel free to read the latest new about Strapi. We are giving our best to improve the product based on your feedback.", "app.components.HomePage.welcomeBlock.content.issues": "issues.", "app.components.HomePage.welcomeBlock.content.raise": " or raise ", diff --git a/packages/strapi-helper-plugin/lib/src/testUtils/commonTrads.json b/packages/strapi-helper-plugin/lib/src/testUtils/commonTrads.json index a2b939cff2..ec9ea99d29 100644 --- a/packages/strapi-helper-plugin/lib/src/testUtils/commonTrads.json +++ b/packages/strapi-helper-plugin/lib/src/testUtils/commonTrads.json @@ -41,7 +41,7 @@ "app.components.HomePage.support.link": "GET YOUR T-SHIRT NOW", "app.components.HomePage.welcome": "Welcome on board!", "app.components.HomePage.welcome.again": "Welcome ", - "app.components.HomePage.welcomeBlock.content": "We are happy to have you as one of community member. We are constantly looking for feedback so feel free to send us DM on ", + "app.components.HomePage.welcomeBlock.content": "We are happy to have you as part of the community. We are constantly looking for feedback so feel free to send us DM on ", "app.components.HomePage.welcomeBlock.content.again": "We hope you are making progress on your project... Feel free to read the latest new about Strapi. We are giving our best to improve the product based on your feedback.", "app.components.HomePage.welcomeBlock.content.issues": "issues.", "app.components.HomePage.welcomeBlock.content.raise": " or raise ", diff --git a/test/config/front/testUtils/commonTrads.json b/test/config/front/testUtils/commonTrads.json index a2b939cff2..ec9ea99d29 100644 --- a/test/config/front/testUtils/commonTrads.json +++ b/test/config/front/testUtils/commonTrads.json @@ -41,7 +41,7 @@ "app.components.HomePage.support.link": "GET YOUR T-SHIRT NOW", "app.components.HomePage.welcome": "Welcome on board!", "app.components.HomePage.welcome.again": "Welcome ", - "app.components.HomePage.welcomeBlock.content": "We are happy to have you as one of community member. We are constantly looking for feedback so feel free to send us DM on ", + "app.components.HomePage.welcomeBlock.content": "We are happy to have you as part of the community. We are constantly looking for feedback so feel free to send us DM on ", "app.components.HomePage.welcomeBlock.content.again": "We hope you are making progress on your project... Feel free to read the latest new about Strapi. We are giving our best to improve the product based on your feedback.", "app.components.HomePage.welcomeBlock.content.issues": "issues.", "app.components.HomePage.welcomeBlock.content.raise": " or raise ",