eip-s3-deploy 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/deploy.js +15 -2
  2. package/package.json +1 -1
package/deploy.js CHANGED
@@ -43,7 +43,15 @@ const writeDeploymentLock = async ( deploymentHash ) => fs.access ( process.cwd
43
43
  } );
44
44
 
45
45
  const deploy = async () => {
46
- const config = require ( path.join ( process.cwd (), 'deployConf.js' ) )[ args._[ 0 ] ];
46
+ const files = await fs.readdir ( process.cwd () );
47
+ let deployConfName;
48
+
49
+ if ( files.find ( f => f === 'deployConf.cjs' ) )
50
+ deployConfName = 'deployConf.cjs';
51
+ else
52
+ deployConfName = 'deployConf.js';
53
+
54
+ const config = require ( path.join ( process.cwd (), deployConfName ) )[ args._[ 0 ] ];
47
55
  const promiseChain = _.stubObject ();
48
56
 
49
57
  if ( !config ) {
@@ -123,10 +131,15 @@ const deploy = async () => {
123
131
  if ( key.indexOf ( '/' ) === 0 ){
124
132
  key = key.substr ( 1 );
125
133
  }
134
+ if ( _.lastIndexOf ( key, '/' ) === key.length - 1 ){
135
+ key = key.substr ( 0, key.length - 1 );
136
+ }
137
+
138
+ console.log ( config.Bucket, key );
126
139
 
127
140
  return s3.putObject ( {
128
141
  Bucket: config.Bucket,
129
- Key: ( config.Folder ? `${ config.Folder }` : '' ) + ( config.targetFolder && config.targetFolder !== '' ? _.replace ( _.replace ( filename, process.cwd (), '' ), `${ config.targetFolder }/`, '' ) : _.replace ( filename, process.cwd (), '' ) ),
142
+ Key: key,
130
143
  ACL: 'public-read',
131
144
  Body: body,
132
145
  CacheControl: config.CacheControl || 'max-age=3600, s-maxage=31536000',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eip-s3-deploy",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Deploy static websites to S3 - all files will be public",
5
5
  "main": "deploy.js",
6
6
  "bin": {