Merge branch 'alpha.5' of github.com:strapi/strapi into plugin/settings-manager

This commit is contained in:
Jim Laurie 2017-08-23 16:37:40 +02:00
commit 19c3b11889
10 changed files with 76 additions and 58 deletions

1
.gitignore vendored
View File

@ -93,6 +93,7 @@ build
node_modules node_modules
.node_history .node_history
package-lock.json package-lock.json
**/package-lock.json
############################ ############################

View File

@ -52,23 +52,22 @@ _Reorganize the mono-repository. The rule to follow is to only have hooks withou
- ~~Prototype the CLI to create, install and uninstall plugins.~~ - ~~Prototype the CLI to create, install and uninstall plugins.~~
- ~~Ensure that we are compatible with Node 8.~~ - ~~Ensure that we are compatible with Node 8.~~
`strapi@alpha.5` *(expected release date: 10/08/2017)*: `strapi@alpha.5` *(expected release date: 30/08/2017)*:
- [Plugin] Settings Manager. - ~~[Plugin] Settings Manager~~.
- Update `strapi-helper-plugin` and `strapi-admin` dependencies to the latest version. - ~~Update layout design~~.
- Update layout design. - ~~Create a draft of the guidelines to follow of how to create a plugin~~.
- Create a draft of the guidelines to follow of how to create a plugin. - ~~Initialize the `strapi-docs` package~~.
- Finalize the plugins queries process to be able to use different ORMs. - ~~Synchronize the ORM adapters to set the same properties in the AST~~.
- Initialize the `strapi-docs` package. - ~~Rewrite the Strapi core to improve performances and startup time~~.
- Use [lerna](http://lernajs.io) to run tests. - ~~Freeze (make immutable) the AST~~.
- Synchronize the ORM adapters to set the same properties in the AST. - ~~Remove global variable `strapi` and use the module pattern instead~~.
- Rewrite the Strapi core to improve performances and startup time.
`strapi@alpha.6` *(expected release date: 21/09/2017)*: `strapi@alpha.6` *(expected release date: 21/09/2017)*:
- [Plugin] Content Manager. - [Plugin] Content Manager.
- [Plugin] Content Type Builder. - [Plugin] Content Type Builder.
- Freeze (make immutable) the AST. - Finalize the plugins queries process to be able to use different ORMs.
- Remove global variable `strapi` and use the module pattern instead. - Update `strapi-helper-plugin` and `strapi-admin` dependencies to the latest version.
- Write better tests. - Use [lerna](http://lernajs.io) to run tests.
`strapi@alpha.7` *(expected release date: 31/10/2017)*: `strapi@alpha.7` *(expected release date: 31/10/2017)*:
- [Plugin] Users & groups (with full authentication process). - [Plugin] Users & groups (with full authentication process).

View File

@ -20,7 +20,7 @@ const requireTranslations = language => {
try { try {
return require(`./translations/${language}.json`); // eslint-disable-line global-require return require(`./translations/${language}.json`); // eslint-disable-line global-require
} catch (error) { } catch (error) {
console.error(`Unable to load "${language}" translation. Please make sure "${language}.json" file exists in "admin/public/app/translations" folder.`); console.error(`Unable to load "${language}" translation. Please make sure "${language}.json" file exists in "admin/public/app/translations" folder.`); // eslint-disable-line no-console
return false; return false;
} }
}; };
@ -37,7 +37,7 @@ const addLanguageLocaleData = language => {
addLocaleData(localeData); addLocaleData(localeData);
return true; return true;
} catch (error) { } catch (error) {
console.error(`It looks like the language "${language}" is not supported by "react-intl" module.`); console.error(`It looks like the language "${language}" is not supported by "react-intl" module.`); // eslint-disable-line no-console
return false; return false;
} }
}; };

View File

