Skip to content

Commit

Permalink
fix: pass npmRegistryServer to Yarn config
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonrybczak committed Jan 23, 2024
1 parent efd1cd0 commit 1377330
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/template/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const {reactNativeRootPath, templateName, templateConfigPath, directory} = argv;

const REPO_ROOT = path.resolve(__dirname, '../..');
const VERDACCIO_CONFIG_PATH = `${reactNativeRootPath}/.circleci/verdaccio.yml`;
const NPM_REGISTRY_SERVER = 'http://localhost:4873';

async function install() {
const VERDACCIO_PID = setupVerdaccio(
Expand Down Expand Up @@ -82,7 +83,7 @@ async function install() {
process.stdout.write('Published every package \u2705\n');

execSync(
`node cli.js init ${templateName} --directory ${directory} --template ${templateConfigPath} --verbose --skip-install`,
`node cli.js init ${templateName} --directory ${directory} --template ${templateConfigPath} --verbose --skip-install --yarn-config-options npmRegistryServer="${NPM_REGISTRY_SERVER}"`,
{
cwd: `${reactNativeRootPath}/packages/react-native`,
stdio: [process.stdin, process.stdout, process.stderr],
Expand All @@ -95,6 +96,12 @@ async function install() {
cwd: directory,
stdio: [process.stdin, process.stdout, process.stderr],
};

execSync(
`yarn config set npmRegistryServer "${NPM_REGISTRY_SERVER}"`,
options,
);

const success = await retry('yarn', options, 3, 500, ['install']);

if (!success) {
Expand Down

0 comments on commit 1377330

Please sign in to comment.