Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed Jun 13, 2024
1 parent 40347b1 commit 33ff68a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
23 changes: 12 additions & 11 deletions scripts/run-registry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { execa, execaCommand } from 'execa';
import { execaCommand } from 'execa';
import { remove, pathExists, readJSON } from 'fs-extra';
import chalk from 'chalk';
import path from 'path';
Expand Down Expand Up @@ -123,7 +123,7 @@ const addUser = (url: string) =>

try {
await execaCommand(
`npx npm-cli-adduser -r ${url} -a -u user -p password -e [email protected] -t legacy`
`npx npm-cli-adduser -r ${url} -a -u foo -p s3cret -e [email protected] -t legacy`
);
res();
} catch (e) {
Expand Down Expand Up @@ -169,15 +169,16 @@ const run = async () => {
await publish(packages, verdaccioUrl);
}

verdaccioServer.unref();

if (!program.open) {
verdaccioServer.close(() => {
process.exit(0);
});
} else {
process.exit(0);
}
return new Promise<void>((res) => {
if (!program.open) {
verdaccioServer.closeAllConnections();
verdaccioServer.close(() => {
res();
});
} else {
res();
}
});
};

run().catch((e) => {
Expand Down
12 changes: 10 additions & 2 deletions scripts/utils/exec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-await-in-loop, no-restricted-syntax */
import type { ExecaChildProcess, Options } from 'execa';
import chalk from 'chalk';
import { execa } from 'execa';
import { execa, execaNode } from 'execa';

const logger = console;

Expand Down Expand Up @@ -52,7 +52,15 @@ export const exec = async (
logger.debug(`> ${subcommand}`);
}
const [file, ...args] = subcommand.split(' ');
const currentChild = execa(file, args, { ...defaultOptions, ...options });

let currentChild: ExecaChildProcess;

if (file === 'node') {
const [path, ...pathArgs] = args;
currentChild = execaNode(path, pathArgs, { ...defaultOptions, ...options });
} else {
currentChild = execa(file, args, { ...defaultOptions, ...options });
}

if (debug) {
currentChild.stdout?.pipe(process.stdout);
Expand Down
3 changes: 2 additions & 1 deletion scripts/verdaccio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ uplinks:
npmjs:
url: https://registry.npmjs.org/
cache: true
strict_ssl: false

packages:
# storybook's 'legacy' packages
Expand Down Expand Up @@ -134,7 +135,7 @@ packages:

'**':
access: $all
publish: $all
publish: $authenticated
proxy: npmjs

logs:
Expand Down
6 changes: 3 additions & 3 deletions scripts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4711,9 +4711,9 @@ __metadata:
linkType: hard

"aws4@npm:^1.8.0":
version: 1.12.0
resolution: "aws4@npm:1.12.0"
checksum: 10c0/1e39c266f53b04daf88e112de93a6006375b386a1b7ab6197260886e39abd012aa90bdd87949c3bf9c30754846031f6d5d8ac4f8676628097c11065b5d39847a
version: 1.13.0
resolution: "aws4@npm:1.13.0"
checksum: 10c0/4c71398543e432631a226cabafaa138f8070482f99790233840d84847291ec744e739cb18684a68f52125d0e73f82f16f0246d93524ec85167fadb3cf60dfa4f
languageName: node
linkType: hard

Expand Down

0 comments on commit 33ff68a

Please sign in to comment.