Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| adfdf68c38 | |||
| d4a4d69941 | |||
| c1fed2c758 | |||
| 9918d81f59 |
1444
package-lock.json
generated
1444
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shipzone/npmci",
|
"name": "@shipzone/npmci",
|
||||||
"version": "3.1.33",
|
"version": "3.1.35",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "node and docker in gitlab ci on steroids",
|
"description": "node and docker in gitlab ci on steroids",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
"@pushrocks/smartcli": "^3.0.7",
|
"@pushrocks/smartcli": "^3.0.7",
|
||||||
"@pushrocks/smartdelay": "^2.0.3",
|
"@pushrocks/smartdelay": "^2.0.3",
|
||||||
"@pushrocks/smartfile": "^7.0.2",
|
"@pushrocks/smartfile": "^7.0.2",
|
||||||
|
"@pushrocks/smartgit": "^1.0.9",
|
||||||
"@pushrocks/smartlog": "^2.0.19",
|
"@pushrocks/smartlog": "^2.0.19",
|
||||||
"@pushrocks/smartlog-destination-local": "^8.0.2",
|
"@pushrocks/smartlog-destination-local": "^8.0.2",
|
||||||
"@pushrocks/smartparam": "^1.0.4",
|
"@pushrocks/smartparam": "^1.0.4",
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ export let mirror = async () => {
|
|||||||
if (githubToken) {
|
if (githubToken) {
|
||||||
logger.log('info', 'found github token.');
|
logger.log('info', 'found github token.');
|
||||||
logger.log('info', 'attempting the mirror the repository to GitHub');
|
logger.log('info', 'attempting the mirror the repository to GitHub');
|
||||||
|
|
||||||
|
plugins.smartgit.GitRepo
|
||||||
|
|
||||||
// add the mirror
|
// add the mirror
|
||||||
await bash(
|
await bash(
|
||||||
`git remote add mirror https://${githubToken}@github.com/${githubUser}/${githubRepo}.git`
|
`git remote add mirror https://${githubToken}@github.com/${githubUser}/${githubRepo}.git`
|
||||||
|
|||||||
@@ -1 +1,7 @@
|
|||||||
export * from '../npmci.plugins';
|
export * from '../npmci.plugins';
|
||||||
|
|
||||||
|
import * as smartgit from '@pushrocks/smartgit';
|
||||||
|
|
||||||
|
export {
|
||||||
|
smartgit
|
||||||
|
};
|
||||||
|
|||||||
@@ -66,25 +66,45 @@ const prepare = async () => {
|
|||||||
* publish a package to npm
|
* publish a package to npm
|
||||||
*/
|
*/
|
||||||
const publish = async () => {
|
const publish = async () => {
|
||||||
let npmAccessCliString = ``;
|
const buildPublishCommand = async () => {
|
||||||
let npmRegistryCliString = ``;
|
let npmAccessCliString = ``;
|
||||||
const config = await configModule.getConfig();
|
let npmRegistryCliString = ``;
|
||||||
|
let publishVerdaccioAsWell = false;
|
||||||
|
const config = await configModule.getConfig();
|
||||||
|
const availableRegistries: string[] = [];
|
||||||
|
await plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TOKEN_NPM*', npmEnvArg => {
|
||||||
|
availableRegistries.push(npmEnvArg.split('|')[0]);
|
||||||
|
});
|
||||||
|
|
||||||
// -> configure package access level
|
// -> configure package access level
|
||||||
if (
|
if (
|
||||||
config.npmAccessLevel &&
|
config.npmAccessLevel
|
||||||
(config.npmAccessLevel === 'public' || config.npmAccessLevel === 'private')
|
) {
|
||||||
) {
|
npmAccessCliString = `--access=${config.npmAccessLevel}`;
|
||||||
npmAccessCliString = `--access=${config.npmAccessLevel}`;
|
if (config.npmAccessLevel === 'public') {
|
||||||
}
|
publishVerdaccioAsWell = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// -> configure registry url
|
||||||
|
if (config.npmRegistryUrl) {
|
||||||
|
npmRegistryCliString = `--registry=https://${config.npmRegistryUrl}`;
|
||||||
|
} else {
|
||||||
|
logger.log('error', `no registry url specified. Can't publish!`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// -> configure registry url
|
let publishCommand = `npm publish ${npmAccessCliString} ${npmRegistryCliString} `;
|
||||||
if (config.npmRegistryUrl) {
|
|
||||||
npmRegistryCliString = `--registry=https://${config.npmRegistryUrl}`;
|
// publishEverywhere
|
||||||
} else {
|
if (publishVerdaccioAsWell) {
|
||||||
logger.log('error', `no registry url specified. Can't publish!`);
|
const verdaccioRegistry = availableRegistries.find(registryString => registryString.startsWith('verdaccio'));
|
||||||
process.exit(1);
|
if (verdaccioRegistry) {
|
||||||
}
|
logger.log('info', `package is public and verdaccio registry is specified. Also publishing to Verdaccio!`);
|
||||||
|
publishCommand = `${publishCommand} && npm publish ${npmAccessCliString} --registry=https://${verdaccioRegistry}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return publishCommand;
|
||||||
|
};
|
||||||
|
|
||||||
// -> preparing
|
// -> preparing
|
||||||
logger.log('info', `now preparing environment:`);
|
logger.log('info', `now preparing environment:`);
|
||||||
@@ -105,7 +125,7 @@ const publish = async () => {
|
|||||||
|
|
||||||
// -> publish it
|
// -> publish it
|
||||||
logger.log('info', `now invoking npm to publish the package!`);
|
logger.log('info', `now invoking npm to publish the package!`);
|
||||||
await bash(`npm publish ${npmAccessCliString} ${npmRegistryCliString}`);
|
await bash(await buildPublishCommand());
|
||||||
logger.log('success', `Package was successfully published!`);
|
logger.log('success', `Package was successfully published!`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user