xgqfrms / Gatsby-Tutorials-All-In-One

Gatsby-Tutorials-All-In-One
https://gatsby-react-app.xgqfrms.xyz
MIT License
1 stars 0 forks source link

gatsby import image & webpack & typescript error #7

Open xgqfrms opened 1 year ago

xgqfrms commented 1 year ago

gatsby import image & webpack & typescript error

https://egghead.io/lessons/gatsby-import-a-local-image-into-a-gatsby-component-with-webpack

xgqfrms commented 1 year ago
// 自定义 ts declare, 修复 image 报错信息

// Cannot find module '../images/icon.png' or its corresponding type declarations.ts(2307)

// 把 png 图片声明为 webpack 的模块
declare module '*.png';

// declare module '*.svg';
// declare module '*.gif';
// declare module '*.jpeg';
// declare module '*.jpg';
// declare module '*.webp';
// declare module '*.apng';

TS 项目中 import 图片时, 报错 Cannot find module ‘xxx’ or its corresponding type declarations.ts(2307)

https://juejin.cn/post/7016980878928642061

https://blog.csdn.net/yuliwen0418/article/details/121141130

xgqfrms commented 1 year ago
<!doctype html>
<html>
 <head>
      <meta  charset="utf-8"/>
      <style>
          #canvas1{border:1px solid red}/*不建议使用CSS样式width,height 设置canvas*/
      </style>
 </head>
 <body>
      <canvas id="canvas1" width="600px" height="500px">
         你的浏览器不支持canvas元素!请更新浏览器。
      </canvas>
      <script>
         var canvas = document.getElementById('canvas1');
         var c = canvas.getContext('2d');

        c.beginPath();
        c.moveTo(50,30);
        c.lineTo(300,30);
        c.strokeStyle="red";
        c.lineWidth=10;
        c.stroke();
        //c.closePath();
        var img = new Image();//创建图片对象。
        img.src = '1.png';
        window.onload = function(){//先完全加载,才能绘制。
        c.drawImage(img,50,50);//完全绘制
        }

        //渐变色(线性渐变(水平,垂直))

        var linear=c.createLinearGradient(10,180,310,180);
        linear.addColorStop(0,'red');
        linear.addColorStop(0.2,'orange');
        linear.addColorStop(0.4,'yellow');
        linear.addColorStop(0.6,'green');
        linear.addColorStop(0.8,'blue');
        linear.addColorStop(1,'cyan');
        c.fillStyle=linear;
        c.fillRect(10,180,300,50);//起点,x,y(宽,长)

      </script>

 </body>
</html>

https://blog.csdn.net/u010317382/article/details/84653868

https://blog.csdn.net/u010317382

2014.x.x & shit csdn

https://gitcode.net/users/u010317382/groups

https://gitcode.net/anonymous_ufo_group/free-programming-books

https://mydev.csdn.net/product/ide/dashboard

开源任务 GitCode / 1024程序员开源挑战赛

https://gitcode.net/gitcode/1024opensource/-/blob/master/%E5%BC%80%E6%BA%90%E4%BB%BB%E5%8A%A11.md

xgqfrms commented 1 year ago

gcm bug

image

$ gcm "init repo, 2048"
error: pathspec 'master' did not match any file(s) known to git
error: pathspec 'init repo, 2048' did not match any file(s) known to git

➜  2048-master git:(main) ✗ $ git commit -m"init repo, 2048"  
[main (root-commit) 50d97a0] init repo, 2048
 38 files changed, 8371 insertions(+)

https://blog.csdn.net/Lakers2015/article/details/112320092

git 常见错误问题 fatal: Not a valid object name: 'master'.

问题描述-一个非法的master,原因:本地还没有创建master,你可以执行以下git branch,会发现没有看到本地分支列表

https://www.cnblogs.com/fatfatdachao/p/5597028.html

想新建立一个分支时出现这错误。

后来发现,要先commit一次才会真正建立master分支,此时就可以新建立分支了。。

xgqfrms commented 1 year ago

error: pathspec 'master' did not match any file(s) known to git

$ git branch master
$ git checkout master

$ gco master
Switched to branch 'master'
➜  2048-master git:(master) 

image

xgqfrms commented 1 year ago

https://gitcode.net/anonymous_ufo_group/1024opensource/-/issues/1

xgqfrms commented 1 year ago

$ git init

$ git remote add origin git@gitcode.net:anonymous_ufo_group/1024opensource.git

$ git add .

$ git commit -m "init repo"

# create master branch
$ git branch master

# main => master
$ git checkout master

# -u, --set-upstream    set upstream for git pull/status
$ git push -u origin master
$ git push -h

