pob 9.12.3 → 9.13.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,27 @@
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.0](https://github.com/christophehurpeau/pob/compare/pob@9.12.3...pob@9.13.0) (2022-01-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * disable gh-pages for apps ([0f935ff](https://github.com/christophehurpeau/pob/commit/0f935ff24207ebe782bb7f0a2f75372ab87ac240))
12
+ * **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))
13
+ * **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))
14
+ * **pob:** add @babel/core when pkg has peer dependency ([acd04cb](https://github.com/christophehurpeau/pob/commit/acd04cbc77c914af56db8b83734d187cc926f4e4))
15
+ * **pob:** extraEntries for pkg.type === "module" ([2fae75c](https://github.com/christophehurpeau/pob/commit/2fae75cdf6ee5678f436d11a15f02bd22f1a9c66))
16
+ * **pob:** remove /private_key in gitignore ([368d819](https://github.com/christophehurpeau/pob/commit/368d8193d638ec41a7caa7a46e9cbcd6607dcaf2))
17
+
18
+
19
+ ### Features
20
+
21
+ * generate documentation and coverage on gh-pages ([32e4801](https://github.com/christophehurpeau/pob/commit/32e4801e8a4d1ff221a7fe63d42c6fe52d46f796))
22
+
23
+
24
+
25
+
26
+
6
27
  ## [9.12.3](https://github.com/christophehurpeau/pob/compare/pob@9.12.2...pob@9.12.3) (2022-01-02)
7
28
 
8
29
 
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
- [jsdoc](http://usejsdoc.org/) allows to document the code and generate the api.
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
- - `generate:docs`: run `generate:api` and `generate:test-coverage`
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';
@@ -183,13 +182,11 @@ export default class PobAppGenerator extends Generator {
183
182
  if (this.fs.exists('.env.example')) {
184
183
  ignorePaths.push('/.env*', '!/.env.example');
185
184
  }
186
- if (fs.existsSync('private_key')) {
187
- ignorePaths.push('/private_key');
188
- }
189
185
 
190
186
  this.composeWith('pob:core:gitignore', {
191
187
  root: !inLerna || inLerna.root,
192
188
  documentation: false,
189
+ testing: this.appConfig.testing,
193
190
  withBabel: babel,
194
191
  paths: ignorePaths.join('\n'),
195
192
  buildInGit: false,
@@ -319,10 +319,12 @@ export default class CommonBabelGenerator extends Generator {
319
319
 
320
320
  /* dependencies */
321
321
 
322
- packageUtils.addOrRemoveDevDependencies(pkg, useBabel, [
323
- '@babel/core',
324
- 'pob-babel',
325
- ]);
322
+ packageUtils.addOrRemoveDevDependencies(
323
+ pkg,
324
+ useBabel || (pkg.peerDependencies && pkg.peerDependencies['@babel/core']),
325
+ ['@babel/core'],
326
+ );
327
+ packageUtils.addOrRemoveDevDependencies(pkg, useBabel, ['pob-babel']);
326
328
 
327
329
  if (pkg.dependencies && pkg.dependencies['pob-babel']) {
328
330
  // update pob-babel in alp-dev
@@ -651,10 +653,13 @@ export default class CommonBabelGenerator extends Generator {
651
653
 
652
654
  if (pkg.pob.extraEntries) {
653
655
  pkg.pob.extraEntries.forEach((exportName) => {
654
- pkg.exports[`./${exportName}`] = {
655
- import: `./${exportName}.mjs`,
656
- require: `./${exportName}.js`,
657
- };
656
+ pkg.exports[`./${exportName}`] =
657
+ pkg.type === 'module'
658
+ ? `./${exportName}.js`
659
+ : {
660
+ import: `./${exportName}.mjs`,
661
+ require: `./${exportName}.js`,
662
+ };
658
663
  });
659
664
  }
660
665
  } else if (!pkg.exports) {
@@ -76,7 +76,6 @@ export default class CommonReleaseGenerator extends Generator {
76
76
  preversion: [
77
77
  'yarn run lint',
78
78
  this.options.withBabel && 'yarn run build',
79
- this.options.documentation && 'yarn run generate:docs',
80
79
  'repository-check-dirty',
81
80
  ]
82
81
  .filter(Boolean)
@@ -85,6 +85,7 @@ export default class CommonTestingGenerator extends Generator {
85
85
  'babel-core',
86
86
  'ts-jest',
87
87
  'babel-jest',
88
+ 'pob-lcov-reporter',
88
89
  ]);
89
90
 
90
91
  const yoConfigPobMonorepo = inLerna && inLerna.pobMonorepoConfig;
@@ -116,13 +117,10 @@ export default class CommonTestingGenerator extends Generator {
116
117
  packageUtils.addOrRemoveDevDependencies(
117
118
  pkg,
118
119
  enableForMonorepo || !globalTesting,
119
- [
120
- pkg.name !== 'pob-monorepo' && 'pob-lcov-reporter',
121
- 'jest',
122
- '@types/jest',
123
- ],
120
+ ['jest', '@types/jest'],
124
121
  );
125
122
 
123
+ packageUtils.removeScripts(['test:coverage']);
126
124
  if (this.options.monorepo && !globalTesting) {
127
125
  delete pkg.jest;
128
126
  packageUtils.addScripts(pkg, {
@@ -139,12 +137,6 @@ export default class CommonTestingGenerator extends Generator {
139
137
 
140
138
  packageUtils.addScripts(pkg, {
141
139
  test: jestCommand,
142
- 'generate:test-coverage': [
143
- 'rm -Rf docs/coverage/',
144
- `NODE_ENV=production ${
145
- transpileWithBabel ? 'BABEL_ENV=test ' : ''
146
- }${jestCommand} --coverage --coverageReporters=pob-lcov-reporter --coverageDirectory=docs/coverage/`,
147
- ].join(' ; '),
148
140
  });
149
141
 
150
142
  const workspacesWithoutStar = pkg.workspaces.map((workspace) => {
@@ -206,12 +198,6 @@ export default class CommonTestingGenerator extends Generator {
206
198
  packageUtils.addScripts(pkg, {
207
199
  test: jestCommand,
208
200
  'test:watch': `${jestCommand} --watch`,
209
- 'generate:test-coverage': [
210
- 'rm -Rf docs/coverage/',
211
- `NODE_ENV=production ${
212
- transpileWithBabel ? 'BABEL_ENV=test ' : ''
213
- }${jestCommand} --coverage --coverageReporters=pob-lcov-reporter --coverageDirectory=docs/coverage/`,
214
- ].join(' ; '),
215
201
  });
216
202
 
217
203
  const srcDirectory = transpileWithBabel ? 'src' : 'lib';
@@ -66,6 +66,7 @@ export default class CoreCIGenerator extends Generator {
66
66
  if (fs.existsSync(this.destinationPath('.circleci'))) {
67
67
  fs.rmdirSync(this.destinationPath('.circleci'), { recursive: true });
68
68
  }
69
+
69
70
  if (this.options.enable) {
70
71
  const pkg = this.fs.readJSON(this.destinationPath('package.json'));
71
72
 
@@ -87,6 +88,25 @@ export default class CoreCIGenerator extends Generator {
87
88
  } else {
88
89
  this.fs.delete(this.destinationPath('.github/workflows/push.yml'));
89
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
+ }
90
110
  }
91
111
 
92
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
@@ -73,35 +73,25 @@ jobs:
73
73
  run: yarn run tsc
74
74
  if: startsWith(matrix.node-version, '16.')
75
75
  <% } -%>
76
- <% if (testing) { -%>
77
-
78
- - name: Test
79
- run: <%= packageManager %> run test
80
- env:
81
- CI: true
82
- <% } -%>
83
- <% if (documentation) { -%>
84
-
85
- - name: Documentation
86
- run: <%= packageManager %> run generate:docs
87
- if: startsWith(matrix.node-version, '16.')
88
- env:
89
- CI: true
90
- <% } else if (codecov) { -%>
76
+ <% if (codecov) { -%>
91
77
 
92
- - name: Generate Coverage doc
93
- run: <%= packageManager %> run generate:test-coverage
78
+ - name: Generate Test Coverage
79
+ run: <%= packageManager %> run test --coverage --coverageReporters=json --coverageReporters=text
94
80
  if: startsWith(matrix.node-version, '16.')
95
81
  env:
96
82
  CI: true
97
- <% } -%>
98
- <% if (codecov) { -%>
99
83
 
100
84
  - name: Send results to codecov
101
85
  uses: codecov/codecov-action@v2
102
86
  with:
103
87
  token: ${{ secrets.CODECOV_TOKEN }}
104
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
105
95
  <% } -%>
106
96
  <% if (true) { -%>
107
97
 
@@ -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,
@@ -21,6 +21,17 @@ yarn-error.log*
21
21
  *.sublime-project
22
22
  *.sublime-workspace
23
23
 
24
+ <% if (documentation) { -%>
25
+ # generated documentation directory
26
+ /docs
27
+ <% } -%>
28
+
29
+ <% if (testing) { -%>
30
+ # jest default coverage directory
31
+ /coverage
32
+ <% } -%>
33
+
34
+
24
35
  <% if (typescript && buildInGit) { -%>
25
36
  # Typescript
26
37
  tsbuildinfo
@@ -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
- if (pkg.scripts.build) {
134
- try {
135
- this.spawnCommandSync('yarn', ['run', 'build']);
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
  }
@@ -291,6 +291,7 @@ export default class PobLibGenerator extends Generator {
291
291
  withBabel: babelEnvs.length > 0,
292
292
  typescript: babelEnvs.length > 0,
293
293
  documentation: this.pobjson.documentation,
294
+ testing: !!this.pobjson.testing,
294
295
  });
295
296
 
296
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';
@@ -218,6 +219,8 @@ export default class PobMonorepoGenerator extends Generator {
218
219
  this.composeWith('pob:core:gitignore', {
219
220
  root: true,
220
221
  typescript: this.pobLernaConfig.typescript,
222
+ documentation: this.pobLernaConfig.documentation,
223
+ testing: this.pobLernaConfig.testing,
221
224
  });
222
225
 
223
226
  this.composeWith('pob:common:remove-old-dependencies');
@@ -229,13 +232,11 @@ export default class PobMonorepoGenerator extends Generator {
229
232
  packagePaths: JSON.stringify(packagePaths),
230
233
  });
231
234
 
232
- if (this.pobLernaConfig.documentation) {
233
- pkg.scripts.build = `${
234
- pkg.scripts.build ? `${pkg.scripts.build} && ` : ''
235
- }yarn run generate:docs`;
236
- }
237
-
238
235
  this.fs.writeJSON(this.destinationPath('package.json'), pkg);
236
+
237
+ execSync(
238
+ `rm -Rf ${['lib-*', 'coverage', 'docs'].filter(Boolean).join(' ')}`,
239
+ );
239
240
  }
240
241
 
241
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 += ` && yarn run build:definitions${
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "9.12.3",
3
+ "version": "9.13.0",
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.6",
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.7",
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.6.3",
64
+ "pob-dependencies": "6.7.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": "463af07ec0ae3131bc1728e275b8343d81025ddd"
70
+ "gitHead": "10fc86e0d2cf78d9b2b1299a708ce69b32fbfedc"
71
71
  }