Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fortmarek committed Sep 21, 2022
1 parent 80bb93d commit d82ef32
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .circleci/verdaccio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ auth:
file: ./htpasswd
uplinks:
npmjs:
url: https://registry.yarnpkg.com/
url: https://registry.npmjs.org/
max_fails: 40
maxage: 30m
timeout: 60s
Expand Down
17 changes: 3 additions & 14 deletions scripts/run-ci-e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const {cd, cp, echo, exec, exit, mv, rm} = require('shelljs');
const spawn = require('child_process').spawn;
const argv = require('yargs').argv;
const path = require('path');
const {setupVerdaccio} = require('./setup-verdaccio');

const SCRIPTS = __dirname;
const ROOT = path.normalize(path.join(__dirname, '..'));
Expand Down Expand Up @@ -72,26 +73,14 @@ try {
const REACT_NATIVE_PACKAGE = path.join(ROOT, 'react-native-*.tgz');

describe('Set up Verdaccio');
const verdaccioProcess = spawn('npx', [
'verdaccio@5.15.3',
'--config',
'.circleci/verdaccio.yml',
]);
VERDACCIO_PID = verdaccioProcess.pid;
exec('npx wait-on@6.0.1 http://localhost:4873');
exec('npm set registry http://localhost:4873');
exec('echo "//localhost:4873/:_authToken=secretToken" > .npmrc');
VERDACCIO_PID = setupVerdaccio();

describe('Publish packages');
const packages = JSON.parse(
JSON.parse(exec('yarn --json workspaces info').stdout).data,
);
Object.keys(packages)
.filter(
packageName =>
packageName !== '@react-native/tester' &&
packageName !== '@react-native/repo-config',
)
.filter(packageName => packageName !== '@react-native/repo-config')
.forEach(packageName => {
exec(
`cd ${packages[packageName].location} && npm publish --registry http://localhost:4873 --yes --access public`,
Expand Down
30 changes: 30 additions & 0 deletions scripts/setup-verdaccio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/

'use strict';

function setupVerdaccio() {
const {exec} = require('shelljs');
const spawn = require('child_process').spawn;

const verdaccioProcess = spawn('npx', [
'verdaccio@5.15.3',
'--config',
'.circleci/verdaccio.yml',
]);
const VERDACCIO_PID = verdaccioProcess.pid;
exec('npx wait-on@6.0.1 http://localhost:4873');
exec('npm set registry http://localhost:4873');
exec('echo "//localhost:4873/:_authToken=secretToken" > .npmrc');
return VERDACCIO_PID;
}

module.exports = {
setupVerdaccio: setupVerdaccio,
};

0 comments on commit d82ef32

Please sign in to comment.