Skip to content

Commit

Permalink
fix change cert in new project
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius456 committed Oct 17, 2024
1 parent 2dc17e8 commit 80fac31
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion packages/sdk-tizen/src/tasks/taskChangeCertificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default createTask({
fn: async ({ ctx }) => {
for (const config of ctx.paths.appConfig.configs) {
if (config.includes('base')) {
const configFile = await JSON.parse(fs.readFileSync(config, 'utf-8'));
const { confirm } = await inquirerPrompt({
message:
'Tizen - used certificate change. NOTE: you must create the certificate first through the tizens certificate-manager. Continue?',
Expand All @@ -34,6 +33,29 @@ export default createTask({
return;
}

if (!fs.existsSync(config)) {
const configContent = JSON.stringify(
{
platforms: {
[platform]: {
certificateProfile: name,
},
},
},
null,
2
);

fs.writeFileSync(config, configContent);
return;
}

const configFile = await JSON.parse(fs.readFileSync(config, 'utf-8'));

if (!configFile.platforms[platform]) {
configFile.platforms[platform] = {};
}

configFile.platforms[`${platform}`].certificateProfile = name;

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

0 comments on commit 80fac31

Please sign in to comment.