Merge branch 'master' into fix/issue-3455

This commit is contained in:
Alexandre BODIN 2019-06-18 09:42:26 +02:00 committed by GitHub
commit 74b26f9c0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 77 additions and 35 deletions

10
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,10 @@
trigger_deploy:
stage: deploy
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

View File

@ -8,7 +8,7 @@
<br /> <br />
<p align="center"> <p align="center">
<a href="https://www.npmjs.org/package/strapi"> <a href="https://www.npmjs.org/package/strapi">
<img src="https://img.shields.io/npm/v/strapi/alpha.svg" alt="NPM Version" /> <img src="https://img.shields.io/npm/v/strapi/beta.svg" alt="NPM Version" />
</a> </a>
<a href="https://www.npmjs.org/package/strapi"> <a href="https://www.npmjs.org/package/strapi">
<img src="https://img.shields.io/npm/dm/strapi.svg" alt="Monthly download on NPM" /> <img src="https://img.shields.io/npm/dm/strapi.svg" alt="Monthly download on NPM" />

View File

@ -41,7 +41,7 @@
"app.components.HomePage.support.link": "GET YOUR T-SHIRT NOW", "app.components.HomePage.support.link": "GET YOUR T-SHIRT NOW",
"app.components.HomePage.welcome": "Welcome on board!", "app.components.HomePage.welcome": "Welcome on board!",
"app.components.HomePage.welcome.again": "Welcome ", "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.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.issues": "issues.",
"app.components.HomePage.welcomeBlock.content.raise": " or raise ", "app.components.HomePage.welcomeBlock.content.raise": " or raise ",

View File

@ -41,7 +41,7 @@
"app.components.HomePage.support.link": "GET YOUR T-SHIRT NOW", "app.components.HomePage.support.link": "GET YOUR T-SHIRT NOW",
"app.components.HomePage.welcome": "Welcome on board!", "app.components.HomePage.welcome": "Welcome on board!",
"app.components.HomePage.welcome.again": "Welcome ", "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.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.issues": "issues.",
"app.components.HomePage.welcomeBlock.content.raise": " or raise ", "app.components.HomePage.welcomeBlock.content.raise": " or raise ",

View File

@ -130,7 +130,7 @@ module.exports = {
}, },
}, },
(err, response, body) => { (err, response, body) => {
if (response.statusCode !== 200 || err) { if (err || response.statusCode !== 200) {
return resolve([]); return resolve([]);
} }

View File

@ -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);
});
});

View File

@ -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;
};

View File

@ -1,6 +1,8 @@
const _ = require('lodash'); 'use strict';
const loadFiles = require('./load-files'); const loadFiles = require('./load-files');
const requireFileAndParse = require('./require-file-parse'); const requireFileAndParse = require('./require-file-parse');
const checkReservedFilename = require('./check-reserved-filename');
/** /**
* @param {string} dir - directory from which to load configs * @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)') => const laodConfigFiles = (dir, pattern = 'config/**/*.+(js|json)') =>
loadFiles(dir, pattern, { loadFiles(dir, pattern, {
requireFn: requireFileAndParse, requireFn: requireFileAndParse,
shouldUseFileNameAsKey, shouldUseFileNameAsKey: checkReservedFilename,
globArgs: { globArgs: {
// used to load .init.json at first startup // 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; module.exports = laodConfigFiles;

View File

@ -1,3 +1,5 @@
'use strict';
const path = require('path'); const path = require('path');
const glob = require('./glob'); const glob = require('./glob');
const _ = require('lodash'); const _ = require('lodash');

View File

@ -38,6 +38,7 @@
"koa-session": "^5.5.1", "koa-session": "^5.5.1",
"koa-static": "^4.0.1", "koa-static": "^4.0.1",
"lodash": "^4.17.5", "lodash": "^4.17.5",
"minimatch": "^3.0.4",
"node-fetch": "^1.7.3", "node-fetch": "^1.7.3",
"node-machine-id": "^1.1.10", "node-machine-id": "^1.1.10",
"node-schedule": "^1.2.0", "node-schedule": "^1.2.0",

View File

@ -41,7 +41,7 @@
"app.components.HomePage.support.link": "GET YOUR T-SHIRT NOW", "app.components.HomePage.support.link": "GET YOUR T-SHIRT NOW",
"app.components.HomePage.welcome": "Welcome on board!", "app.components.HomePage.welcome": "Welcome on board!",
"app.components.HomePage.welcome.again": "Welcome ", "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.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.issues": "issues.",
"app.components.HomePage.welcomeBlock.content.raise": " or raise ", "app.components.HomePage.welcomeBlock.content.raise": " or raise ",