@genoacms/adapter-gcp 0.7.1-fix.3 → 0.7.1-fix.5

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.
@@ -1,4 +1,4 @@
1
- import { handler } from './build/handler.js'
1
+ import { handler } from './node_modules/@genoacms/core/build/index.js'
2
2
 
3
3
  function genoacms (req, res) {
4
4
  handler(req, res, undefined)
@@ -22,7 +22,7 @@ async function createZip(source, injectPaths, ignorePaths, out) {
22
22
  reject(err);
23
23
  });
24
24
  archive.pipe(output);
25
- archive.glob(source, { ignore: ignorePaths });
25
+ archive.glob(source, { ignore: ignorePaths, follow: true });
26
26
  for (const path of injectPaths) {
27
27
  archive.file(path, { name: basename(path) });
28
28
  }
@@ -92,17 +92,20 @@ async function deployFunction(functionName, storageSource) {
92
92
  }
93
93
  async function deploy() {
94
94
  const buildDirectoryPath = '**';
95
- const buildArchivePath = resolve(currentDir, '../../../deployment/build.zip');
95
+ const buildArchivePath = resolve(currentDir, '../../../../../../.genoacms/build.zip');
96
96
  const functionEntryScriptPath = resolve(currentDir, '../../../deployment/snippets/index.js');
97
+ const builderScriptPath = resolve(currentDir, '../../../deployment/snippets/build.js');
97
98
  const ignoreArchivePaths = [
98
99
  'node_modules/**',
99
100
  '.git/**',
100
101
  '.github/**',
101
102
  '.gitignore',
103
+ '.genoacms/**',
102
104
  'build/**'
103
105
  ];
104
106
  const injectArchivePaths = [
105
- functionEntryScriptPath
107
+ functionEntryScriptPath,
108
+ builderScriptPath
106
109
  ];
107
110
  await createZip(buildDirectoryPath, injectArchivePaths, ignoreArchivePaths, buildArchivePath);
108
111
  const functionStorageSource = await uploadSource(buildArchivePath);
@@ -35,7 +35,7 @@ const listDirectory = async ({ bucket, name }, listingParams = {}) => {
35
35
  const bucketInstance = getBucket(bucket);
36
36
  const options = {
37
37
  autoPaginate: false,
38
- prefix: join(name, '/'),
38
+ prefix: name ? join(name, '/') : '',
39
39
  maxResults: listingParams?.limit,
40
40
  startOffset: listingParams?.startAfter,
41
41
  delimiter: '/'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genoacms/adapter-gcp",
3
- "version": "0.7.1-fix.3",
3
+ "version": "0.7.1-fix.5",
4
4
  "type": "module",
5
5
  "description": "Implementation of abstraction layer of GenoaCMS for GCP",
6
6
  "repository": {
@@ -30,7 +30,7 @@ async function createZip (source: string, injectPaths: string[], ignorePaths: st
30
30
  })
31
31
 
32
32
  archive.pipe(output)
33
- archive.glob(source, { ignore: ignorePaths })
33
+ archive.glob(source, { ignore: ignorePaths, follow: true })
34
34
  for (const path of injectPaths) {
35
35
  archive.file(path, { name: basename(path) })
36
36
  }
@@ -100,17 +100,20 @@ async function deployFunction (functionName: string, storageSource: IStorageSour
100
100
 
101
101
  async function deploy (): Promise<void> {
102
102
  const buildDirectoryPath = '**'
103
- const buildArchivePath = resolve(currentDir, '../../../deployment/build.zip')
103
+ const buildArchivePath = resolve(currentDir, '../../../../../../.genoacms/build.zip')
104
104
  const functionEntryScriptPath = resolve(currentDir, '../../../deployment/snippets/index.js')
105
+ const builderScriptPath = resolve(currentDir, '../../../deployment/snippets/build.js')
105
106
  const ignoreArchivePaths = [
106
107
  'node_modules/**',
107
108
  '.git/**',
108
109
  '.github/**',
109
110
  '.gitignore',
111
+ '.genoacms/**',
110
112
  'build/**'
111
113
  ]
112
114
  const injectArchivePaths = [
113
- functionEntryScriptPath
115
+ functionEntryScriptPath,
116
+ builderScriptPath
114
117
  ]
115
118
  await createZip(buildDirectoryPath, injectArchivePaths, ignoreArchivePaths, buildArchivePath)
116
119
  const functionStorageSource = await uploadSource(buildArchivePath)
@@ -47,7 +47,7 @@ const listDirectory: Adapter['listDirectory'] = async ({ bucket, name }, listing
47
47
  const bucketInstance = getBucket(bucket)
48
48
  const options = {
49
49
  autoPaginate: false,
50
- prefix: join(name, '/'),
50
+ prefix: name ? join(name, '/') : '',
51
51
  maxResults: listingParams?.limit,
52
52
  startOffset: listingParams?.startAfter,
53
53
  delimiter: '/'