Skip to content

Commit

Permalink
update to rc.16, migrate hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaiblaga89 committed Apr 11, 2024
1 parent 3fd6805 commit 66d8b6d
Show file tree
Hide file tree
Showing 19 changed files with 3,930 additions and 4,698 deletions.
8 changes: 4 additions & 4 deletions buildHooks/src/genApiCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
writeFileSync,
logHook,
registerAllPlatformEngines,
getAllSuitableTasks,
getRegisteredTasks,
RnvTaskOptionPresets,
} from '@rnv/core';
import path from 'path';
Expand All @@ -19,11 +19,11 @@ const kebabToTitleCase = (string: string): string => {
export const generateDocsApiCli = async (c) => {
logHook('generateDocsApiCli');

registerAllPlatformEngines(c);
registerAllPlatformEngines();

const tasks = getAllSuitableTasks(c);
const tasks = getRegisteredTasks();

// console.log('tasks', tasks);
console.log('tasks', tasks);
const tasksGroupedByCommand = Object.values(tasks).reduce((acc, task: any) => {
if (!acc[task.command]) {
acc[task.command] = {};
Expand Down
29 changes: 9 additions & 20 deletions buildHooks/src/genApiSchema.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,33 @@
import {
RootAppSchema,
RootEngineSchema,
RootGlobalSchema,
RootIntegrationSchema,
RootLocalSchema,
RootPluginSchema,
RootPluginsSchema,
RootPrivateSchema,
RootProjectSchema,
RootTemplateSchema,
RootTemplatesSchema,
getContext,
logSuccess,
} from '@rnv/core';
import { ZodFileSchema, getContext, logSuccess } from '@rnv/core';
import { zodToJsonSchema } from 'zod-to-json-schema';
import { z } from 'zod';
import path from 'path';
import fs from 'fs';

const { zodConfigFileApp, zodConfigFileProject, zodConfigFileTemplate, zodConfigFilePlugin, zodConfigFileIntegration } =
ZodFileSchema;

export const generateSchema = async () => {
_generateSchemaFile({
schema: RootProjectSchema,
schema: zodConfigFileProject,
schemaId: 'rnv.project',
sideBarTitle: 'renative.json (Project Config)',
});
_generateSchemaFile({ schema: RootAppSchema, schemaId: 'rnv.app', sideBarTitle: 'renative.json (App Config)' });
_generateSchemaFile({ schema: zodConfigFileApp, schemaId: 'rnv.app', sideBarTitle: 'renative.json (App Config)' });
// _generateSchemaFile({ schema: RootLocalSchema, schemaId: 'rnv.local' });
// _generateSchemaFile({ schema: RootEngineSchema, schemaId: 'rnv.engine' });
// _generateSchemaFile({ schema: RootGlobalSchema, schemaId: 'rnv.global' });
// _generateSchemaFile({ schema: RootPluginsSchema, schemaId: 'rnv.plugins' });
_generateSchemaFile({
schema: RootTemplateSchema,
schema: zodConfigFileTemplate,
schemaId: 'rnv.template',
sideBarTitle: 'renative.template.json (Template Config)',
});
// _generateSchemaFile({ schema: RootPrivateSchema, schemaId: 'rnv.private' });
_generateSchemaFile({ schema: RootPluginSchema, schemaId: 'rnv.plugin', sideBarTitle: 'renative.plugin.json' });
_generateSchemaFile({ schema: zodConfigFilePlugin, schemaId: 'rnv.plugin', sideBarTitle: 'renative.plugin.json' });
// _generateSchemaFile({ schema: RootTemplatesSchema, schemaId: 'rnv.templates' });
_generateSchemaFile({
schema: RootIntegrationSchema,
schema: zodConfigFileIntegration,
schemaId: 'rnv.integration',
sideBarTitle: 'renative.integration.json',
});
Expand Down
8 changes: 4 additions & 4 deletions buildHooks/src/genReferenceEngines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
registerAllPlatformEngines,
RnvContext,
RnvEngine,
PlatformKey,
RnvPlatformKey,
RnvEnginePlatform,
} from '@rnv/core';
import path from 'path';
Expand All @@ -12,7 +12,7 @@ import fs from 'fs';
const cleanUrl = (v: string) => v.replace('@', '').replace('/', '');

export const updateMdFilesEngines = async (c: RnvContext) => {
registerAllPlatformEngines(c);
registerAllPlatformEngines();
const engines = c.runtime.enginesById;

Object.values(engines).forEach((engine) => {
Expand All @@ -35,7 +35,7 @@ const _generateEngineDoc = (c: RnvContext, engine: RnvEngine) => {

if (enginePlatforms) {
Object.keys(enginePlatforms).forEach((v) => {
const pKey = v as PlatformKey;
const pKey = v as RnvPlatformKey;
const engPlatform = enginePlatforms?.[pKey];
if (engPlatform) {
const npm = engineConfigPlatforms?.[pKey]?.npm;
Expand Down Expand Up @@ -107,7 +107,7 @@ ${extContent}
writeFileSync(docFilePath, fixedFile);
};

const _getExtensionContent = (platform: PlatformKey, engine: RnvEngine) => {
const _getExtensionContent = (platform: RnvPlatformKey, engine: RnvEngine) => {
let out = '';
let p: RnvEnginePlatform | undefined;
if (engine?.platforms?.[platform]) {
Expand Down
2 changes: 1 addition & 1 deletion buildHooks/src/genReferencePlatforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ${extContent}
const _getExtensionContent = (c: RnvContext, platform) => {
let out = `Extenstions are defined via engines. Engines with ${platform} support: \n`;

registerAllPlatformEngines(c);
registerAllPlatformEngines();
const engines = c.runtime.enginesById;

Object.values(engines).forEach((engine) => {
Expand Down
6 changes: 3 additions & 3 deletions buildHooks/src/genReferencePlugins.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { doResolve, readObjectSync, fsExistsSync, writeFileSync, SUPPORTED_PLATFORMS, PlatformKey } from '@rnv/core';
import { doResolve, readObjectSync, fsExistsSync, writeFileSync, RnvPlatforms, RnvPlatformKey } from '@rnv/core';
import merge from 'deepmerge';
import path from 'path';

Expand Down Expand Up @@ -34,9 +34,9 @@ sidebar_label: Plugins
const npm = plugin.version ? `Npm: https://www.npmjs.com/package/${key}` : '';
const version = plugin.version ? `Version: \`${plugin.version}\`` : '';
const platforms = Object.keys(plugin)
.map((v) => (SUPPORTED_PLATFORMS.includes(v as PlatformKey) ? v : null))
.map((v) => (RnvPlatforms.includes(v as RnvPlatformKey) ? v : null))
.filter((v) => v);
const supPlats = platforms.length ? platforms : SUPPORTED_PLATFORMS;
const supPlats = platforms.length ? platforms : RnvPlatforms;
const deprecated = plugin.deprecated ? `> ${plugin.deprecated}` : '';
const props = plugin.props ? `Props: ${Object.keys(plugin.props).map((v) => `\`${v}\``)}` : '';

Expand Down
Loading

0 comments on commit 66d8b6d

Please sign in to comment.