Move some packages from @rnw-scripts to @react-native-windows (#6811)
* Move some packages from @rnw-scripts to @react-native-windows These are now being used by product code (e.g. @react-native-windows/cli). Move them to the versioning scheme and naming scheme of other product code, which will also let us backport a change dependent on using package utils. * Change files
This commit is contained in:
Родитель
9d546c3c10
Коммит
cd49e86e7b
|
@ -11,8 +11,8 @@
|
|||
!packages/react-native-windows-init/node_modules
|
||||
!packages/rnpm-plugin-windows/node_modules
|
||||
!packages/scripts/node_modules
|
||||
!packages/@react-native-windows/find-repo-root/node_modules
|
||||
!packages/@rnw-scripts/create-github-releases/node_modules
|
||||
!packages/@rnw-scripts/find-repo-root/node_modules
|
||||
!packages/@rnw-scripts/format-files/node_modules
|
||||
!packages/@rnw-scripts/promote-release/node_modules
|
||||
!.github/ISSUE_TEMPLATE
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "prerelease",
|
||||
"comment": "Move some packages from @rnw-scripts to @react-native-windows",
|
||||
"packageName": "@react-native-windows/cli",
|
||||
"email": "ngerlem@microsoft.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "prerelease",
|
||||
"comment": "Move some packages from @rnw-scripts to @react-native-windows",
|
||||
"packageName": "@react-native-windows/find-repo-root",
|
||||
"email": "ngerlem@microsoft.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "prerelease",
|
||||
"comment": "Move some packages from @rnw-scripts to @react-native-windows",
|
||||
"packageName": "@react-native-windows/package-utils",
|
||||
"email": "ngerlem@microsoft.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Move some packages from @rnw-scripts to @react-native-windows",
|
||||
"packageName": "@rnw-scripts/create-github-releases",
|
||||
"email": "ngerlem@microsoft.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Move some packages from @rnw-scripts to @react-native-windows",
|
||||
"packageName": "@rnw-scripts/integrate-rn",
|
||||
"email": "ngerlem@microsoft.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Move some packages from @rnw-scripts to @react-native-windows",
|
||||
"packageName": "@rnw-scripts/promote-release",
|
||||
"email": "ngerlem@microsoft.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Move some packages from @rnw-scripts to @react-native-windows",
|
||||
"packageName": "react-native-platform-override",
|
||||
"email": "ngerlem@microsoft.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -17,8 +17,8 @@
|
|||
"watch": "just-scripts watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native-windows/package-utils": "^0.0.0-canary.11",
|
||||
"@react-native-windows/telemetry": "^0.0.0-canary.12",
|
||||
"@rnw-scripts/package-utils": "^0.0.11",
|
||||
"chalk": "^4.1.0",
|
||||
"cli-spinners": "^2.2.0",
|
||||
"envinfo": "^7.5.0",
|
||||
|
|
|
@ -22,7 +22,10 @@ import {
|
|||
} from '../generator-common';
|
||||
import {GenerateOptions} from '..';
|
||||
import {CodedError} from '@react-native-windows/telemetry';
|
||||
import {findPackage, WritableNpmPackage} from '@rnw-scripts/package-utils';
|
||||
import {
|
||||
findPackage,
|
||||
WritableNpmPackage,
|
||||
} from '@react-native-windows/package-utils';
|
||||
|
||||
const windowsDir = 'windows';
|
||||
const bundleDir = 'Bundle';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@rnw-scripts/find-repo-root",
|
||||
"version": "0.0.14",
|
||||
"name": "@react-native-windows/find-repo-root",
|
||||
"version": "0.0.0-canary.14",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "just-scripts build",
|
||||
|
@ -24,10 +24,14 @@
|
|||
"typescript": "^3.8.3"
|
||||
},
|
||||
"beachball": {
|
||||
"defaultNpmTag": "canary",
|
||||
"disallowedChangeTypes": [
|
||||
"major"
|
||||
"major",
|
||||
"minor",
|
||||
"patch"
|
||||
]
|
||||
},
|
||||
"promoteRelease": true,
|
||||
"files": [
|
||||
"lib-commonjs"
|
||||
]
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@rnw-scripts/package-utils",
|
||||
"version": "0.0.11",
|
||||
"name": "@react-native-windows/package-utils",
|
||||
"version": "0.0.0-canary.11",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "just-scripts build",
|
||||
|
@ -11,7 +11,7 @@
|
|||
},
|
||||
"main": "lib-commonjs/packageUtils.js",
|
||||
"dependencies": {
|
||||
"@rnw-scripts/find-repo-root": "^0.0.14",
|
||||
"@react-native-windows/find-repo-root": "^0.0.0-canary.14",
|
||||
"get-monorepo-packages": "^1.2.0",
|
||||
"lodash": "^4.17.15"
|
||||
},
|
||||
|
@ -26,10 +26,14 @@
|
|||
"typescript": "^3.8.3"
|
||||
},
|
||||
"beachball": {
|
||||
"defaultNpmTag": "canary",
|
||||
"disallowedChangeTypes": [
|
||||
"major"
|
||||
"major",
|
||||
"minor",
|
||||
"patch"
|
||||
]
|
||||
},
|
||||
"promoteRelease": true,
|
||||
"files": [
|
||||
"lib-commonjs"
|
||||
]
|
|
@ -8,7 +8,7 @@
|
|||
import * as _ from 'lodash';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import findRepoRoot from '@rnw-scripts/find-repo-root';
|
||||
import findRepoRoot from '@react-native-windows/find-repo-root';
|
||||
|
||||
const getMonorepoPackages: (
|
||||
root: string,
|
||||
|
@ -105,7 +105,7 @@ export class WritableNpmPackage extends NpmPackage {
|
|||
*
|
||||
* @param pred predicate describing whether to match a package
|
||||
*/
|
||||
export async function enumerateLocalPackages(
|
||||
export async function enumerateRepoPackages(
|
||||
pred: (pkg: NpmPackage) => Promise<boolean> = async () => true,
|
||||
): Promise<WritableNpmPackage[]> {
|
||||
const repoRoot = await findRepoRoot();
|
||||
|
@ -154,12 +154,10 @@ export async function findPackage(
|
|||
/**
|
||||
* Finds a monorepo-local package with a given name
|
||||
*/
|
||||
export async function findLocalPackage(
|
||||
export async function findRepoPackage(
|
||||
name: string,
|
||||
): Promise<WritableNpmPackage | null> {
|
||||
const packages = await enumerateLocalPackages(
|
||||
async p => p.json.name === name,
|
||||
);
|
||||
const packages = await enumerateRepoPackages(async p => p.json.name === name);
|
||||
|
||||
if (packages.length === 0) {
|
||||
return null;
|
|
@ -13,7 +13,7 @@
|
|||
"create-github-releases": "./bin.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@rnw-scripts/find-repo-root": "^0.0.14",
|
||||
"@react-native-windows/find-repo-root": "^0.0.0-canary.14",
|
||||
"chalk": "^4.1.0",
|
||||
"glob": "^7.1.6",
|
||||
"lodash": "^4.17.15",
|
||||
|
|
|
@ -19,7 +19,7 @@ import * as util from 'util';
|
|||
import * as yargs from 'yargs';
|
||||
|
||||
import fetch from 'node-fetch';
|
||||
import findRepoRoot from '@rnw-scripts/find-repo-root';
|
||||
import findRepoRoot from '@react-native-windows/find-repo-root';
|
||||
|
||||
const glob = util.promisify(require('glob').glob);
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
"integrate-rn": "./bin.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@rnw-scripts/find-repo-root": "^0.0.14",
|
||||
"@rnw-scripts/package-utils": "^0.0.11",
|
||||
"@react-native-windows/find-repo-root": "^0.0.0-canary.14",
|
||||
"@react-native-windows/package-utils": "^0.0.0-canary.11",
|
||||
"async": "^3.2.0",
|
||||
"lodash": "^4.17.15",
|
||||
"ora": "^3.4.0",
|
||||
|
|
|
@ -12,10 +12,10 @@ import * as semver from 'semver';
|
|||
import * as yargs from 'yargs';
|
||||
|
||||
import {
|
||||
enumerateLocalPackages,
|
||||
enumerateRepoPackages,
|
||||
NpmPackage,
|
||||
WritableNpmPackage,
|
||||
} from '@rnw-scripts/package-utils';
|
||||
} from '@react-native-windows/package-utils';
|
||||
|
||||
import {
|
||||
upgradeOverrides,
|
||||
|
@ -59,7 +59,7 @@ import upgradeDependencies from './upgradeDependencies';
|
|||
* Enumerate packages subject to override validation
|
||||
*/
|
||||
async function enumerateOverridePackages(): Promise<WritableNpmPackage[]> {
|
||||
return await enumerateLocalPackages(isOverridePackage);
|
||||
return await enumerateRepoPackages(isOverridePackage);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import {exec, ExecOptions} from 'child_process';
|
||||
import findRepoRoot from '@rnw-scripts/find-repo-root';
|
||||
import findRepoRoot from '@react-native-windows/find-repo-root';
|
||||
|
||||
/**
|
||||
* Run a command asyncronously, setting cwd to repo root if none is specified
|
||||
|
|
|
@ -9,10 +9,10 @@ import * as _ from 'lodash';
|
|||
import * as path from 'path';
|
||||
import * as semver from 'semver';
|
||||
import {
|
||||
enumerateLocalPackages,
|
||||
enumerateRepoPackages,
|
||||
findPackage,
|
||||
findLocalPackage,
|
||||
} from '@rnw-scripts/package-utils';
|
||||
findRepoPackage,
|
||||
} from '@react-native-windows/package-utils';
|
||||
import runCommand from './runCommand';
|
||||
import {upgradeOverrides} from 'react-native-platform-override';
|
||||
|
||||
|
@ -60,7 +60,7 @@ export default async function upgradeDependencies(
|
|||
) {
|
||||
const reactNativeDiff = await upgradeReactNative(newReactNativeVersion);
|
||||
const repoConfigDiff = await upgradeRepoConfig(newReactNativeVersion);
|
||||
const localPackages = (await enumerateLocalPackages()).map(pkg => ({
|
||||
const localPackages = (await enumerateRepoPackages()).map(pkg => ({
|
||||
...extractPackageDeps(pkg.json),
|
||||
outOfTreePlatform: OUT_OF_TREE_PLATFORMS.includes(pkg.json.name),
|
||||
}));
|
||||
|
@ -72,7 +72,7 @@ export default async function upgradeDependencies(
|
|||
localPackages,
|
||||
);
|
||||
|
||||
const writablePackages = await enumerateLocalPackages();
|
||||
const writablePackages = await enumerateRepoPackages();
|
||||
await Promise.all(
|
||||
newDeps.map(async deps => {
|
||||
const [writablePackage] = writablePackages.filter(
|
||||
|
@ -111,7 +111,7 @@ export default async function upgradeDependencies(
|
|||
async function upgradeReactNative(
|
||||
newReactNativeVersion: string,
|
||||
): Promise<PackageDiff> {
|
||||
const platformPackages = await enumerateLocalPackages(async pkg =>
|
||||
const platformPackages = await enumerateRepoPackages(async pkg =>
|
||||
OUT_OF_TREE_PLATFORMS.includes(pkg.json.name),
|
||||
);
|
||||
|
||||
|
@ -124,7 +124,7 @@ async function upgradeReactNative(
|
|||
const findRnOpts = {searchPath: platformPackages[0].path};
|
||||
const origJson = (await findPackage('react-native', findRnOpts))!.json;
|
||||
|
||||
for (const pkg of await enumerateLocalPackages()) {
|
||||
for (const pkg of await enumerateRepoPackages()) {
|
||||
if (pkg.json.dependencies && pkg.json.dependencies['react-native']) {
|
||||
await pkg.mergeProps({
|
||||
dependencies: {
|
||||
|
@ -160,7 +160,7 @@ async function upgradeReactNative(
|
|||
async function upgradeRepoConfig(
|
||||
newReactNativeVersion: string,
|
||||
): Promise<PackageDiff> {
|
||||
const origPackage = (await findLocalPackage('@react-native/repo-config'))!;
|
||||
const origPackage = (await findRepoPackage('@react-native/repo-config'))!;
|
||||
|
||||
const upgradeResults = await upgradeOverrides(
|
||||
path.join(origPackage.path, 'overrides.json'),
|
||||
|
@ -176,7 +176,7 @@ async function upgradeRepoConfig(
|
|||
);
|
||||
}
|
||||
|
||||
const newPackage = (await findLocalPackage('@react-native/repo-config'))!;
|
||||
const newPackage = (await findRepoPackage('@react-native/repo-config'))!;
|
||||
return extractPackageDiff(origPackage.json, newPackage.json);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
"promote-release": "./bin.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@rnw-scripts/find-repo-root": "^0.0.14",
|
||||
"@rnw-scripts/package-utils": "^0.0.11",
|
||||
"@react-native-windows/find-repo-root": "^0.0.0-canary.14",
|
||||
"@react-native-windows/package-utils": "^0.0.0-canary.11",
|
||||
"chalk": "^4.1.0",
|
||||
"simple-git": "^1.131.0",
|
||||
"yargs": "^15.4.1"
|
||||
|
|
|
@ -18,10 +18,10 @@ import * as simplegit from 'simple-git/promise';
|
|||
import * as yargs from 'yargs';
|
||||
|
||||
import {
|
||||
enumerateLocalPackages,
|
||||
enumerateRepoPackages,
|
||||
WritableNpmPackage,
|
||||
} from '@rnw-scripts/package-utils';
|
||||
import findRepoRoot from '@rnw-scripts/find-repo-root';
|
||||
} from '@react-native-windows/package-utils';
|
||||
import findRepoRoot from '@react-native-windows/find-repo-root';
|
||||
|
||||
type ReleaseType = 'preview' | 'latest' | 'legacy';
|
||||
|
||||
|
@ -155,7 +155,7 @@ async function updateBeachballConfig(
|
|||
* Finds packages where we need to update version number + beachball config
|
||||
*/
|
||||
async function enumeratePackagesToPromote(): Promise<WritableNpmPackage[]> {
|
||||
return enumerateLocalPackages(async pkg => pkg.json.promoteRelease === true);
|
||||
return enumerateRepoPackages(async pkg => pkg.json.promoteRelease === true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,7 +186,7 @@ async function updatePackageVersions(version: string) {
|
|||
|
||||
// We need to update anything that might have a dependency on what we just
|
||||
// bumped.
|
||||
for (const pkg of await enumerateLocalPackages()) {
|
||||
for (const pkg of await enumerateRepoPackages()) {
|
||||
for (const field of [
|
||||
'dependencies',
|
||||
'peerDependencies',
|
||||
|
@ -214,7 +214,7 @@ async function updatePackageVersions(version: string) {
|
|||
* ensure we do not depend on any of these in our published packages.
|
||||
*/
|
||||
async function markMasterPackagesPrivate() {
|
||||
const masterPublishedPackages = await enumerateLocalPackages(
|
||||
const masterPublishedPackages = await enumerateRepoPackages(
|
||||
async pkg => !pkg.json.promoteRelease && !pkg.json.private,
|
||||
);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
"react-native-platform-override": "./bin.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@rnw-scripts/package-utils": "^0.0.11",
|
||||
"@react-native-windows/package-utils": "^0.0.0-canary.11",
|
||||
"async": "^3.2.0",
|
||||
"chalk": "^4.1.0",
|
||||
"fp-ts": "^2.5.0",
|
||||
|
@ -45,7 +45,7 @@
|
|||
"@rnw-scripts/eslint-config": "0.1.6",
|
||||
"@rnw-scripts/jest-unittest-config": "0.1.1",
|
||||
"@rnw-scripts/just-task": "0.0.6",
|
||||
"@rnw-scripts/package-utils": "0.0.11",
|
||||
"@react-native-windows/package-utils": "0.0.11",
|
||||
"@rnw-scripts/ts-config": "0.1.0",
|
||||
"@types/async": "^3.2.3",
|
||||
"@types/chalk": "^2.2.0",
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import {enumerateLocalPackages} from '@rnw-scripts/package-utils';
|
||||
import {enumerateRepoPackages} from '@react-native-windows/package-utils';
|
||||
|
||||
/**
|
||||
* Search for a single manifest adjacent to the package above a directory or
|
||||
|
@ -45,7 +45,7 @@ export async function findAllManifests(): Promise<string[]> {
|
|||
return [path.join(packageDir, 'overrides.json')];
|
||||
}
|
||||
|
||||
const localPackages = await enumerateLocalPackages(pkg =>
|
||||
const localPackages = await enumerateRepoPackages(pkg =>
|
||||
exists(path.join(pkg.path, 'overrides.json')),
|
||||
);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче