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

@adobe/aio-run-detached

v2.0.1

Published

Runs commands in a detached process, reports to the parent process the detached process pid

Downloads

42

Readme

Version Downloads/week Node.js CILicense Codecov Coverage

@adobe/aio-run-detached

Helper command for the Adobe I/O CLI App Plugin and Adobe Developer App Builder.

This command runs another command in a detached process, and reports to the parent process that calls it, the detached process' pid for cleanup in the future.

You would run your command in a detached process if it is a long running process, and the use case for it is running a command in an App Builder Event Hook.

Usage

You will need to add @adobe/aio-run-detached as a dependency in your project:

npm install @adobe/aio-run-detached

For example, if you have a long running command called long-running-process.sh, and you want to run it in the pre-app-run app hook, you prefix your command with aio-run-detached like so in your app's package.json:

{
  "scripts": {
    "pre-app-run": "aio-run-detached long-running-process.sh"
  }
}

aio-run-detached will report back to the App plugin the process id of the detached process, so that the App plugin can terminate the detached process when the App plugin command exits.

The first argument after aio-run-detached must be an executable. Any subsequent arguments that use shell operators must be quote escaped. See the Shell Operators Must Be Quoted section below.

Logging

Since it is a detached process, logs from stdout and stderr are not available in the terminal. Instead, the logs are written out to disk.

For example:

{
  "scripts": {
    "pre-app-run": "aio-run-detached long-running-process.sh"
  }
}

Log file name format: {processname}.out.log and {processname}.err.log.

In this example, your stdout log will be called long-running-process.sh.out.log and your stderr log will be called long-running-process.sh.err.log.

Both files will be appended to, and will be created if they don't exist, and both will be created inside a logs folder in your current working folder. Make sure you put your logs folder in your .gitignore in case there are secrets being logged. Newly generated templates will have this folder added in .gitignore.

On every run, a timestamp is logged to the log file to differentiate runs.

Shell Operators Must Be Quoted

As an example, pipe, redirection and logical operators must be quoted. This includes other shell operators. If not, the operators will apply to aio-run-detached itself and not to the executable that aio-run-detached will run.

Pipe operator example:

{
  "scripts": {
    "pre-app-run": "aio-run-detached cat package.json '|' jq .version"
  }
}

Redirection operator example:

{
  "scripts": {
    "pre-app-run": "aio-run-detached echo this is fine '>' someFile.txt"
  }
}

Logical operator example:

{
  "scripts": {
    "pre-app-run": "aio-run-detached echo this is ok '&&' echo this is fine"
  }
}

Contributing

Contributions are welcome! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.