npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

semantic-release-space

v1.4.1

Published

A Semantic Release JetBrains Space plugin

Downloads

29

Readme

semantic-release-space

semantic-release plugin to publish a JetBrains Space Deployment.

npm latest version npm next version npm beta version

| Step | Description | |--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| | verifyConditions | Verifies that all required options are set. | | prepare | Creates a JetBrains Space Deployment Target if it does not yet exist. | | publish | Starts a JetBrains Space Deployment. | | success | Marks the JetBrains Space Deployment as completed. | | fail | Marks the JetBrains Space Deployment as failed. |

Install

$ npm install --save-dev semantic-release-space

Usage

The plugin can be configured in the semantic-release configuration file:

"plugins": [
  ...
  [
    "semantic-release-space", {
      "targetId": "example-target"
    }
  ]
  ...
]

With this example a JetBrains Space Deployment will be published on the example-target deployment target .

Configuration

Make sure to set targetId or JB_SPACE_TARGET_ID to the deployment target you want to use. All other options are automatically set via their environment variables in a Space Job.

Options and Environment variables

| Option | Environment variable | Type | Description | |--------------------|---------------------------------------------|-----------------------|--------------------------------------------------------------------------------------------------------------------------------| | target | JB_SPACE_TARGET_ID | TargetConfiguration | RequiredThe Space deployment target(s)Set to an key value object to specify target(s) per branch | | projectId | JB_SPACE_PROJECT_ID | string | Required Automatically set in JetBrains Space JobsThe Space project id | | apiUrl | JB_SPACE_API_URL | string | Required Automatically set in JetBrains Space JobsThe Space API url | | apiToken | JB_SPACE_TOKENJB_SPACE_CLIENT_TOKEN | string | Required Automatically set in JetBrains Space JobsThe Space API auth token | | repositoryName | JB_SPACE_GIT_REPOSITORY_NAME | string | Required Automatically set in JetBrains Space JobsThe repositories name | | requireTarget | JB_SPACE_REQUIRE_TARGET | boolean | Defaults to trueIf set to false an invalid or missing target configuration will be ignored instead of throwing an error | | job | JB_SPACE_JOB_ID | JobConfiguration | Defaults to []The Space automation job(s) to startSet to an key value object to specify job(s) per branch | | jobTimeout | JB_SPACE_JOB_TIMEOUT | number | Defaults to 3600The max timeout waiting for jobs to complete in seconds | | jobCheckInterval | JB_SPACE_JOB_CHECK_INTERVAL | number | Defaults to 10The interval between job status checks in seconds |

Option Types

  • TargetConfiguration: string | string[] | { [branch: string]: string | string[] }
  • JobConfiguration: JobBranchConfiguration | { [branch: string]: JobBranchConfiguration }
  • JobBranchConfiguration: string | string[] | { id: string, parameters?: { [name: string]: string } }

Job Parameters

Job parameters can be set via the parameters property of a job configuration for all or only specific branches. The values will be parsed using Handlebars and with the plugin context as template context. Examples:

  • "parameters": { "hello": "world" } will set the parameter hello to world
  • "parameters": { "version": "{{nextRelease.version}}" } will set the parameter version to the next release version
  • "parameters": { "channel": "{{#if nextRelease.channel}}{{nextRelease.channel}}{{else}}latest{{/if}}" } will set the parameter channel to the next release channel or latest if no channel is set

Job Example

With this example the package.json will be pumped and committed, a NPM package will be published and a JetBrains Space Deployment of the new tag will be published on the example-target deployment target.

Authentication

  • Go into your Space Instance > Extensions > Applications and create a new Application (or select an existing one).
  • Go into Authorization and give the Application at least the following permissions for the target project:
    • Read Git repositories
    • Write Git repositories
    • Create package registries
    • Read package registries
    • Write package registires
  • Go into Permanent Tokens and create and copy a new token for the Application.
  • Go into Projects > your target project > Settings > Secrets & Parameters > and create a new secret:
    • key: ci-token
    • value: <application key>:<the token you just coppied>

.releaserc

{
  "branches": [
    "main"
  ],
  "plugins": [
    [
      "@semantic-release/commit-analyzer",
      {}
    ],
    [
      "@semantic-release/release-notes-generator",
      {
        "linkCompare": false,
        "linkReferences": false
      }
    ],
    [
      "semantic-release-space",
      {
        "targetId": "example-target",
        "job": {
          "id": "Example",
          "parameters": {
            "example-param": "example-value",
            "release-version": "{{nextRelease.version}}",
            "release-channel": "{{#if nextRelease.channel}}{{nextRelease.channel}}{{else}}latest{{/if}}"
          }
        }
      }
    ],
    [
      "@semantic-release/npm",
      {}
    ],
    [
      "@semantic-release/git",
      {
        "assets": [
          "package.json"
        ],
        "message": "release: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
      }
    ]
  ]
}

.space.kts

job("Release") {
  git {
    refSpec = "refs/heads/main"
  }

  container(displayName = "Publish", image = "node:lts") {
    env["GIT_CREDENTIALS"] = Secrets("ci-token")
    env["NPM_TOKEN"] = Secrets("ci-token")
    shellScript {
      content = """
        npm install
        npx semantic-release
      """
    }
  }
}

job("Example") {
  parameters {       
    text("release-version")
    text("release-channel")
    text("example-param")
  }

  startOn {}

  container(image = "alpine:lts") {
    shellScript {
      content = """
        echo {{ release-version }}
        echo {{ release-channel }}
        echo {{ example-param }}
      """
    }
  }  
}