@netlify/run-utils 4.0.1 → 4.0.2-rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +7 -6
  2. package/src/main.js +0 -46
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@netlify/run-utils",
3
- "version": "4.0.1",
3
+ "version": "4.0.2-rc",
4
4
  "description": "Utility for running commands inside Netlify Build",
5
5
  "type": "module",
6
- "exports": "./src/main.js",
7
- "main": "./src/main.js",
6
+ "exports": "./lib/main.js",
7
+ "main": "./lib/main.js",
8
8
  "files": [
9
- "src/**/*.js"
9
+ "lib/**/*.js"
10
10
  ],
11
11
  "author": "Netlify Inc.",
12
12
  "scripts": {
13
- "prepublishOnly": "cd ../../ && npm run prepublishOnly"
13
+ "prepublishOnly": "cd ../../ && npm run prepublishOnly",
14
+ "build": "cp -a src lib/"
14
15
  },
15
16
  "keywords": [
16
17
  "nodejs",
@@ -48,7 +49,7 @@
48
49
  "execa": "^6.0.0"
49
50
  },
50
51
  "devDependencies": {
51
- "ava": "^3.15.0",
52
+ "ava": "^4.0.0",
52
53
  "semver": "^7.0.0"
53
54
  },
54
55
  "engines": {
package/src/main.js DELETED
@@ -1,46 +0,0 @@
1
- import process from 'process'
2
-
3
- import { execa, execaCommand } from 'execa'
4
-
5
- // Run a command, with arguments being an array
6
- export const run = function (file, args, options) {
7
- const [argsA, optionsA] = parseArgs(args, options)
8
- const optionsB = { ...DEFAULT_OPTIONS, ...optionsA }
9
- const childProcess = execa(file, argsA, optionsB)
10
- redirectOutput(childProcess, optionsB)
11
- return childProcess
12
- }
13
-
14
- // Run a command, with file + arguments being a single string
15
- export const runCommand = function (command, options) {
16
- const optionsA = { ...DEFAULT_OPTIONS, ...options }
17
- const childProcess = execaCommand(command, optionsA)
18
- redirectOutput(childProcess, optionsA)
19
- return childProcess
20
- }
21
-
22
- // Both `args` and `options` are optional
23
- const parseArgs = function (args, options) {
24
- if (Array.isArray(args)) {
25
- return [args, options]
26
- }
27
-
28
- if (typeof args === 'object') {
29
- return [[], args]
30
- }
31
-
32
- return []
33
- }
34
-
35
- // Allow running local binaries by default
36
- const DEFAULT_OPTIONS = { preferLocal: true }
37
-
38
- // Redirect output by default, unless specified otherwise
39
- const redirectOutput = function (childProcess, { stdio, stdout, stderr }) {
40
- if (stdio !== undefined || stdout !== undefined || stderr !== undefined) {
41
- return
42
- }
43
-
44
- childProcess.stdout.pipe(process.stdout)
45
- childProcess.stderr.pipe(process.stderr)
46
- }