pob 8.7.0 → 8.8.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 +35 -0
- package/lib/generators/lib/PobLibGenerator.js +11 -40
- package/lib/generators/lib/release/LibReleaseGenerator.js +80 -0
- package/lib/generators/lib/release/templates/release-please.yml.ejs +34 -0
- package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +19 -27
- package/lib/generators/monorepo/lerna/templates/workflow-publish.yml.ejs +77 -0
- package/lib/pob.js +6 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
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
|
+
## [8.8.2](https://github.com/christophehurpeau/pob/compare/pob@8.8.1...pob@8.8.2) (2021-11-14)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package pob
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [8.8.1](https://github.com/christophehurpeau/pob/compare/pob@8.8.0...pob@8.8.1) (2021-11-14)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package pob
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [8.8.0](https://github.com/christophehurpeau/pob/compare/pob@8.7.1...pob@8.8.0) (2021-11-14)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* release libs using github ([3c09271](https://github.com/christophehurpeau/pob/commit/3c0927168a7bd755311470212a8699a560a52174))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [8.7.1](https://github.com/christophehurpeau/pob/compare/pob@8.7.0...pob@8.7.1) (2021-11-11)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package pob
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
# [8.7.0](https://github.com/christophehurpeau/pob/compare/pob@8.6.0...pob@8.7.0) (2021-11-11)
|
|
7
42
|
|
|
8
43
|
|
|
@@ -2,7 +2,6 @@ import { execSync } from 'child_process';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import Generator from 'yeoman-generator';
|
|
4
4
|
import inLerna from '../../utils/inLerna.js';
|
|
5
|
-
import inNpmLerna from '../../utils/inNpmLerna.js';
|
|
6
5
|
import * as packageUtils from '../../utils/package.js';
|
|
7
6
|
|
|
8
7
|
export default class PobLibGenerator extends Generator {
|
|
@@ -273,6 +272,12 @@ export default class PobLibGenerator extends Generator {
|
|
|
273
272
|
codecov: this.pobjson.testing && this.pobjson.testing.codecov,
|
|
274
273
|
});
|
|
275
274
|
|
|
275
|
+
this.composeWith('pob:lib:release', {
|
|
276
|
+
enable: !inLerna,
|
|
277
|
+
withBabel: babelEnvs.length > 0,
|
|
278
|
+
documentation: !!this.pobjson.documentation,
|
|
279
|
+
});
|
|
280
|
+
|
|
276
281
|
// must be after doc, testing
|
|
277
282
|
this.composeWith('pob:core:gitignore', {
|
|
278
283
|
root: !inLerna,
|
|
@@ -291,8 +296,6 @@ export default class PobLibGenerator extends Generator {
|
|
|
291
296
|
writing() {
|
|
292
297
|
// Re-read the content at this point because a composed generator might modify it.
|
|
293
298
|
const pkg = this.fs.readJSON(this.destinationPath('package.json'));
|
|
294
|
-
const isNpmPackageLock = this.fs.exists('package-lock.json');
|
|
295
|
-
const isNpm = isNpmPackageLock || inNpmLerna;
|
|
296
299
|
|
|
297
300
|
if (pkg.engines) {
|
|
298
301
|
delete pkg.engines.yarn;
|
|
@@ -313,44 +316,12 @@ export default class PobLibGenerator extends Generator {
|
|
|
313
316
|
delete pkg.scripts.release;
|
|
314
317
|
delete pkg.scripts.version;
|
|
315
318
|
}
|
|
319
|
+
} else if (withBabel) {
|
|
320
|
+
packageUtils.addScripts(pkg, {
|
|
321
|
+
clean: 'rm -Rf dist',
|
|
322
|
+
});
|
|
316
323
|
} else {
|
|
317
|
-
|
|
318
|
-
this.fs.exists(
|
|
319
|
-
this.destinationPath('.github/workflows/release-please.yml'),
|
|
320
|
-
)
|
|
321
|
-
) {
|
|
322
|
-
packageUtils.removeDevDependencies(pkg, ['standard-version']);
|
|
323
|
-
packageUtils.removeScripts(pkg, ['release', 'preversion']);
|
|
324
|
-
} else {
|
|
325
|
-
packageUtils.addDevDependencies(pkg, ['standard-version']);
|
|
326
|
-
if (pkg.name !== 'pob-monorepo') {
|
|
327
|
-
packageUtils.addScripts(pkg, {
|
|
328
|
-
release:
|
|
329
|
-
"repository-check-dirty && yarn preversion && standard-version -a -m 'chore(release): %s [skip ci]' && git push --follow-tags origin master && npm publish",
|
|
330
|
-
preversion: [
|
|
331
|
-
`${isNpm ? 'npm' : 'yarn'} run lint`,
|
|
332
|
-
withBabel && `${isNpm ? 'npm' : 'yarn'} run build`,
|
|
333
|
-
this.pobjson.documentation &&
|
|
334
|
-
`${isNpm ? 'npm' : 'yarn'} run generate:docs`,
|
|
335
|
-
'repository-check-dirty',
|
|
336
|
-
]
|
|
337
|
-
.filter(Boolean)
|
|
338
|
-
.join(' && '),
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
if (pkg.scripts.version === 'pob-version') {
|
|
342
|
-
delete pkg.scripts.version;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
if (withBabel) {
|
|
348
|
-
packageUtils.addScripts(pkg, {
|
|
349
|
-
clean: 'rm -Rf dist',
|
|
350
|
-
});
|
|
351
|
-
} else {
|
|
352
|
-
delete pkg.scripts.clean;
|
|
353
|
-
}
|
|
324
|
+
delete pkg.scripts.clean;
|
|
354
325
|
}
|
|
355
326
|
|
|
356
327
|
if (!withBabel) {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import Generator from 'yeoman-generator';
|
|
2
|
+
import inLerna from '../../../utils/inLerna.js';
|
|
3
|
+
import * as packageUtils from '../../../utils/package.js';
|
|
4
|
+
|
|
5
|
+
export default class LibReleaseGenerator extends Generator {
|
|
6
|
+
constructor(args, opts) {
|
|
7
|
+
super(args, opts);
|
|
8
|
+
|
|
9
|
+
this.option('enable', {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
required: true,
|
|
12
|
+
desc: 'If releasing is enabled',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
this.option('withBabel', {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
required: false,
|
|
18
|
+
defaults: undefined,
|
|
19
|
+
desc: 'Babel enabled.',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
this.option('documentation', {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
required: true,
|
|
25
|
+
desc: 'Include documentation',
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
writing() {
|
|
30
|
+
const pkg = this.fs.readJSON(this.destinationPath('package.json'));
|
|
31
|
+
|
|
32
|
+
const isReleasePleaseEnabled =
|
|
33
|
+
this.options.enable &&
|
|
34
|
+
this.fs.exists(
|
|
35
|
+
this.destinationPath('.github/workflows/release-please.yml'),
|
|
36
|
+
);
|
|
37
|
+
const isStandardVersionEnabled =
|
|
38
|
+
this.options.enable && !isReleasePleaseEnabled;
|
|
39
|
+
|
|
40
|
+
if (!isStandardVersionEnabled) {
|
|
41
|
+
packageUtils.removeDevDependencies(pkg, ['standard-version']);
|
|
42
|
+
packageUtils.removeScripts(pkg, ['release', 'preversion']);
|
|
43
|
+
} else {
|
|
44
|
+
packageUtils.addDevDependencies(pkg, ['standard-version']);
|
|
45
|
+
packageUtils.addScripts(pkg, {
|
|
46
|
+
release:
|
|
47
|
+
"repository-check-dirty && yarn preversion && standard-version -a -m 'chore(release): %s [skip ci]' && git push --follow-tags origin master && npm publish",
|
|
48
|
+
preversion: [
|
|
49
|
+
'yarn run lint',
|
|
50
|
+
this.options.withBabel && 'yarn run build',
|
|
51
|
+
this.options.documentation && 'yarn run generate:docs',
|
|
52
|
+
'repository-check-dirty',
|
|
53
|
+
]
|
|
54
|
+
.filter(Boolean)
|
|
55
|
+
.join(' && '),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (pkg.scripts.version === 'pob-version') {
|
|
59
|
+
delete pkg.scripts.version;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!isReleasePleaseEnabled) {
|
|
64
|
+
this.fs.delete(
|
|
65
|
+
this.destinationPath('.github/workflows/release-please.yml'),
|
|
66
|
+
);
|
|
67
|
+
} else {
|
|
68
|
+
this.fs.copyTpl(
|
|
69
|
+
this.templatePath('release-please.yml.ejs'),
|
|
70
|
+
this.destinationPath('.github/workflows/release-please.yml'),
|
|
71
|
+
{
|
|
72
|
+
isLerna: !!inLerna,
|
|
73
|
+
// publish: ...
|
|
74
|
+
},
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: release-please
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release-please:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: GoogleCloudPlatform/release-please-action@v2
|
|
13
|
+
id: release
|
|
14
|
+
with:
|
|
15
|
+
token: ${{ secrets.GH_TOKEN }}
|
|
16
|
+
release-type: node
|
|
17
|
+
package-name: release-please-action
|
|
18
|
+
|
|
19
|
+
# publish:
|
|
20
|
+
- uses: actions/checkout@v2
|
|
21
|
+
# these if statements ensure that a publication only occurs when
|
|
22
|
+
# a new release is created:
|
|
23
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-node@v2
|
|
26
|
+
with:
|
|
27
|
+
node-version: 14
|
|
28
|
+
registry-url: 'https://registry.npmjs.org'
|
|
29
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
30
|
+
|
|
31
|
+
- run: npm publish
|
|
32
|
+
env:
|
|
33
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
34
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
@@ -177,37 +177,29 @@ export default class MonorepoLernaGenerator extends Generator {
|
|
|
177
177
|
'lint:eslint':
|
|
178
178
|
monorepoConfig &&
|
|
179
179
|
monorepoConfig.eslint &&
|
|
180
|
-
|
|
181
|
-
(this.packagesConfig.length < 25 ||
|
|
182
|
-
this.options.packageManager === 'yarn')
|
|
180
|
+
this.packagesConfig.length < 25
|
|
183
181
|
? 'eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet .'
|
|
182
|
+
: // eslint-disable-next-line unicorn/no-nested-ternary
|
|
183
|
+
this.options.packageManager === 'yarn'
|
|
184
|
+
? 'yarn workspaces foreach --parallel -Av run lint'
|
|
184
185
|
: 'lerna run --stream lint',
|
|
185
|
-
preversion: [
|
|
186
|
-
monorepoConfig &&
|
|
187
|
-
monorepoConfig.eslint &&
|
|
188
|
-
(this.packagesConfig.length < 25 ||
|
|
189
|
-
this.options.packageManager === 'yarn')
|
|
190
|
-
? `${packageManager} run lint`
|
|
191
|
-
: `${packageManager} run lint:prettier && ${packageManager} run lint:eslint${
|
|
192
|
-
useYarnWorkspacesCommand ? '' : ' --since'
|
|
193
|
-
}`,
|
|
194
|
-
withBabel && `${packageManager} run build`,
|
|
195
|
-
'repository-check-dirty',
|
|
196
|
-
]
|
|
197
|
-
.filter(Boolean)
|
|
198
|
-
.join(' && '),
|
|
199
|
-
// cannot use this with lerna because it changes packages.json
|
|
200
|
-
// prepublishOnly: 'repository-check-dirty',
|
|
201
|
-
release: [
|
|
202
|
-
`${
|
|
203
|
-
this.options.packageManager === 'yarn' ? '' : 'cross-env '
|
|
204
|
-
}GH_TOKEN=$POB_GITHUB_TOKEN lerna version --conventional-commits --conventional-graduate --create-release=github -m 'chore: release'`,
|
|
205
|
-
!this.options.isAppProject && 'lerna publish from-git',
|
|
206
|
-
]
|
|
207
|
-
.filter(Boolean)
|
|
208
|
-
.join(' && '),
|
|
209
186
|
});
|
|
210
187
|
|
|
188
|
+
this.fs.copyTpl(
|
|
189
|
+
this.templatePath('workflow-publish.yml.ejs'),
|
|
190
|
+
this.destinationPath('.github/workflows/publish.yml'),
|
|
191
|
+
{
|
|
192
|
+
publish: !this.options.isAppProject,
|
|
193
|
+
},
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
packageUtils.removeScripts(
|
|
197
|
+
pkg,
|
|
198
|
+
[pkg.name !== 'pob-dependencies' && 'preversion', 'release'].filter(
|
|
199
|
+
Boolean,
|
|
200
|
+
),
|
|
201
|
+
);
|
|
202
|
+
|
|
211
203
|
packageUtils.addOrRemoveScripts(pkg, withTests, {
|
|
212
204
|
test: `${
|
|
213
205
|
useYarnWorkspacesCommand
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
on:
|
|
3
|
+
workflow_dispatch:
|
|
4
|
+
inputs:
|
|
5
|
+
dry-run:
|
|
6
|
+
description: 'Dry run? (y/N)'
|
|
7
|
+
required: true
|
|
8
|
+
default: 'N'
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v2
|
|
15
|
+
with:
|
|
16
|
+
token: ${{ secrets.GH_TOKEN }}
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-node@v2
|
|
20
|
+
with:
|
|
21
|
+
node-version: 14
|
|
22
|
+
|
|
23
|
+
- name: Cache dependencies
|
|
24
|
+
uses: actions/cache@v2
|
|
25
|
+
with:
|
|
26
|
+
path: |
|
|
27
|
+
.yarn/unplugged
|
|
28
|
+
.yarn/build-state.yml
|
|
29
|
+
.yarn/install-state.gz
|
|
30
|
+
key: v2-dependencies--${{ matrix.node-version }}-${{ runner.OS }}-${{ hashFiles('yarn.lock') }}
|
|
31
|
+
restore-keys: |
|
|
32
|
+
v2-dependencies--${{ matrix.node-version }}-${{ runner.OS }}-
|
|
33
|
+
v2-dependencies--${{ matrix.node-version }}-
|
|
34
|
+
|
|
35
|
+
- name: Check Dependencies
|
|
36
|
+
run: yarn install --immutable --immutable-cache
|
|
37
|
+
|
|
38
|
+
- name: New version (dry run)
|
|
39
|
+
if: |
|
|
40
|
+
github.ref == 'refs/heads/main'
|
|
41
|
+
&& contains(github.event.inputs.dry-run, 'y')
|
|
42
|
+
run: yarn lerna version --yes --no-push --conventional-commits --conventional-graduate --no-git-tag-version --loglevel=verbose
|
|
43
|
+
|
|
44
|
+
- name: Configure Git user
|
|
45
|
+
if: |
|
|
46
|
+
github.ref == 'refs/heads/main'
|
|
47
|
+
&& contains(github.event.inputs.dry-run, 'y') == false
|
|
48
|
+
run: |
|
|
49
|
+
git config --global user.name 'github-actions[bot]'
|
|
50
|
+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
51
|
+
|
|
52
|
+
- name: New version
|
|
53
|
+
if: |
|
|
54
|
+
github.ref == 'refs/heads/main'
|
|
55
|
+
&& contains(github.event.inputs.dry-run, 'y') == false
|
|
56
|
+
run: |
|
|
57
|
+
yarn lerna version --yes --push --conventional-commits --conventional-graduate --create-release=github -m 'chore: release [skip ci]'
|
|
58
|
+
env:
|
|
59
|
+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
60
|
+
YARN_ENABLE_IMMUTABLE_INSTALLS: false
|
|
61
|
+
<% if (publish) { -%>
|
|
62
|
+
|
|
63
|
+
- uses: actions/setup-node@v2
|
|
64
|
+
if: |
|
|
65
|
+
github.ref == 'refs/heads/main'
|
|
66
|
+
&& contains(github.event.inputs.dry-run, 'y') == false
|
|
67
|
+
with:
|
|
68
|
+
node-version: 14
|
|
69
|
+
registry-url: 'https://registry.npmjs.org'
|
|
70
|
+
|
|
71
|
+
- run: lerna publish from-git --no-verify-access --yes
|
|
72
|
+
if: |
|
|
73
|
+
github.ref == 'refs/heads/main'
|
|
74
|
+
&& contains(github.event.inputs.dry-run, 'y') == false
|
|
75
|
+
env:
|
|
76
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
77
|
+
<% } -%>
|
package/lib/pob.js
CHANGED
|
@@ -29,6 +29,7 @@ import CoreYarnGenerator from './generators/core/yarn/CoreYarnGenerator.js';
|
|
|
29
29
|
import PobLibGenerator from './generators/lib/PobLibGenerator.js';
|
|
30
30
|
import LibDocGenerator from './generators/lib/doc/LibDocGenerator.js';
|
|
31
31
|
import LibReadmeGenerator from './generators/lib/readme/LibReadmeGenerator.js';
|
|
32
|
+
import LibReleaseGenerator from './generators/lib/release/LibReleaseGenerator.js';
|
|
32
33
|
import PobMonorepoGenerator from './generators/monorepo/PobMonorepoGenerator.js';
|
|
33
34
|
import MonorepoLernaGenerator from './generators/monorepo/lerna/MonorepoLernaGenerator.js';
|
|
34
35
|
import MonorepoTypescriptGenerator from './generators/monorepo/typescript/MonorepoTypescriptGenerator.js';
|
|
@@ -187,6 +188,11 @@ env.registerStub(
|
|
|
187
188
|
'pob:lib:readme',
|
|
188
189
|
`${__dirname}/generators/lib/readme/LibReadmeGenerator.js`,
|
|
189
190
|
);
|
|
191
|
+
env.registerStub(
|
|
192
|
+
LibReleaseGenerator,
|
|
193
|
+
'pob:lib:release',
|
|
194
|
+
`${__dirname}/generators/lib/release/LibReleaseGenerator.js`,
|
|
195
|
+
);
|
|
190
196
|
env.registerStub(
|
|
191
197
|
PobMonorepoGenerator,
|
|
192
198
|
'pob:monorepo',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.8.2",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
"mem-fs-editor": "8.1.2",
|
|
64
64
|
"minimist-argv": "^1.1.0",
|
|
65
65
|
"parse-author": "^2.0.0",
|
|
66
|
-
"pob-dependencies": "^5.
|
|
66
|
+
"pob-dependencies": "^5.9.2",
|
|
67
67
|
"prettier": "2.4.1",
|
|
68
68
|
"semver": "^7.3.4",
|
|
69
69
|
"update-notifier": "^5.0.1",
|
|
70
70
|
"yeoman-environment": "^3.5.1",
|
|
71
71
|
"yeoman-generator": "^5.4.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "fb02f559e09921ba0fb110a26cae9dca8053ac80"
|
|
74
74
|
}
|