Installations
npm install @jim.catts/run-script-os
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
8.10.0
NPM Version
6.11.3
Score
69
Supply Chain
92.1
Quality
75
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (72.37%)
PowerShell (14.87%)
Shell (12.77%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
charlesguse
Download Statistics
Total Downloads
19,121
Last Day
18
Last Week
64
Last Month
220
Last Year
1,804
GitHub Statistics
195 Stars
127 Commits
30 Forks
2 Watching
1 Branches
9 Contributors
Package Meta Information
Latest Version
1.1.4
Package Id
@jim.catts/run-script-os@1.1.4
Unpacked Size
18.86 kB
Size
7.06 kB
File Count
13
NPM Version
6.11.3
Node Version
8.10.0
Total Downloads
Cumulative downloads
Total Downloads
19,121
Last day
1,700%
18
Compared to previous day
Last week
3.2%
64
Compared to previous week
Last month
528.6%
220
Compared to previous month
Last year
-53.3%
1,804
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No dependencies detected.
Why does this fork exists?
This fork was made to fix #20 in the original repo. Please check in there if you want to have a well supported version. There's also a couple of changes that were implemented to improve the readibility and allow for easier fixes in the future, I sure hope @charlesguse don't mind too much!
run-script-os
You will be able to use OS specific operations in npm scripts.
Who would want this?
If you have experienced the pain of trying to make npm scripts usable across different operating system, this package is for you! Looking at you rm
and del
!
Installation
npm install --save-dev run-script-os
Usage
Set run-script-os
(or run-os
) as the value of the npm script field that you want different functionality per OS. In the example below, we set test
, but it can be any npm script. It also uses pre
and post
commands (explained more below).
Then create OS specific scripts. In the example below, you can see:
test:win32
test:linux:darwin
test:default
Those can have OS specific logic.
package.json
{
...
"scripts": {
...
"test": "run-script-os",
"test:win32": "echo 'del whatever you want in Windows 32/64'",
"test:darwin:linux": "echo 'You can combine OS tags and rm all the things!'",
"test:default": "echo 'This will run on any platform that does not have its own script'"
...
},
...
}
Windows Output:
> npm test
del whatever you want in Windows 32/64
macOS and Linux Output:
> npm test
You can combine OS tags and rm all the things!
Aliases
You can use the following aliases:
:windows
- Alias for win32:macos
- Alias for darwin:nix
- This will run on anything considered to be a *nix OS (aix, darwin, freebsd, linux, openbsd, sunos, android):default
- This will run if no platform-specific scripts are found
Override detection settings for linux-based shells on Windows
By default, run-script-os will detect cygwin/git bash as Windows. If you would rather your platform be detected as Linux under these environments:
Set environment variable:
RUN_OS_WINBASH_IS_LINUX=true
NPM Scripts Order
When you call a script like npm test
, npm will first call pretest
if it exists. It will then call test
, which, if you are using run-script-os
, it will then call npm run test:YOUR OS
, which in turn will call pretest:YOUR OS
before actually running test:YOUR OS
. Then posttest:YOUR OS
will run, and then after that posttest
will finally execute.
There is an example showing pre
and post
commands found in the package.json
of this repository.
OS Options: darwin
, freebsd
, linux
, sunos
, win32
More information can be found in Node's process.platform
and Node's os.platform()
.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cicd.yaml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/charlesguse/run-script-os/cicd.yaml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cicd.yaml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/charlesguse/run-script-os/cicd.yaml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cicd.yaml:55: update your workflow using https://app.stepsecurity.io/secureworkflow/charlesguse/run-script-os/cicd.yaml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cicd.yaml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/charlesguse/run-script-os/cicd.yaml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/cicd.yaml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/charlesguse/run-script-os/cicd.yaml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/cicd.yaml:43
- Info: 0 out of 4 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 1 out of 2 npmCommand dependencies pinned
Reason
Found 3/16 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/cicd.yaml:1
- Info: no jobLevel write permissions found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 18 are checked with a SAST tool
Score
3.7
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More