mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 11:25:17 +00:00
Merge branch 'master' into fix/issue-3455
This commit is contained in:
commit
74b26f9c0e
10
.gitlab-ci.yml
Normal file
10
.gitlab-ci.yml
Normal 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
|
||||
@ -8,7 +8,7 @@
|
||||
<br />
|
||||
<p align="center">
|
||||
<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 href="https://www.npmjs.org/package/strapi">
|
||||
<img src="https://img.shields.io/npm/dm/strapi.svg" alt="Monthly download on NPM" />
|
||||
|
||||
@ -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 ",
|
||||
|
||||
@ -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 ",
|
||||
|
||||
@ -130,7 +130,7 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
(err, response, body) => {
|
||||
if (response.statusCode !== 200 || err) {
|
||||
if (err || response.statusCode !== 200) {
|
||||
return resolve([]);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
});
|
||||
});
|
||||
27
packages/strapi/lib/load/check-reserved-filename.js
Normal file
27
packages/strapi/lib/load/check-reserved-filename.js
Normal 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;
|
||||
};
|
||||
@ -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;
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const glob = require('./glob');
|
||||
const _ = require('lodash');
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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 ",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user