ict.ken.be

 

Reactjs 

Categories: Reactjs

Just some basic react cheatsheet

  • import React from "react"
  • use an expression to put comments
{/* you can use this to commend inside your jsx */}
  • useĀ a fragment if you want to quickly include an exiting html structure with more then one element at the root
<>
<h1>Some header<h1>
<h2>Some subheader<h2>
</>

Error: endpoint data missing from graphql config when using gatsby with vscode 

Categories: Gatsbyjs GraphQL VSCode

Most likely you installed the GraphQL extension for VSCode to add syntax highlighting to your graphql queries. Then you noticed the codelens 'Execute Query' and got one of the following errors:

  • Error: endpoint data missing from graphql config
  • ConfigNotFoundError: ".graphqlconfig" file is not available in the provided config directory

To solve this issue, you need to create a .graphqlconfig file in your project root folder.

Tricky part is figuring out what you need to put in there for using Gatsby.

So here is an example:

{
  "name": "Gatsby Schema",
  "schemaPath": "schema.graphql",
  "extensions": {
    "endpoints": {
      "Remote GraphQL Endpoint": {
        "url": "http://localhost:8000/___graphql",
        "headers": {
          "user-agent": "JS GraphQL"
        },
        "introspect": true
      }
    }
  }
}

Upgrading Nodejs package.json dependencies 

Categories: Javascript Nodejs

Doing a minor update

  • npm update

Doing a major update

Ensure you have the 'check updates' module installed, which will give you the ncu command.

npm install -g npm-check-updates
  • npm outdated
  • ncu -u
  • npm update
  • npm install

Stop Teamcity build when other build starts 

Categories: Windows

Most likely you want to stop running your long end-2-end tests when a new deployment is ready.
You will lose the correlation between when the error happened, but at least you can move on.
The easiest way to do this in Teamcity (as there is no support at this writing),
is to add an additional step before the deployment build configuration using the following powershell script.

So you basically cancel the test build configuration when the deployment starts.

$buildConfigurationId = '%E2ETestBuildConfigurationId%'
If (![string]::IsNullOrWhitespace($buildConfigurationId)) { 
    Write-Host "Finding test builds"
    $user = '%system.teamcity.auth.userId%'
    $pass = '%system.teamcity.auth.password%'
    $pair = "${user}:${pass}"
    $bytes = [System.Text.Encoding]::ASCII.GetBytes($pair)
    $base64 = [System.Convert]::ToBase64String($bytes)
    $basicAuthValue = "Basic $base64"
    $headers = @{ Authorization = $basicAuthValue; "Content-Type" = "application/xml" }
    $response = Invoke-WebRequest -Uri "http://teamcity.conseur.org/app/rest/builds?locator=buildType:($buildConfigurationId),state:queued" -Method GET -Headers $headers
    $postParams = "<buildCancelRequest comment='Build was canceled because of new deployment.' readdIntoQueue='true' />"
    Foreach($buildId in ([xml]$response.Content).builds.build.id) 
    {
        Write-Host "Cancel queued buildId: $buildId"
        Invoke-WebRequest -Uri "http://teamcity.conseur.org/app/rest/buildQueue/id:$buildId" -Headers $headers -Method POST -Body $postParams
    }
    $response = Invoke-WebRequest -Uri "http://teamcity.conseur.org/app/rest/builds?locator=buildType:($buildConfigurationId),state:running" -Method GET -Headers $headers
    $postParams = "<buildCancelRequest comment='Build was canceled because of new deployment.' readdIntoQueue='false' />"
    Foreach($buildId in ([xml]$response.Content).builds.build.id) 
    {
        Write-Host "Cancel running buildId: $buildId"
        Invoke-WebRequest -Uri "http://teamcity.conseur.org/app/rest/builds/id:$buildId" -Headers $headers -Method POST -Body $postParams
    }
}

Jekyll regeneration does not stop 

Categories: Visual Studio

Most likely your editor is writing settings to the folder you are running Jekyll from. For example, try running 'jekyll serve' and then open the folder with Visual Studio 2017 and you will see it starts regenerating.

Command line showing Jekyll regenerating issue

Page 2 of 42 << < 1 2 3 4 5 6 7 8 9 10 20 40 > >>