usage: git push [<options>] [<repository> [<refspec>...]]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --repo <repository>   repository
    --all                 push all refs
    --mirror              mirror all refs
    -d, --delete          delete refs
    --tags                push tags (can't be used with --all or --mirror)
    -n, --dry-run         dry run
    --porcelain           machine-readable output
    -f, --force           force updates
    --force-with-lease[=<refname>:<expect>]
                          require old value of ref to be at this value
    --force-if-includes   require remote updates to be integrated locally
    --recurse-submodules (check|on-demand|no)
                          control recursive pushing of submodules
    --thin                use thin pack
    --receive-pack <receive-pack>
                          receive pack program
    --exec <receive-pack>
                          receive pack program
    -u, --set-upstream    set upstream for git pull/status
    --progress            force progress reporting
    --prune               prune locally removed refs
    --no-verify           bypass pre-push hook
    --follow-tags         push missing but relevant tags
    --signed[=(yes|no|if-asked)]
                          GPG sign the push
    --atomic              request atomic transaction on remote side
    -o, --push-option <server-specific>
                          option to transmit
    -4, --ipv4            use IPv4 addresses only
    -6, --ipv6            use IPv6 addresses only
xgqfrms commented 1 year ago
$ git push -u origin master
The authenticity of host 'gitcode.net (119.3.229.170)' can't be established.
RSA key fingerprint is SHA256:pyrMa3p0o90Qsuz2+kMX3CIBl+S1cZsdRlCoaosSgQs.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitcode.net' (RSA) to the list of known hosts.
git@gitcode.net: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
xgqfrms commented 1 year ago

https://www.runoob.com/git/git-push.html

SSH keys

https://blog.csdn.net/kaimo313/article/details/107307266

ssh -V 
OpenSSH_8.6p1, LibreSSL 3.3.6

https://gitcode.net/gitcode/help-docs/-/wikis/docs/ssh#ssh%E5%AF%86%E9%92%A5

https://gitcode.net/gitcode/help-docs/-/wikis/docs/ssh#ed25519-ssh-keys

单个仓库的 密钥

https://gitcode.net/anonymous_ufo_group/1024opensource/-/settings/repository

全局 密钥

https://gitcode.net/-/profile/keys

xgqfrms commented 1 year ago
$ ls -al ~/.ssh  
total 24
drwx------   5 xgqfrms-mm  staff   160 Dec 21  2019 .
drwxr-xr-x+ 63 xgqfrms-mm  staff  2016 Nov  2 00:22 ..

$ cd  ~/.ssh  

➜  .ssh ssh -V 
OpenSSH_8.6p1, LibreSSL 3.3.6

➜  .ssh ssh-keygen -t ed25519 -C "xgqfrms@xgqfrms.xyz"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/Users/xgqfrms-mm/.ssh/id_ed25519): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/xgqfrms-mm/.ssh/id_ed25519
Your public key has been saved in /Users/xgqfrms-mm/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:BzWXb8ZawNUAKyq9XPGJW9pnT+15XoqRtmk7I7uXE/s xgqfrms@xgqfrms.xyz
The key's randomart image is:
+--[ED25519 256]--+
|          o.o+oo |
|         . o+.  .|
|        . o .+   |
|       . o = .*  |
|      . S + +=   |
|       o + =o.  .|
|        o o =+o +|
|          ..OB =+|
|          o*=*Eo=|
+----[SHA256]-----+
➜  .ssh 
$ cat id_ed25519.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMDqM6EOp5FrOSAOjjKXF+cFl/JvoezXE4DAVxPIWLCY xgqfrms@xgqfrms.xyz

为了支持 SSH,GitCode 需要安装 OpenSSH 客户端,该客户端已预装在 GNU / Linux 和 macOS 上,但未预先安装在 Windows 上。

我们要求您使用 SSH 6.5 或更高版本,因为它不包括现在不安全的 MD5 签名。您可以通过下命令查看系统上安装的 SSH 版本:

$ ssh -V 

ED25519 密钥:

ED25519 密钥比 RSA 密钥更为安全。

2014年 OpenSSH 6.5 引入 ED25519 SSH 密钥后,当前任何操作系统都可用使用这种密钥。ED25519 密钥比 RSA 密钥更为安全。 2014年 OpenSSH 6.5 引入 ED25519 SSH 密钥后,当前任何操作系统都可用使用这种密钥。

$ ssh-keygen -t ed25519 -C "xgqfrms@xgqfrms.xyz" 

RSA SSH 密钥, 2048

$ ssh-keygen -t rsa -b 2048 -C "xgqfrms@xgqfrms.xyz"
xgqfrms commented 1 year ago
$ git pull remote master

