From 620f8a1c2a24e74e83e3b181782ebec847490964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abd=C3=B3n=20Rodr=C3=ADguez=20Davila?= Date: Wed, 18 Apr 2018 15:38:14 +0200 Subject: [PATCH 1/5] Fix post-install script --- packages/strapi/lib/utils/post-install.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/strapi/lib/utils/post-install.js b/packages/strapi/lib/utils/post-install.js index 8ae028e299..d6697da4a2 100644 --- a/packages/strapi/lib/utils/post-install.js +++ b/packages/strapi/lib/utils/post-install.js @@ -24,7 +24,7 @@ try { // Check if path is existing. fs.accessSync(adminDirPath, fs.constants.R_OK | fs.constants.W_OK); - const install = exec(`cd ${adminDirPath} && npm install --prod --ignore-scripts`, { + const install = exec(`cd "${adminDirPath}" && npm install --prod --ignore-scripts`, { silent: true }); @@ -35,8 +35,8 @@ try { console.log('✅ Success'); console.log(''); -} catch (err) { - if (err.code === 'ENOENT') { +} catch (e) { + if (e.code === 'ENOENT') { console.log('✅ Success'); console.log(''); @@ -60,7 +60,7 @@ try { console.log('📦 Installing packages...'); try { - const install = exec(`cd ${pluginPath} && npm install --prod --ignore-scripts`, { + const install = exec(`cd "${pluginPath}" && npm install --prod --ignore-scripts`, { silent: true }); @@ -76,7 +76,7 @@ try { } }); } catch (e) { - if (err.code === 'ENOENT') { + if (e.code === 'ENOENT') { console.log('✅ Success'); console.log(''); From 686a278406fb0ad1aae44606aa31eeec44b3a156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abd=C3=B3n=20Rodr=C3=ADguez=20Davila?= Date: Thu, 19 Apr 2018 13:10:34 +0200 Subject: [PATCH 2/5] Fix exec command when the path has spaces Fixes #962 --- packages/strapi-admin/controllers/Admin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/strapi-admin/controllers/Admin.js b/packages/strapi-admin/controllers/Admin.js index 18fbfc9c37..9b502b0784 100755 --- a/packages/strapi-admin/controllers/Admin.js +++ b/packages/strapi-admin/controllers/Admin.js @@ -54,7 +54,7 @@ module.exports = { strapi.log.info(`Installing ${plugin}...`); - exec(`node ${strapiBin} install ${plugin} ${port === '4000' ? '--dev' : ''}`); + exec(`node "${strapiBin}" install ${plugin} ${port === '4000' ? '--dev' : ''}`); ctx.send({ ok: true }); From 147725f689983bca54e262a595193bff83de2c9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdo=CC=81n=20Rodri=CC=81guez=20Davila?= Date: Thu, 19 Apr 2018 15:49:16 +0200 Subject: [PATCH 3/5] Fix exec command in uninstall plugin --- packages/strapi-admin/controllers/Admin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/strapi-admin/controllers/Admin.js b/packages/strapi-admin/controllers/Admin.js index 9b502b0784..af07830494 100755 --- a/packages/strapi-admin/controllers/Admin.js +++ b/packages/strapi-admin/controllers/Admin.js @@ -87,7 +87,7 @@ module.exports = { strapi.reload.isWatching = false; strapi.log.info(`Uninstalling ${plugin}...`); - exec(`node ${strapiBin} uninstall ${plugin}`); + exec(`node "${strapiBin}" uninstall ${plugin}`); ctx.send({ ok: true }); From 4d8a852cdf49fdbbea51e22b4de71805bd97b91f Mon Sep 17 00:00:00 2001 From: Jim Laurie Date: Fri, 20 Apr 2018 11:26:28 +0200 Subject: [PATCH 4/5] Add migration guide 11 to 12 --- .../migration-guide-alpha-11-to-alpha-12.md | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 docs/3.x.x/en/migration/migration-guide-alpha-11-to-alpha-12.md diff --git a/docs/3.x.x/en/migration/migration-guide-alpha-11-to-alpha-12.md b/docs/3.x.x/en/migration/migration-guide-alpha-11-to-alpha-12.md new file mode 100644 index 0000000000..58fb7192f9 --- /dev/null +++ b/docs/3.x.x/en/migration/migration-guide-alpha-11-to-alpha-12.md @@ -0,0 +1,96 @@ +# Migrating from 3.0.0-alpha.10 to 3.0.0-alpha.11 + +This migration guide is a mix of migrations from 3.0.0-alpha.10.1 to 3.0.0-alpha.10.2, 3.0.0-alpha.10.2 to 3.0.0-alpha.10.3 and from 3.0.0-alpha.10.3 to 3.0.0-alpha.12. + +> Feel free to [join us on Slack](http://slack.strapi.io) and ask questions about the migration process. + + +## Getting started + +Install Strapi `alpha.12` globally on your computer. To do so run `npm install strapi@3.0.0-alpha.12 -g`. + +When it's done, generate a new empty project `strapi new myNewProject` (don't pay attention to the database configuration). + +## Configurations + +You will have to update just 1 file: `package.json` + +- Edit the Strapi's dependencies version: (move Strapi's dependencies to `3.0.0-alpha.12` version) in `package.json` file + +```json +{ + "dependencies": { + "lodash": "4.x.x", + "strapi": "3.0.0-alpha.12", + "strapi-mongoose": "3.0.0-alpha.12" + } +} +``` + + +## Update the Admin + +Delete your old admin folder and replace it by the new one. + + +## Update the Plugins + +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. + +Then, delete your old `plugins` folder and replace it by the new one. + +## Update roles + +> This update is if you come from version before alpha-11.2 + +Update `type` of `Guest` role to `public` in your database. You can also update name and description: + +```json +{ + "name": "Public", + "description": "Default role given to unauthenticated user.", + "type": "public" +} +``` + +Create Authenticated role: + +```json +{ + "name": "Authenticated", + "description": "Default role given to authenticated user.", + "type": "authenticated" +} +``` + +In `Users & Permissions > Advanced` in admin panel update default role to `Authenticated` + +You also will have to reset your roles permissions. + +### Update bookshelf filters + +> This update is if you come from version before alpha-11.3 + +You will have to replace your `fetchAll` services queries of your generated API: + +```js +_.forEach(convertedParams.where, (where, key) => { + if (_.isArray(where.value)) { + for (const value in where.value) { + qb[value ? 'where' : 'orWhere'](key, where.symbol, where.value[value]) + } + } else { + qb.where(key, where.symbol, where.value); + } + }); + + if (convertedParams.sort) { + qb.orderBy(convertedParams.sort.key, convertedParams.sort.order); + } + + qb.offset(convertedParams.start); + + qb.limit(convertedParams.limit); +``` + +That's all, you have now upgraded to Strapi `alpha.12`. From c15874e6b9f6855eb7fcaa3abde76f251a974c1d Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Fri, 20 Apr 2018 11:38:23 +0200 Subject: [PATCH 5/5] Fix versions --- .../en/migration/migration-guide-alpha-11-to-alpha-12.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/3.x.x/en/migration/migration-guide-alpha-11-to-alpha-12.md b/docs/3.x.x/en/migration/migration-guide-alpha-11-to-alpha-12.md index 58fb7192f9..01c30b6875 100644 --- a/docs/3.x.x/en/migration/migration-guide-alpha-11-to-alpha-12.md +++ b/docs/3.x.x/en/migration/migration-guide-alpha-11-to-alpha-12.md @@ -1,6 +1,6 @@ -# Migrating from 3.0.0-alpha.10 to 3.0.0-alpha.11 +# Migrating from 3.0.0-alpha.11 to 3.0.0-alpha.12 -This migration guide is a mix of migrations from 3.0.0-alpha.10.1 to 3.0.0-alpha.10.2, 3.0.0-alpha.10.2 to 3.0.0-alpha.10.3 and from 3.0.0-alpha.10.3 to 3.0.0-alpha.12. +This migration guide is a mix of migrations from 3.0.0-alpha.11.1 to 3.0.0-alpha.11.2, 3.0.0-alpha.11.2 to 3.0.0-alpha.11.3 and from 3.0.0-alpha.11.3 to 3.0.0-alpha.12. > Feel free to [join us on Slack](http://slack.strapi.io) and ask questions about the migration process.