diff --git a/src/commands/initialize.ts b/src/commands/initialize.ts index 248cee7..30fd84e 100644 --- a/src/commands/initialize.ts +++ b/src/commands/initialize.ts @@ -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.' )]; @@ -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.` )); @@ -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.', () => { @@ -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 @@ -253,5 +259,5 @@ async function chooseUkWorkdir(projectPath: string): Promise if (ukWorkdirLocation === 'Use local') return join(projectPath, '.unikraft'); - return join(homedir(), '.unikraft'); + return join(homedir(), '.local/share/kraftkit/'); }