@react-native-community/cli-tools
Advanced tools
Comparing version 12.0.0-alpha.5 to 12.0.0-alpha.6
@@ -1,6 +0,5 @@ | ||
type Platforms = 'android' | 'ios'; | ||
type Platforms = 'android' | 'ios' | 'inherit' | 'none'; | ||
export declare function getOS(): string; | ||
interface Overrides { | ||
os?: string; | ||
platform?: string; | ||
hash?: string; | ||
@@ -12,7 +11,7 @@ version?: string; | ||
} | ||
export declare const docs: (path: string, hashOrOverrides?: string | (Overrides & Other) | undefined) => string; | ||
export declare const contributing: (path: string, hashOrOverrides?: string | (Overrides & Other) | undefined) => string; | ||
export declare const community: (path: string, hashOrOverrides?: string | (Overrides & Other) | undefined) => string; | ||
export declare const showcase: (path: string, hashOrOverrides?: string | (Overrides & Other) | undefined) => string; | ||
export declare const blog: (path: string, hashOrOverrides?: string | (Overrides & Other) | undefined) => string; | ||
export declare const docs: (path: string, platform: Platforms, hashOrOverrides?: string | (Overrides & Other) | undefined) => string; | ||
export declare const contributing: (path: string, platform: Platforms, hashOrOverrides?: string | (Overrides & Other) | undefined) => string; | ||
export declare const community: (path: string, platform: Platforms, hashOrOverrides?: string | (Overrides & Other) | undefined) => string; | ||
export declare const showcase: (path: string, platform: Platforms, hashOrOverrides?: string | (Overrides & Other) | undefined) => string; | ||
export declare const blog: (path: string, platform: Platforms, hashOrOverrides?: string | (Overrides & Other) | undefined) => string; | ||
/** | ||
@@ -19,0 +18,0 @@ * When the user builds, we should define the target platform globally. |
@@ -26,2 +26,4 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// No platform specific documentation | ||
function getOS() { | ||
@@ -46,3 +48,3 @@ // Using os.platform instead of process.platform so we can test more easily. Once jest upgrades | ||
} | ||
let _platform = 'android'; | ||
let _platform = null; | ||
let _version; | ||
@@ -52,3 +54,3 @@ /** | ||
*/ | ||
function doclink(section, path, hashOrOverrides) { | ||
function doclink(section, path, platform, hashOrOverrides) { | ||
const url = new URL('https://reactnative.dev/'); | ||
@@ -61,8 +63,13 @@ | ||
const OS = isObj && hashOrOverrides.os ? hashOrOverrides.os : getOS(); | ||
const platform = isObj && hashOrOverrides.platform ? hashOrOverrides.platform : _platform; | ||
url.pathname = _version ? `${section}/${version}/${path}` : `${section}/${path}`; | ||
url.searchParams.set('os', OS); | ||
url.searchParams.set('platform', platform); | ||
if (platform === 'inherit') { | ||
_assert().default.ok(_platform !== null, `Please report this CLI error: link.setPlatform('ios'|'android'|'none') was expected to be set before using link.${section}(${path}, 'inherit').`); | ||
} | ||
const plat = platform === 'inherit' ? _platform : platform ?? _platform; | ||
if (plat !== 'none') { | ||
url.searchParams.set('platform', plat); | ||
} | ||
if (isObj) { | ||
const otherKeys = Object.keys(hashOrOverrides).filter(key => !['hash', 'version', 'os', 'platform'].includes(key)); | ||
const otherKeys = Object.keys(hashOrOverrides).filter(key => !['hash', 'version', 'os'].includes(key)); | ||
for (let key of otherKeys) { | ||
@@ -73,3 +80,3 @@ url.searchParams.set(key, hashOrOverrides[key]); | ||
if (hash) { | ||
_assert().default.doesNotMatch(hash, /#/, "Anchor links should be written withou a '#'"); | ||
_assert().default.doesNotMatch(hash, /#/, "Anchor links should be written without a '#'"); | ||
url.hash = hash; | ||
@@ -76,0 +83,0 @@ } |
@@ -27,3 +27,3 @@ "use strict"; | ||
_logger.default.info(`Diff: ${_chalk().default.dim.underline(latestRelease.diffUrl)}`); | ||
_logger.default.info(`For more info, check out "${_chalk().default.dim.underline(link.docs('upgrading'))}".`); | ||
_logger.default.info(`For more info, check out "${_chalk().default.dim.underline(link.docs('upgrading', 'inherit'))}".`); | ||
_releaseCacheManager.default.set(name, 'lastChecked', new Date().toISOString()); | ||
@@ -30,0 +30,0 @@ } |
{ | ||
"name": "@react-native-community/cli-tools", | ||
"version": "12.0.0-alpha.5", | ||
"version": "12.0.0-alpha.6", | ||
"license": "MIT", | ||
@@ -21,3 +21,3 @@ "main": "build/index.js", | ||
"devDependencies": { | ||
"@react-native-community/cli-types": "12.0.0-alpha.5", | ||
"@react-native-community/cli-types": "12.0.0-alpha.6", | ||
"@types/lodash": "^4.14.149", | ||
@@ -40,3 +40,3 @@ "@types/mime": "^2.0.1", | ||
}, | ||
"gitHead": "3569633e1bbda4858195feb8537d7b9969b2040e" | ||
"gitHead": "5e583ab8775cedfa6b26295e851e20055665f214" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158322
1737