pob 9.13.0 → 9.14.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/CHANGELOG.md CHANGED
@@ -3,6 +3,59 @@
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
+ ## [9.14.1](https://github.com/christophehurpeau/pob/compare/pob@9.14.0...pob@9.14.1) (2022-01-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **pob:** vscode generator monorepo option ([cb589e8](https://github.com/christophehurpeau/pob/commit/cb589e80168eaf114a5b22bc4e454ec59d449097))
12
+ * **pob:** vscode generator tsdk path for monorepo ([fc92541](https://github.com/christophehurpeau/pob/commit/fc92541f5926a6892186c086940c966420e4ef83))
13
+
14
+
15
+
16
+
17
+
18
+ # [9.14.0](https://github.com/christophehurpeau/pob/compare/pob@9.13.2...pob@9.14.0) (2022-01-20)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **deps:** update dependency @yarnpkg/parsers to v2.5.0-rc.9 ([#1165](https://github.com/christophehurpeau/pob/issues/1165)) ([bdb496f](https://github.com/christophehurpeau/pob/commit/bdb496febb6ec534a0ca0ac24cb32fe16b639e79))
24
+ * full vscode workspace config ([f3aa63d](https://github.com/christophehurpeau/pob/commit/f3aa63de6cc2b597c3114eb34757e94347cf5f3f))
25
+ * remove tasks from workspace config ([cc4b1a7](https://github.com/christophehurpeau/pob/commit/cc4b1a7efe39e2d7f13ac3079a32c58d3cd86c75))
26
+
27
+
28
+ ### Features
29
+
30
+ * **deps:** update dependency eslint to v8.7.0 ([#1164](https://github.com/christophehurpeau/pob/issues/1164)) ([9ec0c31](https://github.com/christophehurpeau/pob/commit/9ec0c3156cf5ed5d1f9e3e4ce4636b77da826850))
31
+ * **pob:** generate vscode monorepo workspace ([23ceaae](https://github.com/christophehurpeau/pob/commit/23ceaae63bc1abc58061366d90f8cd5c397bf232))
32
+
33
+
34
+
35
+
36
+
37
+ ## [9.13.2](https://github.com/christophehurpeau/pob/compare/pob@9.13.1...pob@9.13.2) (2022-01-15)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * **@pob/root:** fix use default github token for gh-pages workflow ([784ce66](https://github.com/christophehurpeau/pob/commit/784ce6633d5d5d14cdcf63aeb5a83ed036434673))
43
+
44
+
45
+
46
+
47
+
48
+ ## [9.13.1](https://github.com/christophehurpeau/pob/compare/pob@9.13.0...pob@9.13.1) (2022-01-15)
49
+
50
+
51
+ ### Bug Fixes
52
+
53
+ * **pob:** multiple newlines in gitignore template ([f00c5be](https://github.com/christophehurpeau/pob/commit/f00c5bed9a6200d3ded4737ffcdab175eb56b2c5))
54
+
55
+
56
+
57
+
58
+
6
59
  # [9.13.0](https://github.com/christophehurpeau/pob/compare/pob@9.12.3...pob@9.13.0) (2022-01-15)
7
60
 
8
61
 
@@ -178,6 +178,15 @@ export default class PobAppGenerator extends Generator {
178
178
  updateOnly: this.options.updateOnly,
179
179
  });
180
180
 
181
+ this.composeWith('pob:core:vscode', {
182
+ root: !inLerna,
183
+ monorepo: false,
184
+ packageManager: this.options.packageManager,
185
+ yarnNodeLinker: this.options.yarnNodeLinker,
186
+ typescript: babel,
187
+ testing: this.appConfig.testing,
188
+ });
189
+
181
190
  // only for gitignore
182
191
  if (this.fs.exists('.env.example')) {
183
192
  ignorePaths.push('/.env*', '!/.env.example');
@@ -9,8 +9,6 @@ jobs:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
11
  - uses: actions/checkout@v2
12
- with:
13
- token: ${{ secrets.GH_TOKEN }}
14
12
 
15
13
  - uses: actions/setup-node@v2
16
14
  with:
@@ -7,12 +7,12 @@ npm-debug.log*
7
7
  yarn-debug.log*
8
8
  yarn-error.log*
9
9
  <% } -%>
10
-
11
10
  <% if (paths) { -%>
11
+
12
12
  <%= paths %>
13
13
  <% } -%>
14
-
15
14
  <% if (root) { -%>
15
+
16
16
  # IDE
17
17
  /.settings
18
18
  /.project
@@ -20,19 +20,18 @@ yarn-error.log*
20
20
  !/.vscode
21
21
  *.sublime-project
22
22
  *.sublime-workspace
23
-
24
23
  <% if (documentation) { -%>
24
+
25
25
  # generated documentation directory
26
26
  /docs
27
27
  <% } -%>
28
-
29
28
  <% if (testing) { -%>
29
+
30
30
  # jest default coverage directory
31
31
  /coverage
32
32
  <% } -%>
33
-
34
-
35
33
  <% if (typescript && buildInGit) { -%>
34
+
36
35
  # Typescript
37
36
  tsbuildinfo
38
37
  <% } -%>
@@ -1,6 +1,9 @@
1
1
  import Generator from 'yeoman-generator';
2
2
  import { readJSON5 } from '../../../utils/json5.js';
3
- import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
3
+ import {
4
+ copyAndFormatTpl,
5
+ writeAndFormatJson,
6
+ } from '../../../utils/writeAndFormat.js';
4
7
 
5
8
  export default class CoreVSCodeGenerator extends Generator {
6
9
  constructor(args, opts) {
@@ -20,6 +23,20 @@ export default class CoreVSCodeGenerator extends Generator {
20
23
  desc: 'yarn|npm.',
21
24
  });
22
25
 
26
+ this.option('monorepo', {
27
+ type: Boolean,
28
+ required: false,
29
+ defaults: false,
30
+ desc: 'is monorepo',
31
+ });
32
+
33
+ this.option('testing', {
34
+ type: Boolean,
35
+ required: false,
36
+ defaults: false,
37
+ desc: 'Testing enabled',
38
+ });
39
+
23
40
  this.option('yarnNodeLinker', {
24
41
  type: String,
25
42
  required: false,
@@ -33,10 +50,21 @@ export default class CoreVSCodeGenerator extends Generator {
33
50
  defaults: false,
34
51
  desc: 'Typescript enabled',
35
52
  });
53
+
54
+ this.option('packageNames', {
55
+ type: String,
56
+ required: false,
57
+ });
58
+
59
+ this.option('packageLocations', {
60
+ type: String,
61
+ required: false,
62
+ });
36
63
  }
37
64
 
38
65
  writing() {
39
66
  if (this.options.root) {
67
+ const pkg = this.fs.readJSON(this.destinationPath('package.json'));
40
68
  copyAndFormatTpl(
41
69
  this.fs,
42
70
  this.templatePath('extensions.json.ejs'),
@@ -55,6 +83,8 @@ export default class CoreVSCodeGenerator extends Generator {
55
83
  pnp: this.options.yarnNodeLinker === 'pnp',
56
84
  npm: this.options.packageManager === 'npm',
57
85
  typescript: this.options.typescript,
86
+ testing: this.options.testing,
87
+ module: pkg.type === 'module',
58
88
  },
59
89
  );
60
90
 
@@ -72,6 +102,59 @@ export default class CoreVSCodeGenerator extends Generator {
72
102
  tasks: JSON.stringify(tasksConfig.tasks || [], null, 2),
73
103
  },
74
104
  );
105
+
106
+ if (this.options.monorepo) {
107
+ const packageNames = JSON.parse(this.options.packageNames);
108
+ const packageLocations = JSON.parse(this.options.packageLocations);
109
+ const folders = packageLocations.map((location, i) => ({
110
+ name: packageNames[i],
111
+ path: `../${location}`,
112
+ }));
113
+ folders.sort((a, b) => a.name.localeCompare(b.name, 'en'));
114
+
115
+ const extensions = readJSON5(
116
+ this.fs,
117
+ this.destinationPath('.vscode/extensions.json'),
118
+ {},
119
+ );
120
+ const settings = readJSON5(
121
+ this.fs,
122
+ this.destinationPath('.vscode/settings.json'),
123
+ {},
124
+ );
125
+
126
+ const projectName = pkg.name.replace('/', '-');
127
+ writeAndFormatJson(
128
+ this.fs,
129
+ this.destinationPath(`.vscode/${projectName}.code-workspace`),
130
+ {
131
+ extensions,
132
+ settings: {
133
+ ...settings,
134
+ ...(settings['typescript.tsdk']
135
+ ? { 'typescript.tsdk': '✨ root/node_modules/typescript/lib' }
136
+ : {}),
137
+ ...(this.options.testing
138
+ ? {
139
+ 'jest.jestCommandLine':
140
+ 'NODE_OPTIONS=--experimental-vm-modules node_modules/.bin/jest',
141
+ // disable all folders to enable only root.
142
+ 'jest.disabledWorkspaceFolders': folders.map(
143
+ (folder) => folder.name,
144
+ ),
145
+ }
146
+ : {}),
147
+ },
148
+ folders: [
149
+ {
150
+ name: '✨ root',
151
+ path: '..',
152
+ },
153
+ ...folders,
154
+ ],
155
+ },
156
+ );
157
+ }
75
158
  } else {
76
159
  this.fs.delete('.vscode');
77
160
  }
@@ -29,6 +29,11 @@
29
29
  "source.organizeImports": false
30
30
  },
31
31
 
32
+ <% if (testing && module) { -%>
33
+ // jest
34
+ "jest.jestCommandLine": "NODE_OPTIONS=--experimental-vm-modules node_modules/.bin/jest",
35
+ <% } -%>
36
+
32
37
  // eslint config
33
38
  "eslint.workingDirectories": ["."],
34
39
  "eslint.options": {
@@ -285,6 +285,15 @@ export default class PobLibGenerator extends Generator {
285
285
  updateOnly: this.options.updateOnly,
286
286
  });
287
287
 
288
+ this.composeWith('pob:core:vscode', {
289
+ root: !inLerna,
290
+ monorepo: false,
291
+ packageManager: this.options.packageManager,
292
+ yarnNodeLinker: this.options.yarnNodeLinker,
293
+ typescript: withBabel,
294
+ testing: this.pobjson.testing,
295
+ });
296
+
288
297
  // must be after doc, testing
289
298
  this.composeWith('pob:core:gitignore', {
290
299
  root: !inLerna,
@@ -215,6 +215,18 @@ export default class PobMonorepoGenerator extends Generator {
215
215
  packagePaths: JSON.stringify(packagePaths),
216
216
  packageManager: this.options.packageManager,
217
217
  });
218
+
219
+ this.composeWith('pob:core:vscode', {
220
+ root: true,
221
+ monorepo: true,
222
+ packageManager: this.options.packageManager,
223
+ yarnNodeLinker: this.options.yarnNodeLinker,
224
+ typescript: this.pobLernaConfig.typescript,
225
+ testing: this.pobLernaConfig.testing,
226
+ packageNames: JSON.stringify(packageNames),
227
+ packageLocations: JSON.stringify(this.packageLocations),
228
+ });
229
+
218
230
  // Always add a gitignore, because npm publish uses it.
219
231
  this.composeWith('pob:core:gitignore', {
220
232
  root: true,
@@ -149,15 +149,6 @@ export default class PobBaseGenerator extends Generator {
149
149
  app: this.projectConfig.type === 'app',
150
150
  });
151
151
 
152
- const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
153
-
154
- this.composeWith('pob:core:vscode', {
155
- root: this.isRoot,
156
- packageManager: this.projectConfig.packageManager,
157
- yarnNodeLinker: this.projectConfig.yarnNodeLinker,
158
- typescript: !!(pkg.devDependencies && pkg.devDependencies.typescript),
159
- });
160
-
161
152
  this.composeWith('pob:core:yarn', {
162
153
  type: this.projectConfig.type,
163
154
  enable: this.isRoot && this.projectConfig.packageManager === 'yarn',
@@ -1,9 +1,10 @@
1
1
  import prettier from 'prettier';
2
2
 
3
- export function writeAndFormat(fs, destinationPath, content) {
3
+ export function writeAndFormat(fs, destinationPath, content, { parser } = {}) {
4
4
  fs.write(
5
5
  destinationPath,
6
6
  prettier.format(content, {
7
+ parser,
7
8
  filepath: destinationPath,
8
9
  trailingComma: 'all',
9
10
  singleQuote: true,
@@ -13,7 +14,10 @@ export function writeAndFormat(fs, destinationPath, content) {
13
14
  }
14
15
 
15
16
  export function writeAndFormatJson(fs, destinationPath, value) {
16
- writeAndFormat(fs, destinationPath, JSON.stringify(value, null, 2));
17
+ writeAndFormat(fs, destinationPath, JSON.stringify(value, null, 2), {
18
+ // project.code-workspace is json
19
+ parser: destinationPath.endsWith('json') ? undefined : 'json',
20
+ });
17
21
  }
18
22
  export function copyAndFormatTpl(fs, templatePath, destinationPath, options) {
19
23
  fs.copyTpl(templatePath, destinationPath, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "9.13.0",
3
+ "version": "9.14.1",
4
4
  "description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
5
5
  "keywords": [
6
6
  "skeleton"
@@ -47,8 +47,8 @@
47
47
  "@pob/sort-eslint-config": "^3.0.1",
48
48
  "@pob/sort-object": "^4.0.1",
49
49
  "@pob/sort-pkg": "^4.0.1",
50
- "@yarnpkg/parsers": "2.5.0-rc.8",
51
- "eslint": "8.6.0",
50
+ "@yarnpkg/parsers": "2.5.0-rc.9",
51
+ "eslint": "8.7.0",
52
52
  "findup-sync": "^5.0.0",
53
53
  "git-remote-url": "^1.0.1",
54
54
  "github-username": "^6.0.0",
@@ -61,11 +61,11 @@
61
61
  "mem-fs-editor": "9.4.0",
62
62
  "minimist-argv": "^1.1.0",
63
63
  "parse-author": "^2.0.0",
64
- "pob-dependencies": "6.7.0",
64
+ "pob-dependencies": "6.10.0",
65
65
  "prettier": "2.5.1",
66
66
  "semver": "^7.3.4",
67
67
  "yeoman-environment": "^3.5.1",
68
68
  "yeoman-generator": "^5.4.0"
69
69
  },
70
- "gitHead": "10fc86e0d2cf78d9b2b1299a708ce69b32fbfedc"
70
+ "gitHead": "8e6c43e4b3090d88bc6f844e3f57de685a88ac96"
71
71
  }