Link the strapi-utils dependecy to the users-permissions module in the setup step

This commit is contained in:
Kamal Bennani 2018-11-17 13:50:50 +01:00
parent 19ec6242f9
commit da5ca2a125
No known key found for this signature in database
GPG Key ID: 4513063CDB1A1C25
12 changed files with 83 additions and 31 deletions

View File

@ -49,4 +49,4 @@
"npm": ">= 5.0.0"
},
"license": "MIT"
}
}

View File

@ -47,4 +47,4 @@
"npm": ">= 3.0.0"
},
"license": "MIT"
}
}

View File

@ -29,7 +29,7 @@
"koa2-ratelimit": "^0.6.1",
"purest": "^2.0.1",
"request": "^2.83.0",
"strapi-utils": "3.0.0-alpha.14.3",
"strapi-utils": "3.0.0-alpha.14.5",
"uuid": "^3.1.0"
},
"devDependencies": {

View File

@ -39,4 +39,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -42,4 +42,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -42,4 +42,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -41,4 +41,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -39,4 +39,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -13,4 +13,4 @@
"pkgcloud": "^1.5.0",
"streamifier": "^0.1.1"
}
}
}

View File

@ -34,7 +34,6 @@ const watcher = (label, cmd, withSuccess = true) => {
shell.echo('✅ Success');
shell.echo('');
}
};
const asyncWatcher = (label, cmd, withSuccess = true, resolve) => {
@ -88,7 +87,6 @@ if (shell.test('-e', 'admin/src/config/plugins.json') === false) {
shell.cd('../../../');
}
watcher('📦 Linking strapi-admin', 'npm link --no-optional', false);
shell.cd('../strapi-generate-admin');
@ -112,18 +110,33 @@ watcher('', 'npm install ../strapi-hook-knex');
watcher('📦 Linking strapi-hook-bookshelf...', 'npm link');
shell.cd('../strapi');
watcher('', 'npm install ../strapi-generate ../strapi-generate-admin ../strapi-generate-api ../strapi-generate-new ../strapi-generate-plugin ../strapi-generate-policy ../strapi-generate-service ../strapi-utils');
watcher(
'',
'npm install ../strapi-generate ../strapi-generate-admin ../strapi-generate-api ../strapi-generate-new ../strapi-generate-plugin ../strapi-generate-policy ../strapi-generate-service ../strapi-utils'
);
watcher('📦 Linking strapi...', 'npm link');
shell.cd('../strapi-plugin-graphql');
watcher('📦 Linking strapi-plugin-graphql...', 'npm link --no-optional', false);
watcher(
'📦 Linking strapi-plugin-graphql...',
'npm link --no-optional',
false
);
// Plugin services
shell.cd('../strapi-provider-upload-local');
watcher('📦 Linking strapi-provider-upload-local...', 'npm link --no-optional', false);
watcher(
'📦 Linking strapi-provider-upload-local...',
'npm link --no-optional',
false
);
shell.cd('../strapi-provider-email-sendmail');
watcher('📦 Linking strapi-provider-email-sendmail...', 'npm link --no-optional', false);
watcher(
'📦 Linking strapi-provider-email-sendmail...',
'npm link --no-optional',
false
);
// Plugins with admin
shell.cd('../strapi-plugin-email');
@ -134,19 +147,31 @@ watcher('📦 Linking strapi-plugin-email...', 'npm link --no-optional', false)
shell.cd('../strapi-plugin-users-permissions');
watcher('', 'npm install ../strapi-helper-plugin --no-optional');
watcher('', 'npm install ../strapi-utils --no-optional');
shell.rm('-f', 'package-lock.json');
watcher('📦 Linking strapi-plugin-users-permissions...', 'npm link --no-optional', false);
watcher(
'📦 Linking strapi-plugin-users-permissions...',
'npm link --no-optional',
false
);
shell.cd('../strapi-plugin-content-manager');
watcher('', 'npm install ../strapi-helper-plugin --no-optional');
shell.rm('-f', 'package-lock.json');
watcher('📦 Linking strapi-plugin-content-manager...', 'npm link --no-optional', false);
watcher(
'📦 Linking strapi-plugin-content-manager...',
'npm link --no-optional',
false
);
shell.cd('../strapi-plugin-settings-manager');
watcher('', 'npm install ../strapi-helper-plugin --no-optional');
shell.rm('-f', 'package-lock.json');
watcher('📦 Linking strapi-plugin-settings-manager...', 'npm link --no-optional', false);
watcher(
'📦 Linking strapi-plugin-settings-manager...',
'npm link --no-optional',
false
);
// Plugins with admin and other plugin's dependencies
shell.cd('../strapi-plugin-upload');
@ -160,16 +185,32 @@ watcher('', 'npm install ../strapi-helper-plugin --no-optional');
watcher('', 'npm install ../strapi-generate --no-optional');
watcher('', 'npm install ../strapi-generate-api --no-optional');
shell.rm('-f', 'package-lock.json');
watcher('📦 Linking strapi-plugin-content-type-builder...', 'npm link --no-optional', false);
watcher(
'📦 Linking strapi-plugin-content-type-builder...',
'npm link --no-optional',
false
);
const pluginsToBuild = ['admin', 'content-manager', 'content-type-builder', 'upload', 'email', 'users-permissions', 'settings-manager'];
const pluginsToBuild = [
'admin',
'content-manager',
'content-type-builder',
'upload',
'email',
'users-permissions',
'settings-manager'
];
const buildPlugins = async () => {
const build = (pckgName) => {
const build = pckgName => {
return new Promise(resolve => {
const name = pckgName === 'admin' ? pckgName: `plugin-${pckgName}`;
asyncWatcher(`🏗 Building ${name}...`, `cd ../strapi-${name} && IS_MONOREPO=true npm run build`, false, resolve);
const name = pckgName === 'admin' ? pckgName : `plugin-${pckgName}`;
asyncWatcher(
`🏗 Building ${name}...`,
`cd ../strapi-${name} && IS_MONOREPO=true npm run build`,
false,
resolve
);
});
};
@ -178,23 +219,34 @@ const buildPlugins = async () => {
const setup = async () => {
if (process.env.npm_config_build) {
if (process.platform === 'darwin') { // Allow async build for darwin platform
if (process.platform === 'darwin') {
// Allow async build for darwin platform
await buildPlugins();
} else {
pluginsToBuild.map(name => {
const pluginName = name === 'admin' ? name : `plugin-${name}`;
shell.cd(`../strapi-${pluginName}`);
return watcher(`🏗 Building ${pluginName}...`, 'IS_MONOREPO=true npm run build');
return watcher(
`🏗 Building ${pluginName}...`,
'IS_MONOREPO=true npm run build'
);
});
}
}
// Log installation duration.
const installationEndDate = new Date();
const duration = (installationEndDate.getTime() - installationStartDate.getTime()) / 1000;
const duration =
(installationEndDate.getTime() - installationStartDate.getTime()) / 1000;
shell.echo('✅ Strapi has been succesfully installed.');
shell.echo(`⏳ The installation took ${Math.floor(duration / 60) > 0 ? `${Math.floor(duration / 60)} minutes and ` : ''}${Math.floor(duration % 60)} seconds.`);
shell.echo(
`⏳ The installation took ${
Math.floor(duration / 60) > 0
? `${Math.floor(duration / 60)} minutes and `
: ''
}${Math.floor(duration % 60)} seconds.`
);
};
setup();