pob 11.3.0 → 11.4.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,25 @@
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
+ # [11.4.0](https://github.com/christophehurpeau/pob/compare/pob@11.3.0...pob@11.4.0) (2022-11-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix clean:build script in workspace ([990dbb9](https://github.com/christophehurpeau/pob/commit/990dbb9815d550fb154d25deb7540e175a58f409))
12
+ * **pob:** fix removed @pob/root ([79f2b1f](https://github.com/christophehurpeau/pob/commit/79f2b1f1ea8e20a60f7ccecf796e1cd8d8fdb706))
13
+ * **pob:** packageUtils ([ce3df65](https://github.com/christophehurpeau/pob/commit/ce3df6583c415b5e59fafdc8ea300730237bdbef))
14
+
15
+
16
+ ### Features
17
+
18
+ * **deps:** update dependency eslint to v8.28.0 ([#1458](https://github.com/christophehurpeau/pob/issues/1458)) ([dab9337](https://github.com/christophehurpeau/pob/commit/dab93371c4e8ff4e424e97c6ffad8232ac2e68aa))
19
+ * simplify tsconfig ([83e1ad1](https://github.com/christophehurpeau/pob/commit/83e1ad11dac522c93821fb91dc1b2ccdebd0be16))
20
+
21
+
22
+
23
+
24
+
6
25
  # [11.3.0](https://github.com/christophehurpeau/pob/compare/pob@11.2.0...pob@11.3.0) (2022-11-15)
7
26
 
8
27
 
@@ -249,14 +249,15 @@ export default class CommonBabelGenerator extends Generator {
249
249
  if (this.entries) {
250
250
  this.entries.forEach((entry) => {
251
251
  const entryDestPath = this.destinationPath(`${entry}.js`);
252
- if (this.options.isApp && entry !== 'index') {
253
- this.fs.write(
254
- entryDestPath,
255
- `// resolution for eslint-plugin-import\nexport * from './src/${entry}/index.ts';\n`,
256
- );
257
- } else {
258
- this.fs.delete(entryDestPath);
259
- }
252
+ // TODO check nightingale before uncomment this
253
+ // if (this.options.isApp && entry !== 'index') {
254
+ // this.fs.write(
255
+ // entryDestPath,
256
+ // `// resolution for eslint-plugin-import\nexport * from './src/${entry}/index.ts';\n`,
257
+ // );
258
+ // } else {
259
+ this.fs.delete(entryDestPath);
260
+ // }
260
261
  });
261
262
  }
262
263
  //
@@ -299,7 +300,7 @@ export default class CommonBabelGenerator extends Generator {
299
300
 
300
301
  const shouldBuildDefinitions = !this.options.isApp && useBabel;
301
302
  packageUtils.addOrRemoveScripts(pkg, shouldBuildDefinitions, {
302
- 'build:definitions': 'tsc -p tsconfig.build.json',
303
+ 'build:definitions': 'tsc -p',
303
304
  });
304
305
 
305
306
  if (shouldBuildDefinitions) {
@@ -469,7 +470,7 @@ export default class CommonBabelGenerator extends Generator {
469
470
  // see pkg.exports instead.
470
471
  delete pkg.main;
471
472
  if (!this.options.isApp) {
472
- pkg.types = `./${this.options.buildDirectory}/index.d.ts`;
473
+ pkg.types = `./${this.options.buildDirectory}/definitions/index.d.ts`;
473
474
  }
474
475
  } else {
475
476
  if (!pkg.main) {
@@ -38,12 +38,12 @@ function updateParserAndPlugins(
38
38
 
39
39
  if (!globalEslint) {
40
40
  config.parserOptions = {
41
- project: './tsconfig.eslint.json',
41
+ project: './tsconfig.json',
42
42
  createDefaultProgram: true, // fix for lint-staged
43
43
  };
44
44
  } else {
45
45
  config.parserOptions = {
46
- project: `${relativePath}/tsconfig.eslint.json`,
46
+ project: `${relativePath}/tsconfig.json`,
47
47
  };
48
48
  }
49
49
  } else {
@@ -103,7 +103,7 @@ export default class CommonHuskyGenerator extends Generator {
103
103
  // this.fs.delete('.git/hooks/husky.local.sh');
104
104
  } else {
105
105
  packageUtils.removeDevDependencies(pkg, [
106
- '@pob/root',
106
+ pkg.name !== 'pob' && '@pob/root',
107
107
  '@pob/commitlint-config',
108
108
  ]);
109
109
  this.fs.delete(this.destinationPath('lint-staged.config.cjs'));
@@ -193,7 +193,7 @@ export default class CommonTestingGenerator extends Generator {
193
193
  delete pkg.scripts['generate:test-coverage'];
194
194
  delete pkg.scripts['test:watch'];
195
195
  }
196
- pkg.addScripts(pkg, {
196
+ packageUtils.addScripts(pkg, {
197
197
  test: `yarn ../../ run test -- ${path
198
198
  .relative('../..', '.')
199
199
  .replace('\\', '/')}`,
@@ -91,13 +91,15 @@ export default class CommonTypescriptGenerator extends Generator {
91
91
  );
92
92
 
93
93
  const tsconfigPath = this.destinationPath('tsconfig.json');
94
+ const tsconfigCheckPath = this.destinationPath('tsconfig.check.json');
94
95
  const tsconfigEslintPath = this.destinationPath('tsconfig.eslint.json');
95
96
  const tsconfigBuildPath = this.destinationPath('tsconfig.build.json');
97
+
96
98
  if (this.options.enable) {
97
99
  const { jsx, dom } = this.options;
98
100
  let composite;
99
101
  let monorepoPackageReferences;
100
- let monorepoPackageBuildReferences;
102
+ // let monorepoPackageBuildReferences;
101
103
  let monorepoPackageSrcPaths;
102
104
 
103
105
  if (inLerna && !inLerna.root) {
@@ -153,21 +155,34 @@ export default class CommonTypescriptGenerator extends Generator {
153
155
  existsSync(`${packageLocations.get(packageName)}/tsconfig.json`),
154
156
  )
155
157
  .map((packageName) => packageLocations.get(packageName));
156
- monorepoPackageBuildReferences = yoConfig.pob.monorepo.packageNames
157
- .filter((packageName) =>
158
- existsSync(
159
- `${packageLocations.get(packageName)}/tsconfig.build.json`,
160
- ),
161
- )
162
- .map((packageName) => packageLocations.get(packageName));
158
+ // monorepoPackageBuildReferences = yoConfig.pob.monorepo.packageNames
159
+ // .filter((packageName) =>
160
+ // existsSync(
161
+ // `${packageLocations.get(packageName)}/tsconfig.build.json`,
162
+ // ),
163
+ // )
164
+ // .map((packageName) => packageLocations.get(packageName));
163
165
  }
164
166
  }
165
167
 
168
+ if (this.fs.exists(tsconfigEslintPath)) {
169
+ this.fs.delete(tsconfigEslintPath);
170
+ }
171
+ if (this.fs.exists(tsconfigCheckPath)) {
172
+ this.fs.delete(tsconfigCheckPath);
173
+ }
174
+
175
+ /*
176
+ Only using one file:
177
+ - allows IDE and typedoc to behave correctly
178
+ - generate useless definition files for not excluded tests files. However, it also use them for cache.
179
+ */
166
180
  copyAndFormatTpl(
167
181
  this.fs,
168
182
  this.templatePath('tsconfig.json.ejs'),
169
183
  tsconfigPath,
170
184
  {
185
+ emit: this.options.builddefs,
171
186
  monorepoPackageSrcPaths,
172
187
  monorepoPackageReferences,
173
188
  rootDir: this.options.rootDir,
@@ -181,36 +196,32 @@ export default class CommonTypescriptGenerator extends Generator {
181
196
  forceAllowJs: this.options.forceAllowJs,
182
197
  },
183
198
  );
184
- copyAndFormatTpl(
185
- this.fs,
186
- this.templatePath('tsconfig.eslint.json.ejs'),
187
- tsconfigEslintPath,
188
- {},
189
- );
190
- if (
191
- this.options.builddefs // &&
192
- // (!composite || monorepoPackageNames.length !== 0)
193
- ) {
194
- copyAndFormatTpl(
195
- this.fs,
196
- this.templatePath('tsconfig.build.json.ejs'),
197
- tsconfigBuildPath,
198
- {
199
- inMonorepo: inLerna && !inLerna.root,
200
- jsx,
201
- composite,
202
- monorepoPackageSrcPaths,
203
- monorepoPackageBuildReferences,
204
- },
205
- );
206
- } else {
207
- this.fs.delete(tsconfigBuildPath);
208
- }
199
+
200
+ // if (
201
+ // this.options.builddefs // &&
202
+ // // (!composite || monorepoPackageNames.length !== 0)
203
+ // ) {
204
+ // copyAndFormatTpl(
205
+ // this.fs,
206
+ // this.templatePath('tsconfig.build.json.ejs'),
207
+ // tsconfigBuildPath,
208
+ // {
209
+ // inMonorepo: inLerna && !inLerna.root,
210
+ // jsx,
211
+ // composite,
212
+ // monorepoPackageSrcPaths,
213
+ // monorepoPackageBuildReferences,
214
+ // },
215
+ // );
216
+ // } else {
217
+ this.fs.delete(tsconfigBuildPath);
218
+ // }
209
219
  } else {
210
220
  if (pkg.scripts) delete pkg.scripts.tsc;
211
221
  this.fs.delete(tsconfigPath);
212
- this.fs.delete(tsconfigEslintPath);
213
222
  this.fs.delete(tsconfigBuildPath);
223
+ this.fs.delete(tsconfigCheckPath);
224
+ this.fs.delete(tsconfigEslintPath);
214
225
  }
215
226
 
216
227
  this.fs.writeJSON(this.destinationPath('package.json'), pkg);
@@ -3,14 +3,6 @@
3
3
 
4
4
  "compilerOptions": {
5
5
  "noEmit": false,
6
- "declaration": true,
7
- "declarationMap": true,
8
- "emitDeclarationOnly": true,
9
- "outDir": "dist",
10
- "newLine": "lf"<% if(composite) { -%>,
11
- "composite": true,
12
- "tsBuildInfoFile": "dist/tsbuildinfo"
13
- <% } -%>
14
6
  },
15
7
 
16
8
  "exclude": [
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+
4
+ "compilerOptions": {
5
+ "noEmit": true,
6
+ }<% if (monorepoPackageCheckReferences && monorepoPackageCheckReferences.length) { %>,<% } -%>
7
+ <% if (monorepoPackageCheckReferences && monorepoPackageCheckReferences.length) { %>
8
+ "references": [
9
+ <% monorepoPackageCheckReferences.forEach((monorepoPackageSrcPath, index) => { -%>
10
+ { "path": "<%= monorepoPackageSrcPath %>/tsconfig.check.json" }<%= index === monorepoPackageCheckReferences.length -1 ? '' : ',' %>
11
+ <% }) -%>
12
+ ]<% } -%>
13
+ }
@@ -10,19 +10,25 @@
10
10
  <% } -%>
11
11
  "compilerOptions": {
12
12
  "rootDir": "<%= rootDir %>",
13
- <% if(!composite) { -%>
14
- /* No emit in default config file. See build config file for config to build declaration files */
15
- "noEmit": true,
13
+ "newLine": "lf",
14
+ <% if (emit) { -%>
15
+ "outDir": "dist/definitions",
16
+ "tsBuildInfoFile": "dist/definitions/tsbuildinfo",
17
+ <% } else if (composite) { -%>
18
+ "outDir": "node_modules/.cache/tsc",
19
+ "tsBuildInfoFile": "node_modules/.cache/tsc/tsbuildinfo",
16
20
  <% } else { -%>
17
- "incremental": true,
18
- "composite": true,
19
- "noEmit": false,
21
+ "noEmit": true,
22
+ <% } -%>
23
+ <% if (composite || emit) { -%>
20
24
  "noEmitOnError": true,
21
25
  "declaration": true,
22
26
  "declarationMap": true,
23
27
  "emitDeclarationOnly": true,
24
- "outDir": "node_modules/.cache/tsc",
25
- "tsBuildInfoFile": "node_modules/.cache/tsc/tsbuildinfo",
28
+ <% } -%>
29
+ <% if(composite) { -%>
30
+ "incremental": true,
31
+ "composite": true,
26
32
  <% } -%>
27
33
 
28
34
  /* No need to check .d.ts files */
@@ -17,9 +17,7 @@
17
17
  /*.config.mjs
18
18
  <% if (babel) { -%>
19
19
  /tsconfig.json
20
- /tsconfig.build.json
21
- /tsconfig.eslint.json
22
- /dist/tsbuildinfo
20
+ /dist/definitions/tsbuildinfo
23
21
  <% if (typedoc) { -%>
24
22
  /tsconfig.doc.json
25
23
  <% } -%>
@@ -12,7 +12,7 @@
12
12
  "readme": "<%= readme %>",
13
13
  "out": "docs",
14
14
  "excludePrivate": true,
15
- "gitRevision": "master"
15
+ "gitRevision": "main"
16
16
  },
17
17
 
18
18
  "exclude": [
@@ -22,7 +22,7 @@
22
22
 
23
23
  "references": [
24
24
  <% packagePaths.forEach((packagePath, index) => { -%>
25
- { "path": "<%= packagePath %>/tsconfig.build.json" }<%= index === packagePaths.length -1 ? '' : ',' %>
25
+ { "path": "<%= packagePath %>/tsconfig.json" }<%= index === packagePaths.length -1 ? '' : ',' %>
26
26
  <% }) -%>
27
27
  ],
28
28
 
@@ -315,9 +315,7 @@ export default class PobMonorepoGenerator extends Generator {
315
315
  this.fs.delete('rollup.config.mjs');
316
316
  }
317
317
  packageUtils.addOrRemoveScripts(pkg, rollupConfigs.length > 0, {
318
- 'clean:build': `(${pkg.workspaces
319
- .map((workspaces) => `rm -Rf ${workspaces}/dist ${workspaces}/build`)
320
- .join(' ; ')}) || true`,
318
+ 'clean:build': 'yarn workspaces foreach run clean:build',
321
319
  build: 'yarn clean:build && rollup --config rollup.config.mjs',
322
320
  watch: 'yarn clean:build && rollup --config rollup.config.mjs --watch',
323
321
  });
@@ -109,10 +109,7 @@ export default class MonorepoLernaGenerator extends Generator {
109
109
  ];
110
110
 
111
111
  if (withBabel) {
112
- lernaConfig.command.publish.ignoreChanges.push(
113
- '**/tsconfig.json',
114
- '**/tsconfig.build.json',
115
- );
112
+ lernaConfig.command.publish.ignoreChanges.push('**/tsconfig.json');
116
113
  }
117
114
 
118
115
  writeAndFormatJson(
@@ -1,4 +1,3 @@
1
- import { existsSync } from 'fs';
2
1
  import Generator from 'yeoman-generator';
3
2
  import * as packageUtils from '../../../utils/package.js';
4
3
  import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
@@ -48,14 +47,12 @@ export default class MonorepoTypescriptGenerator extends Generator {
48
47
  'typescript',
49
48
  ]);
50
49
 
51
- const tsconfigPath = this.destinationPath('tsconfig.json');
52
- const tsconfigBuildPath = this.destinationPath('tsconfig.build.json');
53
50
  if (this.options.enable) {
54
51
  packageUtils.addScripts(pkg, {
55
52
  tsc: 'tsc -b',
56
53
  });
57
54
  packageUtils.addOrRemoveScripts(pkg, !this.options.isAppProject, {
58
- 'build:definitions': 'tsc -b tsconfig.build.json',
55
+ 'build:definitions': 'tsc -b',
59
56
  });
60
57
 
61
58
  delete pkg.scripts.postbuild;
@@ -63,7 +60,35 @@ export default class MonorepoTypescriptGenerator extends Generator {
63
60
  if (!this.options.isAppProject) {
64
61
  pkg.scripts.build += ' && yarn run build:definitions';
65
62
  }
63
+ } else if (pkg.scripts) {
64
+ delete pkg.scripts.tsc;
65
+ if (
66
+ pkg.scripts.postbuild === 'tsc -b tsconfig.build.json' ||
67
+ pkg.scripts.postbuild === 'tsc -b'
68
+ ) {
69
+ delete pkg.scripts.postbuild;
70
+ }
71
+ delete pkg.scripts['build:definitions'];
72
+ }
73
+
74
+ if (pkg.scripts) {
75
+ delete pkg.scripts['typescript-check'];
76
+ }
77
+
78
+ this.fs.writeJSON(this.destinationPath('package.json'), pkg);
79
+ }
80
+
81
+ // after pob ran in workspaces
82
+ end() {
83
+ const tsconfigPath = this.destinationPath('tsconfig.json');
84
+ const tsconfigCheckPath = this.destinationPath('tsconfig.check.json');
85
+ const tsconfigBuildPath = this.destinationPath('tsconfig.build.json');
66
86
 
87
+ if (!this.options.enable) {
88
+ this.fs.delete(tsconfigPath);
89
+ this.fs.delete(tsconfigCheckPath);
90
+ this.fs.delete(tsconfigBuildPath);
91
+ } else {
67
92
  const packagePaths = JSON.parse(this.options.packagePaths);
68
93
 
69
94
  copyAndFormatTpl(
@@ -74,40 +99,33 @@ export default class MonorepoTypescriptGenerator extends Generator {
74
99
  packagePaths,
75
100
  },
76
101
  );
77
- if (this.options.isAppProject) {
78
- this.fs.delete(tsconfigBuildPath);
79
- } else {
80
- copyAndFormatTpl(
81
- this.fs,
82
- this.templatePath('tsconfig.build.json.ejs'),
83
- tsconfigBuildPath,
84
- {
85
- packagePaths: packagePaths.filter((packagePath) =>
86
- existsSync(
87
- `${packagePath}/tsconfig${
88
- this.options.isAppProject ? '' : '.build'
89
- }.json`,
90
- ),
91
- ),
92
- },
93
- );
94
- }
95
- } else {
96
- if (pkg.scripts) {
97
- delete pkg.scripts.tsc;
98
- if (pkg.scripts.postbuild === 'tsc -b tsconfig.build.json') {
99
- delete pkg.scripts.postbuild;
100
- }
101
- delete pkg.scripts['build:definitions'];
102
- }
103
- this.fs.delete(tsconfigPath);
104
- this.fs.delete(tsconfigBuildPath);
105
- }
106
102
 
107
- if (pkg.scripts) {
108
- delete pkg.scripts['typescript-check'];
103
+ this.fs.delete(tsconfigCheckPath);
104
+ this.fs.delete(tsconfigBuildPath);
105
+ // if (this.options.isAppProject) {
106
+ // } else {
107
+ // copyAndFormatTpl(
108
+ // this.fs,
109
+ // this.templatePath('tsconfig.check.json.ejs'),
110
+ // tsconfigCheckPath,
111
+ // {
112
+ // packagePaths: packagePaths.filter((packagePath) =>
113
+ // existsSync(`${packagePath}/tsconfig.check.json`),
114
+ // ),
115
+ // },
116
+ // );
117
+
118
+ // copyAndFormatTpl(
119
+ // this.fs,
120
+ // this.templatePath('tsconfig.build.json.ejs'),
121
+ // tsconfigBuildPath,
122
+ // {
123
+ // packagePaths: packagePaths.filter((packagePath) =>
124
+ // existsSync(`${packagePath}/tsconfig.build.json`),
125
+ // ),
126
+ // },
127
+ // );
128
+ // }
109
129
  }
110
-
111
- this.fs.writeJSON(this.destinationPath('package.json'), pkg);
112
130
  }
113
131
  }
@@ -0,0 +1,8 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ <% packagePaths.forEach((packagePath, index) => { -%>
5
+ { "path": "<%= packagePath %>/tsconfig.check.json" }<%= index === packagePaths.length -1 ? '' : ',' %>
6
+ <% }) -%>
7
+ ]
8
+ }
@@ -177,7 +177,7 @@ export default class PobBaseGenerator extends Generator {
177
177
  'yarnhook',
178
178
  'lerna',
179
179
  '@pob/lerna-light',
180
- '@pob/root',
180
+ pkg.name !== 'pob' && '@pob/root',
181
181
  ]);
182
182
  delete pkg.commitlint;
183
183
  delete pkg.husky;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "11.3.0",
3
+ "version": "11.4.0",
4
4
  "description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
5
5
  "keywords": [
6
6
  "skeleton"
@@ -30,7 +30,7 @@
30
30
  "scripts": {
31
31
  "format": "prettier --write",
32
32
  "lint": "yarn run lint:eslint",
33
- "lint:eslint": "cd ../.. && yarn run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/pob"
33
+ "lint:eslint": "yarn ../.. run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/pob"
34
34
  },
35
35
  "prettier": "@pob/root/prettier-config",
36
36
  "pob": {},
@@ -40,10 +40,10 @@
40
40
  "@pob/eslint-config": "49.4.0",
41
41
  "@pob/eslint-config-typescript": "49.4.0",
42
42
  "@pob/eslint-config-typescript-react": "49.4.0",
43
- "@pob/sort-eslint-config": "4.0.0",
44
- "@pob/sort-object": "5.0.0",
45
- "@pob/sort-pkg": "5.0.0",
46
- "eslint": "8.27.0",
43
+ "@pob/sort-eslint-config": "4.1.0",
44
+ "@pob/sort-object": "5.1.0",
45
+ "@pob/sort-pkg": "5.1.0",
46
+ "eslint": "8.28.0",
47
47
  "findup-sync": "^5.0.0",
48
48
  "git-remote-url": "^1.0.1",
49
49
  "github-username": "^6.0.0",
@@ -57,14 +57,14 @@
57
57
  "minimist": "1.2.7",
58
58
  "node-fetch": "3.3.0",
59
59
  "parse-author": "2.0.0",
60
- "pob-dependencies": "7.1.1",
60
+ "pob-dependencies": "7.2.0",
61
61
  "prettier": "2.7.1",
62
62
  "semver": "7.3.8",
63
63
  "yeoman-environment": "3.12.1",
64
64
  "yeoman-generator": "5.7.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@pob/root": "7.1.1"
67
+ "@pob/root": "7.2.0"
68
68
  },
69
- "gitHead": "33e161c4d1126092c4ab2dfa490a03ac6359e663"
69
+ "gitHead": "e251d920020bbd336916da28d2681a45b5acf807"
70
70
  }
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
-
4
- "compilerOptions": {
5
- "noEmit": true,
6
- }
7
- }