oclif / dev-cli

MIT License
62 stars 56 forks source link

Support custom prefixes in S3 key #83

Open cameronpickham opened 5 years ago

cameronpickham commented 5 years ago

I'm able to specify a bucket, but it would be nice if I could namespace it so that my bucket can be more organized.

Currently-generated location: s3://mybucket/channels/alpha/mycli-v1.0.0-alpha.1/mycli-v1.0.0-alpha.1-linux-x64.tar.gz

Desired location: s3://mybucket/mycli/channels/alpha/mycli-v1.0.0-alpha.1/mycli-v1.0.0-alpha.1-linux-x64.tar.gz

jdx commented 5 years ago

This should be supported. Just override the baseDir in package.json

cameronpickham commented 5 years ago

I tried this and couldn't get it work. I poked around the dev-cli and config source and can't find a way to do it.

r1m commented 5 years ago

baseDir is used only to create the manifest but not used for publish. I had to redefine the whole oclif.update.s3.templates config :

"update": {
  "s3": {
    "bucket": "devbucket",
    "templates": {
      "target": {
        "baseDir": "my-cli/<%- bin %>",
        "unversioned": "my-cli/<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-<%- platform %>-<%- arch %><%- ext %>",
        "versioned": "my-cli/<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-v<%- version %>/<%- bin %>-v<%- version %>-<%- platform %>-<%- arch %><%- ext %>",
        "manifest": "my-cli/<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- platform %>-<%- arch %>"
      },
      "vanilla": {
        "baseDir": "my-cli/<%- bin %>",
        "unversioned": "my-cli/<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-<%- platform %>-<%- arch %><%- ext %>",
        "versioned": "my-cli/<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-v<%- version %>/<%- bin %>-v<%- version %>-<%- platform %>-<%- arch %><%- ext %>",
        "manifest": "my-cli/<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- platform %>-<%- arch %>"
      }
    }
  }
}
r1m commented 5 years ago

Another workaround is to set the path inside S3 bucket key...

"update": {
      "s3": {
        "bucket": "devbucket/my-cli"
      }
    }

It publish files inside the folder. but generated version file is wrong.

@oclif/dev-cli/1.22.2 linux-x64 node-v10.16.3