@stdlib/process-cwd-cli
Advanced tools
+1
-1
@@ -1,1 +0,1 @@ | ||
| Copyright (c) 2016-2023 The Stdlib Authors. | ||
| Copyright (c) 2016-2024 The Stdlib Authors. |
+6
-6
| { | ||
| "name": "@stdlib/process-cwd-cli", | ||
| "version": "0.1.1", | ||
| "version": "0.2.0", | ||
| "description": "Return the current working directory.", | ||
@@ -29,9 +29,9 @@ "license": "Apache-2.0", | ||
| "@stdlib/cli-ctor": "^0.1.1", | ||
| "@stdlib/fs-read-file": "^0.1.1", | ||
| "@stdlib/process-cwd": "0.1.1" | ||
| "@stdlib/fs-read-file": "^0.2.0", | ||
| "@stdlib/process-cwd": "0.2.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@stdlib/assert-is-browser": "^0.1.0", | ||
| "@stdlib/assert-is-windows": "^0.1.0", | ||
| "@stdlib/process-exec-path": "^0.1.0", | ||
| "@stdlib/assert-is-browser": "^0.1.1", | ||
| "@stdlib/assert-is-windows": "^0.1.1", | ||
| "@stdlib/process-exec-path": "^0.1.1", | ||
| "tape": "git+https://github.com/kgryte/tape.git#fix/globby", | ||
@@ -38,0 +38,0 @@ "istanbul": "^0.4.1", |
+6
-3
@@ -139,3 +139,3 @@ <!-- | ||
| Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. | ||
| Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. | ||
@@ -153,4 +153,4 @@ </section> | ||
| [test-image]: https://github.com/stdlib-js/process-cwd/actions/workflows/test.yml/badge.svg?branch=v0.1.1 | ||
| [test-url]: https://github.com/stdlib-js/process-cwd/actions/workflows/test.yml?query=branch:v0.1.1 | ||
| [test-image]: https://github.com/stdlib-js/process-cwd/actions/workflows/test.yml/badge.svg?branch=v0.2.0 | ||
| [test-url]: https://github.com/stdlib-js/process-cwd/actions/workflows/test.yml?query=branch:v0.2.0 | ||
@@ -182,4 +182,7 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/process-cwd/main.svg | ||
| [deno-url]: https://github.com/stdlib-js/process-cwd/tree/deno | ||
| [deno-readme]: https://github.com/stdlib-js/process-cwd/blob/deno/README.md | ||
| [umd-url]: https://github.com/stdlib-js/process-cwd/tree/umd | ||
| [umd-readme]: https://github.com/stdlib-js/process-cwd/blob/umd/README.md | ||
| [esm-url]: https://github.com/stdlib-js/process-cwd/tree/esm | ||
| [esm-readme]: https://github.com/stdlib-js/process-cwd/blob/esm/README.md | ||
| [branches-url]: https://github.com/stdlib-js/process-cwd/blob/main/branches.md | ||
@@ -186,0 +189,0 @@ |
| #/ | ||
| # @license Apache-2.0 | ||
| # | ||
| # Copyright (c) 2023 The Stdlib Authors. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| #/ | ||
| # Workflow name: | ||
| name: publish_cli | ||
| # Workflow triggers: | ||
| on: | ||
| # Allow the workflow to be manually run: | ||
| workflow_dispatch: | ||
| # Workflow inputs: | ||
| inputs: | ||
| version: | ||
| description: 'Version Increment' | ||
| type: choice | ||
| default: 'none' | ||
| options: | ||
| - 'none' | ||
| - 'major' | ||
| - 'minor' | ||
| - 'patch' | ||
| - 'premajor' | ||
| - 'preminor' | ||
| - 'prepatch' | ||
| - 'prerelease' | ||
| # Workflow jobs: | ||
| jobs: | ||
| # Define job to publish package to npm: | ||
| publish: | ||
| # Define display name: | ||
| name: 'Publish CLI package to npm' | ||
| # Define the type of virtual host machine on which to run the job: | ||
| runs-on: ubuntu-latest | ||
| # Define environment variables: | ||
| env: | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| # Define the sequence of job steps... | ||
| steps: | ||
| # Checkout cli branch: | ||
| - name: 'Checkout cli branch' | ||
| # Pin action to full length commit SHA corresponding to v4.1.0 | ||
| uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 | ||
| with: | ||
| ref: cli | ||
| # Install Node.js: | ||
| - name: 'Install Node.js' | ||
| # Pin action to full length commit SHA corresponding to v3.8.1 | ||
| uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d | ||
| with: | ||
| node-version: 16 | ||
| timeout-minutes: 5 | ||
| # Configure git: | ||
| - name: 'Configure git' | ||
| run: | | ||
| git config --local user.email "noreply@stdlib.io" | ||
| git config --local user.name "stdlib-bot" | ||
| # Increment package version (if requested): | ||
| - name: 'Increment package version (if requested)' | ||
| if: ${{ github.event.inputs.version != 'none' }} | ||
| run: | | ||
| # Save NPM_TOKEN to user's .npmrc: | ||
| echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | ||
| # Increment package version: | ||
| npm version ${{ github.event.inputs.version }} --no-git-tag-version | ||
| # Define variable for new version: | ||
| NEW_VERSION=$(node -p "require('./package.json').version") | ||
| # Replace branch in README.md link definitions for badges with the new version: | ||
| find . -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/branch([=:])[^ ]+/branch\1v${NEW_VERSION}/g" | ||
| # Create a new commit and tag: | ||
| git add package.json README.md | ||
| git commit -m "Release v${NEW_VERSION}" | ||
| git tag -a "v${NEW_VERSION}-cli" -m "Release v${NEW_VERSION}" | ||
| # Push changes to GitHub: | ||
| SLUG=${{ github.repository }} | ||
| git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" --follow-tags | ||
| # Replace GitHub MathJax equations with SVGs: | ||
| - name: 'Replace GitHub MathJax equations with SVGs' | ||
| run: | | ||
| find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe 's/```math\n([\s\S]+?)\n```\n\n//g' | ||
| find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe 's/<!-- <div class="equation"(.*)(<\/div>\s*-->)/<div class="equation"$1<\/div>/sg' | ||
| # Replace GitHub links to individual packages with npm links: | ||
| - name: 'Replace all GitHub links to individual packages with npm links' | ||
| run: | | ||
| find . -type f -name '*.md' -print0 | xargs -0 sed -Ei '/tree\/main/b; s/@stdlib\/([^:]*)\]: https:\/\/github.com\/stdlib-js/@stdlib\/\1\]: https:\/\/www.npmjs.com\/package\/@stdlib/g' | ||
| SLUG=${{ github.repository }} | ||
| ESCAPED_SLUG=${SLUG//\//\\\/} | ||
| REPO=${SLUG#*/} | ||
| find . -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/https:\/\/github.com\/${ESCAPED_SLUG}\/tree\/main/https:\/\/www.npmjs.com\/package\/@stdlib\/${REPO}/g" | ||
| # Publish package to npm: | ||
| - name: 'Publish package to npm' | ||
| # Pin action to full length commit SHA corresponding to v2.2.2 | ||
| uses: JS-DevTools/npm-publish@fe72237be0920f7a0cafd6a966c9b929c9466e9b | ||
| with: | ||
| token: ${{ secrets.NPM_TOKEN }} | ||
| access: public | ||
| # Discard any uncommitted changes: | ||
| - name: 'Discard any uncommitted changes' | ||
| run: | | ||
| git reset --hard | ||
| # Send status to Slack channel if job fails: | ||
| - name: 'Send status to Slack channel in case of failure' | ||
| # Pin action to full length commit SHA corresponding to v2.0.0 | ||
| uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f | ||
| with: | ||
| status: ${{ job.status }} | ||
| steps: ${{ toJson(steps) }} | ||
| channel: '#npm-ci' | ||
| if: failure() | ||
| # Define job to cancel any running or queued workflow runs... | ||
| cancel: | ||
| # Define the type of virtual host machine on which to run the job: | ||
| runs-on: ubuntu-latest | ||
| # Time out the job after 3 minutes: | ||
| timeout-minutes: 3 | ||
| # Define the sequence of job steps... | ||
| steps: | ||
| # Cancel any running or queued workflow runs: | ||
| - name: 'Cancel running or queued workflow runs' | ||
| # Pin action to full length commit SHA corresponding to v0.11.0 | ||
| uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 | ||
| with: | ||
| workflow_id: >- | ||
| benchmark.yml, | ||
| examples.yml, | ||
| test.yml, | ||
| test_coverage.yml, | ||
| test_install.yml, | ||
| publish.yml | ||
| access_token: ${{ github.token }} |
-39
| # This file is generated by tools/scripts/update_contributors. | ||
| # | ||
| # Contributors listed in alphabetical order. | ||
| Ali Salesi <ali_sal1381@yahoo.com> | ||
| Amit Jimiwal <amitjimiwal45@gmail.com> | ||
| Athan Reines <kgryte@gmail.com> | ||
| Brendan Graetz <bguiz@users.noreply.github.com> | ||
| Bruno Fenzl <brunofenzl@gmail.com> | ||
| Christopher Dambamuromo <chridam@gmail.com> | ||
| Dan Rose <danoftheroses@gmail.com> | ||
| Dominik Moritz <domoritz@gmail.com> | ||
| Dorrin Sotoudeh <dorrinsotoudeh123@gmail.com> | ||
| Frank Kovacs <fran70kk@gmail.com> | ||
| Harshita Kalani <harshitakalani02@gmail.com> | ||
| James Gelok <jdgelok@gmail.com> | ||
| Jithin KS <jithinks112@gmail.com> | ||
| Joey Reed <joeyrreed@gmail.com> | ||
| Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com> | ||
| Joris Labie <joris.labie1@gmail.com> | ||
| Justin Dennison <justin1dennison@gmail.com> | ||
| Marcus Fantham <mfantham@users.noreply.github.com> | ||
| Matt Cochrane <matthew.cochrane.eng@gmail.com> | ||
| Milan Raj <rajsite@users.noreply.github.com> | ||
| Momtchil Momtchev <momtchil@momtchev.com> | ||
| Naresh Jagadeesan <naresh.naresh000@gmail.com> | ||
| Nithin Katta <88046362+nithinkatta@users.noreply.github.com> | ||
| Ognjen Jevremović <ognjenjevremovic@users.noreply.github.com> | ||
| Philipp Burckhardt <pburckhardt@outlook.com> | ||
| Pranav Goswami <goswami.4@iitj.ac.in> | ||
| Ricky Reusser <rsreusser@gmail.com> | ||
| Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com> | ||
| Ryan Seal <splrk@users.noreply.github.com> | ||
| Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com> | ||
| Shraddheya Shendre <shendreshraddheya@gmail.com> | ||
| Stephannie Jiménez Gacha <steff456@hotmail.com> | ||
| Yernar Yergaziyev <yernar.yergaziyev@erg.kz> | ||
| orimiles5 <97595296+orimiles5@users.noreply.github.com> | ||
| rei2hu <reimu@reimu.ws> |
-164
| /** | ||
| * @license Apache-2.0 | ||
| * | ||
| * Copyright (c) 2018 The Stdlib Authors. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| 'use strict'; | ||
| // MODULES // | ||
| var proc = require( 'process' ); | ||
| var resolve = require( 'path' ).resolve; | ||
| var exec = require( 'child_process' ).exec; | ||
| var tape = require( 'tape' ); | ||
| var IS_BROWSER = require( '@stdlib/assert-is-browser' ); | ||
| var IS_WINDOWS = require( '@stdlib/assert-is-windows' ); | ||
| var readFileSync = require( '@stdlib/fs-read-file' ).sync; | ||
| var EXEC_PATH = require( '@stdlib/process-exec-path' ); | ||
| // VARIABLES // | ||
| var fpath = resolve( __dirname, '..', 'bin', 'cli' ); | ||
| var opts = { | ||
| 'skip': IS_BROWSER || IS_WINDOWS | ||
| }; | ||
| // FIXTURES // | ||
| var PKG_VERSION = require( './../package.json' ).version; | ||
| // TESTS // | ||
| tape( 'command-line interface', function test( t ) { | ||
| t.ok( true, __filename ); | ||
| t.end(); | ||
| }); | ||
| tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { | ||
| var expected; | ||
| var cmd; | ||
| expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { | ||
| 'encoding': 'utf8' | ||
| }); | ||
| cmd = [ | ||
| EXEC_PATH, | ||
| fpath, | ||
| '--help' | ||
| ]; | ||
| exec( cmd.join( ' ' ), done ); | ||
| function done( error, stdout, stderr ) { | ||
| if ( error ) { | ||
| t.fail( error.message ); | ||
| } else { | ||
| t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); | ||
| t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); | ||
| } | ||
| t.end(); | ||
| } | ||
| }); | ||
| tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { | ||
| var expected; | ||
| var cmd; | ||
| expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { | ||
| 'encoding': 'utf8' | ||
| }); | ||
| cmd = [ | ||
| EXEC_PATH, | ||
| fpath, | ||
| '-h' | ||
| ]; | ||
| exec( cmd.join( ' ' ), done ); | ||
| function done( error, stdout, stderr ) { | ||
| if ( error ) { | ||
| t.fail( error.message ); | ||
| } else { | ||
| t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); | ||
| t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); | ||
| } | ||
| t.end(); | ||
| } | ||
| }); | ||
| tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { | ||
| var cmd = [ | ||
| EXEC_PATH, | ||
| fpath, | ||
| '--version' | ||
| ]; | ||
| exec( cmd.join( ' ' ), done ); | ||
| function done( error, stdout, stderr ) { | ||
| if ( error ) { | ||
| t.fail( error.message ); | ||
| } else { | ||
| t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); | ||
| t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); | ||
| } | ||
| t.end(); | ||
| } | ||
| }); | ||
| tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { | ||
| var cmd = [ | ||
| EXEC_PATH, | ||
| fpath, | ||
| '-V' | ||
| ]; | ||
| exec( cmd.join( ' ' ), done ); | ||
| function done( error, stdout, stderr ) { | ||
| if ( error ) { | ||
| t.fail( error.message ); | ||
| } else { | ||
| t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); | ||
| t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); | ||
| } | ||
| t.end(); | ||
| } | ||
| }); | ||
| tape( 'the command-line interface prints the current working directory', opts, function test( t ) { | ||
| var cmd = [ | ||
| EXEC_PATH, | ||
| fpath | ||
| ]; | ||
| exec( cmd.join( ' ' ), done ); | ||
| function done( error, stdout, stderr ) { | ||
| var str; | ||
| if ( error ) { | ||
| t.fail( error.message ); | ||
| } else { | ||
| str = stdout.toString(); | ||
| t.strictEqual( str, proc.cwd()+'\n', 'prints path to `stdout`' ); | ||
| t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); | ||
| } | ||
| t.end(); | ||
| } | ||
| }); |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
198
1.54%0
-100%19343
-37.04%7
-30%14
-90.6%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
Updated
Updated