Skip to content

Commit

Permalink
wip: being able to change tizen certificate, and not only just RNV on…
Browse files Browse the repository at this point in the history
…e easier
  • Loading branch information
justinasRm committed Sep 27, 2024
1 parent 67ef77e commit 9b678d1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/core/src/enums/taskName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ export const RnvTaskName = {
telemetryStatus: 'telemetry status',
config: 'config',
patchReset: 'patch reset',
tizenCertificate: 'tizen certificate',
} as const;
3 changes: 2 additions & 1 deletion packages/sdk-tizen/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ export * from './constants';
import taskTargetLaunch from './tasks/taskTargetLaunch';
import taskTargetList from './tasks/taskTargetList';
import taskSdkConfigure from './tasks/taskSdkConfigure';
import taskChangeCertificate from './tasks/taskChangeCertificate';
import { GetContextType, createRnvModule } from '@rnv/core';

const RnvModule = createRnvModule({
tasks: [taskTargetLaunch, taskTargetList, taskSdkConfigure] as const,
tasks: [taskTargetLaunch, taskTargetList, taskSdkConfigure, taskChangeCertificate] as const,
name: '@rnv/sdk-tizen',
type: 'internal',
});
Expand Down
28 changes: 28 additions & 0 deletions packages/sdk-tizen/src/tasks/taskChangeCertificate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { createTask, RnvTaskName } from '@rnv/core';
import { SdkPlatforms } from '../constants';
import fs from 'fs';
export default createTask({
description: 'Change tizen certificate',
fn: async ({ ctx }) => {
console.log('good');

// bad approach?
ctx.paths.appConfig.configs.forEach(async (config: string) => {
if (config.includes('base')) {
const configFile = await JSON.parse(fs.readFileSync(config, 'utf-8'));

configFile.platforms.tizen.certificateProfile = 'newCert';
configFile.platforms.tizenwatch.certificateProfile = 'newCert';
configFile.platforms.tizenmobile.certificateProfile = 'newCert';

fs.writeFileSync(config, JSON.stringify(configFile, null, 2));
}
});

// should do a simple thing - update core/src/schema/defaults.ts certificateProfile key
// AND update certificateProfile key in template-starter/appConfigs/base/renative.json platforms.tizen, platforms.tizenwatch and platforms.tizenmobile
},
task: RnvTaskName.tizenCertificate,
platforms: SdkPlatforms,
isGlobalScope: true,
});
6 changes: 3 additions & 3 deletions packages/template-starter/appConfigs/base/renative.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
"tizen": {
"appName": "RNVanillaTV",
"entryFile": "index",
"certificateProfile": "RNVanillaCert",
"certificateProfile": "newCert",
"package": "NkVRhWHJSX",
"id": "NkVRhWHJSX.RNVanillaTV",
"buildSchemes": {
Expand All @@ -225,7 +225,7 @@
"tizenwatch": {
"appName": "RNVanillaWatch",
"entryFile": "index",
"certificateProfile": "RNVanillaCert",
"certificateProfile": "newCert",
"package": "cHIP2fIRQZ",
"id": "cHIP2fIRQZ.RNVanillaWatch",
"buildSchemes": {
Expand All @@ -241,7 +241,7 @@
"tizenmobile": {
"appName": "RNVanillaMobile",
"entryFile": "index",
"certificateProfile": "RNVanillaCert",
"certificateProfile": "newCert",
"package": "PauodvCU2r",
"id": "PauodvCU2r.RNVanillaMobile",
"buildSchemes": {
Expand Down

0 comments on commit 9b678d1

Please sign in to comment.