pob 9.7.4 → 9.10.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 +67 -0
- package/lib/generators/app/PobAppGenerator.js +19 -1
- package/lib/generators/common/babel/CommonBabelGenerator.js +14 -2
- package/lib/generators/{lib/release/LibReleaseGenerator.js → common/release/CommonReleaseGenerator.js} +31 -6
- package/lib/generators/{lib → common}/release/templates/release-please.yml.ejs +2 -0
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +7 -0
- package/lib/generators/common/typescript/templates/tsconfig.json.ejs +3 -0
- package/lib/generators/core/ci/CoreCIGenerator.js +1 -1
- package/lib/generators/core/yarn/CoreYarnGenerator.js +21 -9
- package/lib/generators/lib/PobLibGenerator.js +5 -2
- package/lib/generators/monorepo/PobMonorepoGenerator.js +0 -5
- package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +5 -13
- package/lib/generators/pob/PobBaseGenerator.js +1 -1
- package/lib/pob.js +7 -22
- package/lib/utils/ensureJsonFileFormatted.js +7 -3
- package/lib/utils/json5.js +1 -1
- package/package.json +8 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,73 @@
|
|
|
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.10.0](https://github.com/christophehurpeau/pob/compare/pob@9.9.1...pob@9.10.0) (2021-12-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **deps:** update dependency mem-fs-editor to v9.4.0 ([#992](https://github.com/christophehurpeau/pob/issues/992)) ([692888b](https://github.com/christophehurpeau/pob/commit/692888bfb3546028f6cf86c58bd8cf2efecfbf71))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [9.9.1](https://github.com/christophehurpeau/pob/compare/pob@9.9.0...pob@9.9.1) (2021-12-19)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **pob:** add missing workspaces plugin when needed ([f3759c3](https://github.com/christophehurpeau/pob/commit/f3759c3f9bc34f30a7f72580df85b352fb67fbad))
|
|
23
|
+
* **pob:** exports for browser only ([0ede342](https://github.com/christophehurpeau/pob/commit/0ede342c71aefbcad6b037c3bd6ea1ac4eec2a61))
|
|
24
|
+
* **pob:** watch command ([e026f52](https://github.com/christophehurpeau/pob/commit/e026f5209d5bc0eb81ce766bbc8b7e5f62abe4b7))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# [9.9.0](https://github.com/christophehurpeau/pob/compare/pob@9.8.0...pob@9.9.0) (2021-12-18)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* update mem-fs ([8fdf8f7](https://github.com/christophehurpeau/pob/commit/8fdf8f79768ac0ca6e0326e629834657e2992c71))
|
|
36
|
+
* **pob:** ci testing check fix ([c8eb2cd](https://github.com/christophehurpeau/pob/commit/c8eb2cdf000766699e5590aebcc55e1c23d15700))
|
|
37
|
+
* coverage is a documentation ([cfde873](https://github.com/christophehurpeau/pob/commit/cfde8733ef340dd097143acb66e9acd87e69fbbe))
|
|
38
|
+
* defaults for readJSON5 method ([2a213b5](https://github.com/christophehurpeau/pob/commit/2a213b545be5e653b4f0a279983ea4cfeaacaa11))
|
|
39
|
+
* update legacy yarn2 to node-modules ([d543e5e](https://github.com/christophehurpeau/pob/commit/d543e5ede8273f16fb0416424671c2d1d7c60c73))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
|
|
44
|
+
* always use yarn workspaces commands ([83945e0](https://github.com/christophehurpeau/pob/commit/83945e0a2ee07c52ecd1a105e1e7b9749f91b712))
|
|
45
|
+
* **deps:** update dependency eslint to v8.5.0 ([#1069](https://github.com/christophehurpeau/pob/issues/1069)) ([46d8538](https://github.com/christophehurpeau/pob/commit/46d85381f97fbd55e424ca8b6f1fc0138900ff7f))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# [9.8.0](https://github.com/christophehurpeau/pob/compare/pob@9.7.4...pob@9.8.0) (2021-12-12)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Bug Fixes
|
|
55
|
+
|
|
56
|
+
* **pob:** dont try release-please if release is disabled ([86d6edf](https://github.com/christophehurpeau/pob/commit/86d6edf3e84cf98c0605044e09fb994fb036a3cc))
|
|
57
|
+
* sort package after running yarn version update ([b9773f0](https://github.com/christophehurpeau/pob/commit/b9773f0ac08c857b87836cbb2a665557f652bffd))
|
|
58
|
+
* **deps:** update @pob/eslint-config to v48.0.6 ([#1137](https://github.com/christophehurpeau/pob/issues/1137)) ([999b411](https://github.com/christophehurpeau/pob/commit/999b411e0e4a1c0a47e3c8f23ca20694ca8f2451))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Features
|
|
62
|
+
|
|
63
|
+
* **pob:** add env in app gitignore ([148a02a](https://github.com/christophehurpeau/pob/commit/148a02a9437b638051b384c7bd61ce1195cae8aa))
|
|
64
|
+
* allow to configure resolveJsonModule and fix baseUrl in tsconfig for apps ([d68393f](https://github.com/christophehurpeau/pob/commit/d68393f9bf02598aa3638e21d2dc407b9b282d1b))
|
|
65
|
+
* **pob:** allow release-please in apps ([6d567c6](https://github.com/christophehurpeau/pob/commit/6d567c6ee49f4faa26d7ab23f042615134681158))
|
|
66
|
+
* **pob:** suggest to enable release-please ([f62e46c](https://github.com/christophehurpeau/pob/commit/f62e46c8fd9e5936b10790288b14f516e9d8e6d6))
|
|
67
|
+
* conditional publish in release workflow ([162c83e](https://github.com/christophehurpeau/pob/commit/162c83ed7875d7caeaef43169742eef8742825f5))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
6
73
|
## [9.7.4](https://github.com/christophehurpeau/pob/compare/pob@9.7.3...pob@9.7.4) (2021-12-12)
|
|
7
74
|
|
|
8
75
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import Generator from 'yeoman-generator';
|
|
2
3
|
import inLerna from '../../utils/inLerna.js';
|
|
3
4
|
import inNpmLerna from '../../utils/inNpmLerna.js';
|
|
@@ -132,10 +133,12 @@ export default class PobAppGenerator extends Generator {
|
|
|
132
133
|
dom: browser,
|
|
133
134
|
jsx,
|
|
134
135
|
updateOnly: this.options.updateOnly,
|
|
136
|
+
resolveJsonModule: true,
|
|
135
137
|
baseUrl: (() => {
|
|
136
138
|
if (
|
|
137
139
|
this.appConfig.type === 'alp' ||
|
|
138
|
-
this.appConfig.type === 'pobpack'
|
|
140
|
+
this.appConfig.type === 'pobpack' ||
|
|
141
|
+
this.appConfig.type === 'node'
|
|
139
142
|
) {
|
|
140
143
|
return './src';
|
|
141
144
|
}
|
|
@@ -168,6 +171,21 @@ export default class PobAppGenerator extends Generator {
|
|
|
168
171
|
ignorePaths: ignorePaths.join('\n'),
|
|
169
172
|
});
|
|
170
173
|
|
|
174
|
+
this.composeWith('pob:common:release', {
|
|
175
|
+
enable: !inLerna && this.appConfig.testing && this.appConfig.ci,
|
|
176
|
+
withBabel: babel,
|
|
177
|
+
documentation: false,
|
|
178
|
+
updateOnly: this.options.updateOnly,
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// only for gitignore
|
|
182
|
+
if (this.fs.exists('.env.example')) {
|
|
183
|
+
ignorePaths.push('/.env*', '!/.env.example');
|
|
184
|
+
}
|
|
185
|
+
if (fs.existsSync('private_key')) {
|
|
186
|
+
ignorePaths.push('/private_key');
|
|
187
|
+
}
|
|
188
|
+
|
|
171
189
|
this.composeWith('pob:core:gitignore', {
|
|
172
190
|
root: !inLerna || inLerna.root,
|
|
173
191
|
documentation: false,
|
|
@@ -421,6 +421,17 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
421
421
|
'not safari < 10',
|
|
422
422
|
'not ios_saf < 10',
|
|
423
423
|
];
|
|
424
|
+
} else if (this.options.isApp && pkg.browserslist) {
|
|
425
|
+
pkg.browserslist = {
|
|
426
|
+
...pkg.browserslist,
|
|
427
|
+
production: [
|
|
428
|
+
'defaults',
|
|
429
|
+
'> 0.2%',
|
|
430
|
+
'not ie < 12',
|
|
431
|
+
'not safari < 10',
|
|
432
|
+
'not ios_saf < 10',
|
|
433
|
+
],
|
|
434
|
+
};
|
|
424
435
|
} else {
|
|
425
436
|
delete pkg.browserslist;
|
|
426
437
|
}
|
|
@@ -568,9 +579,10 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
568
579
|
this.entries.forEach((entry) => {
|
|
569
580
|
const isBrowserOnly =
|
|
570
581
|
entry === 'browser' &&
|
|
571
|
-
this.babelEnvs.every((env) => env.target === 'browser')
|
|
582
|
+
(this.babelEnvs.every((env) => env.target === 'browser') ||
|
|
583
|
+
(this.entries.length === 2 && this.entries.includes('index')));
|
|
572
584
|
const entryDistName = isBrowserOnly ? 'index' : entry;
|
|
573
|
-
const exportName =
|
|
585
|
+
const exportName = entry === 'index' ? '.' : `./${entry}`;
|
|
574
586
|
|
|
575
587
|
const targets = {};
|
|
576
588
|
|
|
@@ -2,7 +2,7 @@ import Generator from 'yeoman-generator';
|
|
|
2
2
|
import inLerna from '../../../utils/inLerna.js';
|
|
3
3
|
import * as packageUtils from '../../../utils/package.js';
|
|
4
4
|
|
|
5
|
-
export default class
|
|
5
|
+
export default class CommonReleaseGenerator extends Generator {
|
|
6
6
|
constructor(args, opts) {
|
|
7
7
|
super(args, opts);
|
|
8
8
|
|
|
@@ -24,16 +24,41 @@ export default class LibReleaseGenerator extends Generator {
|
|
|
24
24
|
required: true,
|
|
25
25
|
desc: 'Include documentation',
|
|
26
26
|
});
|
|
27
|
-
}
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
this.option('updateOnly', {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
required: false,
|
|
31
|
+
defaults: false,
|
|
32
|
+
desc: 'Avoid asking questions',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
async prompting() {
|
|
37
|
+
this.isReleasePleaseEnabled =
|
|
33
38
|
this.options.enable &&
|
|
34
39
|
this.fs.exists(
|
|
35
40
|
this.destinationPath('.github/workflows/release-please.yml'),
|
|
36
41
|
);
|
|
42
|
+
|
|
43
|
+
if (
|
|
44
|
+
this.options.enable &&
|
|
45
|
+
!process.env.CI &&
|
|
46
|
+
!this.isReleasePleaseEnabled
|
|
47
|
+
) {
|
|
48
|
+
const { enableReleasePlease } = await this.prompt({
|
|
49
|
+
type: 'confirm',
|
|
50
|
+
name: 'enableReleasePlease',
|
|
51
|
+
message: 'Would you like to enable release please ?',
|
|
52
|
+
default: true,
|
|
53
|
+
});
|
|
54
|
+
this.isReleasePleaseEnabled = enableReleasePlease;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
writing() {
|
|
59
|
+
const pkg = this.fs.readJSON(this.destinationPath('package.json'));
|
|
60
|
+
|
|
61
|
+
const isReleasePleaseEnabled = this.isReleasePleaseEnabled;
|
|
37
62
|
const isStandardVersionEnabled =
|
|
38
63
|
this.options.enable && !isReleasePleaseEnabled;
|
|
39
64
|
|
|
@@ -79,7 +104,7 @@ export default class LibReleaseGenerator extends Generator {
|
|
|
79
104
|
this.destinationPath('.github/workflows/release-please.yml'),
|
|
80
105
|
{
|
|
81
106
|
isLerna: !!inLerna,
|
|
82
|
-
|
|
107
|
+
publish: !pkg.private,
|
|
83
108
|
},
|
|
84
109
|
);
|
|
85
110
|
}
|
|
@@ -27,8 +27,10 @@ jobs:
|
|
|
27
27
|
node-version: 14
|
|
28
28
|
registry-url: 'https://registry.npmjs.org'
|
|
29
29
|
if: ${{ steps.release.outputs.release_created }}
|
|
30
|
+
<% if (publish) { -%>
|
|
30
31
|
|
|
31
32
|
- run: npm publish
|
|
32
33
|
env:
|
|
33
34
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
34
35
|
if: ${{ steps.release.outputs.release_created }}
|
|
36
|
+
<% } -%>
|
|
@@ -32,6 +32,12 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
32
32
|
desc: 'baseUrl option',
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
this.option('resolveJsonModule', {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
defaults: false,
|
|
38
|
+
desc: 'resolveJsonModule option',
|
|
39
|
+
});
|
|
40
|
+
|
|
35
41
|
this.option('builddefs', {
|
|
36
42
|
type: Boolean,
|
|
37
43
|
defaults: true,
|
|
@@ -116,6 +122,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
116
122
|
jsx,
|
|
117
123
|
dom,
|
|
118
124
|
baseUrl: this.options.baseUrl,
|
|
125
|
+
resolveJsonModule: this.options.resolveJsonModule,
|
|
119
126
|
},
|
|
120
127
|
);
|
|
121
128
|
if (
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
32
32
|
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
33
33
|
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
34
|
+
<% if (resolveJsonModule) { -%>
|
|
35
|
+
"resolveJsonModule": <%= resolveJsonModule %>,
|
|
36
|
+
<% } -%>
|
|
34
37
|
"baseUrl": "<%= baseUrl %>"<% if (monorepoPackageNames) { %>,<% } %><%= ' '.slice(0, -(baseUrl.length + (monorepoPackageNames ? 1 : 0))) %>/* Base directory to resolve non-absolute module names. */
|
|
35
38
|
<% if (monorepoPackageNames && monorepoPackageNames.length !== 0) { -%>
|
|
36
39
|
|
|
@@ -69,7 +69,7 @@ export default class CoreCIGenerator extends Generator {
|
|
|
69
69
|
this.destinationPath('.github/workflows/push.yml'),
|
|
70
70
|
{
|
|
71
71
|
packageManager: this.options.packageManager,
|
|
72
|
-
testing: this.options.testing && !!pkg.scripts.test,
|
|
72
|
+
testing: this.options.testing && !!pkg.scripts && !!pkg.scripts.test,
|
|
73
73
|
checks: !!pkg.scripts && !!pkg.scripts.checks,
|
|
74
74
|
documentation: this.options.documentation,
|
|
75
75
|
build: this.options.build,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import yarnParsers from '@yarnpkg/parsers';
|
|
3
3
|
import Generator from 'yeoman-generator';
|
|
4
|
+
import ensureJsonFileFormatted from '../../../utils/ensureJsonFileFormatted.js';
|
|
4
5
|
import inLerna from '../../../utils/inLerna.js';
|
|
5
6
|
import * as packageUtils from '../../../utils/package.js';
|
|
6
7
|
import { writeAndFormat } from '../../../utils/writeAndFormat.js';
|
|
@@ -40,6 +41,7 @@ export default class CoreYarnGenerator extends Generator {
|
|
|
40
41
|
this.spawnCommandSync('yarn', ['set', 'version', 'latest']);
|
|
41
42
|
} else {
|
|
42
43
|
this.spawnCommandSync('yarn', ['set', 'version', 'latest']);
|
|
44
|
+
ensureJsonFileFormatted(this.destinationPath('package.json'));
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
}
|
|
@@ -64,22 +66,32 @@ export default class CoreYarnGenerator extends Generator {
|
|
|
64
66
|
const isPluginInstalled = (name) =>
|
|
65
67
|
installedPlugins.some((plugin) => plugin.name === name);
|
|
66
68
|
|
|
69
|
+
const installPlugin = (nameOrUrl) => {
|
|
70
|
+
this.spawnCommandSync('yarn', ['plugin', 'import', nameOrUrl]);
|
|
71
|
+
};
|
|
72
|
+
const removePlugin = (name) => {
|
|
73
|
+
this.spawnCommandSync('yarn', ['plugin', 'remove', name]);
|
|
74
|
+
};
|
|
75
|
+
|
|
67
76
|
const postinstallDevPluginName = '@yarnpkg/plugin-postinstall-dev';
|
|
77
|
+
const workspacesPluginName = '@yarnpkg/plugin-workspace-tools';
|
|
68
78
|
|
|
69
79
|
if (!inLerna && !pkg.private) {
|
|
70
80
|
if (!isPluginInstalled(postinstallDevPluginName)) {
|
|
71
|
-
|
|
72
|
-
'plugin',
|
|
73
|
-
'import',
|
|
81
|
+
installPlugin(
|
|
74
82
|
'https://raw.githubusercontent.com/sachinraja/yarn-plugin-postinstall-dev/main/bundles/%40yarnpkg/plugin-postinstall-dev.js',
|
|
75
|
-
|
|
83
|
+
);
|
|
76
84
|
}
|
|
77
85
|
} else if (isPluginInstalled(postinstallDevPluginName)) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
removePlugin(postinstallDevPluginName);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (pkg.workspaces) {
|
|
90
|
+
if (!isPluginInstalled(workspacesPluginName)) {
|
|
91
|
+
installPlugin(workspacesPluginName);
|
|
92
|
+
}
|
|
93
|
+
} else if (isPluginInstalled(workspacesPluginName)) {
|
|
94
|
+
removePlugin(workspacesPluginName);
|
|
83
95
|
}
|
|
84
96
|
|
|
85
97
|
// must be done after plugins installed
|
|
@@ -254,7 +254,9 @@ export default class PobLibGenerator extends Generator {
|
|
|
254
254
|
|
|
255
255
|
// must be after testing
|
|
256
256
|
this.composeWith('pob:common:format-lint', {
|
|
257
|
-
documentation:
|
|
257
|
+
documentation:
|
|
258
|
+
!!this.pobjson.documentation ||
|
|
259
|
+
!!(this.pobjson.testing && this.pobjson.testing.codecov),
|
|
258
260
|
testing: this.pobjson.testing,
|
|
259
261
|
packageManager: this.options.packageManager,
|
|
260
262
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
@@ -275,10 +277,11 @@ export default class PobLibGenerator extends Generator {
|
|
|
275
277
|
codecov: this.pobjson.testing && this.pobjson.testing.codecov,
|
|
276
278
|
});
|
|
277
279
|
|
|
278
|
-
this.composeWith('pob:
|
|
280
|
+
this.composeWith('pob:common:release', {
|
|
279
281
|
enable: !inLerna && this.pobjson.testing && this.pobjson.testing.ci,
|
|
280
282
|
withBabel: babelEnvs.length > 0,
|
|
281
283
|
documentation: !!this.pobjson.documentation,
|
|
284
|
+
updateOnly: this.options.updateOnly,
|
|
282
285
|
});
|
|
283
286
|
|
|
284
287
|
// must be after doc, testing
|
|
@@ -228,11 +228,6 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
228
228
|
packagePaths: JSON.stringify(packagePaths),
|
|
229
229
|
});
|
|
230
230
|
|
|
231
|
-
// packageUtils.addOrRemoveScripts(pkg, this.pobLernaConfig.documentation, {
|
|
232
|
-
// 'generate:test-coverage':
|
|
233
|
-
// 'lerna run --parallel --ignore "*-example" generate:test-coverage',
|
|
234
|
-
// });
|
|
235
|
-
|
|
236
231
|
if (this.pobLernaConfig.documentation) {
|
|
237
232
|
pkg.scripts.build = `${
|
|
238
233
|
pkg.scripts.build ? `${pkg.scripts.build} && ` : ''
|
|
@@ -154,8 +154,6 @@ export default class MonorepoLernaGenerator extends Generator {
|
|
|
154
154
|
|
|
155
155
|
const monorepoConfig = this.config.get('monorepo');
|
|
156
156
|
const packageManager = this.npm ? 'npm' : 'yarn';
|
|
157
|
-
const useYarnWorkspacesCommand =
|
|
158
|
-
pkg.name === 'pob-monorepo' || pkg.name === 'nightingale-monorepo'; // this.options.packageManager === 'yarn';
|
|
159
157
|
|
|
160
158
|
packageUtils.addScripts(pkg, {
|
|
161
159
|
lint: `${packageManager} run lint:prettier && ${packageManager} run lint:eslint`,
|
|
@@ -174,7 +172,7 @@ export default class MonorepoLernaGenerator extends Generator {
|
|
|
174
172
|
? `NODE_OPTIONS=--max_old_space_size=4096 eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet . --ignore-pattern ${pkg.workspaces.join(
|
|
175
173
|
',',
|
|
176
174
|
)} && yarn workspaces foreach --parallel -Av run lint:eslint`
|
|
177
|
-
: '
|
|
175
|
+
: 'npm run lint:eslint --workspaces',
|
|
178
176
|
});
|
|
179
177
|
|
|
180
178
|
this.fs.copyTpl(
|
|
@@ -193,16 +191,10 @@ export default class MonorepoLernaGenerator extends Generator {
|
|
|
193
191
|
);
|
|
194
192
|
|
|
195
193
|
packageUtils.addOrRemoveScripts(pkg, withBabel, {
|
|
196
|
-
build:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
} build`,
|
|
201
|
-
watch: `${
|
|
202
|
-
useYarnWorkspacesCommand
|
|
203
|
-
? 'yarn workspaces foreach --parallel --exclude "*-example" -Av run'
|
|
204
|
-
: 'lerna run --parallel --ignore "*-example"'
|
|
205
|
-
} watch`,
|
|
194
|
+
build:
|
|
195
|
+
'yarn workspaces foreach --parallel --topological-dev -Av run build',
|
|
196
|
+
watch:
|
|
197
|
+
'yarn workspaces foreach --parallel --jobs unlimited --interlaced --exclude "*-example" -Av run watch',
|
|
206
198
|
});
|
|
207
199
|
|
|
208
200
|
// packageUtils.addOrRemoveScripts(pkg, withTypescript, {
|
package/lib/pob.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { spawnSync } from 'child_process';
|
|
4
4
|
import fs, { existsSync, writeFileSync, readFileSync } from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import argv from 'minimist-argv';
|
|
7
|
-
// import updateNotifier from 'update-notifier';
|
|
8
7
|
import yeoman from 'yeoman-environment';
|
|
9
|
-
// import pkg from '../package.json';
|
|
10
8
|
import PobAppGenerator from './generators/app/PobAppGenerator.js';
|
|
11
9
|
import CommonBabelGenerator from './generators/common/babel/CommonBabelGenerator.js';
|
|
12
10
|
import CommonLintGenerator from './generators/common/format-lint/CommonLintGenerator.js';
|
|
13
11
|
import CommonHuskyGenerator from './generators/common/husky/CommonHuskyGenerator.js';
|
|
14
12
|
import CommonRemoveOldDependenciesGenerator from './generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js';
|
|
13
|
+
import CommonReleaseGenerator from './generators/common/release/CommonReleaseGenerator.js';
|
|
15
14
|
import CommonTestingGenerator from './generators/common/testing/CommonTestingGenerator.js';
|
|
16
15
|
import CommonTypescriptGenerator from './generators/common/typescript/CommonTypescriptGenerator.js';
|
|
17
16
|
import CoreCIGenerator from './generators/core/ci/CoreCIGenerator.js';
|
|
@@ -29,7 +28,6 @@ import CoreYarnGenerator from './generators/core/yarn/CoreYarnGenerator.js';
|
|
|
29
28
|
import PobLibGenerator from './generators/lib/PobLibGenerator.js';
|
|
30
29
|
import LibDocGenerator from './generators/lib/doc/LibDocGenerator.js';
|
|
31
30
|
import LibReadmeGenerator from './generators/lib/readme/LibReadmeGenerator.js';
|
|
32
|
-
import LibReleaseGenerator from './generators/lib/release/LibReleaseGenerator.js';
|
|
33
31
|
import PobMonorepoGenerator from './generators/monorepo/PobMonorepoGenerator.js';
|
|
34
32
|
import MonorepoLernaGenerator from './generators/monorepo/lerna/MonorepoLernaGenerator.js';
|
|
35
33
|
import MonorepoTypescriptGenerator from './generators/monorepo/typescript/MonorepoTypescriptGenerator.js';
|
|
@@ -39,7 +37,6 @@ import { __dirname } from './pob-dirname.cjs';
|
|
|
39
37
|
const printUsage = () => {
|
|
40
38
|
console.error('Usage: pob [monorepo] [lib|app|init]');
|
|
41
39
|
console.error(' pob [monorepo] update [--force]');
|
|
42
|
-
console.error(' pob monorepo convert-npm');
|
|
43
40
|
console.error(' pob add <packageName>');
|
|
44
41
|
};
|
|
45
42
|
|
|
@@ -60,8 +57,6 @@ if (argv.version) {
|
|
|
60
57
|
process.exit(0);
|
|
61
58
|
}
|
|
62
59
|
|
|
63
|
-
// updateNotifier({ pkg }).notify();
|
|
64
|
-
|
|
65
60
|
const env = yeoman.createEnv();
|
|
66
61
|
|
|
67
62
|
env.on('error', (err) => {
|
|
@@ -103,6 +98,11 @@ env.registerStub(
|
|
|
103
98
|
'pob:common:remove-old-dependencies',
|
|
104
99
|
`${__dirname}/generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js`,
|
|
105
100
|
);
|
|
101
|
+
env.registerStub(
|
|
102
|
+
CommonReleaseGenerator,
|
|
103
|
+
'pob:common:release',
|
|
104
|
+
`${__dirname}/generators/common/release/CommonReleaseGenerator.js`,
|
|
105
|
+
);
|
|
106
106
|
env.registerStub(
|
|
107
107
|
CommonTestingGenerator,
|
|
108
108
|
'pob:common:testing',
|
|
@@ -188,11 +188,6 @@ env.registerStub(
|
|
|
188
188
|
'pob:lib:readme',
|
|
189
189
|
`${__dirname}/generators/lib/readme/LibReadmeGenerator.js`,
|
|
190
190
|
);
|
|
191
|
-
env.registerStub(
|
|
192
|
-
LibReleaseGenerator,
|
|
193
|
-
'pob:lib:release',
|
|
194
|
-
`${__dirname}/generators/lib/release/LibReleaseGenerator.js`,
|
|
195
|
-
);
|
|
196
191
|
env.registerStub(
|
|
197
192
|
PobMonorepoGenerator,
|
|
198
193
|
'pob:monorepo',
|
|
@@ -250,16 +245,6 @@ if (action === 'add') {
|
|
|
250
245
|
process.exit(0);
|
|
251
246
|
}
|
|
252
247
|
|
|
253
|
-
if (monorepo && action === 'convert-npm') {
|
|
254
|
-
execSync('sed -i \'/"npmClient": "yarn",/d\' ./lerna.json', {
|
|
255
|
-
stdio: 'inherit',
|
|
256
|
-
});
|
|
257
|
-
execSync('npm install packages/*', { stdio: 'inherit' });
|
|
258
|
-
execSync('yarn lerna link convert', { stdio: 'inherit' });
|
|
259
|
-
execSync('rm -Rf yarn.lock packages/*/yarn.lock', { stdio: 'inherit' });
|
|
260
|
-
process.exit(0);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
248
|
const updateOnly = action === 'update';
|
|
264
249
|
const init = action === 'init';
|
|
265
250
|
const type = updateOnly || init ? null : action;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
+
import sortPkg from '@pob/sort-pkg';
|
|
2
3
|
import prettier from 'prettier';
|
|
3
4
|
|
|
4
5
|
export default function ensureJsonFileFormatted(path) {
|
|
5
6
|
try {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
let contentJson = fs.readFileSync(path, 'utf-8');
|
|
8
|
+
if (path === 'package.json' || path.endsWith('/package.json')) {
|
|
9
|
+
contentJson = JSON.stringify(sortPkg(JSON.parse(contentJson)), null, 2);
|
|
10
|
+
}
|
|
11
|
+
const formattedPkg = prettier.format(contentJson, {
|
|
8
12
|
filepath: path,
|
|
9
13
|
});
|
|
10
|
-
if (
|
|
14
|
+
if (contentJson !== formattedPkg) {
|
|
11
15
|
console.warn(`formatted json file ${path}`);
|
|
12
16
|
fs.writeFileSync(path, formattedPkg);
|
|
13
17
|
}
|
package/lib/utils/json5.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import JSON5 from 'json5';
|
|
2
2
|
|
|
3
3
|
export function readJSON5(fs, destinationPath, defaults) {
|
|
4
|
-
const content = fs.read(destinationPath, null);
|
|
4
|
+
const content = fs.read(destinationPath, { defaults: null });
|
|
5
5
|
if (content === null) return defaults;
|
|
6
6
|
return JSON5.parse(content);
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.10.0",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"@lerna/package-graph": "^4.0.0",
|
|
43
43
|
"@lerna/project": "^4.0.0",
|
|
44
44
|
"@pob/eslint-config": "48.0.5",
|
|
45
|
-
"@pob/eslint-config-typescript": "48.0.
|
|
46
|
-
"@pob/eslint-config-typescript-react": "48.0.
|
|
45
|
+
"@pob/eslint-config-typescript": "48.0.6",
|
|
46
|
+
"@pob/eslint-config-typescript-react": "48.0.6",
|
|
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
50
|
"@yarnpkg/parsers": "2.5.0-rc.6",
|
|
51
|
-
"eslint": "8.
|
|
51
|
+
"eslint": "8.5.0",
|
|
52
52
|
"findup-sync": "^5.0.0",
|
|
53
53
|
"git-remote-url": "^1.0.1",
|
|
54
54
|
"github-username": "^6.0.0",
|
|
@@ -57,16 +57,15 @@
|
|
|
57
57
|
"json5": "^2.2.0",
|
|
58
58
|
"lodash.camelcase": "^4.3.0",
|
|
59
59
|
"lodash.kebabcase": "^4.1.1",
|
|
60
|
-
"mem-fs": "
|
|
61
|
-
"mem-fs-editor": "
|
|
60
|
+
"mem-fs": "2.2.1",
|
|
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.5.0",
|
|
65
65
|
"prettier": "2.5.1",
|
|
66
66
|
"semver": "^7.3.4",
|
|
67
|
-
"update-notifier": "^5.0.1",
|
|
68
67
|
"yeoman-environment": "^3.5.1",
|
|
69
68
|
"yeoman-generator": "^5.4.0"
|
|
70
69
|
},
|
|
71
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "c4a529a8e84d4aab433ecd39956ccc586ab75f8d"
|
|
72
71
|
}
|