Rename E2E template init script, relocate Verdaccio config + storage (#43001)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43001

More understandable name: ~"React Native init, for E2E testing". Also relocates Verdaccio config and storage location under `scripts/e2e/` (resolving TODO comment).

The intent is for the `scripts/e2e/` dir to also group the existing E2E testing-related scripts — although I will stop here for the current release-related work.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53609332

fbshipit-source-id: fb2f6502a18c4a4ac2368b46af1e3ee42edbadd6
This commit is contained in:
Alex Hunt 2024-02-15 14:51:48 -08:00 committed by Facebook GitHub Bot
parent e4135e9be5
commit fb446598f9
8 changed files with 12 additions and 15 deletions

View File

@ -360,7 +360,7 @@ jobs:
command: |
REPO_ROOT=$(pwd)
node ./scripts/releases/update-template-package.js "{\"react-native\":\"file:$REPO_ROOT/build/$(cat build/react-native-package-version)\"}"
node ./scripts/template/initialize.js --projectName $PROJECT_NAME --templatePath "$REPO_ROOT/packages/react-native" --directory "/tmp/$PROJECT_NAME" --verbose
node ./scripts/e2e/init-template-e2e.js --projectName $PROJECT_NAME --templatePath "$REPO_ROOT/packages/react-native" --directory "/tmp/$PROJECT_NAME" --verbose
- with_gradle_cache:
steps:
- run:
@ -458,7 +458,7 @@ jobs:
PACKAGE=$(cat build/react-native-package-version)
PATH_TO_PACKAGE="$REPO_ROOT/build/$PACKAGE"
node ./scripts/releases/update-template-package.js "{\"react-native\":\"file:$PATH_TO_PACKAGE\"}"
node ./scripts/template/initialize.js --projectName $PROJECT_NAME --templatePath "$REPO_ROOT/packages/react-native" --directory "/tmp/$PROJECT_NAME" --verbose
node ./scripts/e2e/init-template-e2e.js --projectName $PROJECT_NAME --templatePath "$REPO_ROOT/packages/react-native" --directory "/tmp/$PROJECT_NAME" --verbose
- with_xcodebuild_cache:
podfile_lock_path: << parameters.podfile_lock_path >>
pods_build_folder: << parameters.pods_build_folder >>

1
.gitignore vendored
View File

@ -155,4 +155,3 @@ vendor/
# CircleCI
.circleci/generated_config.yml
.circleci/storage

View File

@ -17,7 +17,7 @@ const {
VERDACCIO_SERVER_URL,
VERDACCIO_STORAGE_PATH,
setupVerdaccio,
} = require('./setup-verdaccio');
} = require('./utils/verdaccio');
const {parseArgs} = require('@pkgjs/parseargs');
const chalk = require('chalk');
const {execSync} = require('child_process');
@ -42,7 +42,7 @@ async function main() {
if (help) {
console.log(`
Usage: node ./scripts/template/initialize.js [OPTIONS]
Usage: node ./scripts/e2e/init-template-e2e.js [OPTIONS]
Bootstraps and runs \`react-native init\`, using the currently checked out
repository as the source of truth for the react-native package and

View File

@ -15,18 +15,16 @@ const {execSync, spawn} = require('child_process');
const fs = require('fs');
const path = require('path');
const REPO_ROOT = path.join(__dirname, '../..');
const REPO_ROOT = path.join(__dirname, '../../..');
const NPM_CONFIG_PATH = path.join(REPO_ROOT, '.npmrc');
// TODO(huntie): Relocate (used by both local and CI scripts)
const VERDACCIO_CONFIG_PATH = `${REPO_ROOT}/.circleci/verdaccio.yml`;
const VERDACCIO_STORAGE_PATH = `${REPO_ROOT}/.circleci/storage`;
const VERDACCIO_CONFIG_PATH = path.join(__dirname, '..', 'verdaccio.yml');
const VERDACCIO_STORAGE_PATH = '/tmp/verdaccio';
const VERDACCIO_SERVER_URL = 'http://localhost:4873';
/**
* Configure and run a local Verdaccio server. This is an npm proxy that can be
* used with `npm publish` and `npm install`, configured in
* `.circleci/verdaccio.yml`.
* `scripts/e2e/verdaccio.yml`.
*/
function setupVerdaccio() /*: number */ {
const {host} = new URL(VERDACCIO_SERVER_URL);

View File

@ -1,4 +1,4 @@
storage: ./storage
storage: /tmp/verdaccio
auth:
htpasswd:
file: ./htpasswd

View File

@ -29,7 +29,7 @@
* - an option to uninstall the apps (RNTester, RNTestProject) from emulators
*/
const {VERDACCIO_STORAGE_PATH} = require('../template/setup-verdaccio');
const {VERDACCIO_STORAGE_PATH} = require('../e2e/utils/verdaccio');
const {isPackagerRunning} = require('./utils/testing-utils');
const {exec, exit} = require('shelljs');

View File

@ -17,8 +17,8 @@
* and to make it more accessible for other devs to play around with.
*/
const {initNewProjectFromSource} = require('../e2e/init-template-e2e');
const updateTemplatePackage = require('../releases/update-template-package');
const {initNewProjectFromSource} = require('../template/initialize');
const {
checkPackagerRunning,
launchPackagerInSeparateWindow,

View File

@ -19,8 +19,8 @@
* --retries [num] - how many times to retry possible flaky commands: yarn add and running tests, default 1
*/
const {setupVerdaccio} = require('./e2e/utils/verdaccio');
const forEachPackage = require('./monorepo/for-each-package');
const {setupVerdaccio} = require('./template/setup-verdaccio');
const tryExecNTimes = require('./try-n-times');
const {execFileSync, spawn} = require('child_process');
const fs = require('fs');