@pob/root 6.7.2 → 6.11.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,55 @@
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.11.0](https://github.com/christophehurpeau/pob/compare/@pob/root@6.10.0...@pob/root@6.11.0) (2022-02-20)
7
+
8
+
9
+ ### Features
10
+
11
+ * **@pob/root:** add lint task ([51cce9f](https://github.com/christophehurpeau/pob/commit/51cce9f9605c3c2ce09de5a69ed84178659d6338))
12
+
13
+
14
+
15
+
16
+
17
+ # [6.10.0](https://github.com/christophehurpeau/pob/compare/@pob/root@6.9.0...@pob/root@6.10.0) (2022-02-20)
18
+
19
+
20
+ ### Features
21
+
22
+ * experimental vscode tasks generator ([d7a727f](https://github.com/christophehurpeau/pob/commit/d7a727fa1f8aec1e0f6f56b8219ea781b0759240))
23
+
24
+
25
+
26
+
27
+
28
+ # [6.9.0](https://github.com/christophehurpeau/pob/compare/@pob/root@6.8.0...@pob/root@6.9.0) (2022-02-19)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **deps:** update dependency lint-staged to v12.3.4 ([#1207](https://github.com/christophehurpeau/pob/issues/1207)) ([00e6c79](https://github.com/christophehurpeau/pob/commit/00e6c7909214d4039c386be2777d603f70d823ce))
34
+
35
+
36
+ ### Features
37
+
38
+ * **deps:** update dependency which-pm-runs to v1.1.0 ([#1212](https://github.com/christophehurpeau/pob/issues/1212)) ([b759252](https://github.com/christophehurpeau/pob/commit/b759252115b7fe6f726c3aa1c042ef3b6b0b96d2))
39
+
40
+
41
+
42
+
43
+
44
+ # [6.8.0](https://github.com/christophehurpeau/pob/compare/@pob/root@6.7.2...@pob/root@6.8.0) (2022-02-13)
45
+
46
+
47
+ ### Features
48
+
49
+ * **deps:** update dependency @commitlint/cli to v16.2.1 ([#1205](https://github.com/christophehurpeau/pob/issues/1205)) ([303ad10](https://github.com/christophehurpeau/pob/commit/303ad1098d28610b2919679d5cb7feacf0956ddc))
50
+
51
+
52
+
53
+
54
+
6
55
  ## [6.7.2](https://github.com/christophehurpeau/pob/compare/@pob/root@6.7.1...@pob/root@6.7.2) (2022-02-12)
7
56
 
8
57
  **Note:** Version bump only for package @pob/root
@@ -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,93 @@
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
+ tasks.push({
44
+ label: scriptName,
45
+ group: getGroupNameFromScriptName(scriptName),
46
+ dependsOn: scriptNames.filter(
47
+ (name) =>
48
+ (name !== 'lint' &&
49
+ name.startsWith('lint') &&
50
+ !name.endsWith(':fix')) ||
51
+ name === 'tsc',
52
+ ),
53
+ });
54
+ return;
55
+ }
56
+
57
+ const task = {
58
+ label: scriptName,
59
+ problemMatcher: getProblemMatcherFromScriptName(scriptName),
60
+ type: 'npm',
61
+ script: scriptName,
62
+ group: getGroupNameFromScriptName(scriptName),
63
+ presentation: {
64
+ panel: 'dedicated',
65
+ group: getGroupNameFromScriptName(scriptName),
66
+ clear: true,
67
+ },
68
+ };
69
+
70
+ if (scriptName === 'start' || scriptName === 'watch') {
71
+ task.isBackground = true;
72
+ }
73
+
74
+ tasks.push(task);
75
+ });
76
+ }
77
+
78
+ fs.writeFileSync(
79
+ '.vscode/tasks.json',
80
+ prettier.format(
81
+ `{
82
+ // See https://go.microsoft.com/fwlink/?LinkId=733558
83
+ // for the documentation about the tasks.json format
84
+ "version": "2.0.0",
85
+ "tasks": ${JSON.stringify(tasks)}
86
+ }
87
+ `,
88
+ {
89
+ filepath: '.vscode/tasks.json',
90
+ },
91
+ ),
92
+ );
93
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/root",
3
- "version": "6.7.2",
3
+ "version": "6.11.0",
4
4
  "description": "root package",
5
5
  "keywords": [],
6
6
  "author": "Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)",
@@ -46,15 +46,17 @@
46
46
  },
47
47
  "pob": {},
48
48
  "dependencies": {
49
- "@commitlint/cli": "16.1.0",
49
+ "@commitlint/cli": "16.2.1",
50
50
  "@pob/pretty-eslint-config": "3.0.2",
51
51
  "@pob/pretty-pkg": "^4.0.1",
52
52
  "husky": "^7.0.0",
53
- "lint-staged": "12.3.3",
54
- "pob-dependencies": "6.14.0",
53
+ "json5": "^2.2.0",
54
+ "lint-staged": "12.3.4",
55
+ "pob-dependencies": "6.17.1",
56
+ "prettier": "2.5.1",
55
57
  "repository-check-dirty": "^4.0.0",
56
58
  "semver": "^7.1.2",
57
- "which-pm-runs": "1.0.0"
59
+ "which-pm-runs": "1.1.0"
58
60
  },
59
- "gitHead": "a2c45c96006ec7d270c9d25386055411985932e6"
61
+ "gitHead": "d147b252e8d66a669d7d5530797a7f29ce2503ae"
60
62
  }