Skip to content

Commit

Permalink
feat(commands): adding run command
Browse files Browse the repository at this point in the history
  • Loading branch information
Gal Bashan committed Jun 24, 2020
1 parent ff7eb1d commit fad17fd
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ class PackageExternal {

this.symlinked = false;

this.commands = {
packageExternal: {
usage: 'create external package symlinks',
lifecycleEvents: ['run'],
commands: {
run: {
usage: 'remove symlinks',
lifecycleEvents: ['init'],
},
},
},
};

this.hooks = {
'before:package:createDeploymentArtifacts': this.beforeDeploy.bind(this),
'before:deploy:function:packageFunction': this.beforeDeploy.bind(this),
Expand All @@ -21,7 +34,8 @@ class PackageExternal {
"before:offline:start:init": this.beforeDeploy.bind(this),
"before:offline:start:end": this.afterDeploy.bind(this),
"invoke:local:loadEnvVars": this.beforeDeploy.bind(this),
"invoke:local:invoke": this.afterDeploy.bind(this)
"invoke:local:invoke": this.afterDeploy.bind(this),
"packageExternal:run:init": this.beforeDeploy.bind(this),
};

this.handleExit();
Expand All @@ -40,6 +54,7 @@ class PackageExternal {

afterDeploy() {
if(this.symlinked) {
this.serverless.cli.log(`[serverless-package-external] cleaning up`);
this.options.external.forEach(externalFolder => {
const target = path.basename(externalFolder);
symlink.removeFolder(target);
Expand Down

0 comments on commit fad17fd

Please # to comment.