pob 9.13.1 → 9.15.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,66 @@
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.15.0](https://github.com/christophehurpeau/pob/compare/pob@9.14.1...pob@9.15.0) (2022-01-29)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **deps:** update dependency @yarnpkg/parsers to v2.5.0-rc.10 ([#1182](https://github.com/christophehurpeau/pob/issues/1182)) ([4d3c5b4](https://github.com/christophehurpeau/pob/commit/4d3c5b4ef731cb1cb059f81494b4e0eda3778f80))
12
+
13
+
14
+ ### Features
15
+
16
+ * **pob:** update exported cjs extension ([47e7031](https://github.com/christophehurpeau/pob/commit/47e7031af4e83db775f2da607a299c5b896da89b))
17
+ * support codecov for apps ([741380b](https://github.com/christophehurpeau/pob/commit/741380b0fd9acfcb0b21e4c98fd4111cff692cbf))
18
+ * **deps:** update dependency eslint to v8.8.0 ([#1186](https://github.com/christophehurpeau/pob/issues/1186)) ([14f9e44](https://github.com/christophehurpeau/pob/commit/14f9e4460257392979383b264af4499a4ae24dc5))
19
+
20
+
21
+
22
+
23
+
24
+ ## [9.14.1](https://github.com/christophehurpeau/pob/compare/pob@9.14.0...pob@9.14.1) (2022-01-22)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **pob:** vscode generator monorepo option ([cb589e8](https://github.com/christophehurpeau/pob/commit/cb589e80168eaf114a5b22bc4e454ec59d449097))
30
+ * **pob:** vscode generator tsdk path for monorepo ([fc92541](https://github.com/christophehurpeau/pob/commit/fc92541f5926a6892186c086940c966420e4ef83))
31
+
32
+
33
+
34
+
35
+
36
+ # [9.14.0](https://github.com/christophehurpeau/pob/compare/pob@9.13.2...pob@9.14.0) (2022-01-20)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * **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))
42
+ * full vscode workspace config ([f3aa63d](https://github.com/christophehurpeau/pob/commit/f3aa63de6cc2b597c3114eb34757e94347cf5f3f))
43
+ * remove tasks from workspace config ([cc4b1a7](https://github.com/christophehurpeau/pob/commit/cc4b1a7efe39e2d7f13ac3079a32c58d3cd86c75))
44
+
45
+
46
+ ### Features
47
+
48
+ * **deps:** update dependency eslint to v8.7.0 ([#1164](https://github.com/christophehurpeau/pob/issues/1164)) ([9ec0c31](https://github.com/christophehurpeau/pob/commit/9ec0c3156cf5ed5d1f9e3e4ce4636b77da826850))
49
+ * **pob:** generate vscode monorepo workspace ([23ceaae](https://github.com/christophehurpeau/pob/commit/23ceaae63bc1abc58061366d90f8cd5c397bf232))
50
+
51
+
52
+
53
+
54
+
55
+ ## [9.13.2](https://github.com/christophehurpeau/pob/compare/pob@9.13.1...pob@9.13.2) (2022-01-15)
56
+
57
+
58
+ ### Bug Fixes
59
+
60
+ * **@pob/root:** fix use default github token for gh-pages workflow ([784ce66](https://github.com/christophehurpeau/pob/commit/784ce6633d5d5d14cdcf63aeb5a83ed036434673))
61
+
62
+
63
+
64
+
65
+
6
66
  ## [9.13.1](https://github.com/christophehurpeau/pob/compare/pob@9.13.0...pob@9.13.1) (2022-01-15)
7
67
 
8
68
 
@@ -82,6 +82,13 @@ export default class PobAppGenerator extends Generator {
82
82
  default:
83
83
  !config || config.testing === undefined ? false : config.testing,
84
84
  },
85
+ {
86
+ type: 'confirm',
87
+ name: 'codecov',
88
+ message: 'Do you want codecov ?',
89
+ default: !config || false,
90
+ when: (values) => values.testing,
91
+ },
85
92
  {
86
93
  type: 'confirm',
87
94
  name: 'ci',
@@ -153,7 +160,7 @@ export default class PobAppGenerator extends Generator {
153
160
  testing: this.appConfig.testing,
154
161
  typescript: babel,
155
162
  documentation: false,
156
- codecov: false,
163
+ codecov: this.appConfig.codecov,
157
164
  ci: this.appConfig.ci,
158
165
  packageManager: this.options.packageManager,
159
166
  isApp: true,
@@ -178,6 +185,15 @@ export default class PobAppGenerator extends Generator {
178
185
  updateOnly: this.options.updateOnly,
179
186
  });
180
187
 
188
+ this.composeWith('pob:core:vscode', {
189
+ root: !inLerna,
190
+ monorepo: false,
191
+ packageManager: this.options.packageManager,
192
+ yarnNodeLinker: this.options.yarnNodeLinker,
193
+ typescript: babel,
194
+ testing: this.appConfig.testing,
195
+ });
196
+
181
197
  // only for gitignore
182
198
  if (this.fs.exists('.env.example')) {
183
199
  ignorePaths.push('/.env*', '!/.env.example');
@@ -599,14 +599,15 @@ export default class CommonBabelGenerator extends Generator {
599
599
  const exportTarget = {};
600
600
 
601
601
  if (target === 'node') {
602
+ const cjsExt = pkg.type === 'module' ? 'cjs' : 'cjs.js';
602
603
  if (formats.includes('es')) {
603
604
  exportTarget.import = `./dist/${entryDistName}-${target}${version}.mjs`;
604
605
 
605
606
  if (formats.includes('cjs')) {
606
- exportTarget.require = `./dist/${entryDistName}-${target}${version}.cjs.js`;
607
+ exportTarget.require = `./dist/${entryDistName}-${target}${version}.${cjsExt}`;
607
608
  }
608
609
  } else if (formats.includes('cjs')) {
609
- exportTarget.default = `./dist/${entryDistName}-${target}${version}.cjs.js`;
610
+ exportTarget.default = `./dist/${entryDistName}-${target}${version}.${cjsExt}`;
610
611
  }
611
612
  // eslint: https://github.com/benmosher/eslint-plugin-import/issues/2132
612
613
  // jest: https://github.com/facebook/jest/issues/9771
@@ -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:
@@ -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.1",
3
+ "version": "9.15.0",
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.10",
51
+ "eslint": "8.8.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.8.0",
64
+ "pob-dependencies": "6.11.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": "640dd9ead1e1b8b72d32227a43a390209dee47d1"
70
+ "gitHead": "f367e618ae312861f4f50d15d4a3330dc6280115"
71
71
  }