@genoacms/adapter-gcp 0.7.1-fix.2 → 0.7.1-fix.4
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.
- package/deployment/snippets/index.js +1 -1
- package/dist/services/authorization/index.js +2 -1
- package/dist/services/database/index.js +2 -1
- package/dist/services/deployment/deploy.js +6 -3
- package/dist/services/storage/storage.js +1 -1
- package/package.json +1 -1
- package/src/services/authorization/index.ts +2 -1
- package/src/services/database/index.ts +2 -1
- package/src/services/deployment/deploy.ts +6 -3
- package/src/services/storage/storage.ts +1 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
import config from '../../config.js';
|
2
2
|
import { ProjectsClient } from '@google-cloud/resource-manager';
|
3
|
-
const
|
3
|
+
const PROVIDER_NAME = '@genoacms/adapter-gcp/authorization';
|
4
|
+
const authorizationConfig = config.authorization.providers.find((provider) => provider.name === PROVIDER_NAME);
|
4
5
|
if (!authorizationConfig)
|
5
6
|
throw new Error('authorization-provider-not-found');
|
6
7
|
const projectId = authorizationConfig.projectId;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import config from '../../config.js';
|
2
2
|
import { Firestore } from '@google-cloud/firestore';
|
3
|
-
const
|
3
|
+
const PROVIDER_NAME = '@genoacms/adapter-gcp/database';
|
4
|
+
const firestoreConfig = config.database.providers.find((provider) => provider.name === PROVIDER_NAME);
|
4
5
|
if (!firestoreConfig)
|
5
6
|
throw new Error('firestore-provider-not-found');
|
6
7
|
const firestore = new Firestore({
|
@@ -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, '
|
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);
|
@@ -5,7 +5,7 @@ const storageConfig = config.storage.providers.find((provider) => provider.name
|
|
5
5
|
if (!storageConfig)
|
6
6
|
throw new Error('storage-provider-not-found');
|
7
7
|
const storage = new Storage({
|
8
|
-
credentials:
|
8
|
+
credentials: storageConfig.credentials
|
9
9
|
});
|
10
10
|
const hasBucket = (name) => {
|
11
11
|
const has = config.storage.buckets.find((bucket) => bucket.name === name && bucket.providerName === PROVIDER_NAME);
|
package/package.json
CHANGED
@@ -2,7 +2,8 @@ import type { Adapter, AuthorizationProvider } from '@genoacms/cloudabstraction/
|
|
2
2
|
import config from '../../config.js'
|
3
3
|
import { ProjectsClient } from '@google-cloud/resource-manager'
|
4
4
|
|
5
|
-
const
|
5
|
+
const PROVIDER_NAME = '@genoacms/adapter-gcp/authorization'
|
6
|
+
const authorizationConfig = config.authorization.providers.find((provider: AuthorizationProvider) => provider.name === PROVIDER_NAME)
|
6
7
|
if (!authorizationConfig) throw new Error('authorization-provider-not-found')
|
7
8
|
const projectId = authorizationConfig.projectId
|
8
9
|
const resourceManager = new ProjectsClient({
|
@@ -10,7 +10,8 @@ import type {
|
|
10
10
|
import config from '../../config.js'
|
11
11
|
import { Firestore } from '@google-cloud/firestore'
|
12
12
|
|
13
|
-
const
|
13
|
+
const PROVIDER_NAME = '@genoacms/adapter-gcp/database'
|
14
|
+
const firestoreConfig = config.database.providers.find((provider: DatabaseProvider) => provider.name === PROVIDER_NAME)
|
14
15
|
if (!firestoreConfig) throw new Error('firestore-provider-not-found')
|
15
16
|
const firestore = new Firestore({
|
16
17
|
credentials: firestoreConfig.credentials,
|
@@ -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, '
|
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)
|
@@ -6,7 +6,7 @@ const PROVIDER_NAME = '@genoacms/adapter-gcp/storage'
|
|
6
6
|
const storageConfig = config.storage.providers.find((provider: StorageProvider) => provider.name === PROVIDER_NAME)
|
7
7
|
if (!storageConfig) throw new Error('storage-provider-not-found')
|
8
8
|
const storage = new Storage({
|
9
|
-
credentials:
|
9
|
+
credentials: storageConfig.credentials
|
10
10
|
})
|
11
11
|
|
12
12
|
const hasBucket = (name: string): boolean => {
|