$  git push -u origin master
git push -u origin master                   
To gitcode.net:anonymous_ufo_group/1024opensource.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'gitcode.net:anonymous_ufo_group/1024opensource.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
➜  2048-master git:(master) git pull
remote: Enumerating objects: 352, done.
remote: Counting objects: 100% (352/352), done.
remote: Compressing objects: 100% (171/171), done.
remote: Total 352 (delta 180), reused 342 (delta 173), pack-reused 0
Receiving objects: 100% (352/352), 52.81 KiB | 1.89 MiB/s, done.
Resolving deltas: 100% (180/180), done.
From gitcode.net:anonymous_ufo_group/1024opensource
 * [new branch]      master     -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master

➜  2048-master git:(master) git push -u origin master
To gitcode.net:anonymous_ufo_group/1024opensource.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'gitcode.net:anonymous_ufo_group/1024opensource.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
➜  2048-master git:(master)  git branch --set-upstream-to=origin/master  master 
branch 'master' set up to track 'origin/master'.
➜  2048-master git:(master) git push -u origin master                          
To gitcode.net:anonymous_ufo_group/1024opensource.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'gitcode.net:anonymous_ufo_group/1024opensource.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
➜  2048-master git:(master) git pull remote master
xgqfrms commented 1 year ago
$ git fetch     

➜  2048-master git:(master) gst
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 123 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

nothing to commit, working tree clean
➜  2048-master git:(master) git pull                 
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint: 
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.

hint: You have divergent branches and need to specify how to reconcile them. 提示:您有不同的分支,需要指定如何协调它们。

xgqfrms commented 1 year ago
$ git config pull.rebase true
➜  2048-master git:(master) gst
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 123 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

nothing to commit, working tree clean
➜  2048-master git:(master) git pull
Successfully rebased and updated refs/heads/master.

git push                   
Enumerating objects: 46, done.
Counting objects: 100% (46/46), done.
Delta compression using up to 6 threads
Compressing objects: 100% (43/43), done.
Writing objects: 100% (45/45), 330.55 KiB | 14.37 MiB/s, done.
Total 45 (delta 1), reused 0 (delta 0), pack-reused 0
To gitcode.net:anonymous_ufo_group/1024opensource.git
   a730cae..d210825  master -> master

https://blog.csdn.net/kikyou132/article/details/106316571

https://blog.csdn.net/cyqzy/article/details/122037120

xgqfrms commented 1 year ago

https://idegitcode.net/anonymous_ufo_group/1024opensource

https://dev-ide.csdn.net/#gitcode.net/anonymous_ufo_group/1024opensource

组织的项目,为什么只能是私有的 ❌

https://gitcode.net/u010317382/1024opensource/-/issues/2

https://gitcode.net/u010317382/1024opensource/

https://idegitcode.net/u010317382/1024opensource/

xgqfrms commented 1 year ago
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = git@gitcode.net:anonymous_ufo_group/1024opensource.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[user]
    name = anonymous_ufo
    email = anonymous_ufo@email.com
[user]
    name = anonymous_ufo
    email = anonymous_ufo@email.com

image

https://ide.csdn.net/ws/63615522aee4323e8878d05c/?folder=/ide/workspace/1024opensource

xgqfrms commented 1 year ago

断网了

https://mp.csdn.net/mp_download/manage/download/UpDetailed

xgqfrms commented 1 year ago

Pro Git 2 中文版

https://codechina_dev.gitcode.host/progit2/

learn-git

https://codechina_dev.gitcode.host/learn-git-branching/?locale=zh_CN

https://gitee.com/all-about-git

https://www.cnblogs.com/syp172654682/p/7689328.html

https://www.cnblogs.com/yaozhongxiao/p/3811130.html

Node.js实战(第2版)pdf

技术路线图

https://dev-roadmap.gitcode.host/

https://codechina.gitcode.host/developer-roadmap/frontend/intro/

image

https://blog.csdn.net/linxinfa/article/details/108730290

GitEE

https://gitee.com/

xgqfrms commented 1 year ago

启用快进合并( --ff-only )时,将不会创建任何合并请求提交,并且所有合并都将会被设置快进,这也就意味着仅当分支可以被快进时才允许合并。 当无法进行快进合并时,将为用户提供重新设置基准的选项。

fast forward

https://gitcode.net/gitcode/help-docs/-/wikis/docs/user/project/merge-request/fast-forward#%E5%BC%80%E5%90%AF%E5%BF%AB%E8%BF%9B%E5%90%88%E5%B9%B6

xgqfrms commented 1 year ago

https://training.github.com/

Git Cheat Sheets

https://training.github.com/downloads/zh_CN/github-git-cheat-sheet/