Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
Signed-off-by: Md Sahil <mohdssahil1@gmail.com>
  • Loading branch information
MdSahil-oss committed Jul 17, 2023
1 parent 73c1973 commit efee5ea
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/commands/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,17 @@ async function initializeLibrary(
return;
}

const libsPath = join(ukWorkdir, 'libs');
let libsPath
if (ukWorkdir.endsWith('.unikraft')) {
libsPath = join(ukWorkdir, 'libs');
} else {
libsPath = join(ukWorkdir, 'sources');
}

const kraftEnv = Object.assign(process.env, { 'UK_WORKDIR': ukWorkdir });
const commands = [new Command(
'kraft list pull unikraft@staging',

const commands = [new Command(
'kraft pkg pull unikraft:staging',
{ cwd: projectPath, env: kraftEnv },
'Pulled unikraft.'
)];
Expand Down Expand Up @@ -170,11 +176,11 @@ async function initializeLibrary(

commands.push(new Command(
`kraft lib init --no-prompt`
+ ` --author-name "${authorName}"`
+ ` --author-email "${authorEmail}"`
+ ` --version ${libVersion}`
+ ` --origin ${libOrigin}`
+ ` ${libName}`,
+ ` --author-name "${authorName}"`
+ ` --author-email "${authorEmail}"`
+ ` --version ${libVersion}`
+ ` --origin ${libOrigin}`
+ ` ${libName}`,
{ cwd: libsPath, env: kraftEnv },
`Initialized ${libName} library.`
));
Expand Down Expand Up @@ -213,10 +219,10 @@ async function initializeCore(
kraftStatusBarItem: StatusBarItem
) {
const command = new Command(
'kraft list pull unikraft@staging',
'kraft pkg pull unikraft:staging',
{
cwd: projectPath,
env: Object.assign(process.env, {'UK_WORKDIR': projectPath})
env: Object.assign(process.env, { 'UK_WORKDIR': projectPath })
},
'Initialized new core project.',
() => {
Expand All @@ -231,9 +237,9 @@ async function initializeCore(

function getApps(ukWorkdir: string): string[] {
const jsonApps = execSync(
'kraft list -a -j',
{env: Object.assign(process.env, {'UK_WORKDIR': ukWorkdir})}
).toString();
'kraft list -a -j',
{ env: Object.assign(process.env, { 'UK_WORKDIR': ukWorkdir }) }
).toString();

return JSON.parse(jsonApps)
.applications
Expand All @@ -253,5 +259,5 @@ async function chooseUkWorkdir(projectPath: string): Promise<string | undefined>
if (ukWorkdirLocation === 'Use local')
return join(projectPath, '.unikraft');

return join(homedir(), '.unikraft');
return join(homedir(), '.local/share/kraftkit/');
}

0 comments on commit efee5ea

Please sign in to comment.