Skip to content

Commit

Permalink
replace file name with constant
Browse files Browse the repository at this point in the history
  • Loading branch information
BioPhoton committed Sep 10, 2024
1 parent 50973bc commit ec3b45d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions tooling/build-env/src/executors/setup/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { objectToCliArgs } from '../../internal/utils/terminal-command';
import type { VerdaccioProcessResult } from '../../internal/verdaccio/verdaccio-registry';
import type { SetupEnvironmentExecutorOptions } from './schema';
import { normalizeOptions } from '../internal/normalize-options';
import { VERDACCIO_REGISTRY_JSON } from '../../internal/verdaccio/verdaccio-npm-env';

export type ExecutorOutput = {
success: boolean;
Expand Down Expand Up @@ -50,14 +51,14 @@ export default async function runSetupEnvironmentExecutor(
...normalizedOptions,
filePath: join(
normalizedOptions.environmentRoot,
'verdaccio-registry.json'
VERDACCIO_REGISTRY_JSON
),
},
context
);
} else {
const { url } = readJsonFile<VerdaccioProcessResult>(
join(normalizedOptions.environmentRoot, 'verdaccio-registry.json')
join(normalizedOptions.environmentRoot, VERDACCIO_REGISTRY_JSON)
);
logger.info(`Verdaccio server kept running under : ${url}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ function errorLog(msg: string) {
error(msg, 'Verdaccio Env: ');
}

export const VERDACCIO_REGISTRY_JSON = 'verdaccio-registry.json';

export const verdaccioEnvLogger = {
info: logInfo,
error: errorLog,
Expand Down Expand Up @@ -66,7 +68,7 @@ export async function bootstrapEnvironment({
`Save active verdaccio registry data to file: ${activeRegistry.root}`
);
await writeFile(
join(activeRegistry.root, 'verdaccio-registry.json'),
join(activeRegistry.root, VERDACCIO_REGISTRY_JSON),
JSON.stringify(activeRegistry.registry, null, 2)
);

Expand Down
3 changes: 2 additions & 1 deletion tooling/build-env/src/plugin/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import { dirname, join } from 'node:path';
import { DEFAULT_ENVIRONMENTS_OUTPUT_DIR } from '../internal/constants';
import type { StarVerdaccioOptions } from '../internal/verdaccio/verdaccio-registry';
import { VERDACCIO_REGISTRY_JSON } from '../internal/verdaccio/verdaccio-npm-env';

export function isPublishable(tags: string[]): boolean {
return tags.some((target) => target === 'publishable');
Expand Down Expand Up @@ -78,7 +79,7 @@ function verdaccioTargets({
'stop-verdaccio': {
executor: '@org/build-env:kill-process',
options: {
filePath: join(environmentRoot, 'verdaccio-registry.json'),
filePath: join(environmentRoot, VERDACCIO_REGISTRY_JSON),
...options,
},
},
Expand Down

0 comments on commit ec3b45d

Please sign in to comment.