小编The*_*mer的帖子

关于git中常规提交消息的问题

我正在尝试适应本文中描述的传统提交消息。

这是文章的一个片段:

允许<type>值:

feat (new feature)
fix (bug fix)
docs (changes to documentation)
style (formatting, missing semi colons, etc; no code change)
refactor (refactoring production code)
test (adding missing tests, refactoring tests; no production code change)
chore (updating grunt tasks etc; no production code change)
Run Code Online (Sandbox Code Playgroud)

但有时有些变化很难归类为此类。我将列出一些关于使用哪种类型感到困惑的更改

在这种情况下我应该使用什么类型

  1. 我在现有组件上添加了 css 样式(react、Angular、Vue 等)
  2. 我在项目中编辑了配置文件,例如package.json、.prettierc等。
  3. 重命名文件
  4. 删除文件

git conventional-commits

13
推荐指数
2
解决办法
1万
查看次数

如何在 Firebase 中免费发送电子邮件?

我知道 Firebase 不允许您使用 3rd 方电子邮件服务发送电子邮件。所以唯一的方法是通过 Gmail 发送。

所以我在互联网上搜索了一些方法,所以这里有一个片段,它可以让我免费发送电子邮件。

export const shareSpeechWithEmail = functions.firestore
  .document("/sharedSpeeches/{userId}")
  .onCreate(async (snapshot, context) => {
    // const userId = context.params.userId;
    // const data = snapshot.data();
    const mailTransport = nodemailer.createTransport(
      `smtps://${process.env.USER_EMAIL}:${process.env.USER_PASSWORD}@smtp.gmail.com`
    );


    const mailOptions = {
      to: "test@gmail.com",
      subject: `Message test`,
      html: `<p><b>test</b></p>`
    };
    try {
      return mailTransport.sendMail(mailOptions);
    } catch (err) {
      console.log(err);
      return Promise.reject(err);
    }
  });

Run Code Online (Sandbox Code Playgroud)

我想创建一个模板,所以我使用了这个名为email-templatesnodemailer 的包。但该函数不会在 Firebase 控制台中执行,也不会显示错误并显示与“计费”相关的警告。

export const shareSpeechWithEmail = functions.firestore
  .document("/sharedSpeeches/{userId}")
  .onCreate(async (snapshot, context) => {

    const email = …
Run Code Online (Sandbox Code Playgroud)

node.js firebase google-cloud-functions

10
推荐指数
3
解决办法
9213
查看次数

打字稿中的多种类型断言

我正在查看角度存储库的源代码,偶然发现了一行使用多种类型断言的代码。

代码看起来有点像这个,它使用 2 种类型断言:unknown和Record<string, unknown>

 (window as unknown as Record<string, unknown>)['ResizeObserver'] 
Run Code Online (Sandbox Code Playgroud)

这是实际文件的链接。

多重断言实际上意味着什么?

typescript angular

5
推荐指数
2
解决办法
2096
查看次数