13/06/2020 - codesandbox

  1. sign up 
  1. create a project 
  • backend templates are to be forked and saved before editing is allowed 
   
  1. OR import from github repo grab the url 
  • grab the url  
 
  
tips for imported projects 
  1. crash/error prevention 
  1. package json 
  1. make sure the root folder has a package json 
  1. scripts 
  1. package json script must contain any of the above command, dev develop, serve, start 
  1. start script references the main/entry point. so if you have none, put n/a in the main 
  1. dependencies 
  1. the root folder package json listed dependencies are installed 
  1. if you have a sub-folder package json, (eg you have a server, client folder) the dependencies will not be imported 
  1. devdependencies also 
  1. different treatment of developer/client side secrets.  
  1. config file and gitignore it, need to refactor code to use process.env variables, and add in the secret name value pairs 
  1. uses dotenv, add in the secret name value keys 
  1. Master vs branch 
  1. if you are importing tutorials git repo, they usually branch by lesson, so you cannot import from the master, each branch has its own package json 

exploring the sandbox 
 top menu  
ignore 

left side bar/left panel 

  1. sandbox info explorer  
    files
    dependencies/packages installation  
    https://codesandbox.io/docs/environment 
    server 
    opened ports, if more than 1 server. this is not localhost 
    restart after changes or error - containers are only valid for backend like nodejs 
    client api keys are stored as name value pairs. to access, use process.env.[name] https://codesandbox.io/docs/secrets 
    github - optional https://codesandbox.io/docs/git https://codesandbox.io/s/github deploy - optional 

Right panel 
  1. Top  
  1. who is editing the sandbox 
  1. share/embed frame 
  1. fork (if using a container template) 
  1. Browser tabs 
  1. graphql projects have multiple ports and multiple browsers 
  1. index url of the rendered index 
  1. open the browser in another window 
  1. Bottom right panel/terminal 
  1. show hide terminal, can resize the window 
  1. 3 tabs 
  1. terminal (ready only) ctrl c does not work, use right click to copy errors 
  1. console log. console.log appears here 
  1. error check- problems. browser new window press f12=>console, will give the same thing 
  1. add a new terminal - commands here 
linters and formatters 
  1. csb uses eslint and prettier, see config left side bar 
  1. you cannot add extensions unlike vscode 
  1. emmet is also installed.  
  1. or go fil>preferences>settings 
  

Comments

Popular posts from this blog

green tea bitch

song

20231104