Skip to content

Commit

Permalink
don't install package during eject js runtime, install and build when…
Browse files Browse the repository at this point in the history
… publish (microsoft#4668)

Co-authored-by: Dong Lei <donglei@microsoft.com>
Co-authored-by: Lu Han <32191031+luhan2017@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 5, 2020
1 parent 2f143cd commit 940331a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
2 changes: 2 additions & 0 deletions extensions/localPublish/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class LocalPublisher implements PublishPlugin<PublishConfig> {
'azurewebapp'
);
} else if (project.settings.runtime.path && project.settings.runtime.command) {
const runtimePath = path.isAbsolute(project.settings.runtime.path)? project.settings.runtime.path: path.resolve(project.dataDir, project.settings.runtime.path);
await runtime.build(runtimePath, project);
await runtime.setSkillManifest(
project.settings.runtime.path,
project.fileStorage,
Expand Down
16 changes: 4 additions & 12 deletions extensions/runtimes/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,14 @@ export default async (composer: any): Promise<void> => {
// install dev dependencies in production, make sure typescript is installed
const { stderr: installErr } = await execAsync('npm install && npm install --only=dev', {
cwd: runtimePath,
timeout: 120000,
});
if (installErr) {
// in order to not throw warning, we just log all warning and error message
composer.log(installErr);
composer.log(`npm install timeout, ${installErr}`);
}

// runtime build need typescript
const { stderr: install2Err } = await execAsync('npm run build', {
cwd: runtimePath,
});
Expand Down Expand Up @@ -220,17 +223,6 @@ export default async (composer: any): Promise<void> => {
// used to read bot project template from source (bundled in plugin)
const excludeFolder = new Set<string>().add(path.resolve(sourcePath, 'node_modules'));
await copyDir(sourcePath, localDisk, destPath, project.fileStorage, excludeFolder);
// install dev dependencies in production, make sure typescript is installed
const { stderr: initErr } = await execAsync('npm install && npm install --only=dev', {
cwd: destPath,
});
if (initErr) {
composer.log(initErr);
}
const { stderr: initErr2 } = await execAsync('npm run build', { cwd: destPath });
if (initErr2) {
throw new Error(initErr2);
}
return destPath;
} else {
throw new Error(`Runtime already exists at ${destPath}`);
Expand Down

0 comments on commit 940331a

Please sign in to comment.