Skip to content

Commit

Permalink
Merge pull request #1433 from flexn-io/chore/release-prep
Browse files Browse the repository at this point in the history
1.0 release prep
  • Loading branch information
pavjacko committed Mar 4, 2024
2 parents 2a957ec + 2f5ff38 commit 64ce4b1
Show file tree
Hide file tree
Showing 274 changed files with 2,371 additions and 2,791 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint
npm run sanity
1 change: 1 addition & 0 deletions __mocks__/@rnv/core.ts
Expand Up @@ -262,6 +262,7 @@ rnvcore.confirmActiveBundler = () => null;
rnvcore.getAppFolder = jest.fn();
rnvcore.logToSummary = jest.fn();
rnvcore.logTask = jest.fn();
rnvcore.logDefault = jest.fn();
rnvcore.logDebug = jest.fn();
rnvcore.logInfo = jest.fn();
rnvcore.logError = jest.fn();
Expand Down
File renamed without changes.
60 changes: 39 additions & 21 deletions buildHooks/src/prePublish.js → buildHooks/src/prePublish.ts
@@ -1,5 +1,5 @@
import path from 'path';
import { copyFileSync, fixPackageObject, fsExistsSync, readObjectSync, writeFileSync } from '@rnv/core';
import { RnvContext, copyFileSync, fixPackageObject, fsExistsSync, readObjectSync, writeFileSync } from '@rnv/core';
import fs from 'fs';

const merge = require('deepmerge');
Expand Down Expand Up @@ -31,8 +31,18 @@ const VERSIONED_PACKAGES = [
'renative',
];

