piral-cli 0.15.0-beta.4607 → 0.15.0-beta.4630

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.15.0-beta.4607",
3
+ "version": "0.15.0-beta.4630",
4
4
  "description": "The standard CLI for creating and building a Piral instance or a Pilet.",
5
5
  "keywords": [
6
6
  "portal",
@@ -78,5 +78,5 @@
78
78
  "typescript": "^4.7.3",
79
79
  "yargs": "^15.4.1"
80
80
  },
81
- "gitHead": "2b1f8f84149c0ddb5020a5df0bb1b94dad56f386"
81
+ "gitHead": "08aea96af9587e73b1a6c4eb108f94f285186b10"
82
82
  }
@@ -285,9 +285,10 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
285
285
  Promise.all(pilets.map((p) => p.bundler.ready())).then(() => logDone(`Ready!`));
286
286
 
287
287
  const sources = pilets.map((m) => m.mocks).filter(Boolean);
288
+ const baseMocks = resolve(fullBase, 'mocks');
288
289
  const krasBaseConfig = resolve(fullBase, krasrc);
289
290
  const krasRootConfig = resolve(appRoot, krasrc);
290
- const initial = createInitialKrasConfig(sources[0] || resolve(fullBase, 'mocks'), { [api]: '' }, sources, feed);
291
+ const initial = createInitialKrasConfig(baseMocks, sources, { [api]: '' }, feed);
291
292
  const required = {
292
293
  injectors: {
293
294
  piral: {
@@ -17,6 +17,7 @@ import {
17
17
  getDestination,
18
18
  createInitialKrasConfig,
19
19
  getAvailablePort,
20
+ checkExistingDirectory,
20
21
  } from '../common';
21
22
 
22
23
  export interface DebugPiralOptions {
@@ -122,6 +123,7 @@ export async function debugPiral(baseDir = process.cwd(), options: DebugPiralOpt
122
123
  await hooks.onBegin?.({ options, fullBase });
123
124
  progress('Reading configuration ...');
124
125
  const entryFiles = await retrievePiralRoot(fullBase, entry);
126
+ const targetDir = dirname(entryFiles);
125
127
  const { externals, name, root, ignored } = await retrievePiletsInfo(entryFiles);
126
128
  const dest = getDestination(entryFiles, resolve(fullBase, target));
127
129
 
@@ -154,7 +156,11 @@ export async function debugPiral(baseDir = process.cwd(), options: DebugPiralOpt
154
156
 
155
157
  const krasBaseConfig = resolve(fullBase, krasrc);
156
158
  const krasRootConfig = resolve(root, krasrc);
157
- const initial = createInitialKrasConfig(join(dirname(entryFiles), 'mocks'));
159
+ const mocks = join(targetDir, 'mocks');
160
+ const baseMocks = resolve(fullBase, 'mocks');
161
+ const mocksExist = await checkExistingDirectory(mocks);
162
+ const sources = [mocksExist ? mocks : undefined].filter(Boolean);
163
+ const initial = createInitialKrasConfig(baseMocks, sources);
158
164
  const required = {
159
165
  injectors: {
160
166
  piral: {
@@ -1,5 +1,6 @@
1
1
  import { resolve } from 'path';
2
2
  import { publishArtifacts } from '../release';
3
+ import { LogLevels, PiralBuildType } from '../types';
3
4
  import {
4
5
  setLogLevel,
5
6
  progress,
@@ -11,7 +12,6 @@ import {
11
12
  matchFiles,
12
13
  log,
13
14
  } from '../common';
14
- import { LogLevels, PiralBuildType } from '../types';
15
15
 
16
16
  export interface PublishPiralOptions {
17
17
  /**
@@ -17,8 +17,8 @@ export function notifyServerOnline(bundlers: Array<Bundler>, path: string, api:
17
17
 
18
18
  export function createInitialKrasConfig(
19
19
  directory: string,
20
- map: Record<string, string> = {},
21
20
  sources: Array<string> = [],
21
+ map: Record<string, string> = {},
22
22
  feed: string | Array<string> = [],
23
23
  ) {
24
24
  return {