Compare commits

..
5 changed files with 22 additions and 95 deletions

No files matched your search

-18
View File
@@ -7,24 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased ## Unreleased
# [0.18.6] - 2020-10-22
### Fixed
- Fix issues with notifications ([10624](https://github.com/expo/expo/pull/10624) and [10608](https://github.com/expo/expo/pull/10608)) in the Android SDK 39 tarball.
# [0.18.5] - 2020-10-07
### Fixed
- Always add expo-notifications for SDK >= 39 projects with android.enableDangerousExperimentalLeanBuilds enabled.
# [0.18.4] - 2020-10-06
### Fixed
- Fixed an issue with notifications ([expo/expo#10562](https://github.com/expo/expo/issues/10562)) in the Android SDK 39 tarball.
# [0.18.3] - 2020-10-03 # [0.18.3] - 2020-10-03
### Fixed ### Fixed
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "turtle-cli", "name": "turtle-cli",
"version": "0.18.6", "version": "0.18.3",
"description": "The command-line tool for building standalone Expo apps", "description": "The command-line tool for building standalone Expo apps",
"preferGlobal": true, "preferGlobal": true,
"scripts": { "scripts": {
+1 -1
View File
@@ -1 +1 @@
s3://exp-artifacts/android-shell-builder-1fd35ae3121ff51d657c93598947c17276bcb392.tar.gz s3://exp-artifacts/android-shell-builder-b8193b76084128d714a240bbaa5c2450cc4a2c41.tar.gz
+1 -1
View File
@@ -84,7 +84,7 @@ async function runShellAppBuilder(
logger.info({ buildPhase: 'resolve native modules' }, 'Resolving universal modules dependencies'); logger.info({ buildPhase: 'resolve native modules' }, 'Resolving universal modules dependencies');
const packageJsonDependecies = _.get(manifest, 'dependencies'); const packageJsonDependecies = _.get(manifest, 'dependencies');
const enabledModules = _.get(manifest, 'android.enableDangerousExperimentalLeanBuilds') const enabledModules = _.get(manifest, 'android.enableDangerousExperimentalLeanBuilds')
? await resolveNativeModules(workingDir, sdkVersion, packageJsonDependecies) ? await resolveNativeModules(workingDir, packageJsonDependecies)
: await resolveExplicitOptIn(workingDir, packageJsonDependecies); : await resolveExplicitOptIn(workingDir, packageJsonDependecies);
try { try {
+19 -74
View File
@@ -4,7 +4,6 @@ import keys from 'lodash/keys';
import merge from 'lodash/merge'; import merge from 'lodash/merge';
import values from 'lodash/values'; import values from 'lodash/values';
import path from 'path'; import path from 'path';
import semver from 'semver';
import logger from 'turtle/logger'; import logger from 'turtle/logger';
export interface IUnimoduleEntry { export interface IUnimoduleEntry {
@@ -20,37 +19,21 @@ interface IPackageInfo {
dependencies: string[]; dependencies: string[];
} }
export async function resolveExplicitOptIn( export async function resolveExplicitOptIn(workingdir: string, packages?: string[]): Promise<IUnimoduleEntry[]> {
workingdir: string,
packages?: string[],
): Promise<IUnimoduleEntry[]> {
const resolver = new Resolver(workingdir); const resolver = new Resolver(workingdir);
await resolver.init(); await resolver.init();
const optionalModules = ['expo-branch']; const optionalModules = ['expo-branch'];
resolver.addAll(); resolver.addAll();
const modules = packages const modules = packages
? resolver ? resolver.getModules().filter((mod) => !optionalModules.includes(mod.name) || packages.includes(mod.name))
.getModules() : resolver.getModules().filter((mod) => !optionalModules.includes(mod.name));
.filter(
(mod) =>
!optionalModules.includes(mod.name) || packages.includes(mod.name),
)
: resolver
.getModules()
.filter((mod) => !optionalModules.includes(mod.name));
modules.forEach(({ name, version }) => { modules.forEach(({ name, version }) => { logger.info(`Adding ${name}:${version}`); });
logger.info(`Adding ${name}:${version}`);
});
return modules; return modules;
} }
export async function resolveNativeModules( export async function resolveNativeModules(workingdir: string, packages?: string[]): Promise<IUnimoduleEntry[]> {
workingdir: string,
sdkVersion: string,
packages?: string[],
): Promise<IUnimoduleEntry[]> {
const resolver = new Resolver(workingdir); const resolver = new Resolver(workingdir);
await resolver.init(); await resolver.init();
@@ -58,13 +41,6 @@ export async function resolveNativeModules(
resolver.addAll(); resolver.addAll();
} else { } else {
const corePackages = await readCorePackages(workingdir); const corePackages = await readCorePackages(workingdir);
// expo-notifications is required for shell apps in SDK >= 39
// https://github.com/expo/expo/issues/10569
if (semver.gte(sdkVersion, '39.0.0')) {
resolver.addModule('expo-notifications');
}
for (const pkg of corePackages) { for (const pkg of corePackages) {
if (resolver.isUnimodule(pkg)) { if (resolver.isUnimodule(pkg)) {
resolver.addModule(pkg); resolver.addModule(pkg);
@@ -77,36 +53,17 @@ export async function resolveNativeModules(
} }
} }
const modules = resolver.getModules(); const modules = resolver.getModules();
modules.forEach(({ name, version }) => { modules.forEach(({ name, version }) => { logger.info(`Adding ${name}:${version}`); });
logger.info(`Adding ${name}:${version}`);
});
return modules; return modules;
} }
async function readCorePackages(workingdir: string) { async function readCorePackages(workingdir: string) {
const pkgJsonPath = path.join( const pkgJsonPath = path.join(workingdir, 'node_modules', 'react-native-unimodules', 'package.json');
workingdir, const expoPkgJsonPath = path.join(workingdir, 'packages', 'expo', 'package.json');
'node_modules', if (await fs.pathExists(pkgJsonPath) && await fs.pathExists(expoPkgJsonPath)) {
'react-native-unimodules',
'package.json',
);
const expoPkgJsonPath = path.join(
workingdir,
'packages',
'expo',
'package.json',
);
if (
(await fs.pathExists(pkgJsonPath)) &&
(await fs.pathExists(expoPkgJsonPath))
) {
const packageJson = JSON.parse(await fs.readFile(pkgJsonPath, 'utf-8')); const packageJson = JSON.parse(await fs.readFile(pkgJsonPath, 'utf-8'));
const expoPackageJson = JSON.parse( const expoPackageJson = JSON.parse(await fs.readFile(expoPkgJsonPath, 'utf-8'));
await fs.readFile(expoPkgJsonPath, 'utf-8'), return keys(packageJson.dependencies).concat(keys(expoPackageJson.dependencies));
);
return keys(packageJson.dependencies).concat(
keys(expoPackageJson.dependencies),
);
} else { } else {
logger.warn('No core packages detected'); logger.warn('No core packages detected');
return []; return [];
@@ -119,7 +76,7 @@ interface IDependencyInfo {
class Resolver { class Resolver {
private workingdir: string; private workingdir: string;
private modulesMap: { [key: string]: IUnimoduleEntry }; private modulesMap: {[key: string]: IUnimoduleEntry};
private dependencyMap: IDependencyInfo; private dependencyMap: IDependencyInfo;
constructor(workingdir: string) { constructor(workingdir: string) {
@@ -151,7 +108,7 @@ class Resolver {
} }
public getModules(): IUnimoduleEntry[] { public getModules(): IUnimoduleEntry[] {
return values(this.modulesMap); return values(this.modulesMap);
} }
private async resolveModule(moduleName: string) { private async resolveModule(moduleName: string) {
@@ -170,9 +127,7 @@ class Resolver {
} }
} }
async function generateDependenciesInfo( async function generateDependenciesInfo(workingdir: string): Promise<IDependencyInfo> {
workingdir: string,
): Promise<IDependencyInfo> {
const dir = await fs.readdir(path.join(workingdir, 'packages')); const dir = await fs.readdir(path.join(workingdir, 'packages'));
const map: IDependencyInfo = {}; const map: IDependencyInfo = {};
@@ -185,9 +140,7 @@ async function generateDependenciesInfo(
} }
// handle @unimodules directory // handle @unimodules directory
const unimodulesDir = await fs.readdir( const unimodulesDir = await fs.readdir(path.join(workingdir, 'packages', '@unimodules'));
path.join(workingdir, 'packages', '@unimodules'),
);
for (const pkgName of unimodulesDir) { for (const pkgName of unimodulesDir) {
const pkg = await getPackage(workingdir, path.join('@unimodules', pkgName)); const pkg = await getPackage(workingdir, path.join('@unimodules', pkgName));
if (pkg) { if (pkg) {
@@ -202,27 +155,19 @@ async function generateDependenciesInfo(
return map; return map;
} }
async function getPackage( async function getPackage(workingdir: string, pkgName: string): Promise<IPackageInfo | null> {
workingdir: string,
pkgName: string,
): Promise<IPackageInfo | null> {
const pkgPath = path.join(workingdir, 'packages', pkgName); const pkgPath = path.join(workingdir, 'packages', pkgName);
const isAndroid = await fs.pathExists(path.join(pkgPath, 'android')); const isAndroid = await fs.pathExists(path.join(pkgPath, 'android'));
const isIos = await fs.pathExists(path.join(pkgPath, 'ios')); const isIos = await fs.pathExists(path.join(pkgPath, 'ios'));
const isUnimodule = await fs.pathExists(path.join(pkgPath, 'unimodule.json')); const isUnimodule = await fs.pathExists(path.join(pkgPath, 'unimodule.json'));
const hasPackageJson = await fs.pathExists( const hasPackageJson = await fs.pathExists(path.join(pkgPath, 'package.json'));
path.join(pkgPath, 'package.json'),
);
if (!isUnimodule || !hasPackageJson || (!isAndroid && !isIos)) { if (!isUnimodule || !hasPackageJson || (!isAndroid && !isIos)) {
return null; return null;
} }
const packageJson = JSON.parse( const packageJson = JSON.parse(await fs.readFile(path.join(pkgPath, 'package.json'), 'utf-8'));
await fs.readFile(path.join(pkgPath, 'package.json'), 'utf-8'),
);
const pkgDeps = merge( const pkgDeps = merge({}, // reading everything to make sure
{}, // reading everything to make sure
packageJson.dependencies, packageJson.dependencies,
packageJson.peerDependencies, packageJson.peerDependencies,
packageJson.unimodulePeerDependencies, packageJson.unimodulePeerDependencies,