@pob/root 6.9.0 → 6.12.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,45 @@
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.12.0](https://github.com/christophehurpeau/pob/compare/@pob/root@6.11.0...@pob/root@6.12.0) (2022-03-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **deps:** update dependency lint-staged to v12.3.5 ([#1228](https://github.com/christophehurpeau/pob/issues/1228)) ([177259b](https://github.com/christophehurpeau/pob/commit/177259bf9fdbce0e2c38036dfe94c501c5b18842))
12
+
13
+
14
+ ### Features
15
+
16
+ * update actions/checkout ([b8abb40](https://github.com/christophehurpeau/pob/commit/b8abb40cfecaeceda0998246be17c7ef35f05d32))
17
+ * update yarn to 3.2.0 ([3066268](https://github.com/christophehurpeau/pob/commit/3066268b13a658e52d3d1458ec386462ef8f401a))
18
+
19
+
20
+
21
+
22
+
23
+ # [6.11.0](https://github.com/christophehurpeau/pob/compare/@pob/root@6.10.0...@pob/root@6.11.0) (2022-02-20)
24
+
25
+
26
+ ### Features
27
+
28
+ * **@pob/root:** add lint task ([51cce9f](https://github.com/christophehurpeau/pob/commit/51cce9f9605c3c2ce09de5a69ed84178659d6338))
29
+
30
+
31
+
32
+
33
+
34
+ # [6.10.0](https://github.com/christophehurpeau/pob/compare/@pob/root@6.9.0...@pob/root@6.10.0) (2022-02-20)
35
+
36
+
37
+ ### Features
38
+
39
+ * experimental vscode tasks generator ([d7a727f](https://github.com/christophehurpeau/pob/commit/d7a727fa1f8aec1e0f6f56b8219ea781b0759240))
40
+
41
+
42
+
43
+
44
+
6
45
  # [6.9.0](https://github.com/christophehurpeau/pob/compare/@pob/root@6.8.0...@pob/root@6.9.0) (2022-02-19)
7
46
 
8
47
 
@@ -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
+ };
@@ -6,7 +6,7 @@ const semver = require('semver');
6
6
  module.exports = function updateYarn({ pkg, pm }) {
7
7
  if (pm.name !== 'yarn' || !pm.version) return;
8
8
 
9
- if (semver.lt(pm.version, '3.1.0')) {
9
+ if (semver.lt(pm.version, '3.2.0')) {
10
10
  // Upgrade from yarn 1
11
11
  if (semver.lt(pm.version, '2.0.0')) {
12
12
  console.log('-- Upgrade from yarn 1 --');
@@ -9,7 +9,7 @@ jobs:
9
9
  run-install-and-commit-modified-files:
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: actions/checkout@v2
12
+ - uses: actions/checkout@v3
13
13
  with:
14
14
  token: ${{ secrets.GH_TOKEN }}
15
15
 
@@ -9,7 +9,7 @@ jobs:
9
9
  run-prettier:
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: actions/checkout@v2
12
+ - uses: actions/checkout@v3
13
13
  with:
14
14
  token: ${{ secrets.GH_TOKEN }}
15
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/root",
3
- "version": "6.9.0",
3
+ "version": "6.12.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
- "lint-staged": "12.3.4",
54
- "pob-dependencies": "6.16.0",
53
+ "json5": "^2.2.0",
54
+ "lint-staged": "12.3.5",
55
+ "pob-dependencies": "6.18.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": "f23f89112a35d2df5b8e6da96dee061043b4c362"
61
+ "gitHead": "2e8a1622f20909fb5f9f6793ad85963bf094c23e"
60
62
  }