Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/1.1 #1673

Merged
merged 7 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e-harness-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
yarn bootstrap
- name: Run
run: |
cd packages/app-harness && yarn run:ios-test & sleep 540
cd packages/app-harness && yarn run:ios-test & sleep 600
- name: E2E
run: |
cd packages/app-harness && yarn e2e:ios && kill $(lsof -t -i:8092)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-template-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
yarn bootstrap
- name: Run
run: |
cd packages/template-starter && yarn run:ios-test & sleep 540
cd packages/template-starter && yarn run:ios-test & sleep 600
- name: E2E
run: |
cd packages/template-starter && yarn e2e:ios && kill $(lsof -t -i:8082)
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/tasks/taskOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ export const RnvTaskOptions = createTaskOptionsMap([
altKey: 'skipDependencyCheck',
description: 'Skips auto update of npm dependencies if mismatch found',
},
{
key: 'offline',
description: 'Run without connecting to the internet whenever possible',
},
{
key: 'app-config-ID',
altKey: 'appConfigID',
Expand Down Expand Up @@ -232,6 +236,8 @@ export const RnvTaskCoreOptionPresets = createTaskOptionsPreset({
RnvTaskOptions.json,
RnvTaskOptions.noSummary,
RnvTaskOptions.noIntro,
RnvTaskOptions.offline,
RnvTaskOptions.skipDependencyCheck,
],
});

Expand Down
11 changes: 9 additions & 2 deletions packages/engine-core/src/taskHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import {
getContext,
installPackageDependencies,
logDefault,
logInfo,
overrideTemplatePlugins,
} from '@rnv/core';
import { configureFonts } from '@rnv/sdk-utils';
import { configureFonts, isOfflineMode } from '@rnv/sdk-utils';

export const installPackageDependenciesAndPlugins = async () => {
logDefault('installPackageDependenciesAndPlugins');
Expand All @@ -21,7 +22,13 @@ export const installPackageDependenciesAndPlugins = async () => {

export const checkAndInstallIfRequired = async () => {
const ctx = getContext();
if (ctx.program.opts().skipDependencyCheck) return true;
if (isOfflineMode('install package dependencies and plugins')) {
return true;
}
if (ctx.program.opts().skipDependencyCheck) {
logInfo(`Skipping installing package dependencies and plugins due to --skip-dependency-check option`);
return true;
}
const isNmInstalled = areNodeModulesInstalled();
if (isNmInstalled && !ctx._requiresNpmInstall) {
return true;
Expand Down
6 changes: 6 additions & 0 deletions packages/engine-core/src/taskOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ export const TaskOptions = createTaskOptionsMap([
isValueType: true,
description: 'select the template version',
},
{
key: 'local-template-path',
altKey: 'localTemplatePath',
isValueType: true,
description: 'select the local template path (absolute)',
},
{
key: 'title',
isValueType: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,36 @@ const Question = async (data: NewProjectData) => {

const c = getContext();
const { templateVersion, projectTemplate } = c.program.opts();
let { localTemplatePath } = c.program.opts();

const projectTemplates = c.buildConfig.projectTemplates || {}; // c.files.rnvConfigTemplates.config?.projectTemplates || {};

const options: TemplateOption[] = [];
let defaultOverride;
Object.keys(projectTemplates).forEach((k) => {
const value = projectTemplates[k];
const option: TemplateOption = {
name: `${k} ${chalk().grey(`- ${value.localPath || value.description}`)}`,
value: { ...value, type: 'existing', packageName: value?.packageName || k },
};
options.push(option);
if (value.localPath) {
defaultOverride = option.value;
}
});

options.push(inquirerSeparator('Advanced:----------------'));
options.push(customTemplate);
options.push(localTemplate);
options.push(noTemplate);
let localTemplatePath: string | undefined;
const projectTemplateKeys = Object.keys(projectTemplates);

inputs.template = {};

if (checkInputValue(projectTemplate)) {
inputs.template.packageName = projectTemplate;
} else {
} else if (!checkInputValue(localTemplatePath)) {
const options: TemplateOption[] = [];
let defaultOverride;
projectTemplateKeys.forEach((k) => {
const value = projectTemplates[k];

const option: TemplateOption = {
name: `${k} ${chalk().grey(`- ${value.localPath || value.description}`)}`,
value: { ...value, type: 'existing', packageName: value?.packageName || k },
};
options.push(option);
if (value.localPath) {
defaultOverride = option.value;
}
});

options.push(inquirerSeparator('Advanced:----------------'));
options.push(customTemplate);
options.push(localTemplate);
options.push(noTemplate);

const iRes = await inquirerPrompt({
name: 'inputTemplate',
type: 'list',
Expand Down Expand Up @@ -112,7 +114,7 @@ const Question = async (data: NewProjectData) => {

const npmCacheDir = path.join(c.paths.project.dir, RnvFolderName.dotRnv, RnvFolderName.npmCache);

if (localTemplatePath) {
if (checkInputValue(localTemplatePath)) {
if (!fsExistsSync(localTemplatePath)) {
return Promise.reject(`Local template path ${localTemplatePath} does not exist`);
}
Expand All @@ -136,6 +138,12 @@ const Question = async (data: NewProjectData) => {
inputs.template.packageName = pkg.name;
inputs.template.version = pkg.version;
inputs.template.localPath = localTemplatePath;
projectTemplateKeys.find((tpl) => {
const value = projectTemplates[tpl];
if (value.localPath === localTemplatePath && inputs.template) {
inputs.template.type = 'existing';
}
});

if (!inputs.template) return;

Expand Down
1 change: 1 addition & 0 deletions packages/engine-core/src/tasks/bootstrap/taskNew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default createTask({
TaskOptions.projectName,
TaskOptions.projectTemplate,
TaskOptions.templateVersion,
TaskOptions.localTemplatePath,
TaskOptions.title,
TaskOptions.appVersion,
TaskOptions.id,
Expand Down
4 changes: 4 additions & 0 deletions packages/sdk-react-native/src/iosRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { EnvVars } from './env';
import shellQuote from 'shell-quote';
import path from 'path';
import crypto from 'crypto';
import { isOfflineMode } from '@rnv/sdk-utils';

export const packageReactNativeIOS = (isDev = false) => {
const c = getContext();
Expand Down Expand Up @@ -126,6 +127,9 @@ const checkIfPodsIsRequired = (
c: RnvContext,
forceUpdatePods: boolean
): { result: boolean; reason: string; code: number } => {
if (isOfflineMode()) {
return { result: false, reason: 'You passed --offline option', code: 7 };
}
if (c.runtime._skipNativeDepResolutions) {
return { result: false, reason: `Command ${getCurrentCommand(true)} explicitly skips pod checks`, code: 1 };
}
Expand Down
12 changes: 12 additions & 0 deletions packages/sdk-utils/src/getCliOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { getContext, logInfo } from '@rnv/core';

export const isOfflineMode = (logMessage?: string) => {
if (getContext().program.opts().offline) {
if (logMessage) {
logInfo(`Skipping "${logMessage}" due to --offline option`);
}
return true;
} else {
return false;
}
};
1 change: 1 addition & 0 deletions packages/sdk-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './ipUtils';
export * from './utils';
export * from './target';
export * from './axiosUtils';
export * from './getCliOptions';
Loading