@lowdefy/node-utils 4.0.0-alpha.8 → 4.0.0-rc.0

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ import fsExtra from 'fs-extra';
16
- async function copyDirectory(dirPathFrom, dirPathTo) {
17
- await fsExtra.copy(dirPathFrom, dirPathTo);
16
+ async function copyDirectory(dirPathFrom, dirPathTo, options) {
17
+ await fsExtra.copy(dirPathFrom, dirPathTo, options);
18
18
  }
19
19
  export default copyDirectory;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/readFile.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -13,29 +13,33 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ import { spawn } from 'child_process';
16
- async function spawnProcess({ logger , command , args , processOptions , silent }) {
17
- return new Promise((resolve, reject)=>{
18
- const process = spawn(command, args, processOptions);
19
- process.stdout.on('data', (data)=>{
20
- if (!silent) {
21
- data.toString('utf8').split('\n').forEach((line)=>{
22
- if (line) {
23
- logger.log(line);
24
- }
25
- });
26
- }
27
- });
28
- process.stderr.on('data', (data)=>{
29
- if (!silent) {
30
- data.toString('utf8').split('\n').forEach((line)=>{
31
- if (line) {
32
- logger.warn(line);
33
- }
34
- });
16
+ function createStdIOHandler({ lineHandler }) {
17
+ function handler(data) {
18
+ data.toString('utf8').split('\n').forEach((line)=>{
19
+ if (line) {
20
+ lineHandler(line);
35
21
  }
36
22
  });
23
+ }
24
+ return handler;
25
+ }
26
+ function spawnProcess({ args , command , processOptions , returnProcess , stdErrLineHandler , stdOutLineHandler =()=>{} , }) {
27
+ if (!stdErrLineHandler) {
28
+ stdErrLineHandler = stdOutLineHandler;
29
+ }
30
+ const process = spawn(command, args, processOptions);
31
+ process.stdout.on('data', createStdIOHandler({
32
+ lineHandler: stdOutLineHandler
33
+ }));
34
+ process.stderr.on('data', createStdIOHandler({
35
+ lineHandler: stdErrLineHandler
36
+ }));
37
+ if (returnProcess) {
38
+ return process;
39
+ }
40
+ return new Promise((resolve, reject)=>{
37
41
  process.on('error', (error)=>{
38
- reject(error);
42
+ stdErrLineHandler(error);
39
43
  });
40
44
  process.on('exit', (code)=>{
41
45
  if (code !== 0) {
package/dist/writeFile.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lowdefy/node-utils",
3
- "version": "4.0.0-alpha.8",
4
- "licence": "Apache-2.0",
3
+ "version": "4.0.0-rc.0",
4
+ "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
7
7
  "keywords": [
@@ -34,24 +34,23 @@
34
34
  "dist/*"
35
35
  ],
36
36
  "scripts": {
37
- "build": "yarn swc",
37
+ "build": "swc src --out-dir dist --config-file ../../../.swcrc --delete-dir-on-start",
38
38
  "clean": "rm -rf dist",
39
- "prepare": "yarn build",
40
- "swc": "swc src --out-dir dist --config-file ../../../.swcrc --delete-dir-on-start",
39
+ "prepublishOnly": "pnpm build",
41
40
  "test": "jest --coverage"
42
41
  },
43
42
  "dependencies": {
44
- "@lowdefy/helpers": "4.0.0-alpha.8",
45
- "fs-extra": "10.0.0"
43
+ "@lowdefy/helpers": "4.0.0-rc.0",
44
+ "fs-extra": "10.1.0"
46
45
  },
47
46
  "devDependencies": {
48
- "@swc/cli": "0.1.55",
49
- "@swc/core": "1.2.135",
50
- "@swc/jest": "0.2.17",
51
- "jest": "27.5.1"
47
+ "@swc/cli": "0.1.57",
48
+ "@swc/core": "1.2.194",
49
+ "@swc/jest": "0.2.21",
50
+ "jest": "28.1.0"
52
51
  },
53
52
  "publishConfig": {
54
53
  "access": "public"
55
54
  },
56
- "gitHead": "9d56b83cf45e868afe3a1eeba750fe826eb74c8c"
55
+ "gitHead": "f6872d7ff6da421710096536fce7b2016ef8f35c"
57
56
  }