@lowdefy/node-utils 4.0.0-alpha.9 → 4.0.0-rc.1
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.
- package/dist/cleanDirectory.js +1 -1
- package/dist/{copyDirectory.js → copyFileOrDirectory.js} +4 -4
- package/dist/getConfigFromEnv.js +1 -1
- package/dist/getFileExtension.js +1 -1
- package/dist/getSecretsFromEnv.js +1 -1
- package/dist/index.js +3 -3
- package/dist/readFile.js +1 -1
- package/dist/spawnProcess.js +25 -21
- package/dist/writeFile.js +1 -1
- package/package.json +12 -13
package/dist/cleanDirectory.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 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
|
|
17
|
-
await fsExtra.copy(dirPathFrom, dirPathTo);
|
|
16
|
+
async function copyFileOrDirectory(dirPathFrom, dirPathTo, options) {
|
|
17
|
+
await fsExtra.copy(dirPathFrom, dirPathTo, options);
|
|
18
18
|
}
|
|
19
|
-
export default
|
|
19
|
+
export default copyFileOrDirectory;
|
package/dist/getConfigFromEnv.js
CHANGED
package/dist/getFileExtension.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 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,11 +13,11 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import cleanDirectory from './cleanDirectory.js';
|
|
16
|
-
import
|
|
16
|
+
import copyFileOrDirectory from './copyFileOrDirectory.js';
|
|
17
17
|
import getConfigFromEnv from './getConfigFromEnv.js';
|
|
18
18
|
import getFileExtension, { getFileSubExtension } from './getFileExtension.js';
|
|
19
19
|
import getSecretsFromEnv from './getSecretsFromEnv.js';
|
|
20
20
|
import spawnProcess from './spawnProcess.js';
|
|
21
21
|
import readFile from './readFile.js';
|
|
22
22
|
import writeFile from './writeFile.js';
|
|
23
|
-
export { cleanDirectory,
|
|
23
|
+
export { cleanDirectory, copyFileOrDirectory, getConfigFromEnv, getFileExtension, getFileSubExtension, getSecretsFromEnv, spawnProcess, readFile, writeFile };
|
package/dist/readFile.js
CHANGED
package/dist/spawnProcess.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
42
|
+
stdErrLineHandler(error);
|
|
39
43
|
});
|
|
40
44
|
process.on('exit', (code)=>{
|
|
41
45
|
if (code !== 0) {
|
package/dist/writeFile.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/node-utils",
|
|
3
|
-
"version": "4.0.0-
|
|
4
|
-
"
|
|
3
|
+
"version": "4.0.0-rc.1",
|
|
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": "
|
|
37
|
+
"build": "swc src --out-dir dist --config-file ../../../.swcrc --delete-dir-on-start",
|
|
38
38
|
"clean": "rm -rf dist",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"test": "jest --coverage"
|
|
39
|
+
"prepublishOnly": "pnpm build",
|
|
40
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
|
|
42
41
|
},
|
|
43
42
|
"dependencies": {
|
|
44
|
-
"@lowdefy/helpers": "4.0.0-
|
|
45
|
-
"fs-extra": "
|
|
43
|
+
"@lowdefy/helpers": "4.0.0-rc.1",
|
|
44
|
+
"fs-extra": "11.1.0"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
|
-
"@swc/cli": "0.1.
|
|
49
|
-
"@swc/core": "1.
|
|
50
|
-
"@swc/jest": "0.2.
|
|
51
|
-
"jest": "
|
|
47
|
+
"@swc/cli": "0.1.59",
|
|
48
|
+
"@swc/core": "1.3.24",
|
|
49
|
+
"@swc/jest": "0.2.24",
|
|
50
|
+
"jest": "28.1.0"
|
|
52
51
|
},
|
|
53
52
|
"publishConfig": {
|
|
54
53
|
"access": "public"
|
|
55
54
|
},
|
|
56
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "ecc4f16c19eede929eda177db524cf13a8053379"
|
|
57
56
|
}
|