@azrico/azcli 1.1.43 → 1.1.45
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/cli.js +54 -2
- package/dist/libs/builder/build_wp.js +113 -1
- package/dist/libs/builder/build_yarn.js +11 -1
- package/dist/libs/builder/index.js +21 -1
- package/dist/libs/cleaner/cleanbuild.js +12 -1
- package/dist/libs/cleaner/cleannext.js +12 -1
- package/dist/libs/cleaner/cleannode.js +21 -1
- package/dist/libs/cleaner/index.js +37 -1
- package/dist/libs/commons/filehandler.js +61 -3
- package/dist/libs/commons/helper_exec.js +49 -1
- package/dist/libs/commons/helper_interface.js +96 -4
- package/dist/libs/commons/helper_string.js +15 -1
- package/dist/libs/commons/index.js +5 -1
- package/dist/libs/integ/index.js +7 -1
- package/dist/libs/integ/integ_readme.js +6 -1
- package/dist/libs/packager/index.js +18 -1
- package/dist/libs/packager/packager.js +236 -9
- package/dist/libs/up/filterOptionsByAcceptable.js +16 -2
- package/dist/libs/up/index.js +35 -1
- package/dist/libs/up/update_composer.js +53 -1
- package/dist/libs/up/update_py.js +10 -1
- package/dist/libs/up/update_yarn.js +78 -2
- package/dist/libs/yarnhelp/index.js +8 -1
- package/dist/libs/yarnhelp/yarnb.js +14 -1
- package/dist/libs/yarnhelp/yarni.js +14 -1
- package/dist/libs/yarnhelp/yarnt.js +14 -1
- package/package.json +1 -1
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { do_exec, show_msg } from '../commons';
|
|
2
|
+
export async function update_py(args) {
|
|
3
|
+
if (args.nopython)
|
|
4
|
+
return;
|
|
5
|
+
show_msg(`cleaning python cache...`);
|
|
6
|
+
await do_exec([`pip3 cache purge`]);
|
|
7
|
+
show_msg(`installing python packages...`);
|
|
8
|
+
await do_exec([`pip3 install -r requirements.txt`]);
|
|
9
|
+
show_msg(`done`);
|
|
10
|
+
}
|
|
@@ -1,2 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* This lib helps you build a wordpress plugin */
|
|
2
|
+
//https://github.com/monorepo-template/dependencies/blob/main/packages/yarn-up-skip-workspace/src/utils/filter-options-by-keep-workspace-dependency.ts
|
|
3
|
+
import { spawn } from 'node:child_process';
|
|
4
|
+
import { do_exec, show_error, show_msg } from '../commons';
|
|
5
|
+
import findAcceptableIndex from './filterOptionsByAcceptable';
|
|
6
|
+
const SPAWN_OPTIONS = {
|
|
7
|
+
shell: true,
|
|
8
|
+
};
|
|
9
|
+
const KEYPRESS_DOWN = '\u001b[B';
|
|
10
|
+
const KEYPRESS_ENTER = '\n';
|
|
11
|
+
export async function update_yarn(args) {
|
|
12
|
+
show_msg(`updating yarn packages...`);
|
|
13
|
+
const packages = Array.isArray(args.target) ? args.target : [''];
|
|
14
|
+
for (let index = 0; index < packages.length; index++) {
|
|
15
|
+
const pkg_name = packages[index];
|
|
16
|
+
await new Promise((resolve, reject) => {
|
|
17
|
+
let child;
|
|
18
|
+
const write = (chunk) => {
|
|
19
|
+
if (child.stdin === null)
|
|
20
|
+
throw new Error('Expected STDIN to exist, but received null.');
|
|
21
|
+
child.stdin.write(chunk);
|
|
22
|
+
};
|
|
23
|
+
const handleStdOutData = (chunk) => {
|
|
24
|
+
const chunkStr = chunk.toString();
|
|
25
|
+
const options = chunkStr.split('\n');
|
|
26
|
+
const acceptedOption = findAcceptableIndex(options);
|
|
27
|
+
const currentSelectedIndex = options.findIndex((s) => String(s).trim().includes('>'));
|
|
28
|
+
/**
|
|
29
|
+
* the option at index 0 is always the title!
|
|
30
|
+
* so if there are less than 2 options we skip as there is nothing to chose...
|
|
31
|
+
*/
|
|
32
|
+
process.stdout.write(chunkStr);
|
|
33
|
+
if (options.length === 1) {
|
|
34
|
+
// show_msg(`-> ${chunkStr}`);
|
|
35
|
+
}
|
|
36
|
+
else if (acceptedOption > 0) {
|
|
37
|
+
// show_msg(
|
|
38
|
+
// `acceptedOption: ${acceptedOption} currentSelectedIndex: ${currentSelectedIndex}`
|
|
39
|
+
// );
|
|
40
|
+
/**
|
|
41
|
+
* there is an option in current line
|
|
42
|
+
* we go down until we reach it
|
|
43
|
+
*/
|
|
44
|
+
if (acceptedOption === currentSelectedIndex) {
|
|
45
|
+
// show_msg(`select: ${options[currentSelectedIndex]}`);
|
|
46
|
+
write(KEYPRESS_ENTER);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// show_msg(`skip: ${options[currentSelectedIndex]}`);
|
|
50
|
+
write(KEYPRESS_DOWN);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
show_msg(`update: ${pkg_name}`);
|
|
55
|
+
child = spawn('yarn', ['up', '--interactive', pkg_name], SPAWN_OPTIONS);
|
|
56
|
+
child.on('close', resolve);
|
|
57
|
+
child.on('error', reject);
|
|
58
|
+
/* --------------------------------- events --------------------------------- */
|
|
59
|
+
if (child.stdout !== null) {
|
|
60
|
+
child.stdout.setEncoding('utf8');
|
|
61
|
+
child.stdout.on('data', handleStdOutData);
|
|
62
|
+
}
|
|
63
|
+
else
|
|
64
|
+
throw 'Expected STDOUT to exist, but received null.';
|
|
65
|
+
if (child.stderr !== null) {
|
|
66
|
+
child.stderr.on('data', show_error);
|
|
67
|
+
}
|
|
68
|
+
else
|
|
69
|
+
throw 'Expected STDERR to exist, but received null.';
|
|
70
|
+
/* -------------------------------------------------------------------------- */
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
process.stdout.write('\n\n');
|
|
74
|
+
if (args.dedupe) {
|
|
75
|
+
await do_exec([`yarn dedupe`]);
|
|
76
|
+
}
|
|
77
|
+
show_msg(`yarn update done`);
|
|
78
|
+
}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import yarnb from './yarnb';
|
|
2
|
+
import yarni from './yarni';
|
|
3
|
+
import yarnt from './yarnt';
|
|
4
|
+
export default [
|
|
5
|
+
['yarni', 'YarnInstall', () => { }, yarni],
|
|
6
|
+
['yarnb', 'YarnBuild', () => { }, yarnb],
|
|
7
|
+
['yarnt', 'YarnTest', () => { }, yarnt],
|
|
8
|
+
];
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { do_exec, err_unknown, show_msg } from '../commons';
|
|
2
|
+
const cmd1 = ['yarn run build'];
|
|
3
|
+
export function handle(args) {
|
|
4
|
+
show_msg('YarnBuild', 'text');
|
|
5
|
+
const fhandler = args.q ? undefined : console.log;
|
|
6
|
+
return do_exec(cmd1, fhandler)
|
|
7
|
+
.finally(() => {
|
|
8
|
+
show_msg('YarnBuild done', 'text');
|
|
9
|
+
})
|
|
10
|
+
.catch(() => {
|
|
11
|
+
err_unknown('YarnBuild failed');
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export default handle;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { do_exec, err_unknown, show_msg } from '../commons';
|
|
2
|
+
const cmd1 = ['yarn install'];
|
|
3
|
+
export function handle(args) {
|
|
4
|
+
show_msg('YarnInstall', 'text');
|
|
5
|
+
const fhandler = args.q ? undefined : console.log;
|
|
6
|
+
return do_exec(cmd1, fhandler)
|
|
7
|
+
.finally(() => {
|
|
8
|
+
show_msg('YarnInstall done', 'text');
|
|
9
|
+
})
|
|
10
|
+
.catch(() => {
|
|
11
|
+
err_unknown('YarnInstall failed');
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export default handle;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { do_exec, err_unknown, show_msg } from '../commons';
|
|
2
|
+
const cmd1 = ['yarn run test'];
|
|
3
|
+
export function handle(args) {
|
|
4
|
+
show_msg('YarnTest', 'text');
|
|
5
|
+
const fhandler = args.q ? undefined : console.log;
|
|
6
|
+
return do_exec(cmd1, fhandler)
|
|
7
|
+
.finally(() => {
|
|
8
|
+
show_msg('YarnTest done', 'text');
|
|
9
|
+
})
|
|
10
|
+
.catch(() => {
|
|
11
|
+
err_unknown('YarnTest failed');
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export default handle;
|