pob 9.12.1 → 9.13.1
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 +54 -0
- package/README.md +2 -5
- package/lib/generators/app/PobAppGenerator.js +2 -4
- package/lib/generators/common/babel/CommonBabelGenerator.js +13 -12
- package/lib/generators/common/release/CommonReleaseGenerator.js +0 -1
- package/lib/generators/common/testing/CommonTestingGenerator.js +10 -17
- package/lib/generators/core/ci/CoreCIGenerator.js +27 -0
- package/lib/generators/core/ci/templates/github-action-documentation-workflow.yml.ejs +50 -0
- package/lib/generators/core/ci/templates/github-action-node-workflow.yml.ejs +10 -21
- package/lib/generators/core/git/CoreGitGenerator.js +7 -0
- package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +14 -4
- package/lib/generators/core/gitignore/CoreGitignoreGenerator.js +8 -0
- package/lib/generators/core/gitignore/templates/gitignore.ejs +12 -2
- package/lib/generators/core/yarn/CoreYarnGenerator.js +4 -11
- package/lib/generators/core/yarn/templates/yarn_gitignore.ejs +0 -1
- package/lib/generators/lib/PobLibGenerator.js +2 -0
- package/lib/generators/lib/doc/LibDocGenerator.js +4 -7
- package/lib/generators/monorepo/PobMonorepoGenerator.js +8 -6
- package/lib/generators/monorepo/lerna/templates/workflow-publish.yml.ejs +0 -1
- package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +1 -3
- package/lib/generators/pob/PobBaseGenerator.js +3 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,60 @@
|
|
|
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.13.1](https://github.com/christophehurpeau/pob/compare/pob@9.13.0...pob@9.13.1) (2022-01-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **pob:** multiple newlines in gitignore template ([f00c5be](https://github.com/christophehurpeau/pob/commit/f00c5bed9a6200d3ded4737ffcdab175eb56b2c5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [9.13.0](https://github.com/christophehurpeau/pob/compare/pob@9.12.3...pob@9.13.0) (2022-01-15)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* disable gh-pages for apps ([0f935ff](https://github.com/christophehurpeau/pob/commit/0f935ff24207ebe782bb7f0a2f75372ab87ac240))
|
|
23
|
+
* **deps:** update dependency @pob/eslint-config-typescript-react to v48.0.7 ([#1153](https://github.com/christophehurpeau/pob/issues/1153)) ([b96b1c4](https://github.com/christophehurpeau/pob/commit/b96b1c4497529772b58e18c04b6b19020bb4931f))
|
|
24
|
+
* **deps:** update dependency @yarnpkg/parsers to v2.5.0-rc.8 ([#1155](https://github.com/christophehurpeau/pob/issues/1155)) ([4a01d49](https://github.com/christophehurpeau/pob/commit/4a01d4929b0b6ae0d19494e478357a6d7bf4acb6))
|
|
25
|
+
* **pob:** add @babel/core when pkg has peer dependency ([acd04cb](https://github.com/christophehurpeau/pob/commit/acd04cbc77c914af56db8b83734d187cc926f4e4))
|
|
26
|
+
* **pob:** extraEntries for pkg.type === "module" ([2fae75c](https://github.com/christophehurpeau/pob/commit/2fae75cdf6ee5678f436d11a15f02bd22f1a9c66))
|
|
27
|
+
* **pob:** remove /private_key in gitignore ([368d819](https://github.com/christophehurpeau/pob/commit/368d8193d638ec41a7caa7a46e9cbcd6607dcaf2))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* generate documentation and coverage on gh-pages ([32e4801](https://github.com/christophehurpeau/pob/commit/32e4801e8a4d1ff221a7fe63d42c6fe52d46f796))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [9.12.3](https://github.com/christophehurpeau/pob/compare/pob@9.12.2...pob@9.12.3) (2022-01-02)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* remove legacy .yarn/build-state.yml ([b625bab](https://github.com/christophehurpeau/pob/commit/b625bab16caa53342fdcbf1961b73446cdfd2541))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## [9.12.2](https://github.com/christophehurpeau/pob/compare/pob@9.12.1...pob@9.12.2) (2022-01-02)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Bug Fixes
|
|
53
|
+
|
|
54
|
+
* **pob:** stop ci testing on node 14 on app projects ([c775697](https://github.com/christophehurpeau/pob/commit/c77569741136dc3feefcdc61f666092751be944c))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
6
60
|
## [9.12.1](https://github.com/christophehurpeau/pob/compare/pob@9.12.0...pob@9.12.1) (2022-01-02)
|
|
7
61
|
|
|
8
62
|
|
package/README.md
CHANGED
|
@@ -40,9 +40,8 @@ You can check the code by running the task `yarn run lint`. With an editor, inst
|
|
|
40
40
|
|
|
41
41
|
#### Documentation
|
|
42
42
|
|
|
43
|
-
[
|
|
43
|
+
[typedoc](https://typedoc.org/) allows to document the code and generate the api.
|
|
44
44
|
[jest](https://www.npmjs.com/package/jest) is used to generate the coverage.
|
|
45
|
-
You can generate the documentation with `yarn run generate:docs`.
|
|
46
45
|
|
|
47
46
|
Documentation can be generated by github actions and pushed to github-pages.
|
|
48
47
|
|
|
@@ -61,9 +60,7 @@ Tests are in the directory `src` with jest. Use the task `yarn test` to run the
|
|
|
61
60
|
|
|
62
61
|
### Generate documentation
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
- `generate:api`: generate api with jsdoc
|
|
66
|
-
- `generate:test-coverage`: generate coverage documentation
|
|
63
|
+
Documentation (api + test coverage) is deployed to gh-pages via a github action.
|
|
67
64
|
|
|
68
65
|
### Publish a new release
|
|
69
66
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
1
|
import Generator from 'yeoman-generator';
|
|
3
2
|
import inLerna from '../../utils/inLerna.js';
|
|
4
3
|
import inNpmLerna from '../../utils/inNpmLerna.js';
|
|
@@ -157,6 +156,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
157
156
|
codecov: false,
|
|
158
157
|
ci: this.appConfig.ci,
|
|
159
158
|
packageManager: this.options.packageManager,
|
|
159
|
+
isApp: true,
|
|
160
160
|
});
|
|
161
161
|
|
|
162
162
|
this.composeWith('pob:common:format-lint', {
|
|
@@ -182,13 +182,11 @@ export default class PobAppGenerator extends Generator {
|
|
|
182
182
|
if (this.fs.exists('.env.example')) {
|
|
183
183
|
ignorePaths.push('/.env*', '!/.env.example');
|
|
184
184
|
}
|
|
185
|
-
if (fs.existsSync('private_key')) {
|
|
186
|
-
ignorePaths.push('/private_key');
|
|
187
|
-
}
|
|
188
185
|
|
|
189
186
|
this.composeWith('pob:core:gitignore', {
|
|
190
187
|
root: !inLerna || inLerna.root,
|
|
191
188
|
documentation: false,
|
|
189
|
+
testing: this.appConfig.testing,
|
|
192
190
|
withBabel: babel,
|
|
193
191
|
paths: ignorePaths.join('\n'),
|
|
194
192
|
buildInGit: false,
|
|
@@ -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',
|
|
@@ -323,10 +319,12 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
323
319
|
|
|
324
320
|
/* dependencies */
|
|
325
321
|
|
|
326
|
-
packageUtils.addOrRemoveDevDependencies(
|
|
327
|
-
|
|
328
|
-
'
|
|
329
|
-
|
|
322
|
+
packageUtils.addOrRemoveDevDependencies(
|
|
323
|
+
pkg,
|
|
324
|
+
useBabel || (pkg.peerDependencies && pkg.peerDependencies['@babel/core']),
|
|
325
|
+
['@babel/core'],
|
|
326
|
+
);
|
|
327
|
+
packageUtils.addOrRemoveDevDependencies(pkg, useBabel, ['pob-babel']);
|
|
330
328
|
|
|
331
329
|
if (pkg.dependencies && pkg.dependencies['pob-babel']) {
|
|
332
330
|
// update pob-babel in alp-dev
|
|
@@ -655,10 +653,13 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
655
653
|
|
|
656
654
|
if (pkg.pob.extraEntries) {
|
|
657
655
|
pkg.pob.extraEntries.forEach((exportName) => {
|
|
658
|
-
pkg.exports[`./${exportName}`] =
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
656
|
+
pkg.exports[`./${exportName}`] =
|
|
657
|
+
pkg.type === 'module'
|
|
658
|
+
? `./${exportName}.js`
|
|
659
|
+
: {
|
|
660
|
+
import: `./${exportName}.mjs`,
|
|
661
|
+
require: `./${exportName}.js`,
|
|
662
|
+
};
|
|
662
663
|
});
|
|
663
664
|
}
|
|
664
665
|
} else if (!pkg.exports) {
|
|
@@ -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', {
|
|
@@ -78,6 +85,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
78
85
|
'babel-core',
|
|
79
86
|
'ts-jest',
|
|
80
87
|
'babel-jest',
|
|
88
|
+
'pob-lcov-reporter',
|
|
81
89
|
]);
|
|
82
90
|
|
|
83
91
|
const yoConfigPobMonorepo = inLerna && inLerna.pobMonorepoConfig;
|
|
@@ -109,13 +117,10 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
109
117
|
packageUtils.addOrRemoveDevDependencies(
|
|
110
118
|
pkg,
|
|
111
119
|
enableForMonorepo || !globalTesting,
|
|
112
|
-
[
|
|
113
|
-
pkg.name !== 'pob-monorepo' && 'pob-lcov-reporter',
|
|
114
|
-
'jest',
|
|
115
|
-
'@types/jest',
|
|
116
|
-
],
|
|
120
|
+
['jest', '@types/jest'],
|
|
117
121
|
);
|
|
118
122
|
|
|
123
|
+
packageUtils.removeScripts(['test:coverage']);
|
|
119
124
|
if (this.options.monorepo && !globalTesting) {
|
|
120
125
|
delete pkg.jest;
|
|
121
126
|
packageUtils.addScripts(pkg, {
|
|
@@ -132,12 +137,6 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
132
137
|
|
|
133
138
|
packageUtils.addScripts(pkg, {
|
|
134
139
|
test: jestCommand,
|
|
135
|
-
'generate:test-coverage': [
|
|
136
|
-
'rm -Rf docs/coverage/',
|
|
137
|
-
`NODE_ENV=production ${
|
|
138
|
-
transpileWithBabel ? 'BABEL_ENV=test ' : ''
|
|
139
|
-
}${jestCommand} --coverage --coverageReporters=pob-lcov-reporter --coverageDirectory=docs/coverage/`,
|
|
140
|
-
].join(' ; '),
|
|
141
140
|
});
|
|
142
141
|
|
|
143
142
|
const workspacesWithoutStar = pkg.workspaces.map((workspace) => {
|
|
@@ -199,12 +198,6 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
199
198
|
packageUtils.addScripts(pkg, {
|
|
200
199
|
test: jestCommand,
|
|
201
200
|
'test:watch': `${jestCommand} --watch`,
|
|
202
|
-
'generate:test-coverage': [
|
|
203
|
-
'rm -Rf docs/coverage/',
|
|
204
|
-
`NODE_ENV=production ${
|
|
205
|
-
transpileWithBabel ? 'BABEL_ENV=test ' : ''
|
|
206
|
-
}${jestCommand} --coverage --coverageReporters=pob-lcov-reporter --coverageDirectory=docs/coverage/`,
|
|
207
|
-
].join(' ; '),
|
|
208
201
|
});
|
|
209
202
|
|
|
210
203
|
const srcDirectory = transpileWithBabel ? 'src' : 'lib';
|
|
@@ -54,12 +54,19 @@ 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() {
|
|
60
66
|
if (fs.existsSync(this.destinationPath('.circleci'))) {
|
|
61
67
|
fs.rmdirSync(this.destinationPath('.circleci'), { recursive: true });
|
|
62
68
|
}
|
|
69
|
+
|
|
63
70
|
if (this.options.enable) {
|
|
64
71
|
const pkg = this.fs.readJSON(this.destinationPath('package.json'));
|
|
65
72
|
|
|
@@ -75,11 +82,31 @@ export default class CoreCIGenerator extends Generator {
|
|
|
75
82
|
build: this.options.build,
|
|
76
83
|
typescript: this.options.typescript,
|
|
77
84
|
codecov: this.options.codecov,
|
|
85
|
+
supportsNode14: !this.options.isApp,
|
|
78
86
|
},
|
|
79
87
|
);
|
|
80
88
|
} else {
|
|
81
89
|
this.fs.delete(this.destinationPath('.github/workflows/push.yml'));
|
|
82
90
|
}
|
|
91
|
+
|
|
92
|
+
if (
|
|
93
|
+
this.options.enable &&
|
|
94
|
+
!this.options.isApp &&
|
|
95
|
+
(this.options.documentation || this.options.testing)
|
|
96
|
+
) {
|
|
97
|
+
copyAndFormatTpl(
|
|
98
|
+
this.fs,
|
|
99
|
+
this.templatePath('github-action-documentation-workflow.yml.ejs'),
|
|
100
|
+
this.destinationPath('.github/workflows/gh-pages.yml'),
|
|
101
|
+
{
|
|
102
|
+
packageManager: this.options.packageManager,
|
|
103
|
+
testing: this.options.testing,
|
|
104
|
+
typedoc: this.options.documentation && this.options.typescript,
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
} else {
|
|
108
|
+
this.fs.delete(this.destinationPath('.github/workflows/gh-pages.yml'));
|
|
109
|
+
}
|
|
83
110
|
}
|
|
84
111
|
|
|
85
112
|
writing() {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: 'Create documentation and deploy to Github pages'
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- main
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
create-documentation-and-deploy:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v2
|
|
12
|
+
with:
|
|
13
|
+
token: ${{ secrets.GH_TOKEN }}
|
|
14
|
+
|
|
15
|
+
- uses: actions/setup-node@v2
|
|
16
|
+
with:
|
|
17
|
+
node-version: 16
|
|
18
|
+
|
|
19
|
+
- name: Cache dependencies
|
|
20
|
+
uses: actions/cache@v2
|
|
21
|
+
with:
|
|
22
|
+
path: |
|
|
23
|
+
.yarn/unplugged
|
|
24
|
+
.yarn/install-state.gz
|
|
25
|
+
key: v2-dependencies--${{ matrix.node-version }}-${{ runner.OS }}-${{ hashFiles('yarn.lock') }}
|
|
26
|
+
restore-keys: |
|
|
27
|
+
v2-dependencies--${{ matrix.node-version }}-${{ runner.OS }}-
|
|
28
|
+
v2-dependencies--${{ matrix.node-version }}-
|
|
29
|
+
|
|
30
|
+
- name: Check Dependencies
|
|
31
|
+
run: yarn install --immutable --immutable-cache
|
|
32
|
+
|
|
33
|
+
<% if (typedoc) { -%>
|
|
34
|
+
- name: Generate Typedoc
|
|
35
|
+
run: yarn typedoc --tsconfig tsconfig.doc.json
|
|
36
|
+
<% } -%>
|
|
37
|
+
|
|
38
|
+
<% if (testing) { -%>
|
|
39
|
+
- name: Generate Coverage
|
|
40
|
+
run: yarn test --coverage --coverageReporters=lcov --coverageDirectory=docs/coverage/
|
|
41
|
+
<% } -%>
|
|
42
|
+
|
|
43
|
+
- name: Create nojekyll
|
|
44
|
+
run: touch docs/.nojekyll
|
|
45
|
+
|
|
46
|
+
- name: Deploy
|
|
47
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
48
|
+
with:
|
|
49
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
50
|
+
publish_dir: ./docs
|
|
@@ -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
|
|
@@ -25,7 +25,6 @@ jobs:
|
|
|
25
25
|
<% if (packageManager === 'yarn') { -%>
|
|
26
26
|
path: |
|
|
27
27
|
.yarn/unplugged
|
|
28
|
-
.yarn/build-state.yml
|
|
29
28
|
.yarn/install-state.gz
|
|
30
29
|
<% } else { -%>
|
|
31
30
|
path: node_modules
|
|
@@ -74,35 +73,25 @@ jobs:
|
|
|
74
73
|
run: yarn run tsc
|
|
75
74
|
if: startsWith(matrix.node-version, '16.')
|
|
76
75
|
<% } -%>
|
|
77
|
-
<% if (
|
|
78
|
-
|
|
79
|
-
- name: Test
|
|
80
|
-
run: <%= packageManager %> run test
|
|
81
|
-
env:
|
|
82
|
-
CI: true
|
|
83
|
-
<% } -%>
|
|
84
|
-
<% if (documentation) { -%>
|
|
85
|
-
|
|
86
|
-
- name: Documentation
|
|
87
|
-
run: <%= packageManager %> run generate:docs
|
|
88
|
-
if: startsWith(matrix.node-version, '16.')
|
|
89
|
-
env:
|
|
90
|
-
CI: true
|
|
91
|
-
<% } else if (codecov) { -%>
|
|
76
|
+
<% if (codecov) { -%>
|
|
92
77
|
|
|
93
|
-
- name: Generate Coverage
|
|
94
|
-
run: <%= packageManager %> run
|
|
78
|
+
- name: Generate Test Coverage
|
|
79
|
+
run: <%= packageManager %> run test --coverage --coverageReporters=json --coverageReporters=text
|
|
95
80
|
if: startsWith(matrix.node-version, '16.')
|
|
96
81
|
env:
|
|
97
82
|
CI: true
|
|
98
|
-
<% } -%>
|
|
99
|
-
<% if (codecov) { -%>
|
|
100
83
|
|
|
101
84
|
- name: Send results to codecov
|
|
102
85
|
uses: codecov/codecov-action@v2
|
|
103
86
|
with:
|
|
104
87
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
105
88
|
if: startsWith(matrix.node-version, '16.')
|
|
89
|
+
<% } else if (testing) { -%>
|
|
90
|
+
|
|
91
|
+
- name: Test
|
|
92
|
+
run: <%= packageManager %> run test
|
|
93
|
+
env:
|
|
94
|
+
CI: true
|
|
106
95
|
<% } -%>
|
|
107
96
|
<% if (true) { -%>
|
|
108
97
|
|
|
@@ -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: [
|
|
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
|
}
|
|
@@ -18,6 +18,13 @@ export default class CoreGitignoreGenerator extends Generator {
|
|
|
18
18
|
desc: 'Documentation enabled.',
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
+
this.option('testing', {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
required: false,
|
|
24
|
+
defaults: false,
|
|
25
|
+
desc: 'Testing enabled.',
|
|
26
|
+
});
|
|
27
|
+
|
|
21
28
|
this.option('withBabel', {
|
|
22
29
|
type: Boolean,
|
|
23
30
|
required: false,
|
|
@@ -66,6 +73,7 @@ export default class CoreGitignoreGenerator extends Generator {
|
|
|
66
73
|
this.fs.copyTpl(this.templatePath('gitignore.ejs'), dest, {
|
|
67
74
|
root: this.options.root,
|
|
68
75
|
documentation: this.options.documentation,
|
|
76
|
+
testing: this.options.testing,
|
|
69
77
|
withBabel,
|
|
70
78
|
typescript: withBabel || this.options.typescript,
|
|
71
79
|
paths: this.options.paths,
|
|
@@ -7,12 +7,12 @@ npm-debug.log*
|
|
|
7
7
|
yarn-debug.log*
|
|
8
8
|
yarn-error.log*
|
|
9
9
|
<% } -%>
|
|
10
|
-
|
|
11
10
|
<% if (paths) { -%>
|
|
11
|
+
|
|
12
12
|
<%= paths %>
|
|
13
13
|
<% } -%>
|
|
14
|
-
|
|
15
14
|
<% if (root) { -%>
|
|
15
|
+
|
|
16
16
|
# IDE
|
|
17
17
|
/.settings
|
|
18
18
|
/.project
|
|
@@ -20,8 +20,18 @@ yarn-error.log*
|
|
|
20
20
|
!/.vscode
|
|
21
21
|
*.sublime-project
|
|
22
22
|
*.sublime-workspace
|
|
23
|
+
<% if (documentation) { -%>
|
|
23
24
|
|
|
25
|
+
# generated documentation directory
|
|
26
|
+
/docs
|
|
27
|
+
<% } -%>
|
|
28
|
+
<% if (testing) { -%>
|
|
29
|
+
|
|
30
|
+
# jest default coverage directory
|
|
31
|
+
/coverage
|
|
32
|
+
<% } -%>
|
|
24
33
|
<% if (typescript && buildInGit) { -%>
|
|
34
|
+
|
|
25
35
|
# Typescript
|
|
26
36
|
tsbuildinfo
|
|
27
37
|
<% } -%>
|
|
@@ -129,17 +129,10 @@ export default class CoreYarnGenerator extends Generator {
|
|
|
129
129
|
try {
|
|
130
130
|
this.spawnCommandSync('yarn', ['run', 'preversion']);
|
|
131
131
|
} catch {}
|
|
132
|
-
} else {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
} catch {}
|
|
137
|
-
}
|
|
138
|
-
if (pkg.scripts['generate:docs']) {
|
|
139
|
-
try {
|
|
140
|
-
this.spawnCommandSync('yarn', ['run', 'generate:docs']);
|
|
141
|
-
} catch {}
|
|
142
|
-
}
|
|
132
|
+
} else if (pkg.scripts.build) {
|
|
133
|
+
try {
|
|
134
|
+
this.spawnCommandSync('yarn', ['run', 'build']);
|
|
135
|
+
} catch {}
|
|
143
136
|
}
|
|
144
137
|
}
|
|
145
138
|
}
|
|
@@ -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
|
|
@@ -290,6 +291,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
290
291
|
withBabel: babelEnvs.length > 0,
|
|
291
292
|
typescript: babelEnvs.length > 0,
|
|
292
293
|
documentation: this.pobjson.documentation,
|
|
294
|
+
testing: !!this.pobjson.testing,
|
|
293
295
|
});
|
|
294
296
|
|
|
295
297
|
this.composeWith('pob:core:npm', {
|
|
@@ -146,19 +146,16 @@ export default class LibDocGenerator extends Generator {
|
|
|
146
146
|
// },
|
|
147
147
|
// );
|
|
148
148
|
|
|
149
|
+
if (pkg.scripts) {
|
|
150
|
+
delete pkg.scripts['generate:docs'];
|
|
151
|
+
}
|
|
152
|
+
|
|
149
153
|
if (this.options.enabled) {
|
|
150
154
|
packageUtils.addScripts(pkg, {
|
|
151
|
-
'generate:docs':
|
|
152
|
-
'rm -Rf docs ; yarn run generate:api ; touch docs/.nojekyll',
|
|
153
155
|
'generate:api': 'typedoc --tsconfig tsconfig.doc.json',
|
|
154
156
|
});
|
|
155
|
-
|
|
156
|
-
if (this.options.testing && (!inLerna || !inLerna.root)) {
|
|
157
|
-
pkg.scripts['generate:docs'] += ' && yarn run generate:test-coverage';
|
|
158
|
-
}
|
|
159
157
|
} else {
|
|
160
158
|
delete pkg.scripts['generate:api'];
|
|
161
|
-
delete pkg.scripts['generate:docs'];
|
|
162
159
|
}
|
|
163
160
|
|
|
164
161
|
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
1
2
|
import fs from 'fs';
|
|
2
3
|
import path from 'path';
|
|
3
4
|
import { PackageGraph } from '@lerna/package-graph';
|
|
@@ -193,6 +194,7 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
193
194
|
codecov: this.pobLernaConfig.testing && this.pobLernaConfig.codecov,
|
|
194
195
|
ci: this.pobLernaConfig.ci,
|
|
195
196
|
packageManager: this.options.packageManager,
|
|
197
|
+
isApp: this.options.isAppProject,
|
|
196
198
|
});
|
|
197
199
|
|
|
198
200
|
this.composeWith('pob:common:format-lint', {
|
|
@@ -217,6 +219,8 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
217
219
|
this.composeWith('pob:core:gitignore', {
|
|
218
220
|
root: true,
|
|
219
221
|
typescript: this.pobLernaConfig.typescript,
|
|
222
|
+
documentation: this.pobLernaConfig.documentation,
|
|
223
|
+
testing: this.pobLernaConfig.testing,
|
|
220
224
|
});
|
|
221
225
|
|
|
222
226
|
this.composeWith('pob:common:remove-old-dependencies');
|
|
@@ -228,13 +232,11 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
228
232
|
packagePaths: JSON.stringify(packagePaths),
|
|
229
233
|
});
|
|
230
234
|
|
|
231
|
-
if (this.pobLernaConfig.documentation) {
|
|
232
|
-
pkg.scripts.build = `${
|
|
233
|
-
pkg.scripts.build ? `${pkg.scripts.build} && ` : ''
|
|
234
|
-
}yarn run generate:docs`;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
235
|
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
236
|
+
|
|
237
|
+
execSync(
|
|
238
|
+
`rm -Rf ${['lib-*', 'coverage', 'docs'].filter(Boolean).join(' ')}`,
|
|
239
|
+
);
|
|
238
240
|
}
|
|
239
241
|
|
|
240
242
|
end() {
|
|
@@ -61,9 +61,7 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
61
61
|
delete pkg.scripts.postbuild;
|
|
62
62
|
|
|
63
63
|
if (!this.options.isAppProject) {
|
|
64
|
-
pkg.scripts.build +=
|
|
65
|
-
pkg.scripts['generate:docs'] ? ' && yarn run generate:docs' : ''
|
|
66
|
-
}`;
|
|
64
|
+
pkg.scripts.build += ' && yarn run build:definitions';
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
const packagePaths = JSON.parse(this.options.packagePaths);
|
|
@@ -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.
|
|
3
|
+
"version": "9.13.1",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@lerna/project": "^4.0.0",
|
|
44
44
|
"@pob/eslint-config": "48.0.5",
|
|
45
45
|
"@pob/eslint-config-typescript": "48.0.6",
|
|
46
|
-
"@pob/eslint-config-typescript-react": "48.0.
|
|
46
|
+
"@pob/eslint-config-typescript-react": "48.0.7",
|
|
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.
|
|
50
|
+
"@yarnpkg/parsers": "2.5.0-rc.8",
|
|
51
51
|
"eslint": "8.6.0",
|
|
52
52
|
"findup-sync": "^5.0.0",
|
|
53
53
|
"git-remote-url": "^1.0.1",
|
|
@@ -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.
|
|
64
|
+
"pob-dependencies": "6.8.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": "
|
|
70
|
+
"gitHead": "640dd9ead1e1b8b72d32227a43a390209dee47d1"
|
|
71
71
|
}
|