New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@firefoxic/utils

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firefoxic/utils

Collection of useful utilities for JavaScript and Node.js.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-60%
Maintainers
0
Weekly downloads
 
Created
Source

@firefoxic/utils

License: MIT Changelog NPM version Test Status

Collection of useful utilities for JavaScript and Node.js.

Installation

pnpm add -D @firefoxic/utils

Usage

getProjectRoot

Your action should set the REPO_NAME environment variable to the step you want. If your action works with pull requests, you should also add two lines (which are marked below with a special comment) to use the PR_NUMBER variable. For example:

jobs:
  job_name:
    runs-on: ubuntu-latest
    steps:

      # Any steps before building a project

      - name: Build project
        run: pnpm build
        env:
          REPO_NAME: ${{ github.event.repository.name }}
          PR_NUMBER: ${{ github.event.pull_request.number }}     # For PR action

      - name: Deploy
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          folder: ./dist
          branch: gh-pages
          target-folder: ${{ github.event.pull_request.number }} # For PR action

Than you can get the path to the project root when deploying to GitHub Pages, for example in vite.config.js:

import { defineConfig } from "vite"
import { getProjectRoot } from "@firefoxic/utils"

export default defineConfig({
	base: `${getProjectRoot()}/`,
})

setGitHubEnvVar

Your action must accept the environment variable you pass into it from the JS. For example, you can pass the path to the distribution directory from the vite.config.js:

import { defineConfig } from "vite"

import { setGitHubEnvVar } from "@firefoxic/utils"

const PATH_TO_SRC = `./a_very_strange_path_to_source`
const PATH_TO_DIST = `./a_very_strange_path_to_dist`

setGitHubEnvVar(`PATH_TO_DIST`, PATH_TO_DIST)

export default defineConfig({
	root: PATH_TO_SRC,
	build: {
		outDir: `.${PATH_TO_DIST}`,
	},
})

Then you can use this variable in the deploy step of your action:

jobs:
  job_name:
    runs-on: ubuntu-latest
    steps:

      # Any steps before deploying a project

      - name: Deploy
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          folder: ${{ env.PATH_TO_DIST }}
          branch: gh-pages

Keywords

FAQs

Package last updated on 30 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc