piral-cli 0.14.28-beta.4360 → 0.14.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-cli",
3
- "version": "0.14.28-beta.4360",
3
+ "version": "0.14.28",
4
4
  "description": "The standard CLI for creating and building a Piral instance or a Pilet.",
5
5
  "keywords": [
6
6
  "portal",
@@ -79,5 +79,5 @@
79
79
  "typescript": "^4.0.2",
80
80
  "yargs": "^15.4.1"
81
81
  },
82
- "gitHead": "d7d2a311e7c9c2707d46f41a78d435ff44bc7169"
82
+ "gitHead": "d76ab003556bd113dd00fd41af144411ae974b6c"
83
83
  }
package/src/common/npm.ts CHANGED
@@ -3,7 +3,7 @@ import { createReadStream, existsSync } from 'fs';
3
3
  import { log, fail } from './log';
4
4
  import { clients, detectClients, isWrapperClient } from './clients';
5
5
  import { config } from './config';
6
- import { legacyCoreExternals, frameworkLibs } from './constants';
6
+ import { legacyCoreExternals, frameworkLibs, defaultRegistry } from './constants';
7
7
  import { inspectPackage } from './inspect';
8
8
  import { readJson, checkExists } from './io';
9
9
  import { clientTypeKeys } from '../helpers';
@@ -125,6 +125,22 @@ export function installNpmDependencies(client: NpmClientType, target = '.'): Pro
125
125
  return installDependencies(target);
126
126
  }
127
127
 
128
+ export async function installNpmPackageFromOptionalRegistry(
129
+ packageRef: string,
130
+ target = '.',
131
+ registry: string,
132
+ ): Promise<void> {
133
+ try {
134
+ await installNpmPackage('npm', packageRef, target, '--registry', registry);
135
+ } catch (e) {
136
+ if (registry === defaultRegistry) {
137
+ throw e;
138
+ }
139
+
140
+ await installNpmPackage('npm', packageRef, target, '--registry', defaultRegistry);
141
+ }
142
+ }
143
+
128
144
  export async function installNpmPackage(
129
145
  client: NpmClientType,
130
146
  packageRef: string,
@@ -1,5 +1,5 @@
1
1
  import { join, dirname, resolve, basename, isAbsolute } from 'path';
2
- import { installNpmPackage } from './npm';
2
+ import { installNpmPackageFromOptionalRegistry } from './npm';
3
3
  import { ForceOverwrite, SourceLanguage } from './enums';
4
4
  import { createDirectory, createFileIfNotExists, updateExistingJson } from './io';
5
5
  import { log, fail } from './log';
@@ -40,7 +40,7 @@ async function getTemplateFiles(
40
40
  templatePackageName = `${templatePackageName}@latest`;
41
41
  }
42
42
 
43
- await installNpmPackage('npm', templatePackageName, __dirname, '--registry', registry);
43
+ await installNpmPackageFromOptionalRegistry(templatePackageName, __dirname, registry);
44
44
  }
45
45
 
46
46
  const templateRunner = getTemplatePackage(templatePackageName);