@pob/root 6.9.0 → 6.10.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.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [6.10.0](https://github.com/christophehurpeau/pob/compare/@pob/root@6.9.0...@pob/root@6.10.0) (2022-02-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* experimental vscode tasks generator ([d7a727f](https://github.com/christophehurpeau/pob/commit/d7a727fa1f8aec1e0f6f56b8219ea781b0759240))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [6.9.0](https://github.com/christophehurpeau/pob/compare/@pob/root@6.8.0...@pob/root@6.9.0) (2022-02-19)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -40,3 +40,7 @@ require('./postinstall/update-yarn')({ pkg, pm });
|
|
|
40
40
|
require('./postinstall/install-husky')({ pkg, pm });
|
|
41
41
|
require('./postinstall/install-github-workflows')({ pkg, pm });
|
|
42
42
|
require('./postinstall/install-scripts')({ pkg, pm });
|
|
43
|
+
|
|
44
|
+
if (process.env.POB_EXPERIMENTAL_VSCODE_TASKS) {
|
|
45
|
+
require('./postinstall/install-vscode-tasks')({ pkg, pm });
|
|
46
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const JSON5 = require('json5');
|
|
5
|
+
const prettier = require('prettier');
|
|
6
|
+
|
|
7
|
+
function readJSON5(path, defaults = null) {
|
|
8
|
+
try {
|
|
9
|
+
const content = fs.readFileSync(path);
|
|
10
|
+
return JSON5.parse(content);
|
|
11
|
+
} catch {
|
|
12
|
+
return defaults;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getGroupNameFromScriptName(scriptName) {
|
|
17
|
+
if (scriptName.startsWith('lint') || scriptName === 'tsc') return 'lint';
|
|
18
|
+
if (scriptName.startsWith('test')) return 'test';
|
|
19
|
+
if (scriptName.startsWith('start') || scriptName.startsWith('build')) {
|
|
20
|
+
return 'build';
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getProblemMatcherFromScriptName(scriptName) {
|
|
26
|
+
if (scriptName === 'lint:eslint') return ['$eslint-stylish'];
|
|
27
|
+
if (scriptName === 'tsc') return ['$tsc'];
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = function installVscodeTasks({ pkg }) {
|
|
32
|
+
const existingConfig = readJSON5('.vscode/tasks.json');
|
|
33
|
+
const existingTasks = existingConfig?.tasks || [];
|
|
34
|
+
|
|
35
|
+
// filter all npm tasks, we will recreate them right after
|
|
36
|
+
const tasks = existingTasks.filter((task) => task.type !== 'npm');
|
|
37
|
+
|
|
38
|
+
if (pkg.scripts) {
|
|
39
|
+
const scriptNames = Object.keys(pkg.scripts);
|
|
40
|
+
Object.entries(pkg.scripts).forEach(([scriptName, scriptCommand]) => {
|
|
41
|
+
if (scriptName === 'postinstall') return;
|
|
42
|
+
if (scriptName === 'lint') {
|
|
43
|
+
return {
|
|
44
|
+
label: scriptName,
|
|
45
|
+
group: getGroupNameFromScriptName(scriptName),
|
|
46
|
+
dependsOn: scriptNames.filter(
|
|
47
|
+
(name) =>
|
|
48
|
+
(name !== 'lint' && name.startsWith('lint')) || name === 'tsc',
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const task = {
|
|
54
|
+
label: scriptName,
|
|
55
|
+
problemMatcher: getProblemMatcherFromScriptName(scriptName),
|
|
56
|
+
type: 'npm',
|
|
57
|
+
script: scriptName,
|
|
58
|
+
group: getGroupNameFromScriptName(scriptName),
|
|
59
|
+
presentation: {
|
|
60
|
+
panel: 'dedicated',
|
|
61
|
+
group: getGroupNameFromScriptName(scriptName),
|
|
62
|
+
clear: true,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
if (scriptName === 'start' || scriptName === 'watch') {
|
|
67
|
+
task.isBackground = true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
tasks.push(task);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
fs.writeFileSync(
|
|
75
|
+
'.vscode/tasks.json',
|
|
76
|
+
prettier.format(
|
|
77
|
+
`{
|
|
78
|
+
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
|
79
|
+
// for the documentation about the tasks.json format
|
|
80
|
+
"version": "2.0.0",
|
|
81
|
+
"tasks": ${JSON.stringify(tasks)}
|
|
82
|
+
}
|
|
83
|
+
`,
|
|
84
|
+
{
|
|
85
|
+
filepath: '.vscode/tasks.json',
|
|
86
|
+
},
|
|
87
|
+
),
|
|
88
|
+
);
|
|
89
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pob/root",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.10.0",
|
|
4
4
|
"description": "root package",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)",
|
|
@@ -50,11 +50,13 @@
|
|
|
50
50
|
"@pob/pretty-eslint-config": "3.0.2",
|
|
51
51
|
"@pob/pretty-pkg": "^4.0.1",
|
|
52
52
|
"husky": "^7.0.0",
|
|
53
|
+
"json5": "^2.2.0",
|
|
53
54
|
"lint-staged": "12.3.4",
|
|
54
|
-
"pob-dependencies": "6.
|
|
55
|
+
"pob-dependencies": "6.17.0",
|
|
56
|
+
"prettier": "2.5.1",
|
|
55
57
|
"repository-check-dirty": "^4.0.0",
|
|
56
58
|
"semver": "^7.1.2",
|
|
57
59
|
"which-pm-runs": "1.1.0"
|
|
58
60
|
},
|
|
59
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "033cb44fe500dedc8aed5c19484ef39baa7a90b9"
|
|
60
62
|
}
|