pob 9.10.0 → 9.12.2

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,61 @@
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.12.2](https://github.com/christophehurpeau/pob/compare/pob@9.12.1...pob@9.12.2) (2022-01-02)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **pob:** stop ci testing on node 14 on app projects ([c775697](https://github.com/christophehurpeau/pob/commit/c77569741136dc3feefcdc61f666092751be944c))
12
+
13
+
14
+
15
+
16
+
17
+ ## [9.12.1](https://github.com/christophehurpeau/pob/compare/pob@9.12.0...pob@9.12.1) (2022-01-02)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * set globalEslint default to true ([8d7d3d5](https://github.com/christophehurpeau/pob/commit/8d7d3d5917b340b901b565a23356b21939059cb8))
23
+ * use cjs for default main for jest which doesnt supports exports yet ([f97c897](https://github.com/christophehurpeau/pob/commit/f97c8972b35032078f4603d788b4a3e637d61637))
24
+
25
+
26
+
27
+
28
+
29
+ # [9.12.0](https://github.com/christophehurpeau/pob/compare/pob@9.11.0...pob@9.12.0) (2022-01-01)
30
+
31
+
32
+ ### Features
33
+
34
+ * **pob:** update release-please version ([8091222](https://github.com/christophehurpeau/pob/commit/80912226fedb9eb5e25936f2c9f4a719bf9605e9))
35
+
36
+
37
+
38
+
39
+
40
+ # [9.11.0](https://github.com/christophehurpeau/pob/compare/pob@9.10.0...pob@9.11.0) (2022-01-01)
41
+
42
+
43
+ ### Bug Fixes
44
+
45
+ * **pob:** legacy pkg.main cjs ([04dc5e2](https://github.com/christophehurpeau/pob/commit/04dc5e22e77b7383660b3bc62516d884670cf25a))
46
+ * force package type module when lerna and root is module ([c8e89a8](https://github.com/christophehurpeau/pob/commit/c8e89a8d04936ea7035d86a646437ba74e54146b))
47
+ * **deps:** update dependency @yarnpkg/parsers to v2.5.0-rc.7 ([#1148](https://github.com/christophehurpeau/pob/issues/1148)) ([8da56d4](https://github.com/christophehurpeau/pob/commit/8da56d4c1576908570c16da89caebad87a50c473))
48
+ * **pob:** monorepo react testing detection ([3f95cbf](https://github.com/christophehurpeau/pob/commit/3f95cbf667f624301aab82a88080c526507fe662))
49
+ * **pob:** test babel config with react ([726b954](https://github.com/christophehurpeau/pob/commit/726b95400eeef042bb22cafd1f4cdec23e0008df))
50
+ * package main when only esm is used ([b02684f](https://github.com/christophehurpeau/pob/commit/b02684f03a7bdf5875ac4919aa69df6b4993532f))
51
+
52
+
53
+ ### Features
54
+
55
+ * **deps:** update dependency eslint to v8.6.0 ([#1152](https://github.com/christophehurpeau/pob/issues/1152)) ([004bf4f](https://github.com/christophehurpeau/pob/commit/004bf4f78e200606813498ee4f211ed06fec659f))
56
+
57
+
58
+
59
+
60
+
6
61
  # [9.10.0](https://github.com/christophehurpeau/pob/compare/pob@9.9.1...pob@9.10.0) (2021-12-26)
7
62
 
8
63
 
@@ -157,6 +157,7 @@ export default class PobAppGenerator extends Generator {
157
157
  codecov: false,
158
158
  ci: this.appConfig.ci,
159
159
  packageManager: this.options.packageManager,
160
+ isApp: true,
160
161
  });
161
162
 
162
163
  this.composeWith('pob:common:format-lint', {
@@ -125,10 +125,6 @@ export default class CommonBabelGenerator extends Generator {
125
125
  validate: (versions) => versions.length > 0,
126
126
  default: nodeVersions,
127
127
  choices: [
128
- {
129
- name: '12 (Maintenance LTS)',
130
- value: '12',
131
- },
132
128
  {
133
129
  name: '14 (Maintenance LTS)',
134
130
  value: '14',
@@ -468,7 +464,11 @@ export default class CommonBabelGenerator extends Generator {
468
464
  if (!pkg.main) {
469
465
  pkg.exports = './lib/index.js';
470
466
  }
471
- pkg.main = './lib/index.js';
467
+ if (pkg.type === 'module' && this.fs.exists('./lib/index.cjs')) {
468
+ pkg.main = './lib/index.cjs';
469
+ } else {
470
+ pkg.main = './lib/index.js';
471
+ }
472
472
  if (!this.options.isApp) {
473
473
  if (this.fs.exists('./lib/index.ts')) {
474
474
  pkg.types = './lib/index.ts';
@@ -609,7 +609,12 @@ export default class CommonBabelGenerator extends Generator {
609
609
  // eslint: https://github.com/benmosher/eslint-plugin-import/issues/2132
610
610
  // jest: https://github.com/facebook/jest/issues/9771
611
611
  if (!pkg.main && exportName === '.') {
612
- pkg.main = exportTarget.default || exportTarget.require;
612
+ pkg.main =
613
+ pkg.type === 'module'
614
+ ? exportTarget.import
615
+ : exportTarget.default ||
616
+ exportTarget.require ||
617
+ exportTarget.import;
613
618
  }
614
619
  } else if (target === 'browser') {
615
620
  if (formats.includes('es')) {
@@ -179,7 +179,8 @@ export default class CommonLintGenerator extends Generator {
179
179
  }
180
180
 
181
181
  const yoConfigPobMonorepo = inLerna && inLerna.pobMonorepoConfig;
182
- const globalEslint = yoConfigPobMonorepo && yoConfigPobMonorepo.eslint;
182
+ const globalEslint =
183
+ yoConfigPobMonorepo && yoConfigPobMonorepo.eslint !== false;
183
184
  const globalTesting = yoConfigPobMonorepo && yoConfigPobMonorepo.testing;
184
185
  const composite = yoConfigPobMonorepo && yoConfigPobMonorepo.typescript;
185
186
  const { rootPackageManager, rootYarnNodeLinker } = inLerna || {};
@@ -9,7 +9,7 @@ jobs:
9
9
  release-please:
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: GoogleCloudPlatform/release-please-action@v2
12
+ - uses: GoogleCloudPlatform/release-please-action@v3
13
13
  id: release
14
14
  with:
15
15
  token: ${{ secrets.GH_TOKEN }}
@@ -48,6 +48,12 @@ export default class CommonTestingGenerator extends Generator {
48
48
  defaults: 'yarn',
49
49
  desc: 'yarn or npm',
50
50
  });
51
+
52
+ this.option('isApp', {
53
+ type: Boolean,
54
+ required: true,
55
+ desc: 'is app',
56
+ });
51
57
  }
52
58
 
53
59
  default() {
@@ -60,6 +66,7 @@ export default class CommonTestingGenerator extends Generator {
60
66
  documentation: this.options.documentation,
61
67
  codecov: this.options.codecov,
62
68
  packageManager: this.options.packageManager,
69
+ isApp: this.options.isApp,
63
70
  });
64
71
  } else {
65
72
  this.composeWith('pob:core:ci', {
@@ -86,6 +93,7 @@ export default class CommonTestingGenerator extends Generator {
86
93
  const transpileWithBabel = this.options.monorepo
87
94
  ? yoConfigPobMonorepo.typescript
88
95
  : pkg.pob && pkg.pob.babelEnvs && pkg.pob.babelEnvs.length > 0;
96
+ let hasReact = transpileWithBabel && packageUtils.hasReact(pkg);
89
97
 
90
98
  if (!this.options.enable) {
91
99
  packageUtils.removeDevDependencies(pkg, ['jest', '@types/jest']);
@@ -149,7 +157,9 @@ export default class CommonTestingGenerator extends Generator {
149
157
  workspacesWithoutStar.length === 1
150
158
  ? workspacesWithoutStar[0]
151
159
  : `(${workspacesWithoutStar.join('|')})`;
152
- const hasReact = packageUtils.hasReact(pkg);
160
+ hasReact = yoConfigPobMonorepo.packageNames.some((pkgName) =>
161
+ pkgName.startsWith('react-'),
162
+ );
153
163
 
154
164
  if (!pkg.jest) pkg.jest = {};
155
165
  Object.assign(pkg.jest, {
@@ -204,7 +214,6 @@ export default class CommonTestingGenerator extends Generator {
204
214
  ].join(' ; '),
205
215
  });
206
216
 
207
- const hasReact = transpileWithBabel && packageUtils.hasReact(pkg);
208
217
  const srcDirectory = transpileWithBabel ? 'src' : 'lib';
209
218
 
210
219
  if (!pkg.jest) pkg.jest = {};
@@ -262,7 +271,6 @@ export default class CommonTestingGenerator extends Generator {
262
271
  transpileWithBabel &&
263
272
  ((this.options.monorepo && globalTesting) || !globalTesting)
264
273
  ) {
265
- const hasReact = transpileWithBabel && packageUtils.hasReact(pkg);
266
274
  // cjs for jest compat
267
275
  copyAndFormatTpl(
268
276
  this.fs,
@@ -7,6 +7,15 @@ module.exports = function babelConfig(api) {
7
7
 
8
8
  return {
9
9
  only: [<%- only %>],
10
- presets: [[require.resolve('pob-babel/preset.cjs')<% if (!jestExperimentalESM) { %>, { modules: 'commonjs' }<% } %>]],
10
+ presets: [
11
+ [require.resolve('pob-babel/preset.cjs')<% if (!jestExperimentalESM) { %>, { modules: 'commonjs' }<% } %>]
12
+ <% if (hasReact) { %>, [
13
+ '@babel/preset-react',
14
+ {
15
+ development: false,
16
+ useBuiltIns: true,
17
+ },
18
+ ]<% } %>
19
+ ],
11
20
  };
12
21
  };
@@ -54,6 +54,12 @@ export default class CoreCIGenerator extends Generator {
54
54
  required: true,
55
55
  desc: 'Include documentation generation',
56
56
  });
57
+
58
+ this.option('isApp', {
59
+ type: Boolean,
60
+ required: true,
61
+ desc: 'is app',
62
+ });
57
63
  }
58
64
 
59
65
  default() {
@@ -75,6 +81,7 @@ export default class CoreCIGenerator extends Generator {
75
81
  build: this.options.build,
76
82
  typescript: this.options.typescript,
77
83
  codecov: this.options.codecov,
84
+ supportsNode14: !this.options.isApp,
78
85
  },
79
86
  );
80
87
  } else {
@@ -8,7 +8,7 @@ jobs:
8
8
 
9
9
  strategy:
10
10
  matrix:
11
- node-version: [14.x, 16.x]
11
+ node-version: [<% if (supportsNode14) { -%>14.x, <% } -%>16.x]
12
12
 
13
13
  steps:
14
14
  - uses: actions/checkout@v2
@@ -13,6 +13,12 @@ export default class CoreGitGenerator extends Generator {
13
13
  defaults: '',
14
14
  desc: 'Should create the repo on github',
15
15
  });
16
+
17
+ this.option('isApp', {
18
+ type: String,
19
+ required: true,
20
+ desc: 'is app',
21
+ });
16
22
  }
17
23
 
18
24
  async initializing() {
@@ -94,6 +100,7 @@ export default class CoreGitGenerator extends Generator {
94
100
  shouldCreate: !this.originUrl,
95
101
  gitHostAccount: this.gitHostAccount,
96
102
  repoName: this.repoName,
103
+ isApp: this.options.isApp,
97
104
  });
98
105
  }
99
106
  }
@@ -15,14 +15,18 @@ const gh = got.extend({
15
15
  },
16
16
  });
17
17
 
18
- const configureProtectionRule = async (owner, repo) => {
18
+ const configureProtectionRule = async (owner, repo, isApp) => {
19
19
  for (const branch of ['main', 'master']) {
20
20
  try {
21
21
  await gh.put(`repos/${owner}/${repo}/branches/${branch}/protection`, {
22
22
  json: {
23
23
  required_status_checks: {
24
24
  strict: false,
25
- contexts: ['build (14.x)', 'build (16.x)', 'reviewflow'],
25
+ contexts: [
26
+ !isApp && 'build (14.x)',
27
+ 'build (16.x)',
28
+ 'reviewflow',
29
+ ].filter(Boolean),
26
30
  },
27
31
  enforce_admins: false, // true,
28
32
  required_pull_request_reviews: null,
@@ -67,6 +71,12 @@ export default class CoreGitGithubGenerator extends Generator {
67
71
  desc: 'repo name',
68
72
  });
69
73
 
74
+ this.option('isApp', {
75
+ type: String,
76
+ required: true,
77
+ desc: 'is app',
78
+ });
79
+
70
80
  if (!GITHUB_TOKEN && process.env.CI !== 'true') {
71
81
  throw new Error(
72
82
  'Missing POB_GITHUB_TOKEN. Create one with https://github.com/settings/tokens/new?scopes=repo&description=POB%20Generator and add it in your env variables.',
@@ -137,7 +147,7 @@ export default class CoreGitGithubGenerator extends Generator {
137
147
  cwd,
138
148
  });
139
149
 
140
- configureProtectionRule(owner, repo);
150
+ configureProtectionRule(owner, repo, this.options.isApp);
141
151
 
142
152
  // await gh.put(`/repos/${owner}/${repo}/topics`, {
143
153
  // names: pkg.keywords,
@@ -162,7 +172,7 @@ export default class CoreGitGithubGenerator extends Generator {
162
172
  },
163
173
  });
164
174
 
165
- configureProtectionRule(owner, repo);
175
+ configureProtectionRule(owner, repo, this.options.isApp);
166
176
  }
167
177
  }
168
178
  }
@@ -139,6 +139,9 @@ export default class CorePackageGenerator extends Generator {
139
139
  );
140
140
 
141
141
  if (!pkg.type) pkg.type = props.type;
142
+ if (inLerna && !inLerna.root && inLerna.rootMonorepoPkg.type === 'module') {
143
+ pkg.type = 'module';
144
+ }
142
145
 
143
146
  pkg.description = this.options.updateOnly
144
147
  ? pkg.description
@@ -250,6 +250,7 @@ export default class PobLibGenerator extends Generator {
250
250
  codecov: this.pobjson.testing && this.pobjson.testing.codecov,
251
251
  ci: this.pobjson.testing && this.pobjson.testing.ci,
252
252
  packageManager: this.options.packageManager,
253
+ isApp: false,
253
254
  });
254
255
 
255
256
  // must be after testing
@@ -193,6 +193,7 @@ export default class PobMonorepoGenerator extends Generator {
193
193
  codecov: this.pobLernaConfig.testing && this.pobLernaConfig.codecov,
194
194
  ci: this.pobLernaConfig.ci,
195
195
  packageManager: this.options.packageManager,
196
+ isApp: this.options.isAppProject,
196
197
  });
197
198
 
198
199
  this.composeWith('pob:common:format-lint', {
@@ -165,7 +165,9 @@ export default class PobBaseGenerator extends Generator {
165
165
  });
166
166
 
167
167
  if (!this.inLerna) {
168
- this.composeWith('pob:core:git');
168
+ this.composeWith('pob:core:git', {
169
+ isApp: this.projectConfig.type === 'app',
170
+ });
169
171
  } else {
170
172
  if (this.fs.exists('.git-hooks')) this.fs.delete('.git-hooks');
171
173
  if (this.fs.exists('git-hooks')) this.fs.delete('git-hooks');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "9.10.0",
3
+ "version": "9.12.2",
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.6",
51
- "eslint": "8.5.0",
50
+ "@yarnpkg/parsers": "2.5.0-rc.7",
51
+ "eslint": "8.6.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.5.0",
64
+ "pob-dependencies": "6.6.2",
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": "c4a529a8e84d4aab433ecd39956ccc586ab75f8d"
70
+ "gitHead": "a24cc6360630314a3ed2ea8fd2cc0c5f02e300ce"
71
71
  }