pob 10.21.0 → 11.0.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 +27 -0
- package/README.md +3 -0
- package/lib/generators/app/PobAppGenerator.js +3 -0
- package/lib/generators/common/babel/CommonBabelGenerator.js +23 -34
- package/lib/generators/common/testing/templates/babel.config.cjs.ejs +1 -1
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +21 -0
- package/lib/generators/common/typescript/templates/tsconfig.json.ejs +5 -2
- package/lib/generators/core/ci/CoreCIGenerator.js +7 -4
- package/lib/generators/core/ci/templates/github-action-node-workflow.yml.ejs +10 -10
- package/lib/generators/core/git/CoreGitGenerator.js +3 -3
- package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +56 -52
- package/lib/generators/monorepo/PobMonorepoGenerator.js +1 -1
- package/lib/generators/monorepo/lerna/templates/workflow-publish.yml.ejs +5 -5
- package/lib/generators/pob/PobBaseGenerator.js +7 -1
- package/lib/utils/writeAndFormat.js +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
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.0.0](https://github.com/christophehurpeau/pob/compare/pob@10.21.0...pob@11.0.0) (2022-11-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* onlyLatestLTS option ([09dc340](https://github.com/christophehurpeau/pob/commit/09dc34022ec86ba2a432306d4eebb60fdaa938b0))
|
|
12
|
+
* **pob:** fix tsconfig for nextjs ([3fb68ad](https://github.com/christophehurpeau/pob/commit/3fb68ad3e6170e020aaaff22ea45147c791b8439))
|
|
13
|
+
* **pob:** writeAndFormat yml singleQuote config ([d5e8ffd](https://github.com/christophehurpeau/pob/commit/d5e8ffd2cdf28ac7ac63eb242e9f1cb11e825247))
|
|
14
|
+
* **true:** dont default to true new options in typescript generator ([76e6a95](https://github.com/christophehurpeau/pob/commit/76e6a95dc58f24465e68dc52bf636c7ca6a5c814))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **deps:** update dependency eslint to v8.26.0 ([#1443](https://github.com/christophehurpeau/pob/issues/1443)) ([1c85a56](https://github.com/christophehurpeau/pob/commit/1c85a56de76fe98a33ab120b10af635f5576c091))
|
|
20
|
+
* **deps:** update dependency eslint to v8.27.0 ([#1451](https://github.com/christophehurpeau/pob/issues/1451)) ([27f6965](https://github.com/christophehurpeau/pob/commit/27f6965e3575b06576b08a3d1cca4697e1b9f6c0))
|
|
21
|
+
* **pob:** publish update to node 16 ([389acd1](https://github.com/christophehurpeau/pob/commit/389acd1c247dbd7a83ed285b4a56592effeec7b3))
|
|
22
|
+
* update to node 16 and ESM ([fcdc84f](https://github.com/christophehurpeau/pob/commit/fcdc84f423ac27fd6324b673b9da340b0d22a738))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### BREAKING CHANGES
|
|
26
|
+
|
|
27
|
+
* drop node 14
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
# [10.21.0](https://github.com/christophehurpeau/pob/compare/pob@10.20.0...pob@10.21.0) (2022-10-19)
|
|
7
34
|
|
|
8
35
|
|
package/README.md
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
10
|
<a href="https://npmjs.org/package/pob"><img src="https://img.shields.io/npm/v/pob.svg?style=flat-square"></a>
|
|
11
|
+
<a href="https://npmjs.org/package/pob"><img src="https://img.shields.io/npm/dw/pob.svg?style=flat-square"></a>
|
|
12
|
+
<a href="https://npmjs.org/package/pob"><img src="https://img.shields.io/node/v/pob.svg?style=flat-square"></a>
|
|
13
|
+
<a href="https://npmjs.org/package/pob"><img src="https://img.shields.io/npm/types/pob.svg?style=flat-square"></a>
|
|
11
14
|
</p>
|
|
12
15
|
|
|
13
16
|
## How to install
|
|
@@ -149,6 +149,9 @@ export default class PobAppGenerator extends Generator {
|
|
|
149
149
|
builddefs: false,
|
|
150
150
|
dom: browser,
|
|
151
151
|
jsx,
|
|
152
|
+
jsxPreserve: this.appConfig.type === 'next.js',
|
|
153
|
+
forceExcludeNodeModules: this.appConfig.type === 'next.js',
|
|
154
|
+
forceAllowJs: this.appConfig.type === 'next.js',
|
|
152
155
|
updateOnly: this.options.updateOnly,
|
|
153
156
|
resolveJsonModule: true,
|
|
154
157
|
baseUrl: (() => {
|
|
@@ -93,9 +93,16 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
93
93
|
babelEnvs.some((env) => env.target === 'node') ? 'node' : undefined,
|
|
94
94
|
babelEnvs.some((env) => env.target === 'browser') ? 'browser' : undefined,
|
|
95
95
|
].filter(Boolean);
|
|
96
|
-
const nodeVersions =
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
const nodeVersions = [
|
|
97
|
+
...new Set(
|
|
98
|
+
babelEnvs
|
|
99
|
+
.filter((env) => env.target === 'node')
|
|
100
|
+
.map((env) => {
|
|
101
|
+
if (env.version === '14') return '16';
|
|
102
|
+
return env.version;
|
|
103
|
+
}),
|
|
104
|
+
),
|
|
105
|
+
];
|
|
99
106
|
const browserVersions = babelEnvs
|
|
100
107
|
.filter((env) => env.target === 'browser')
|
|
101
108
|
.map((env) => (env.version === undefined ? 'supported' : env.version));
|
|
@@ -139,8 +146,8 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
139
146
|
default: nodeVersions,
|
|
140
147
|
choices: [
|
|
141
148
|
{
|
|
142
|
-
name: '
|
|
143
|
-
value: '
|
|
149
|
+
name: '16 (Maintenance LTS)',
|
|
150
|
+
value: '16',
|
|
144
151
|
},
|
|
145
152
|
],
|
|
146
153
|
},
|
|
@@ -164,25 +171,6 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
164
171
|
],
|
|
165
172
|
},
|
|
166
173
|
|
|
167
|
-
{
|
|
168
|
-
type: 'checkbox',
|
|
169
|
-
name: 'formats',
|
|
170
|
-
message: 'Babel formats',
|
|
171
|
-
when: ({ targets = [] }) => targets.length > 0,
|
|
172
|
-
validate: (targets = []) => targets.length > 0,
|
|
173
|
-
default: formats,
|
|
174
|
-
choices: [
|
|
175
|
-
{
|
|
176
|
-
name: 'commonjs',
|
|
177
|
-
value: 'cjs',
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
name: 'ES2015 module',
|
|
181
|
-
value: 'es',
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
},
|
|
185
|
-
|
|
186
174
|
{
|
|
187
175
|
type: 'confirm',
|
|
188
176
|
name: 'jsx',
|
|
@@ -209,12 +197,13 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
209
197
|
...(babelConfig.nodeVersions || []).map((version) => ({
|
|
210
198
|
target: 'node',
|
|
211
199
|
version,
|
|
212
|
-
formats:
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
200
|
+
formats:
|
|
201
|
+
babelConfig.formats && babelConfig.formats.includes('cjs')
|
|
202
|
+
? // eslint-disable-next-line unicorn/no-nested-ternary
|
|
203
|
+
version === '16'
|
|
204
|
+
? babelConfig.formats
|
|
205
|
+
: ['es']
|
|
206
|
+
: babelConfig.formats || ['es'],
|
|
218
207
|
})),
|
|
219
208
|
...(babelConfig.browserVersions || []).map((version) => ({
|
|
220
209
|
target: 'browser',
|
|
@@ -224,7 +213,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
224
213
|
version === 'supported'
|
|
225
214
|
? babelConfig.formats
|
|
226
215
|
: ['es']
|
|
227
|
-
: babelConfig.formats,
|
|
216
|
+
: babelConfig.formats || ['es'],
|
|
228
217
|
})),
|
|
229
218
|
];
|
|
230
219
|
|
|
@@ -396,7 +385,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
396
385
|
case '10':
|
|
397
386
|
case '12':
|
|
398
387
|
case '14':
|
|
399
|
-
pkg.engines.node = '
|
|
388
|
+
pkg.engines.node = '>=16.0.0';
|
|
400
389
|
break;
|
|
401
390
|
case '16':
|
|
402
391
|
pkg.engines.node = '>=16.0.0';
|
|
@@ -422,7 +411,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
422
411
|
packageUtils.removeDependencies(pkg, ['@types/node']);
|
|
423
412
|
packageUtils.removeDevDependencies(pkg, ['@types/node']);
|
|
424
413
|
// Supported LTS versions of node, that supports ESM modules.
|
|
425
|
-
pkg.engines.node = '
|
|
414
|
+
pkg.engines.node = '>=16.0.0';
|
|
426
415
|
}
|
|
427
416
|
|
|
428
417
|
/* browserslist */
|
|
@@ -505,7 +494,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
505
494
|
'14.13.1',
|
|
506
495
|
)
|
|
507
496
|
) {
|
|
508
|
-
pkg.engines.node = '
|
|
497
|
+
pkg.engines.node = '>=16.0.0';
|
|
509
498
|
}
|
|
510
499
|
}
|
|
511
500
|
|
|
@@ -8,7 +8,7 @@ module.exports = function babelConfig(api) {
|
|
|
8
8
|
return {
|
|
9
9
|
only: [<%- only %>],
|
|
10
10
|
presets: [
|
|
11
|
-
[require.resolve('pob-babel/preset.
|
|
11
|
+
[require.resolve('pob-babel/preset.js')<% if (!jestExperimentalESM) { %>, { modules: 'commonjs' }<% } %>]
|
|
12
12
|
<% if (hasReact) { %>, [
|
|
13
13
|
'@babel/preset-react',
|
|
14
14
|
{
|
|
@@ -26,6 +26,24 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
26
26
|
desc: 'enable jsx with typescript',
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
+
this.option('jsxPreserve', {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
defaults: false,
|
|
32
|
+
desc: 'force jsx preserve in tsconfig for legacy apps (nextjs, CRA)',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
this.option('forceExcludeNodeModules', {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
defaults: false,
|
|
38
|
+
desc: 'force exclude node_modules for legacy apps (nextjs, CRA)',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
this.option('forceAllowJs', {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
defaults: false,
|
|
44
|
+
desc: 'force allow js for legacy apps (nextjs, CRA)',
|
|
45
|
+
});
|
|
46
|
+
|
|
29
47
|
this.option('dom', {
|
|
30
48
|
type: Boolean,
|
|
31
49
|
defaults: true,
|
|
@@ -154,10 +172,13 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
154
172
|
monorepoPackageReferences,
|
|
155
173
|
rootDir: this.options.rootDir,
|
|
156
174
|
jsx,
|
|
175
|
+
jsxPreserve: this.options.jsxPreserve,
|
|
157
176
|
composite,
|
|
158
177
|
dom,
|
|
159
178
|
baseUrl: this.options.baseUrl,
|
|
160
179
|
resolveJsonModule: this.options.resolveJsonModule,
|
|
180
|
+
forceExcludeNodeModules: this.options.forceExcludeNodeModules,
|
|
181
|
+
forceAllowJs: this.options.forceAllowJs,
|
|
161
182
|
},
|
|
162
183
|
);
|
|
163
184
|
copyAndFormatTpl(
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"<%= rootDir %>/**/*.ts"<% if (jsx) { -%>,
|
|
4
4
|
"<%= rootDir %>/**/*.tsx"<% } %>
|
|
5
5
|
],
|
|
6
|
-
<% if(rootDir === '.') { -%>
|
|
6
|
+
<% if(rootDir === '.' || forceExcludeNodeModules) { -%>
|
|
7
7
|
"exclude": [
|
|
8
8
|
"node_modules"
|
|
9
9
|
],
|
|
@@ -31,8 +31,11 @@
|
|
|
31
31
|
"target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
|
|
32
32
|
"module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
|
33
33
|
"lib": [<%- dom ? '"dom", ' : '' %>"esnext"], /* Polyfills are imported either by babel or with polyfill.io */
|
|
34
|
-
<%= jsx ? '' : '// ' %>"jsx": "react-jsx", /* 'react-jsx' is used with react/jsx-runtime (react >=17 || >= 16.14.0 | >= 15.7.0) */
|
|
34
|
+
<%= jsx ? '' : '// ' %>"jsx": "<%= jsxPreserve ? 'preserve' : 'react-jsx' %>", /* 'react-jsx' is used with react/jsx-runtime (react >=17 || >= 16.14.0 | >= 15.7.0) */
|
|
35
35
|
"isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
36
|
+
<% if(forceAllowJs) { -%>
|
|
37
|
+
"allowJs": true,
|
|
38
|
+
<% } -%>
|
|
36
39
|
|
|
37
40
|
/* Enable all strict type-checking options. */
|
|
38
41
|
"strict": true,
|
|
@@ -67,6 +67,12 @@ export default class CoreCIGenerator extends Generator {
|
|
|
67
67
|
required: true,
|
|
68
68
|
desc: 'is app',
|
|
69
69
|
});
|
|
70
|
+
|
|
71
|
+
this.option('onlyLatestLTS', {
|
|
72
|
+
type: String,
|
|
73
|
+
required: true,
|
|
74
|
+
desc: 'only latest lts',
|
|
75
|
+
});
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
async prompting() {
|
|
@@ -111,10 +117,7 @@ export default class CoreCIGenerator extends Generator {
|
|
|
111
117
|
build: this.options.build,
|
|
112
118
|
typescript: this.options.typescript,
|
|
113
119
|
codecov: this.options.codecov,
|
|
114
|
-
|
|
115
|
-
!this.options.isApp ||
|
|
116
|
-
inLerna.pobConfig?.project?.supportsNode14 !== false,
|
|
117
|
-
|
|
120
|
+
onlyLatestLTS: this.options.onlyLatestLTS,
|
|
118
121
|
isReleasePleaseEnabled: this.isReleasePleaseEnabled,
|
|
119
122
|
publishSinglePackage: this.isReleasePleaseEnabled && !pkg.private,
|
|
120
123
|
publishMonorepo:
|
|
@@ -8,7 +8,7 @@ jobs:
|
|
|
8
8
|
|
|
9
9
|
strategy:
|
|
10
10
|
matrix:
|
|
11
|
-
node-version: [<% if (
|
|
11
|
+
node-version: [<% if (!onlyLatestLTS) { -%>16.x, <% } -%>18.x]
|
|
12
12
|
|
|
13
13
|
steps:
|
|
14
14
|
- uses: actions/checkout@v3
|
|
@@ -35,27 +35,27 @@ jobs:
|
|
|
35
35
|
<% if (build) { -%>
|
|
36
36
|
- name: Build
|
|
37
37
|
run: yarn run build
|
|
38
|
-
if: startsWith(matrix.node-version, '
|
|
38
|
+
if: startsWith(matrix.node-version, '18.')
|
|
39
39
|
|
|
40
40
|
<% } -%>
|
|
41
41
|
- name: Prettier
|
|
42
42
|
run: <%= packageManager %> run lint:prettier
|
|
43
|
-
if: startsWith(matrix.node-version, '
|
|
43
|
+
if: startsWith(matrix.node-version, '18.')
|
|
44
44
|
<% if (typescript) { -%>
|
|
45
45
|
|
|
46
46
|
- name: Typescript
|
|
47
47
|
run: yarn run tsc
|
|
48
|
-
if: startsWith(matrix.node-version, '
|
|
48
|
+
if: startsWith(matrix.node-version, '18.')
|
|
49
49
|
<% } -%>
|
|
50
50
|
|
|
51
51
|
- name: Eslint
|
|
52
52
|
run: <%= packageManager %> run lint:eslint
|
|
53
|
-
if: startsWith(matrix.node-version, '
|
|
53
|
+
if: startsWith(matrix.node-version, '18.')
|
|
54
54
|
<% if (codecov) { -%>
|
|
55
55
|
|
|
56
56
|
- name: Generate Test Coverage
|
|
57
57
|
run: <%= packageManager %> run test --coverage --coverageReporters=json --coverageReporters=text
|
|
58
|
-
if: startsWith(matrix.node-version, '
|
|
58
|
+
if: startsWith(matrix.node-version, '18.')
|
|
59
59
|
env:
|
|
60
60
|
CI: true
|
|
61
61
|
|
|
@@ -63,7 +63,7 @@ jobs:
|
|
|
63
63
|
uses: codecov/codecov-action@v3
|
|
64
64
|
with:
|
|
65
65
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
66
|
-
if: startsWith(matrix.node-version, '
|
|
66
|
+
if: startsWith(matrix.node-version, '18.')
|
|
67
67
|
<% } else if (testing) { -%>
|
|
68
68
|
|
|
69
69
|
- name: Test
|
|
@@ -74,13 +74,13 @@ jobs:
|
|
|
74
74
|
<% if (true) { -%>
|
|
75
75
|
|
|
76
76
|
- name: Check nothing was forgotten before commit
|
|
77
|
-
if: startsWith(matrix.node-version, '
|
|
77
|
+
if: startsWith(matrix.node-version, '18.')
|
|
78
78
|
run: <%= packageManager === 'npm' ? 'npx' : 'yarn run' %> repository-check-dirty
|
|
79
79
|
<% } -%>
|
|
80
80
|
|
|
81
81
|
<% if (isReleasePleaseEnabled) { -%>
|
|
82
82
|
- uses: GoogleCloudPlatform/release-please-action@v3
|
|
83
|
-
if: ${{ startsWith(matrix.node-version, '
|
|
83
|
+
if: ${{ startsWith(matrix.node-version, '18.') && github.ref == 'refs/heads/main' }}
|
|
84
84
|
id: release
|
|
85
85
|
with:
|
|
86
86
|
token: ${{ secrets.GH_TOKEN }}
|
|
@@ -91,7 +91,7 @@ jobs:
|
|
|
91
91
|
|
|
92
92
|
# publish:
|
|
93
93
|
- run: npm publish
|
|
94
|
-
if: ${{ startsWith(matrix.node-version, '
|
|
94
|
+
if: ${{ startsWith(matrix.node-version, '18.') && github.ref == 'refs/heads/main' && steps.release.outputs.release_created }}
|
|
95
95
|
env:
|
|
96
96
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
97
97
|
<% } -%>
|
|
@@ -14,10 +14,10 @@ export default class CoreGitGenerator extends Generator {
|
|
|
14
14
|
desc: 'Should create the repo on github',
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
this.option('
|
|
17
|
+
this.option('onlyLatestLTS', {
|
|
18
18
|
type: String,
|
|
19
19
|
required: true,
|
|
20
|
-
desc: '
|
|
20
|
+
desc: 'only latest lts',
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -100,7 +100,7 @@ export default class CoreGitGenerator extends Generator {
|
|
|
100
100
|
shouldCreate: !this.originUrl,
|
|
101
101
|
gitHostAccount: this.gitHostAccount,
|
|
102
102
|
repoName: this.repoName,
|
|
103
|
-
|
|
103
|
+
onlyLatestLTS: this.options.onlyLatestLTS,
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -1,40 +1,47 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import fetch from 'node-fetch';
|
|
4
4
|
import Generator from 'yeoman-generator';
|
|
5
5
|
// const packageUtils = require('../../../../../utils/package');
|
|
6
6
|
|
|
7
7
|
const GITHUB_TOKEN = process.env.POB_GITHUB_TOKEN;
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const
|
|
9
|
+
const postJson = (url, jsonBody) =>
|
|
10
|
+
fetch(`https://api.github.com/${url}`, {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
body: JSON.stringify(jsonBody),
|
|
13
|
+
headers: {
|
|
14
|
+
authorization: `token ${GITHUB_TOKEN}`,
|
|
15
|
+
},
|
|
16
|
+
}).then((res) => (res.ok ? res.json() : null));
|
|
17
|
+
|
|
18
|
+
const putJson = (url, jsonBody) =>
|
|
19
|
+
fetch(`https://api.github.com/${url}`, {
|
|
20
|
+
method: 'PUT',
|
|
21
|
+
body: JSON.stringify(jsonBody),
|
|
22
|
+
headers: {
|
|
23
|
+
authorization: `token ${GITHUB_TOKEN}`,
|
|
24
|
+
},
|
|
25
|
+
}).then((res) => (res.ok ? res.json() : null));
|
|
26
|
+
|
|
27
|
+
const configureProtectionRule = async (owner, repo, onlyLatestLTS) => {
|
|
19
28
|
for (const branch of ['main', 'master']) {
|
|
20
29
|
try {
|
|
21
|
-
await
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
].filter(Boolean),
|
|
30
|
-
},
|
|
31
|
-
enforce_admins: false, // true,
|
|
32
|
-
required_pull_request_reviews: null,
|
|
33
|
-
restrictions: null,
|
|
34
|
-
required_linear_history: true,
|
|
35
|
-
allow_force_pushes: true, // false
|
|
36
|
-
allow_deletions: false,
|
|
30
|
+
await putJson(`repos/${owner}/${repo}/branches/${branch}/protection`, {
|
|
31
|
+
required_status_checks: {
|
|
32
|
+
strict: false,
|
|
33
|
+
contexts: [
|
|
34
|
+
!onlyLatestLTS && 'build (16.x)',
|
|
35
|
+
'build (18.x)',
|
|
36
|
+
'reviewflow',
|
|
37
|
+
].filter(Boolean),
|
|
37
38
|
},
|
|
39
|
+
enforce_admins: false, // true,
|
|
40
|
+
required_pull_request_reviews: null,
|
|
41
|
+
restrictions: null,
|
|
42
|
+
required_linear_history: true,
|
|
43
|
+
allow_force_pushes: true, // false
|
|
44
|
+
allow_deletions: false,
|
|
38
45
|
});
|
|
39
46
|
if (branch === 'master') {
|
|
40
47
|
console.warn('You should rename your "master" branch to "main"');
|
|
@@ -71,10 +78,10 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
71
78
|
desc: 'repo name',
|
|
72
79
|
});
|
|
73
80
|
|
|
74
|
-
this.option('
|
|
81
|
+
this.option('onlyLatestLTS', {
|
|
75
82
|
type: String,
|
|
76
83
|
required: true,
|
|
77
|
-
desc: '
|
|
84
|
+
desc: 'only latest lts',
|
|
78
85
|
});
|
|
79
86
|
|
|
80
87
|
if (!GITHUB_TOKEN && process.env.CI !== 'true') {
|
|
@@ -98,17 +105,15 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
98
105
|
try {
|
|
99
106
|
if (this.options.shouldCreate) {
|
|
100
107
|
try {
|
|
101
|
-
await
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
allow_rebase_merge: true,
|
|
111
|
-
},
|
|
108
|
+
await postJson('user/repos', {
|
|
109
|
+
name,
|
|
110
|
+
description: pkg.description,
|
|
111
|
+
homepage: null,
|
|
112
|
+
private: false,
|
|
113
|
+
auto_init: false,
|
|
114
|
+
allow_squash_merge: true,
|
|
115
|
+
allow_merge_commit: false,
|
|
116
|
+
allow_rebase_merge: true,
|
|
112
117
|
});
|
|
113
118
|
} catch (err) {
|
|
114
119
|
console.error('Failed to create repository');
|
|
@@ -147,7 +152,7 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
147
152
|
cwd,
|
|
148
153
|
});
|
|
149
154
|
|
|
150
|
-
configureProtectionRule(owner, repo, this.options.
|
|
155
|
+
configureProtectionRule(owner, repo, this.options.onlyLatestLTS);
|
|
151
156
|
|
|
152
157
|
// await gh.put(`/repos/${owner}/${repo}/topics`, {
|
|
153
158
|
// names: pkg.keywords,
|
|
@@ -158,21 +163,20 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
158
163
|
}
|
|
159
164
|
} else {
|
|
160
165
|
console.log('sync github info');
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
|
|
167
|
+
await postJson(`repos/${owner}/${repo}`, {
|
|
168
|
+
name: repo,
|
|
169
|
+
/* pkg.name
|
|
165
170
|
.replace(/-(lerna|monorepo)$/, '')
|
|
166
171
|
.replace(/^@([^-]*)-/, '$1-') */
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
},
|
|
172
|
+
description: pkg.description,
|
|
173
|
+
// homepage: null,
|
|
174
|
+
allow_squash_merge: true,
|
|
175
|
+
allow_merge_commit: false,
|
|
176
|
+
allow_rebase_merge: true,
|
|
173
177
|
});
|
|
174
178
|
|
|
175
|
-
configureProtectionRule(owner, repo, this.options.
|
|
179
|
+
configureProtectionRule(owner, repo, this.options.onlyLatestLTS);
|
|
176
180
|
}
|
|
177
181
|
}
|
|
178
182
|
}
|
|
@@ -317,7 +317,7 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
317
317
|
packageUtils.addOrRemoveScripts(pkg, rollupConfigs.length > 0, {
|
|
318
318
|
'clean:build': `(${pkg.workspaces
|
|
319
319
|
.map((workspaces) => `rm -Rf ${workspaces}/dist ${workspaces}/build`)
|
|
320
|
-
.join('
|
|
320
|
+
.join(' ; ')}) || true`,
|
|
321
321
|
build: 'yarn clean:build && rollup --config rollup.config.mjs',
|
|
322
322
|
watch: 'yarn clean:build && rollup --config rollup.config.mjs --watch',
|
|
323
323
|
});
|
|
@@ -3,9 +3,9 @@ on:
|
|
|
3
3
|
workflow_dispatch:
|
|
4
4
|
inputs:
|
|
5
5
|
dry-run:
|
|
6
|
-
description:
|
|
6
|
+
description: "Dry run? (y/N)"
|
|
7
7
|
required: true
|
|
8
|
-
default:
|
|
8
|
+
default: "N"
|
|
9
9
|
|
|
10
10
|
jobs:
|
|
11
11
|
publish:
|
|
@@ -18,7 +18,7 @@ jobs:
|
|
|
18
18
|
|
|
19
19
|
- uses: actions/setup-node@v3
|
|
20
20
|
with:
|
|
21
|
-
node-version:
|
|
21
|
+
node-version: 18
|
|
22
22
|
|
|
23
23
|
- name: Install Dependencies
|
|
24
24
|
run: yarn install --immutable --immutable-cache
|
|
@@ -54,8 +54,8 @@ jobs:
|
|
|
54
54
|
github.ref == 'refs/heads/main'
|
|
55
55
|
&& contains(github.event.inputs.dry-run, 'y') == false
|
|
56
56
|
with:
|
|
57
|
-
node-version:
|
|
58
|
-
registry-url:
|
|
57
|
+
node-version: 18
|
|
58
|
+
registry-url: "https://registry.npmjs.org"
|
|
59
59
|
|
|
60
60
|
- run: lerna publish from-git --no-verify-access --yes
|
|
61
61
|
if: |
|
|
@@ -155,9 +155,15 @@ export default class PobBaseGenerator extends Generator {
|
|
|
155
155
|
yarnNodeLinker: this.projectConfig.yarnNodeLinker,
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
+
const onlyLatestLTS =
|
|
159
|
+
this.projectConfig.type === 'app' ||
|
|
160
|
+
(inLerna &&
|
|
161
|
+
(inLerna.pobConfig?.project?.supportsNode14 === false ||
|
|
162
|
+
inLerna.pobConfig?.project?.onlyLatestLTS === true));
|
|
163
|
+
|
|
158
164
|
if (!this.inLerna) {
|
|
159
165
|
this.composeWith('pob:core:git', {
|
|
160
|
-
|
|
166
|
+
onlyLatestLTS,
|
|
161
167
|
});
|
|
162
168
|
} else {
|
|
163
169
|
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": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"type": "module",
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": "
|
|
21
|
+
"node": ">=16.0.0"
|
|
22
22
|
},
|
|
23
23
|
"main": "./lib/index.js",
|
|
24
24
|
"exports": {
|
|
@@ -40,14 +40,13 @@
|
|
|
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": "
|
|
44
|
-
"@pob/sort-object": "
|
|
45
|
-
"@pob/sort-pkg": "
|
|
46
|
-
"eslint": "8.
|
|
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",
|
|
47
47
|
"findup-sync": "^5.0.0",
|
|
48
48
|
"git-remote-url": "^1.0.1",
|
|
49
49
|
"github-username": "^6.0.0",
|
|
50
|
-
"got": "^11.8.3",
|
|
51
50
|
"inquirer-npm-name": "^4.0.0",
|
|
52
51
|
"js-yaml": "^4.1.0",
|
|
53
52
|
"json5": "^2.2.1",
|
|
@@ -56,15 +55,16 @@
|
|
|
56
55
|
"mem-fs": "2.2.1",
|
|
57
56
|
"mem-fs-editor": "9.5.0",
|
|
58
57
|
"minimist": "1.2.7",
|
|
58
|
+
"node-fetch": "3.3.0",
|
|
59
59
|
"parse-author": "2.0.0",
|
|
60
|
-
"pob-dependencies": "
|
|
60
|
+
"pob-dependencies": "7.0.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": "
|
|
67
|
+
"@pob/root": "7.0.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "bc7651f464269099759abba08194fc016f5ecf8b"
|
|
70
70
|
}
|