@ -4,6 +4,16 @@
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"JSONStream": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz",
"integrity": "sha1-kWV9/m/4V0gwZhMrRhi2Lo9Ih70=",
"dev": true,
"requires": {
"jsonparse": "0.0.5",
"through": "2.3.8"
}
},
"abab": { "abab": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/abab/-/abab-1.0.3.tgz", "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.3.tgz",
@ -6155,15 +6165,6 @@
} }
} }
}, },
"string_decoder": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz",
"integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=",
"dev": true,
"requires": {
"safe-buffer": "5.0.1"
}
},
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
@ -6175,6 +6176,15 @@
"strip-ansi": "3.0.1" "strip-ansi": "3.0.1"
} }
}, },
"string_decoder": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz",
"integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=",
"dev": true,
"requires": {
"safe-buffer": "5.0.1"
}
},
"stringstream": { "stringstream": {
"version": "0.0.5", "version": "0.0.5",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
@ -8613,16 +8623,6 @@
"integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=",
"dev": true "dev": true
}, },
"JSONStream": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz",
"integrity": "sha1-kWV9/m/4V0gwZhMrRhi2Lo9Ih70=",
"dev": true,
"requires": {
"jsonparse": "0.0.5",
"through": "2.3.8"
}
},
"jsprim": { "jsprim": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz",
@ -13696,15 +13696,6 @@
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM="
}, },
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
},
"string-template": { "string-template": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/string-template/-/string-template-1.0.0.tgz", "resolved": "https://registry.npmjs.org/string-template/-/string-template-1.0.0.tgz",
@ -13722,6 +13713,15 @@
"strip-ansi": "3.0.1" "strip-ansi": "3.0.1"
} }
}, },
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
},
"stringify-object": { "stringify-object": {
"version": "2.4.0", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-2.4.0.tgz", "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-2.4.0.tgz",

View File

@ -2,7 +2,7 @@
/** /**
* An asynchronous bootstrap function that runs before * An asynchronous bootstrap function that runs before
* your application gets lifted. * your application gets started.
* *
* This gives you an opportunity to set up your data model, * This gives you an opportunity to set up your data model,
* run jobs, or perform some special logic. * run jobs, or perform some special logic.

View File

@ -153,9 +153,10 @@
<p>You'll probably also want to learn how to customize your application, set up security and configure your data sources.</p> <p>You'll probably also want to learn how to customize your application, set up security and configure your data sources.</p>
<p>For more help getting started, check out: <p>For more help getting started, check out:
<ul> <ul>
<li><a href="http://strapi.io/documentation/introduction" target="blank">Strapi documentation</a></li> <li><a href="http://strapi.io/documentation/introduction" target="blank">Documentation</a></li>
<li><a href="https://github.com/strapi/strapi" target="blank">Strapi repository on GitHub</a></li> <li><a href="https://github.com/strapi/strapi" target="blank">Repository on GitHub</a></li>
<li><a href="https://twitter.com/strapijs" target="blank">Strapi news on Twitter</a></li> <li><a href="https://twitter.com/strapijs" target="blank">news on Twitter</a></li>
<li><a href="http://slack.strapi.io" target="blank">Real-time support on Slack</a></li>
</ul> </ul>
</p> </p>
</div> </div>

View File

@ -31,17 +31,26 @@ module.exports = (scope, cb) => {
// Copy the default files. // Copy the default files.
fs.copySync(path.resolve(__dirname, '..', 'files'), path.resolve(scope.rootPath)); fs.copySync(path.resolve(__dirname, '..', 'files'), path.resolve(scope.rootPath));
const availableDependencies = [];
const missingDependencies = []; const missingDependencies = [];
// Verify if the dependencies are available into the global // Verify if the dependencies are available into the global
_.forEach(_.merge(_.get(packageJSON, 'dependencies'), _.get(packageJSON, 'devDependencies')), (value, key) => { _.forEach(_.merge(_.get(packageJSON, 'dependencies'), _.get(packageJSON, 'devDependencies')), (value, key) => {
try { try {
fs.accessSync(path.resolve(strapiRootPath, key), fs.constants.R_OK | fs.constants.W_OK); fs.accessSync(path.resolve(strapiRootPath, key), fs.constants.R_OK | fs.constants.W_OK);
fs.symlinkSync(path.resolve(strapiRootPath, key), path.resolve(scope.rootPath, 'node_modules', key), 'dir'); availableDependencies.push({
key,
global: true
});
// fs.symlinkSync(path.resolve(strapiRootPath, key), path.resolve(scope.rootPath, 'node_modules', key), 'dir');
} catch (e1) { } catch (e1) {
try { try {
fs.accessSync(path.resolve(scope.strapiRoot, 'node_modules', key), fs.constants.R_OK | fs.constants.W_OK); fs.accessSync(path.resolve(scope.strapiRoot, 'node_modules', key), fs.constants.R_OK | fs.constants.W_OK);
fs.symlinkSync(path.resolve(scope.strapiRoot, 'node_modules', key), path.resolve(scope.rootPath, 'node_modules', key), 'dir'); availableDependencies.push({
key,
global: false
});
// fs.symlinkSync(path.resolve(scope.strapiRoot, 'node_modules', key), path.resolve(scope.rootPath, 'node_modules', key), 'dir');
} catch (e2) { } catch (e2) {
missingDependencies.push(key); missingDependencies.push(key);
} }
@ -67,6 +76,14 @@ module.exports = (scope, cb) => {
return cb(); return cb();
} }
availableDependencies.forEach(dependency => {
if (dependency.global) {
fs.symlinkSync(path.resolve(strapiRootPath, dependency.key), path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
} else {
fs.symlinkSync(path.resolve(scope.strapiRoot, 'node_modules', dependency.key), path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
}
})
logger.info('Your new application `' + scope.name + '` is ready at `' + scope.rootPath + '`.'); logger.info('Your new application `' + scope.name + '` is ready at `' + scope.rootPath + '`.');
cb(); cb();

View File

@ -17,9 +17,6 @@ const reportback = require('reportback')();
const pathRegexp = require('./util').pathRegexp; const pathRegexp = require('./util').pathRegexp;
const generateTarget = require('./target'); const generateTarget = require('./target');
// Logger.
const { logger } = require('strapi-utils');
/** /**
* Run a generator given an existing scope * Run a generator given an existing scope
* *
@ -50,9 +47,6 @@ function generate(generator, scope, cb) {
invalid: sb.invalid, invalid: sb.invalid,
success: () => { success: () => {
// Emit output.
logger.info('Generating ' + util.inspect(generator) + ' at `' + scope.rootPath + '`...');
// Process all of the generator's targets concurrently. // Process all of the generator's targets concurrently.
async.each(Object.keys(generator.targets), (keyPath, asyncEachCb) => { async.each(Object.keys(generator.targets), (keyPath, asyncEachCb) => {
const asyncEachSb = reportback.extend(asyncEachCb); const asyncEachSb = reportback.extend(asyncEachCb);

View File

@ -13,7 +13,7 @@ const mongooseUtils = require('mongoose/lib/utils');
const utils = require('./utils/'); const utils = require('./utils/');
// Strapi helpers for models. // Strapi helpers for models.
const utilsModels = require('strapi-utils').models; const { models: utilsModels, logger } = require('strapi-utils');
/** /**
* Bookshelf hook * Bookshelf hook
@ -63,6 +63,10 @@ module.exports = function (strapi) {
// Handle error // Handle error
db.on('error', error => { db.on('error', error => {
if (error.message.indexOf(`:${port}`)) {
return cb('Make sure your MongoDB database is running...');
}
cb(error); cb(error);
}); });

View File

@ -56,10 +56,12 @@ module.exports = strapi => {
// Note: This route could be override by the user. // Note: This route could be override by the user.
strapi.router.route({ strapi.router.route({
method: 'GET', method: 'GET',
path: '/*.*', path: '/*(.*)?',
handler: [ handler: [
async (ctx, next) => { async (ctx, next) => {
ctx.url = path.basename(ctx.url); const parse = path.parse(ctx.url);
ctx.url = path.join(parse.dir, parse.base);
await next(); await next();
}, },