const setPackageVersions = (c, version, versionedPackages) => {
var v = {
type PackageConfig = {
pkgName?: string;
rnvPath?: string;
pkgPath?: string;
pkgFile?: any;
rnvFile?: any;
};

type PackageConfigs = Record<string, PackageConfig>;

const setPackageVersions = (c: RnvContext, version: string | undefined, versionedPackages: string[]) => {
const v = {
version: version,
};
const pkgFolder = path.join(c.paths.project.dir, 'packages');
Expand All @@ -42,7 +52,13 @@ const setPackageVersions = (c, version, versionedPackages) => {
});
};

const updatePkgDeps = (pkgConfig, depKey, packageName, packageConfigs, semVer = '') => {
const updatePkgDeps = (
pkgConfig: PackageConfig,
depKey: string,
packageName: string,
packageConfigs: PackageConfigs,
semVer = ''
) => {
const { pkgFile } = pkgConfig;

if (pkgFile) {
Expand All @@ -64,7 +80,7 @@ const updatePkgDeps = (pkgConfig, depKey, packageName, packageConfigs, semVer =
}
};

const updateRenativeDeps = (pkgConfig, packageName, packageConfigs) => {
const updateRenativeDeps = (pkgConfig: PackageConfig, packageName: string, packageConfigs: PackageConfigs) => {
const { rnvFile } = pkgConfig;

if (rnvFile) {
Expand All @@ -85,7 +101,7 @@ const updateRenativeDeps = (pkgConfig, packageName, packageConfigs) => {
}
};

export const prePublish = async (c) => {
export const prePublish = async (c: RnvContext) => {
const v = {
version: c.files.project.package.version,
};
Expand Down Expand Up @@ -114,11 +130,11 @@ export const prePublish = async (c) => {

const dirs = fs.readdirSync(pkgDirPath);

const packageNamesAll = [];
const packageConfigs = {};
const packageNamesAll: string[] = [];
const packageConfigs: PackageConfigs = {};

const parsePackages = (dirPath) => {
let pkgName;
const parsePackages = (dirPath: string) => {
let pkgName: string | undefined;
let rnvPath;
let _pkgPath;
let rnvFile;
Expand All @@ -127,23 +143,25 @@ export const prePublish = async (c) => {
if (fs.statSync(dirPath).isDirectory()) {
_pkgPath = path.join(dirPath, 'package.json');
if (fsExistsSync(_pkgPath)) {
pkgFile = readObjectSync(_pkgPath);
pkgName = pkgFile.name;
pkgFile = readObjectSync<any>(_pkgPath);
pkgName = pkgFile?.name;
}
const _rnvPath = path.join(dirPath, 'renative.json');
if (fsExistsSync(_rnvPath)) {
rnvPath = _rnvPath;
rnvFile = readObjectSync(rnvPath);
}
}
packageConfigs[pkgName] = {
pkgName,
rnvPath,
pkgPath: _pkgPath,
pkgFile,
rnvFile,
};
packageNamesAll.push(pkgName);
if (pkgName) {
packageConfigs[pkgName] = {
pkgName,
rnvPath,
pkgPath: _pkgPath,
pkgFile,
rnvFile,
};
packageNamesAll.push(pkgName);
}
};

parsePackages(c.paths.project.dir);
Expand All @@ -170,7 +188,7 @@ export const prePublish = async (c) => {
return true;
};

const _updateJson = (pPath, updateObj) => {
const _updateJson = (pPath: string | undefined, updateObj: object) => {
const pObj = readObjectSync(pPath);

if (!pObj) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -125,7 +125,7 @@
"title": "ReNative",
"husky": {
"hooks": {
"pre-commit": "yarn lint && yarn test"
"pre-commit": "yarn sanity"
}
},
"lint-staged": {
Expand Down
28 changes: 0 additions & 28 deletions packages/app-harness/buildHooks/src/setup/apple.js

This file was deleted.

35 changes: 35 additions & 0 deletions packages/app-harness/buildHooks/src/setup/apple.ts
@@ -0,0 +1,35 @@
import path from 'path';
import { executeAsync, logInfo, logError, RnvContext } from '@rnv/core';

export default async (c: RnvContext) => {
// TODO: This is a temporary solution. We need to find a better way to handle untyped values
const cfPrivate: any = c.files.workspace.project?.configPrivate;
const certRelativePath = cfPrivate?.apple?.p12?.path;

if (!certRelativePath) {
return logError('No configPrivate found. You sure you decrypted?', true);
}
const certPass = cfPrivate?.apple?.p12?.password;
const certPath = path.resolve(c.paths.workspace.project.dir, certRelativePath);

logInfo(`Importing certificate ${certPath}`);
await executeAsync(
`fastlane run import_certificate certificate_path:${certPath} certificate_password:${certPass} keychain_name:login`,
{ privateParams: [certPass] }
);

const profiles = cfPrivate?.apple?.provisioningProfiles;

if (!profiles) {
return;
}

await Promise.all(
profiles.map(async (profile: { path: string }) => {
const profileRelativePath = profile?.path;
const profilePath = path.resolve(c.paths.workspace.project.dir, profileRelativePath);
logInfo(`Installing provisioning profile ${profilePath}`);
await executeAsync(`fastlane run install_provisioning_profile path:${profilePath}`);
})
);
};
7 changes: 7 additions & 0 deletions packages/app-harness/buildHooks/tsconfig.json
@@ -0,0 +1,7 @@
{
"extends": "@rnv/core/tsconfig.hooks.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src"
}
}
4 changes: 2 additions & 2 deletions packages/app-harness/next.config.js
@@ -1,7 +1,7 @@
const { withRNV } = require('@rnv/engine-rn-next');
const { withRNVNext } = require('@rnv/engine-rn-next');

const config = {
compress: false,
};

module.exports = withRNV(config);
module.exports = withRNVNext(config);
3 changes: 3 additions & 0 deletions packages/app-harness/renative.json
Expand Up @@ -183,6 +183,9 @@
}
}
},
"tvos": {
"disabled": true
},
"version": "1.11.0"
},
"react-native": {
Expand Down

0 comments on commit 64ce4b1

Please sign in to comment.