Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Cloud Platform - check if import map exist and create if it does not #112

Conversation

tungurlakachakcak
Copy link
Contributor

Part of #98

Tested that, initially, if you do not have an import map in your bucket the server breaks.

After adding the changes, the server run fine, import map is created and additional runs do not reset the import map.

exports.readManifest = async function (filePath) {
const { bucketName, fileName } = parseFilePath(filePath);
const file = await storage.bucket(bucketName).file(fileName);
const exists = first(await file.exists());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty weird that file.exists() returns [true] or [false] - i was initially curious why first() was needed but then found the following links and it makes sense:

https://googleapis.dev/nodejs/storage/latest/global.html#FileExistsResponse

https://googleapis.dev/nodejs/storage/latest/File.html#exists

Copy link
Member

@joeldenning joeldenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@joeldenning joeldenning merged commit 28c2406 into single-spa:main May 13, 2021
@joeldenning
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants