pob 19.1.1 → 20.0.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/lib/generators/app/PobAppGenerator.js +120 -120
  3. package/lib/generators/app/e2e-testing/AppE2ETestingGenerator.js +11 -11
  4. package/lib/generators/app/ignorePaths.js +24 -24
  5. package/lib/generators/app/nextjs/AppNextjsGenerator.js +9 -9
  6. package/lib/generators/app/remix/AppRemixGenerator.js +7 -7
  7. package/lib/generators/common/babel/CommonBabelGenerator.js +146 -146
  8. package/lib/generators/common/format-lint/CommonLintGenerator.js +185 -185
  9. package/lib/generators/common/format-lint/updateEslintConfig.js +14 -15
  10. package/lib/generators/common/husky/CommonHuskyGenerator.js +44 -44
  11. package/lib/generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js +44 -44
  12. package/lib/generators/common/release/CommonReleaseGenerator.js +40 -40
  13. package/lib/generators/common/testing/CommonTestingGenerator.js +190 -190
  14. package/lib/generators/common/testing/templates/index.js +3 -3
  15. package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +163 -163
  16. package/lib/generators/common/typescript/CommonTypescriptGenerator.js +79 -79
  17. package/lib/generators/common/typescript/templates/tsconfig.js.json.ejs +12 -0
  18. package/lib/generators/core/ci/CoreCIGenerator.js +72 -72
  19. package/lib/generators/core/clean/CoreCleanGenerator.js +4 -4
  20. package/lib/generators/core/editorconfig/CoreEditorConfigGenerator.js +3 -3
  21. package/lib/generators/core/git/CoreGitGenerator.js +43 -43
  22. package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +43 -43
  23. package/lib/generators/core/gitignore/CoreGitignoreGenerator.js +19 -19
  24. package/lib/generators/core/npm/CoreNpmGenerator.js +20 -20
  25. package/lib/generators/core/package/CorePackageGenerator.js +98 -98
  26. package/lib/generators/core/package/askName.js +4 -4
  27. package/lib/generators/core/renovate/CoreRenovateGenerator.js +28 -28
  28. package/lib/generators/core/sort-package/CoreSortPackageGenerator.js +6 -6
  29. package/lib/generators/core/vscode/CoreVSCodeGenerator.js +43 -43
  30. package/lib/generators/core/yarn/CoreYarnGenerator.js +70 -70
  31. package/lib/generators/lib/PobLibGenerator.js +111 -111
  32. package/lib/generators/lib/doc/LibDocGenerator.js +45 -45
  33. package/lib/generators/lib/readme/LibReadmeGenerator.js +21 -21
  34. package/lib/generators/monorepo/PobMonorepoGenerator.js +89 -89
  35. package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +47 -47
  36. package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +38 -38
  37. package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +57 -57
  38. package/lib/generators/pob/PobBaseGenerator.js +81 -81
  39. package/lib/pob-dirname.cjs +1 -1
  40. package/lib/pob.js +143 -143
  41. package/lib/utils/dependenciesPackages.cjs +4 -4
  42. package/lib/utils/ensureJsonFileFormatted.js +5 -5
  43. package/lib/utils/inMonorepo.js +8 -8
  44. package/lib/utils/json5.js +1 -1
  45. package/lib/utils/package.js +43 -43
  46. package/lib/utils/packagejson.cjs +2 -2
  47. package/lib/utils/templateUtils.js +1 -1
  48. package/lib/utils/writeAndFormat.js +9 -10
  49. package/package.json +10 -10
@@ -1,48 +1,48 @@
1
- import Generator from 'yeoman-generator';
2
- import inMonorepo from '../../../utils/inMonorepo.js';
3
- import * as packageUtils from '../../../utils/package.js';
4
- import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
1
+ import Generator from "yeoman-generator";
2
+ import inMonorepo from "../../../utils/inMonorepo.js";
3
+ import * as packageUtils from "../../../utils/package.js";
4
+ import { copyAndFormatTpl } from "../../../utils/writeAndFormat.js";
5
5
 
6
6
  export default class LibDocGenerator extends Generator {
7
7
  constructor(args, opts) {
8
8
  super(args, opts);
9
9
 
10
- this.option('enabled', {
10
+ this.option("enabled", {
11
11
  type: Boolean,
12
12
  required: false,
13
13
  default: true,
14
- desc: 'Enabled.',
14
+ desc: "Enabled.",
15
15
  });
16
16
 
17
- this.option('testing', {
17
+ this.option("testing", {
18
18
  type: Boolean,
19
19
  required: false,
20
20
  default: false,
21
- desc: 'Coverage.',
21
+ desc: "Coverage.",
22
22
  });
23
23
 
24
- this.option('packageManager', {
24
+ this.option("packageManager", {
25
25
  type: String,
26
- default: 'yarn',
27
- desc: 'yarn or npm',
26
+ default: "yarn",
27
+ desc: "yarn or npm",
28
28
  });
29
29
 
30
- this.option('packageNames', {
30
+ this.option("packageNames", {
31
31
  type: String,
32
32
  required: false,
33
- default: '{}',
33
+ default: "{}",
34
34
  });
35
35
  }
36
36
 
37
37
  writing() {
38
- if (this.fs.exists(this.destinationPath('jsdoc.conf.json'))) {
39
- this.fs.delete(this.destinationPath('jsdoc.conf.json'));
38
+ if (this.fs.exists(this.destinationPath("jsdoc.conf.json"))) {
39
+ this.fs.delete(this.destinationPath("jsdoc.conf.json"));
40
40
  }
41
- if (this.fs.exists(this.destinationPath('jsdoc.conf.js'))) {
42
- this.fs.delete(this.destinationPath('jsdoc.conf.js'));
41
+ if (this.fs.exists(this.destinationPath("jsdoc.conf.js"))) {
42
+ this.fs.delete(this.destinationPath("jsdoc.conf.js"));
43
43
  }
44
44
 
45
- const pkg = this.fs.readJSON(this.destinationPath('package.json'));
45
+ const pkg = this.fs.readJSON(this.destinationPath("package.json"));
46
46
 
47
47
  if (this.options.enabled) {
48
48
  const jsx =
@@ -52,19 +52,19 @@ export default class LibDocGenerator extends Generator {
52
52
 
53
53
  if (inMonorepo && inMonorepo.root) {
54
54
  const existingConfig = this.fs.readJSON(
55
- this.destinationPath('tsconfig.doc.json'),
56
- { typedocOptions: {} },
55
+ this.destinationPath("tsconfig.doc.json"),
56
+ { typedocOptions: {} }
57
57
  );
58
58
  // "external-modulemap": ".*packages/([^/]+)/.*",
59
59
  const packagePaths = JSON.parse(this.options.packagePaths);
60
60
 
61
61
  const filteredPackages = packagePaths
62
- .filter((pkgPath) => !pkgPath.endsWith('-example'))
62
+ .filter((pkgPath) => !pkgPath.endsWith("-example"))
63
63
  .map((pkgPath) => {
64
64
  return {
65
65
  path: pkgPath,
66
66
  packageJSON: this.fs.readJSON(
67
- this.destinationPath(`${pkgPath}/package.json`),
67
+ this.destinationPath(`${pkgPath}/package.json`)
68
68
  ),
69
69
  };
70
70
  });
@@ -79,14 +79,14 @@ export default class LibDocGenerator extends Generator {
79
79
  // unshift:https://typedoc.org/guides/project-references/
80
80
  entryPoints.unshift(
81
81
  // `${path}/src/`,
82
- ...entries.map((entry) => `${path}/src/${entry}.ts`),
82
+ ...entries.map((entry) => `${path}/src/${entry}.ts`)
83
83
  );
84
84
  }
85
85
  }
86
86
  copyAndFormatTpl(
87
87
  this.fs,
88
- this.templatePath('tsconfig.doc.json.lerna.ejs'),
89
- this.destinationPath('tsconfig.doc.json'),
88
+ this.templatePath("tsconfig.doc.json.lerna.ejs"),
89
+ this.destinationPath("tsconfig.doc.json"),
90
90
  {
91
91
  jsx,
92
92
  workspaces: pkg.workspaces,
@@ -94,41 +94,41 @@ export default class LibDocGenerator extends Generator {
94
94
  packagePaths: filteredPackages.map((p) => p.path),
95
95
  repositoryUrl: pkg.homepage, // or pkg.repository.replace(/\.git$/, '')
96
96
  packageManager: this.options.packageManager,
97
- readme: existingConfig.typedocOptions.readme || 'README.md',
98
- },
97
+ readme: existingConfig.typedocOptions.readme || "README.md",
98
+ }
99
99
  );
100
100
  } else {
101
101
  const entryPoints = ((pkg.pob && pkg.pob.entries) || []).map(
102
- (entryName) => `src/${entryName}.ts`,
102
+ (entryName) => `src/${entryName}.ts`
103
103
  );
104
104
  copyAndFormatTpl(
105
105
  this.fs,
106
- this.templatePath('tsconfig.doc.json.ejs'),
107
- this.destinationPath('tsconfig.doc.json'),
108
- { jsx, readme: 'README.md', entryPoints },
106
+ this.templatePath("tsconfig.doc.json.ejs"),
107
+ this.destinationPath("tsconfig.doc.json"),
108
+ { jsx, readme: "README.md", entryPoints }
109
109
  );
110
110
  }
111
111
  } else {
112
112
  // this.fs.delete(this.destinationPath('jsdoc.conf.js'));
113
- if (this.fs.exists(this.destinationPath('docs'))) {
114
- this.fs.delete(this.destinationPath('docs'));
113
+ if (this.fs.exists(this.destinationPath("docs"))) {
114
+ this.fs.delete(this.destinationPath("docs"));
115
115
  }
116
116
 
117
- if (this.fs.exists(this.destinationPath('tsconfig.doc.json'))) {
118
- this.fs.delete(this.destinationPath('tsconfig.doc.json'));
117
+ if (this.fs.exists(this.destinationPath("tsconfig.doc.json"))) {
118
+ this.fs.delete(this.destinationPath("tsconfig.doc.json"));
119
119
  }
120
120
  }
121
121
 
122
122
  packageUtils.removeDevDependencies(pkg, [
123
- 'jsdoc',
124
- 'minami',
125
- 'jaguarjs-jsdoc',
126
- 'typedoc-plugin-lerna-packages',
127
- '@chrp/typedoc-plugin-lerna-packages',
123
+ "jsdoc",
124
+ "minami",
125
+ "jaguarjs-jsdoc",
126
+ "typedoc-plugin-lerna-packages",
127
+ "@chrp/typedoc-plugin-lerna-packages",
128
128
  ]);
129
129
 
130
130
  packageUtils.addOrRemoveDevDependencies(pkg, this.options.enabled, [
131
- 'typedoc',
131
+ "typedoc",
132
132
  ]);
133
133
 
134
134
  // packageUtils.addOrRemoveDevDependencies(
@@ -147,17 +147,17 @@ export default class LibDocGenerator extends Generator {
147
147
  // );
148
148
 
149
149
  if (pkg.scripts) {
150
- delete pkg.scripts['generate:docs'];
150
+ delete pkg.scripts["generate:docs"];
151
151
  }
152
152
 
153
153
  if (this.options.enabled) {
154
154
  packageUtils.addScripts(pkg, {
155
- 'generate:api': 'typedoc --tsconfig tsconfig.doc.json',
155
+ "generate:api": "typedoc --tsconfig tsconfig.doc.json",
156
156
  });
157
157
  } else {
158
- delete pkg.scripts['generate:api'];
158
+ delete pkg.scripts["generate:api"];
159
159
  }
160
160
 
161
- this.fs.writeJSON(this.destinationPath('package.json'), pkg);
161
+ this.fs.writeJSON(this.destinationPath("package.json"), pkg);
162
162
  }
163
163
  }
@@ -1,48 +1,48 @@
1
- import camelCase from 'lodash.camelcase';
2
- import Generator from 'yeoman-generator';
3
- import inMonorepo from '../../../utils/inMonorepo.js';
4
- import * as packageUtils from '../../../utils/package.js';
5
- import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
1
+ import camelCase from "lodash.camelcase";
2
+ import Generator from "yeoman-generator";
3
+ import inMonorepo from "../../../utils/inMonorepo.js";
4
+ import * as packageUtils from "../../../utils/package.js";
5
+ import { copyAndFormatTpl } from "../../../utils/writeAndFormat.js";
6
6
 
7
7
  export default class LibReadmeGenerator extends Generator {
8
8
  constructor(args, opts) {
9
9
  super(args, opts);
10
10
 
11
- this.option('privatePackage', {
11
+ this.option("privatePackage", {
12
12
  type: Boolean,
13
13
  required: true,
14
- desc: 'If the project is private',
14
+ desc: "If the project is private",
15
15
  });
16
16
 
17
- this.option('documentation', {
17
+ this.option("documentation", {
18
18
  type: Boolean,
19
19
  required: true,
20
- desc: 'Include documentation',
20
+ desc: "Include documentation",
21
21
  });
22
22
 
23
- this.option('testing', {
23
+ this.option("testing", {
24
24
  type: Boolean,
25
25
  required: true,
26
- desc: 'Include testing badge',
26
+ desc: "Include testing badge",
27
27
  });
28
28
 
29
- this.option('codecov', {
29
+ this.option("codecov", {
30
30
  type: Boolean,
31
31
  required: true,
32
- desc: 'Include codecov badge',
32
+ desc: "Include codecov badge",
33
33
  });
34
34
 
35
- this.option('content', {
35
+ this.option("content", {
36
36
  type: String,
37
37
  required: false,
38
- desc: 'Readme content',
38
+ desc: "Readme content",
39
39
  });
40
40
  }
41
41
 
42
42
  writing() {
43
- const pkg = this.fs.readJSON(this.destinationPath('package.json'));
43
+ const pkg = this.fs.readJSON(this.destinationPath("package.json"));
44
44
 
45
- const readmePath = this.destinationPath('README.md');
45
+ const readmePath = this.destinationPath("README.md");
46
46
  let content = this.options.content;
47
47
 
48
48
  if (this.fs.exists(readmePath)) {
@@ -68,13 +68,13 @@ export default class LibReadmeGenerator extends Generator {
68
68
  const match =
69
69
  repository &&
70
70
  repository.match(
71
- /^(?:git@|https?:\/\/)(?:([^./:]+)(?:\.com)?[/:])?([^/:]+)\/([^./:]+)(?:.git)?/,
71
+ /^(?:git@|https?:\/\/)(?:([^./:]+)(?:\.com)?[/:])?([^/:]+)\/([^./:]+)(?:.git)?/
72
72
  );
73
73
  const [, gitHost, gitAccount, gitName] = match || [];
74
74
  try {
75
75
  copyAndFormatTpl(
76
76
  this.fs,
77
- this.templatePath('README.md.ejs'),
77
+ this.templatePath("README.md.ejs"),
78
78
  readmePath,
79
79
  {
80
80
  privatePackage: pkg.private,
@@ -93,12 +93,12 @@ export default class LibReadmeGenerator extends Generator {
93
93
  codecov: this.options.codecov,
94
94
  documentation: this.options.documentation,
95
95
  documentationUrl:
96
- this.options.documentation && gitHost === 'github'
96
+ this.options.documentation && gitHost === "github"
97
97
  ? `https://${gitAccount}.github.io/${gitName}/`
98
98
  : undefined,
99
99
  testing: this.options.testing,
100
100
  content,
101
- },
101
+ }
102
102
  );
103
103
  } catch (error) {
104
104
  console.log(error.stack || error.message || error);