pob 8.10.0 → 8.10.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 +15 -0
- package/lib/generators/app/PobAppGenerator.js +1 -0
- package/lib/generators/common/babel/CommonBabelGenerator.js +13 -4
- package/lib/generators/common/format-lint/CommonLintGenerator.js +17 -8
- package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +34 -6
- package/lib/generators/core/package/CorePackageGenerator.js +26 -9
- package/lib/generators/lib/PobLibGenerator.js +1 -1
- package/lib/generators/monorepo/PobMonorepoGenerator.js +1 -0
- package/lib/generators/pob/PobBaseGenerator.js +14 -1
- package/lib/pob.js +26 -23
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
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.10.1](https://github.com/christophehurpeau/pob/compare/pob@8.10.0...pob@8.10.1) (2021-12-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **pob:** only install release workflow if ci is enabled ([8e2fc45](https://github.com/christophehurpeau/pob/commit/8e2fc45ec5435a149b4580b09ae4636e3dbc0fdf))
|
|
12
|
+
* **pob:** start script for apps ([623cfb5](https://github.com/christophehurpeau/pob/commit/623cfb5e5a9af9978b5533962ec7fb3b85035a3b))
|
|
13
|
+
* init new monorepo ([7a212de](https://github.com/christophehurpeau/pob/commit/7a212deb2feb480c19b5243a201f31a7b2ce45c3))
|
|
14
|
+
* monorepo add ([3ae8bfb](https://github.com/christophehurpeau/pob/commit/3ae8bfb487b8a88b62ad8692789ecdddf01ec376))
|
|
15
|
+
* **deps:** update dependency prettier to v2.5.1 ([#1122](https://github.com/christophehurpeau/pob/issues/1122)) ([ba903e3](https://github.com/christophehurpeau/pob/commit/ba903e3c63ff90eab7938d5aecbd9d37fac68293))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
# [8.10.0](https://github.com/christophehurpeau/pob/compare/pob@8.9.0...pob@8.10.0) (2021-11-28)
|
|
7
22
|
|
|
8
23
|
|
|
@@ -267,10 +267,19 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
267
267
|
|
|
268
268
|
/* scripts */
|
|
269
269
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
270
|
+
if (this.options.isApp) {
|
|
271
|
+
packageUtils.removeScripts(['watch']);
|
|
272
|
+
packageUtils.addOrRemoveScripts(pkg, useBabel, {
|
|
273
|
+
build: 'pob-build',
|
|
274
|
+
start: 'pob-watch',
|
|
275
|
+
});
|
|
276
|
+
} else {
|
|
277
|
+
packageUtils.removeScripts(['start']);
|
|
278
|
+
packageUtils.addOrRemoveScripts(pkg, useBabel, {
|
|
279
|
+
build: 'pob-build',
|
|
280
|
+
watch: 'pob-watch',
|
|
281
|
+
});
|
|
282
|
+
}
|
|
274
283
|
|
|
275
284
|
const shouldBuildDefinitions = !this.options.isApp && useBabel;
|
|
276
285
|
packageUtils.addOrRemoveScripts(pkg, shouldBuildDefinitions, {
|
|
@@ -12,6 +12,13 @@ export default class CommonLintGenerator extends Generator {
|
|
|
12
12
|
constructor(args, opts) {
|
|
13
13
|
super(args, opts);
|
|
14
14
|
|
|
15
|
+
this.option('monorepo', {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
required: false,
|
|
18
|
+
defaults: false,
|
|
19
|
+
description: 'Is root monorepo',
|
|
20
|
+
});
|
|
21
|
+
|
|
15
22
|
this.option('babel', {
|
|
16
23
|
type: String,
|
|
17
24
|
required: false,
|
|
@@ -104,7 +111,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
104
111
|
arrowParens: 'always',
|
|
105
112
|
};
|
|
106
113
|
|
|
107
|
-
if (!inLerna || inLerna.root) {
|
|
114
|
+
if (!inLerna || inLerna.root || this.options.monorepo) {
|
|
108
115
|
const ignorePatterns = new Set(
|
|
109
116
|
this.options.ignorePaths.split('\n').filter(Boolean),
|
|
110
117
|
);
|
|
@@ -125,7 +132,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
125
132
|
this.templatePath('prettierignore.ejs'),
|
|
126
133
|
this.destinationPath('.prettierignore'),
|
|
127
134
|
{
|
|
128
|
-
inRoot: !inLerna || inLerna.root,
|
|
135
|
+
inRoot: !inLerna || inLerna.root || this.options.monorepo,
|
|
129
136
|
documentation: this.options.documentation,
|
|
130
137
|
packageManager: this.options.packageManager,
|
|
131
138
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
@@ -181,7 +188,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
181
188
|
|
|
182
189
|
if (
|
|
183
190
|
globalEslint &&
|
|
184
|
-
!(inLerna && inLerna.root) &&
|
|
191
|
+
!((inLerna && inLerna.root) || this.options.monorepo) &&
|
|
185
192
|
(rootPackageManager !== 'yarn' || rootYarnNodeLinker === 'node-modules')
|
|
186
193
|
) {
|
|
187
194
|
packageUtils.removeDevDependencies(
|
|
@@ -205,15 +212,17 @@ export default class CommonLintGenerator extends Generator {
|
|
|
205
212
|
} else {
|
|
206
213
|
packageUtils.addOrRemoveDevDependencies(
|
|
207
214
|
pkg,
|
|
208
|
-
(inLerna && inLerna.root) || !globalEslint,
|
|
215
|
+
(inLerna && inLerna.root) || this.options.monorepo || !globalEslint,
|
|
209
216
|
['prettier'],
|
|
210
217
|
);
|
|
211
218
|
packageUtils.addOrRemoveDevDependencies(
|
|
212
219
|
pkg,
|
|
213
220
|
!globalEslint ||
|
|
214
221
|
(inLerna && inLerna.root) ||
|
|
222
|
+
this.options.monorepo ||
|
|
215
223
|
lernaProjectType === 'app' ||
|
|
216
|
-
rootPackageManager === 'yarn'
|
|
224
|
+
(rootPackageManager === 'yarn' &&
|
|
225
|
+
rootYarnNodeLinker !== 'node-modules') ||
|
|
217
226
|
!!(pkg.peerDependencies && pkg.peerDependencies.eslint),
|
|
218
227
|
['eslint'],
|
|
219
228
|
);
|
|
@@ -241,7 +250,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
241
250
|
['eslint-plugin-node', 'eslint-import-resolver-node'],
|
|
242
251
|
);
|
|
243
252
|
|
|
244
|
-
if (inLerna && inLerna.root) {
|
|
253
|
+
if ((inLerna && inLerna.root) || this.options.monorepo) {
|
|
245
254
|
if (this.options.typescript) {
|
|
246
255
|
packageUtils.updateDevDependenciesIfPresent(pkg, [
|
|
247
256
|
'@pob/eslint-config-typescript',
|
|
@@ -410,7 +419,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
410
419
|
console.warn(`Could not parse/edit ${rootEslintrcPath}: `, err);
|
|
411
420
|
}
|
|
412
421
|
|
|
413
|
-
if (inLerna && inLerna.root) {
|
|
422
|
+
if ((inLerna && inLerna.root) || this.options.monorepo) {
|
|
414
423
|
if (this.fs.exists(srcEslintrcPath)) {
|
|
415
424
|
this.fs.delete(srcEslintrcPath);
|
|
416
425
|
}
|
|
@@ -448,7 +457,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
448
457
|
}
|
|
449
458
|
|
|
450
459
|
// see monorepo/lerna/index.js
|
|
451
|
-
if (!(inLerna && inLerna.root)) {
|
|
460
|
+
if (!(inLerna && inLerna.root) && !this.options.monorepo) {
|
|
452
461
|
const srcDirectory = useBabel ? 'src' : 'lib';
|
|
453
462
|
const lintRootJsFiles = (useBabel && useNode) || !inLerna;
|
|
454
463
|
|
|
@@ -37,9 +37,14 @@ const configureProtectionRule = async (owner, repo) => {
|
|
|
37
37
|
allow_deletions: false,
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
|
+
if (branch === 'master') {
|
|
41
|
+
console.warn('You should rename your "master" branch to "main"');
|
|
42
|
+
}
|
|
40
43
|
} catch (err) {
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
if (branch === 'main') {
|
|
45
|
+
console.error(`Failed to configure ${branch} branch protection`);
|
|
46
|
+
console.error(err.stack || err.message || err);
|
|
47
|
+
}
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
50
|
};
|
|
@@ -79,14 +84,17 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
79
84
|
const repo = this.options.repoName;
|
|
80
85
|
|
|
81
86
|
const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
|
|
87
|
+
const name = pkg.name.endsWith('-monorepo')
|
|
88
|
+
? pkg.name.slice(0, -'-monorepo'.length)
|
|
89
|
+
: pkg.name;
|
|
82
90
|
|
|
83
91
|
if (this.options.shouldCreate) {
|
|
84
92
|
try {
|
|
85
93
|
if (this.options.shouldCreate) {
|
|
86
94
|
try {
|
|
87
|
-
await gh('user/repos', {
|
|
95
|
+
await gh.post('user/repos', {
|
|
88
96
|
json: {
|
|
89
|
-
name
|
|
97
|
+
name,
|
|
90
98
|
description: pkg.description,
|
|
91
99
|
homepage: null,
|
|
92
100
|
private: false,
|
|
@@ -103,13 +111,33 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
103
111
|
}
|
|
104
112
|
|
|
105
113
|
const cwd = this.destinationPath();
|
|
106
|
-
|
|
114
|
+
try {
|
|
115
|
+
this.spawnCommandSync('git', ['add', '--all', '.'], { cwd });
|
|
116
|
+
} catch (err) {
|
|
117
|
+
this.spawnCommandSync('git', ['init'], { cwd });
|
|
118
|
+
this.spawnCommandSync('git', ['add', '--all', '.'], { cwd });
|
|
119
|
+
this.spawnCommandSync(
|
|
120
|
+
'git',
|
|
121
|
+
[
|
|
122
|
+
'remote',
|
|
123
|
+
'add',
|
|
124
|
+
'origin',
|
|
125
|
+
`git@github.com:christophehurpeau/${name}.git`,
|
|
126
|
+
],
|
|
127
|
+
{ cwd },
|
|
128
|
+
);
|
|
129
|
+
console.error('Failed to create repository');
|
|
130
|
+
console.error(err.stack || err.message || err);
|
|
131
|
+
}
|
|
107
132
|
this.spawnCommandSync(
|
|
108
133
|
'git',
|
|
109
134
|
['commit', '-m', 'chore: initial commit [skip ci]'],
|
|
110
135
|
{ cwd },
|
|
111
136
|
);
|
|
112
|
-
this.spawnCommandSync('git', ['
|
|
137
|
+
this.spawnCommandSync('git', ['branch', '-M', 'main'], {
|
|
138
|
+
cwd,
|
|
139
|
+
});
|
|
140
|
+
this.spawnCommandSync('git', ['push', '-u', 'origin', 'main'], {
|
|
113
141
|
cwd,
|
|
114
142
|
});
|
|
115
143
|
|
|
@@ -9,6 +9,20 @@ export default class CorePackageGenerator extends Generator {
|
|
|
9
9
|
constructor(args, opts) {
|
|
10
10
|
super(args, opts);
|
|
11
11
|
|
|
12
|
+
this.option('monorepo', {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
required: true,
|
|
15
|
+
defaults: false,
|
|
16
|
+
desc: 'is monorepo',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
this.option('isRoot', {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
required: true,
|
|
22
|
+
defaults: false,
|
|
23
|
+
desc: 'is root',
|
|
24
|
+
});
|
|
25
|
+
|
|
12
26
|
this.option('private', {
|
|
13
27
|
type: Boolean,
|
|
14
28
|
required: false,
|
|
@@ -29,7 +43,9 @@ export default class CorePackageGenerator extends Generator {
|
|
|
29
43
|
}
|
|
30
44
|
|
|
31
45
|
if (!this.options.updateOnly) {
|
|
32
|
-
if (this.options.
|
|
46
|
+
if (this.options.monorepo && this.options.isRoot) {
|
|
47
|
+
pkg.private = true;
|
|
48
|
+
} else if (this.options.private) {
|
|
33
49
|
pkg.private = true;
|
|
34
50
|
} else {
|
|
35
51
|
const { isPrivate } = await this.prompt({
|
|
@@ -46,7 +62,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
46
62
|
}
|
|
47
63
|
}
|
|
48
64
|
|
|
49
|
-
if (
|
|
65
|
+
if (this.options.monorepo && this.options.isRoot) {
|
|
50
66
|
if (!pkg.name) {
|
|
51
67
|
const { name } = await this.prompt({
|
|
52
68
|
name: 'name',
|
|
@@ -77,7 +93,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
77
93
|
const props = await this.prompt(
|
|
78
94
|
[
|
|
79
95
|
!this.options.updateOnly &&
|
|
80
|
-
!(
|
|
96
|
+
!(this.options.monorepo && this.options.isRoot) && {
|
|
81
97
|
name: 'description',
|
|
82
98
|
message: 'Description',
|
|
83
99
|
default: pkg.description,
|
|
@@ -115,7 +131,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
115
131
|
? pkg.description
|
|
116
132
|
: props.description || pkg.description;
|
|
117
133
|
|
|
118
|
-
if (
|
|
134
|
+
if (this.options.monorepo && !this.options.isRoot) {
|
|
119
135
|
const rootMonorepoPkg = inLerna.rootMonorepoPkg;
|
|
120
136
|
const rootRepositoryUrl =
|
|
121
137
|
typeof rootMonorepoPkg.repository === 'string'
|
|
@@ -136,9 +152,9 @@ export default class CorePackageGenerator extends Generator {
|
|
|
136
152
|
fs.unlinkSync(this.destinationPath('yarn-error.log'));
|
|
137
153
|
}
|
|
138
154
|
|
|
139
|
-
if (
|
|
155
|
+
if (this.options.monorepo && !this.options.isRoot) {
|
|
140
156
|
packageUtils.removeScripts(pkg, ['checks']);
|
|
141
|
-
} else if (
|
|
157
|
+
} else if (this.options.monorepo && this.options.isRoot) {
|
|
142
158
|
const doesMjsCheckPackagesExists = this.fs.exists(
|
|
143
159
|
this.destinationPath('scripts/check-packages.mjs'),
|
|
144
160
|
);
|
|
@@ -206,6 +222,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
206
222
|
|
|
207
223
|
writing() {
|
|
208
224
|
const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
|
|
225
|
+
if (!pkg.scripts) pkg.scripts = {};
|
|
209
226
|
|
|
210
227
|
const installPostinstallScript = (scriptName) => {
|
|
211
228
|
if (
|
|
@@ -217,7 +234,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
217
234
|
};
|
|
218
235
|
|
|
219
236
|
const uninstallPostinstallScript = (scriptName) => {
|
|
220
|
-
if (pkg.scripts[scriptName]) {
|
|
237
|
+
if (pkg.scripts && pkg.scripts[scriptName]) {
|
|
221
238
|
if (pkg.scripts[scriptName] === 'pob-root-postinstall') {
|
|
222
239
|
delete pkg.scripts[scriptName];
|
|
223
240
|
} else if (
|
|
@@ -231,9 +248,9 @@ export default class CorePackageGenerator extends Generator {
|
|
|
231
248
|
}
|
|
232
249
|
}
|
|
233
250
|
};
|
|
234
|
-
if (
|
|
251
|
+
if (this.options.monorepo || pkg.private) {
|
|
235
252
|
uninstallPostinstallScript('postinstallDev');
|
|
236
|
-
if (
|
|
253
|
+
if (this.options.isRoot) {
|
|
237
254
|
installPostinstallScript('postinstall');
|
|
238
255
|
} else {
|
|
239
256
|
uninstallPostinstallScript('postinstall');
|
|
@@ -273,7 +273,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
273
273
|
});
|
|
274
274
|
|
|
275
275
|
this.composeWith('pob:lib:release', {
|
|
276
|
-
enable: !inLerna,
|
|
276
|
+
enable: !inLerna && this.pobjson.testing && this.pobjson.testing.ci,
|
|
277
277
|
withBabel: babelEnvs.length > 0,
|
|
278
278
|
documentation: !!this.pobjson.documentation,
|
|
279
279
|
});
|
|
@@ -207,6 +207,7 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
207
207
|
this.composeWith('pob:common:husky', {});
|
|
208
208
|
|
|
209
209
|
this.composeWith('pob:common:format-lint', {
|
|
210
|
+
monorepo: true,
|
|
210
211
|
documentation: this.pobLernaConfig.documentation,
|
|
211
212
|
typescript: this.pobLernaConfig.typescript,
|
|
212
213
|
testing: this.pobLernaConfig.testing,
|
|
@@ -7,12 +7,19 @@ export default class PobBaseGenerator extends Generator {
|
|
|
7
7
|
constructor(args, opts) {
|
|
8
8
|
super(args, opts, { customInstallTask: true });
|
|
9
9
|
|
|
10
|
+
/** @deprecated use monorepo option instead */
|
|
10
11
|
this.option('lerna', {
|
|
11
12
|
type: Boolean,
|
|
12
13
|
required: false,
|
|
13
14
|
desc: 'Lerna monorepo',
|
|
14
15
|
});
|
|
15
16
|
|
|
17
|
+
this.option('monorepo', {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
required: false,
|
|
20
|
+
desc: 'monorepo',
|
|
21
|
+
});
|
|
22
|
+
|
|
16
23
|
this.option('type', {
|
|
17
24
|
type: String,
|
|
18
25
|
required: true,
|
|
@@ -53,7 +60,7 @@ export default class PobBaseGenerator extends Generator {
|
|
|
53
60
|
// prettier package.json to ensure diff is correct
|
|
54
61
|
ensureJsonFileFormatted(this.destinationPath('package.json'));
|
|
55
62
|
|
|
56
|
-
if (this.options.lerna) {
|
|
63
|
+
if (this.options.monorepo || this.options.lerna) {
|
|
57
64
|
this.useLerna = true;
|
|
58
65
|
this.inLerna = false;
|
|
59
66
|
this.isRoot = true;
|
|
@@ -123,6 +130,8 @@ export default class PobBaseGenerator extends Generator {
|
|
|
123
130
|
this.composeWith('pob:core:package', {
|
|
124
131
|
updateOnly: this.options.updateOnly,
|
|
125
132
|
private: this.useLerna,
|
|
133
|
+
monorepo: this.useLerna,
|
|
134
|
+
isRoot: this.isRoot,
|
|
126
135
|
});
|
|
127
136
|
|
|
128
137
|
if (this.useLerna) {
|
|
@@ -207,6 +216,8 @@ export default class PobBaseGenerator extends Generator {
|
|
|
207
216
|
switch (this.projectConfig.type) {
|
|
208
217
|
case 'lib':
|
|
209
218
|
this.composeWith('pob:lib', {
|
|
219
|
+
monorepo: this.useLerna,
|
|
220
|
+
isRoot: this.isRoot,
|
|
210
221
|
updateOnly: this.options.updateOnly,
|
|
211
222
|
fromPob: this.options.fromPob,
|
|
212
223
|
packageManager: this.projectConfig.packageManager,
|
|
@@ -215,6 +226,8 @@ export default class PobBaseGenerator extends Generator {
|
|
|
215
226
|
break;
|
|
216
227
|
case 'app':
|
|
217
228
|
this.composeWith('pob:app', {
|
|
229
|
+
monorepo: this.useLerna,
|
|
230
|
+
isRoot: this.isRoot,
|
|
218
231
|
updateOnly: this.options.updateOnly,
|
|
219
232
|
fromPob: this.options.fromPob,
|
|
220
233
|
packageManager: this.projectConfig.packageManager,
|
package/lib/pob.js
CHANGED
|
@@ -37,9 +37,9 @@ import PobBaseGenerator from './generators/pob/PobBaseGenerator.js';
|
|
|
37
37
|
import { __dirname } from './pob-dirname.cjs';
|
|
38
38
|
|
|
39
39
|
const printUsage = () => {
|
|
40
|
-
console.error('Usage: pob [
|
|
41
|
-
console.error(' pob [
|
|
42
|
-
console.error(' pob
|
|
40
|
+
console.error('Usage: pob [monorepo] [lib|app|init]');
|
|
41
|
+
console.error(' pob [monorepo] update [--force]');
|
|
42
|
+
console.error(' pob monorepo convert-npm');
|
|
43
43
|
console.error(' pob add <packageName>');
|
|
44
44
|
};
|
|
45
45
|
|
|
@@ -209,32 +209,27 @@ env.registerStub(
|
|
|
209
209
|
`${__dirname}/generators/monorepo/typescript/MonorepoTypescriptGenerator.js`,
|
|
210
210
|
);
|
|
211
211
|
|
|
212
|
-
let
|
|
213
|
-
const action =
|
|
212
|
+
let monorepo = argv._[0] === 'lerna' || argv._[0] === 'monorepo';
|
|
213
|
+
const action = monorepo ? argv._[1] : argv._[0];
|
|
214
214
|
const projectPkg = readJson(path.resolve('./package.json'));
|
|
215
215
|
|
|
216
216
|
if (action === 'add') {
|
|
217
|
-
if (!
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
if (!projectPkg.workspaces) {
|
|
218
|
+
throw new Error(
|
|
219
|
+
'Missing workspaces field in package.json: not a lerna repo',
|
|
220
|
+
);
|
|
220
221
|
}
|
|
221
222
|
|
|
222
|
-
const packageName = argv._[1];
|
|
223
|
+
const packageName = monorepo ? argv._[2] : argv._[1];
|
|
223
224
|
|
|
224
225
|
if (!packageName) {
|
|
225
226
|
console.error('Missing argument: packageName');
|
|
226
227
|
printUsage();
|
|
227
228
|
process.exit(1);
|
|
228
229
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
throw new Error(
|
|
233
|
-
'Missing workspaces field in package.json: not a lerna repo',
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
const packagesPath = pkg.workspaces[0].replace(/\/\*$/, '');
|
|
230
|
+
const packagesPath = packageName.startsWith('@')
|
|
231
|
+
? packageName
|
|
232
|
+
: projectPkg.workspaces[0].replace(/\/\*$/, '');
|
|
238
233
|
|
|
239
234
|
fs.mkdirSync(`${packagesPath}/${packageName}`, { recursive: true });
|
|
240
235
|
writeFileSync(`${packagesPath}/${packageName}/.yo-rc.json`, '{}');
|
|
@@ -242,14 +237,20 @@ if (action === 'add') {
|
|
|
242
237
|
`${packagesPath}/${packageName}/package.json`,
|
|
243
238
|
JSON.stringify({ name: packageName, version: '1.0.0-pre' }, null, 2),
|
|
244
239
|
);
|
|
245
|
-
|
|
240
|
+
console.log('> Creating new Package');
|
|
241
|
+
spawnSync(process.argv[0], [process.argv[1]], {
|
|
246
242
|
cwd: `${packagesPath}/${packageName}`,
|
|
247
243
|
stdio: 'inherit',
|
|
248
244
|
});
|
|
245
|
+
|
|
246
|
+
console.log('> Updating monorepo');
|
|
247
|
+
spawnSync(process.argv[0], [process.argv[1], 'update'], {
|
|
248
|
+
stdio: 'inherit',
|
|
249
|
+
});
|
|
249
250
|
process.exit(0);
|
|
250
251
|
}
|
|
251
252
|
|
|
252
|
-
if (
|
|
253
|
+
if (monorepo && action === 'convert-npm') {
|
|
253
254
|
execSync('sed -i \'/"npmClient": "yarn",/d\' ./lerna.json', {
|
|
254
255
|
stdio: 'inherit',
|
|
255
256
|
});
|
|
@@ -260,7 +261,8 @@ if (lerna && action === 'convert-npm') {
|
|
|
260
261
|
}
|
|
261
262
|
|
|
262
263
|
const updateOnly = action === 'update';
|
|
263
|
-
const
|
|
264
|
+
const init = action === 'init';
|
|
265
|
+
const type = updateOnly || init ? null : action;
|
|
264
266
|
const fromPob = updateOnly && argv._[1] === 'from-pob';
|
|
265
267
|
|
|
266
268
|
if (!existsSync('.yo-rc.json')) {
|
|
@@ -272,13 +274,14 @@ if (!existsSync('.yo-rc.json')) {
|
|
|
272
274
|
}
|
|
273
275
|
|
|
274
276
|
if (existsSync('lerna.json') || (projectPkg && projectPkg.lerna)) {
|
|
275
|
-
|
|
277
|
+
monorepo = true;
|
|
276
278
|
}
|
|
277
279
|
|
|
278
280
|
const options = {
|
|
279
281
|
type,
|
|
282
|
+
init,
|
|
280
283
|
updateOnly,
|
|
281
|
-
|
|
284
|
+
monorepo,
|
|
282
285
|
fromPob,
|
|
283
286
|
force: argv.force,
|
|
284
287
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "8.10.
|
|
3
|
+
"version": "8.10.1",
|
|
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.
|
|
67
|
-
"prettier": "2.5.
|
|
66
|
+
"pob-dependencies": "^5.12.0",
|
|
67
|
+
"prettier": "2.5.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": "22fce6512461fa2282baf86a31d090002abca7ac"
|
|
74
74
|
}
|