Skip to content

Commit 42dea49

Browse files
authored
Merge pull request #1758 from flexn-io/fix/generate_cert_tizen
Fix change tizen certificate command in new project
2 parents 2dc17e8 + 80fac31 commit 42dea49

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

packages/sdk-tizen/src/tasks/taskChangeCertificate.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export default createTask({
88
fn: async ({ ctx }) => {
99
for (const config of ctx.paths.appConfig.configs) {
1010
if (config.includes('base')) {
11-
const configFile = await JSON.parse(fs.readFileSync(config, 'utf-8'));
1211
const { confirm } = await inquirerPrompt({
1312
message:
1413
'Tizen - used certificate change. NOTE: you must create the certificate first through the tizens certificate-manager. Continue?',
@@ -34,6 +33,29 @@ export default createTask({
3433
return;
3534
}
3635

36+
if (!fs.existsSync(config)) {
37+
const configContent = JSON.stringify(
38+
{
39+
platforms: {
40+
[platform]: {
41+
certificateProfile: name,
42+
},
43+
},
44+
},
45+
null,
46+
2
47+
);
48+
49+
fs.writeFileSync(config, configContent);
50+
return;
51+
}
52+
53+
const configFile = await JSON.parse(fs.readFileSync(config, 'utf-8'));
54+
55+
if (!configFile.platforms[platform]) {
56+
configFile.platforms[platform] = {};
57+
}
58+
3759
configFile.platforms[`${platform}`].certificateProfile = name;
3860

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

0 commit comments

Comments
 (0)