pob 20.0.0 → 21.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 (44) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/lib/generators/app/PobAppGenerator.js +12 -10
  3. package/lib/generators/app/e2e-testing/AppE2ETestingGenerator.js +2 -2
  4. package/lib/generators/app/ignorePaths.js +1 -0
  5. package/lib/generators/app/nextjs/AppNextjsGenerator.js +1 -1
  6. package/lib/generators/common/babel/CommonBabelGenerator.js +44 -28
  7. package/lib/generators/common/format-lint/CommonLintGenerator.js +33 -28
  8. package/lib/generators/common/format-lint/updateEslintConfig.js +5 -5
  9. package/lib/generators/common/husky/CommonHuskyGenerator.js +4 -4
  10. package/lib/generators/common/husky/templates/lint-staged.config.js.txt +1 -1
  11. package/lib/generators/common/release/CommonReleaseGenerator.js +14 -13
  12. package/lib/generators/common/release/templates/workflow-release.yml.ejs +2 -2
  13. package/lib/generators/common/testing/CommonTestingGenerator.js +46 -44
  14. package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +18 -25
  15. package/lib/generators/common/typescript/CommonTypescriptGenerator.js +28 -24
  16. package/lib/generators/core/ci/CoreCIGenerator.js +20 -25
  17. package/lib/generators/core/clean/CoreCleanGenerator.js +1 -1
  18. package/lib/generators/core/editorconfig/CoreEditorConfigGenerator.js +1 -1
  19. package/lib/generators/core/git/CoreGitGenerator.js +6 -6
  20. package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +8 -8
  21. package/lib/generators/core/gitignore/CoreGitignoreGenerator.js +7 -11
  22. package/lib/generators/core/npm/CoreNpmGenerator.js +4 -4
  23. package/lib/generators/core/package/CorePackageGenerator.js +18 -18
  24. package/lib/generators/core/renovate/CoreRenovateGenerator.js +5 -5
  25. package/lib/generators/core/sort-package/CoreSortPackageGenerator.js +1 -1
  26. package/lib/generators/core/vscode/CoreVSCodeGenerator.js +13 -12
  27. package/lib/generators/core/yarn/CoreYarnGenerator.js +32 -27
  28. package/lib/generators/lib/PobLibGenerator.js +22 -20
  29. package/lib/generators/lib/doc/LibDocGenerator.js +9 -9
  30. package/lib/generators/lib/readme/LibReadmeGenerator.js +7 -7
  31. package/lib/generators/monorepo/PobMonorepoGenerator.js +19 -18
  32. package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +19 -15
  33. package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +6 -6
  34. package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +23 -19
  35. package/lib/generators/pob/PobBaseGenerator.js +7 -7
  36. package/lib/pob.js +33 -33
  37. package/lib/utils/ensureJsonFileFormatted.js +1 -1
  38. package/lib/utils/inMonorepo.js +1 -1
  39. package/lib/utils/package.js +7 -7
  40. package/lib/utils/packagejson.js +5 -0
  41. package/lib/utils/templateUtils.js +1 -1
  42. package/lib/utils/writeAndFormat.js +2 -2
  43. package/package.json +21 -17
  44. package/lib/utils/packagejson.cjs +0 -3
@@ -11,7 +11,7 @@ export default class CommonHuskyGenerator extends Generator {
11
11
  type: String,
12
12
  required: false,
13
13
  default: "",
14
- desc: "Destination of the generated files.",
14
+ description: "Destination of the generated files.",
15
15
  });
16
16
  }
17
17
 
@@ -51,7 +51,7 @@ export default class CommonHuskyGenerator extends Generator {
51
51
  if (this.fs.exists(this.destinationPath("lint-staged.config.cjs"))) {
52
52
  this.fs.move(
53
53
  this.destinationPath("lint-staged.config.cjs"),
54
- this.destinationPath("lint-staged.config.js")
54
+ this.destinationPath("lint-staged.config.js"),
55
55
  );
56
56
  }
57
57
 
@@ -72,12 +72,12 @@ export default class CommonHuskyGenerator extends Generator {
72
72
  if (pkg.type !== "module") {
73
73
  this.fs.copy(
74
74
  this.templatePath("lint-staged.config.cjs.txt"),
75
- this.destinationPath("lint-staged.config.js")
75
+ this.destinationPath("lint-staged.config.js"),
76
76
  );
77
77
  } else {
78
78
  this.fs.copy(
79
79
  this.templatePath("lint-staged.config.js.txt"),
80
- this.destinationPath("lint-staged.config.js")
80
+ this.destinationPath("lint-staged.config.js"),
81
81
  );
82
82
  }
83
83
  }
@@ -1,3 +1,3 @@
1
- import createLintStagedConfig from '@pob/root/createLintStagedConfig';
1
+ import createLintStagedConfig from "@pob/root/createLintStagedConfig";
2
2
 
3
3
  export default createLintStagedConfig();
@@ -8,58 +8,59 @@ export default class CommonReleaseGenerator extends Generator {
8
8
  this.option("enable", {
9
9
  type: Boolean,
10
10
  required: true,
11
- desc: "If releasing is enabled",
11
+ description: "If releasing is enabled",
12
12
  });
13
13
 
14
14
  this.option("enablePublish", {
15
15
  type: Boolean,
16
16
  required: true,
17
- desc: "If publish on npm is enabled",
17
+ description: "If publish on npm is enabled",
18
18
  });
19
19
 
20
20
  this.option("withBabel", {
21
21
  type: Boolean,
22
22
  required: false,
23
23
  default: undefined,
24
- desc: "Babel enabled.",
24
+ description: "Babel enabled.",
25
25
  });
26
26
 
27
27
  this.option("withTypescript", {
28
28
  type: Boolean,
29
29
  required: false,
30
30
  default: undefined,
31
- desc: "Typescript enabled.",
31
+ description: "Typescript enabled.",
32
32
  });
33
33
  this.option("isMonorepo", {
34
34
  type: Boolean,
35
35
  default: false,
36
- desc: "is monorepo",
36
+ description: "is monorepo",
37
37
  });
38
38
 
39
39
  this.option("enableYarnVersion", {
40
40
  type: Boolean,
41
41
  default: true,
42
- desc: "enable yarn version conventional commits",
42
+ description: "enable yarn version conventional commits",
43
43
  });
44
44
 
45
45
  this.option("ci", {
46
46
  type: Boolean,
47
47
  required: true,
48
- desc: "ci with github actions",
48
+ description: "ci with github actions",
49
49
  });
50
50
 
51
51
  this.option("disableYarnGitCache", {
52
52
  type: Boolean,
53
53
  required: false,
54
54
  default: false,
55
- desc: "Disable git cache. See https://yarnpkg.com/features/caching#offline-mirror.",
55
+ description:
56
+ "Disable git cache. See https://yarnpkg.com/features/caching#offline-mirror.",
56
57
  });
57
58
 
58
59
  this.option("updateOnly", {
59
60
  type: Boolean,
60
61
  required: false,
61
62
  default: false,
62
- desc: "Avoid asking questions",
63
+ description: "Avoid asking questions",
63
64
  });
64
65
  }
65
66
 
@@ -68,7 +69,7 @@ export default class CommonReleaseGenerator extends Generator {
68
69
 
69
70
  if (this.options.enable && this.options.ci) {
70
71
  const useLegacyName = this.fs.exists(
71
- this.destinationPath(".github/workflows/publish.yml")
72
+ this.destinationPath(".github/workflows/publish.yml"),
72
73
  );
73
74
 
74
75
  const name = useLegacyName ? "publish.yml" : "release.yml";
@@ -85,7 +86,7 @@ export default class CommonReleaseGenerator extends Generator {
85
86
  isMonorepoIndependent:
86
87
  this.options.isMonorepo &&
87
88
  (!pkg.version || pkg.version === "0.0.0"),
88
- }
89
+ },
89
90
  );
90
91
  } else {
91
92
  this.fs.delete(this.destinationPath(".github/workflows/publish.yml"));
@@ -117,11 +118,11 @@ export default class CommonReleaseGenerator extends Generator {
117
118
 
118
119
  if (
119
120
  this.fs.exists(
120
- this.destinationPath(".github/workflows/release-please.yml")
121
+ this.destinationPath(".github/workflows/release-please.yml"),
121
122
  )
122
123
  ) {
123
124
  this.fs.delete(
124
- this.destinationPath(".github/workflows/release-please.yml")
125
+ this.destinationPath(".github/workflows/release-please.yml"),
125
126
  );
126
127
  }
127
128
 
@@ -46,7 +46,7 @@ jobs:
46
46
  - name: New version (dry run)
47
47
  if: github.ref == 'refs/heads/main' && inputs.dry-run
48
48
  <% if (enableYarnVersion) { -%>
49
- run: yarn version --dry-run<% if (isMonorepo && isMonorepoIndependent) { %> --bump-dependents-highest-as=${{ inputs.bump-dependents-highest-as }}<% } %>
49
+ run: yarn yarn-version version --dry-run<% if (isMonorepo && isMonorepoIndependent) { %> --bump-dependents-highest-as=${{ inputs.bump-dependents-highest-as }}<% } %>
50
50
  <% } else { -%>
51
51
  run: yarn lerna version --yes --no-push --exact --conventional-commits --conventional-graduate --changelog-preset conventional-changelog-conventionalcommits --no-git-tag-version --loglevel=verbose
52
52
  <% } -%>
@@ -60,7 +60,7 @@ jobs:
60
60
  if: github.ref == 'refs/heads/main' && !inputs.dry-run
61
61
  run: |
62
62
  <% if (enableYarnVersion) { -%>
63
- yarn version --create-release=github <% if (isMonorepo && isMonorepoIndependent) { %> --bump-dependents-highest-as=${{ inputs.bump-dependents-highest-as }}<% } %> -m 'chore: release <%- isMonorepoIndependent ? '' : '%v ' %>[skip ci]<%- isMonorepoIndependent ? '\\n\\n%t' : '' %>'
63
+ yarn yarn-version version --create-release=github <% if (isMonorepo && isMonorepoIndependent) { %> --bump-dependents-highest-as=${{ inputs.bump-dependents-highest-as }}<% } %> -m 'chore: release <%- isMonorepoIndependent ? '' : '%v ' %>[skip ci]<%- isMonorepoIndependent ? '\\n\\n%t' : '' %>'
64
64
  <% } else { -%>
65
65
  yarn lerna version --yes --push --exact --conventional-commits --conventional-graduate --changelog-preset conventional-changelog-conventionalcommits --create-release=github -m 'chore: release [skip ci]'
66
66
  <% } -%>
@@ -15,111 +15,112 @@ export default class CommonTestingGenerator extends Generator {
15
15
  this.option("monorepo", {
16
16
  type: Boolean,
17
17
  default: false,
18
- desc: "is root monorepo",
18
+ description: "is root monorepo",
19
19
  });
20
20
 
21
21
  this.option("enable", {
22
22
  type: Boolean,
23
23
  default: true,
24
- desc: "enable testing",
24
+ description: "enable testing",
25
25
  });
26
26
 
27
27
  this.option("runner", {
28
28
  type: String,
29
29
  default: "jest",
30
- desc: "test runner (jest or node)",
30
+ description: "test runner (jest or node)",
31
31
  });
32
32
 
33
33
  this.option("enableReleasePlease", {
34
34
  type: Boolean,
35
35
  default: true,
36
- desc: "enable release-please",
36
+ description: "enable release-please",
37
37
  });
38
38
 
39
39
  this.option("enableYarnVersion", {
40
40
  type: Boolean,
41
41
  default: true,
42
- desc: "enable yarn version conventional commits",
42
+ description: "enable yarn version conventional commits",
43
43
  });
44
44
 
45
45
  this.option("ci", {
46
46
  type: Boolean,
47
47
  required: true,
48
- desc: "ci",
48
+ description: "ci",
49
49
  });
50
50
 
51
51
  this.option("typescript", {
52
52
  type: Boolean,
53
53
  required: true,
54
- desc: "typescript",
54
+ description: "typescript",
55
55
  });
56
56
 
57
57
  this.option("build", {
58
58
  type: Boolean,
59
59
  required: true,
60
- desc: "build (with babel or typescript)",
60
+ description: "build (with babel or typescript)",
61
61
  });
62
62
 
63
63
  this.option("codecov", {
64
64
  type: Boolean,
65
65
  required: true,
66
- desc: "Include codecov report",
66
+ description: "Include codecov report",
67
67
  });
68
68
 
69
69
  this.option("documentation", {
70
70
  type: Boolean,
71
71
  required: true,
72
- desc: "Include documentation generation",
72
+ description: "Include documentation generation",
73
73
  });
74
74
 
75
75
  this.option("packageManager", {
76
76
  type: String,
77
77
  default: "yarn",
78
- desc: "yarn or npm",
78
+ description: "yarn or npm",
79
79
  });
80
80
 
81
81
  this.option("isApp", {
82
82
  type: Boolean,
83
83
  required: true,
84
- desc: "is app",
84
+ description: "is app",
85
85
  });
86
86
 
87
87
  this.option("e2eTesting", {
88
88
  type: String,
89
89
  default: "",
90
- desc: "e2e testing package path",
90
+ description: "e2e testing package path",
91
91
  });
92
92
 
93
93
  this.option("splitCIJobs", {
94
94
  type: Boolean,
95
95
  required: true,
96
- desc: "split CI jobs for faster result",
96
+ description: "split CI jobs for faster result",
97
97
  });
98
98
 
99
99
  this.option("onlyLatestLTS", {
100
100
  type: Boolean,
101
101
  required: true,
102
- desc: "only latest lts",
102
+ description: "only latest lts",
103
103
  });
104
104
 
105
105
  this.option("srcDirectory", {
106
106
  type: String,
107
107
  default: "src",
108
- desc: 'customize srcDirectory, default to "src"',
108
+ description: 'customize srcDirectory, default to "src"',
109
109
  });
110
110
 
111
111
  this.option("disableYarnGitCache", {
112
112
  type: Boolean,
113
113
  required: false,
114
114
  default: false,
115
- desc: "Disable git cache. See https://yarnpkg.com/features/caching#offline-mirror.",
115
+ description:
116
+ "Disable git cache. See https://yarnpkg.com/features/caching#offline-mirror.",
116
117
  });
117
118
 
118
119
  this.option("swc", {
119
120
  type: Boolean,
120
121
  required: false,
121
122
  default: false,
122
- desc: "Use swc to transpile code.",
123
+ description: "Use swc to transpile code.",
123
124
  });
124
125
  }
125
126
 
@@ -170,9 +171,9 @@ export default class CommonTestingGenerator extends Generator {
170
171
  const transpileWithBabel = transpileWithEsbuild
171
172
  ? false
172
173
  : // eslint-disable-next-line unicorn/no-nested-ternary
173
- this.options.monorepo
174
- ? yoConfigPobMonorepo.typescript
175
- : packageUtils.transpileWithBabel(pkg);
174
+ this.options.monorepo
175
+ ? yoConfigPobMonorepo.typescript
176
+ : packageUtils.transpileWithBabel(pkg);
176
177
  const withTypescript = transpileWithBabel || pkg.pob?.typescript;
177
178
  let hasReact =
178
179
  withTypescript &&
@@ -218,7 +219,7 @@ export default class CommonTestingGenerator extends Generator {
218
219
  pkg,
219
220
  sharedCondition &&
220
221
  (testRunner === "node" || (withTypescript && !transpileWithBabel)),
221
- devDependenciesShared
222
+ devDependenciesShared,
222
223
  );
223
224
  if (devDependenciesWithJest) {
224
225
  packageUtils.addOrRemoveDevDependencies(
@@ -227,7 +228,7 @@ export default class CommonTestingGenerator extends Generator {
227
228
  withTypescript &&
228
229
  !transpileWithBabel &&
229
230
  testRunner === "jest",
230
- devDependenciesWithJest
231
+ devDependenciesWithJest,
231
232
  );
232
233
  }
233
234
  if (devDependenciesWithNode) {
@@ -237,10 +238,10 @@ export default class CommonTestingGenerator extends Generator {
237
238
  withTypescript &&
238
239
  !transpileWithBabel &&
239
240
  testRunner === "node",
240
- devDependenciesWithNode
241
+ devDependenciesWithNode,
241
242
  );
242
243
  }
243
- }
244
+ },
244
245
  );
245
246
 
246
247
  if (
@@ -343,7 +344,7 @@ export default class CommonTestingGenerator extends Generator {
343
344
  this.options.enable &&
344
345
  (enableForMonorepo || !globalTesting) &&
345
346
  testRunner === "jest",
346
- ["jest", "@types/jest"]
347
+ ["jest", "@types/jest"],
347
348
  );
348
349
 
349
350
  if (!this.options.enable) {
@@ -415,7 +416,7 @@ export default class CommonTestingGenerator extends Generator {
415
416
 
416
417
  if (isJestRunner) {
417
418
  hasReact = yoConfigPobMonorepo.packageNames.some((pkgName) =>
418
- pkgName.startsWith("react-")
419
+ pkgName.startsWith("react-"),
419
420
  );
420
421
 
421
422
  const jestConfig = this.fs.readJSON(jestConfigPath, pkg.jest ?? {});
@@ -453,8 +454,8 @@ export default class CommonTestingGenerator extends Generator {
453
454
  Object.entries(jestConfig.transform).filter(
454
455
  ([key, value]) =>
455
456
  value !== "@swc/jest" &&
456
- !(Array.isArray(value) && value[0] === "@swc/jest")
457
- )
457
+ !(Array.isArray(value) && value[0] === "@swc/jest"),
458
+ ),
458
459
  );
459
460
  if (Object.keys(jestConfig.transform).length === 0) {
460
461
  delete jestConfig.transform;
@@ -473,7 +474,7 @@ export default class CommonTestingGenerator extends Generator {
473
474
  tsconfigTestPath,
474
475
  {
475
476
  nodeVersion,
476
- }
477
+ },
477
478
  );
478
479
  } else {
479
480
  this.fs.delete(tsconfigTestPath);
@@ -491,9 +492,10 @@ export default class CommonTestingGenerator extends Generator {
491
492
  .replace("\\", "/")}`,
492
493
  });
493
494
  } else {
494
- const babelEnvs = pkg.pob?.babelEnvs || [];
495
- const transpileWithBabel = packageUtils.transpileWithBabel(pkg);
496
- const withTypescript = babelEnvs.length > 0 || pkg.pob?.typescript;
495
+ const withTypescript =
496
+ pkg.pob?.envs?.length > 0 ||
497
+ pkg.pob?.bundler === "rollup-babel" ||
498
+ pkg.pob?.typescript;
497
499
 
498
500
  const shouldUseExperimentalVmModules =
499
501
  pkg.type === "module" && !inMonorepo;
@@ -519,10 +521,9 @@ export default class CommonTestingGenerator extends Generator {
519
521
  });
520
522
 
521
523
  if (testRunner === "jest") {
522
- const srcDirectory =
523
- transpileWithBabel || withTypescript
524
- ? this.options.srcDirectory
525
- : "lib";
524
+ const srcDirectory = this.options.build
525
+ ? this.options.srcDirectory
526
+ : "lib";
526
527
 
527
528
  const jestConfig = this.fs.readJSON(jestConfigPath, pkg.jest ?? {});
528
529
  delete pkg.jest;
@@ -577,8 +578,8 @@ export default class CommonTestingGenerator extends Generator {
577
578
  Object.entries(jestConfig.transform).filter(
578
579
  ([key, value]) =>
579
580
  value !== "@swc/jest" &&
580
- !(Array.isArray(value) && value[0] === "@swc/jest")
581
- )
581
+ !(Array.isArray(value) && value[0] === "@swc/jest"),
582
+ ),
582
583
  );
583
584
  if (Object.keys(jestConfig.transform).length === 0) {
584
585
  delete jestConfig.transform;
@@ -593,8 +594,8 @@ export default class CommonTestingGenerator extends Generator {
593
594
  value &&
594
595
  Array.isArray(value) &&
595
596
  value[0] === "jest-esbuild"
596
- )
597
- )
597
+ ),
598
+ ),
598
599
  );
599
600
  if (Object.keys(jestConfig.transform).length === 0) {
600
601
  delete jestConfig.transform;
@@ -612,8 +613,9 @@ export default class CommonTestingGenerator extends Generator {
612
613
  }
613
614
 
614
615
  if (
615
- babelEnvs.length === 0 ||
616
- babelEnvs.some((env) => env.target === "node")
616
+ !pkg.pob?.envs ||
617
+ pkg.pob?.envs.length === 0 ||
618
+ pkg.pob?.envs.some((env) => env.target === "node")
617
619
  ) {
618
620
  // jestConfig.testEnvironment = 'node'; this is the default now
619
621
  delete jestConfig.testEnvironment;
@@ -652,7 +654,7 @@ export default class CommonTestingGenerator extends Generator {
652
654
  !!pkg.devDependencies?.["alp-dev"],
653
655
  testing: this.options.testing,
654
656
  jestExperimentalESM: pkg.type === "module",
655
- }
657
+ },
656
658
  );
657
659
  } else {
658
660
  this.fs.delete("babel.config.cjs");
@@ -12,14 +12,14 @@ export default class CommonTranspilerGenerator extends Generator {
12
12
  type: Boolean,
13
13
  required: false,
14
14
  default: false,
15
- desc: "Avoid asking questions",
15
+ description: "Avoid asking questions",
16
16
  });
17
17
 
18
18
  this.option("testing", {
19
19
  type: Boolean,
20
20
  required: false,
21
21
  default: false,
22
- desc: "Has testing.",
22
+ description: "Has testing.",
23
23
  });
24
24
 
25
25
  this.option("fromPob", {
@@ -62,7 +62,7 @@ export default class CommonTranspilerGenerator extends Generator {
62
62
  type: Boolean,
63
63
  required: false,
64
64
  default: false,
65
- desc: "only latest lts",
65
+ description: "only latest lts",
66
66
  });
67
67
  }
68
68
 
@@ -137,15 +137,13 @@ export default class CommonTranspilerGenerator extends Generator {
137
137
  (pkg.pob.rollup === false
138
138
  ? "tsc"
139
139
  : pkg.pob.bundler ??
140
- (pkg.pob.typescript ? "rollup-typescript" : "rollup"));
140
+ (pkg.pob.typescript ? "rollup-typescript" : "rollup-babel"));
141
141
  this.bundler = bundler;
142
142
 
143
143
  const cleanCommand = (() => {
144
144
  if (bundler === "rollup-typescript") return "pob-typescript-clean-out";
145
145
  if (bundler === "rollup-esbuild") return "pob-esbuild-clean-out";
146
- if (bundler === "rollup") {
147
- return "pob-babel-clean-out";
148
- }
146
+ if (bundler === "rollup-babel") return "pob-babel-clean-out";
149
147
  if (bundler === "esbuild") return "pob-esbuild-clean-out";
150
148
  return null;
151
149
  })();
@@ -225,32 +223,32 @@ export default class CommonTranspilerGenerator extends Generator {
225
223
  packageUtils.addOrRemoveDevDependencies(
226
224
  pkg,
227
225
  bundler === "rollup-typescript",
228
- ["@pob/rollup-typescript"]
226
+ ["@pob/rollup-typescript"],
229
227
  );
230
228
  packageUtils.addOrRemoveDevDependencies(
231
229
  pkg,
232
230
  bundler === "esbuild" && withTypescript,
233
- ["@pob/esbuild"]
231
+ ["@pob/esbuild"],
234
232
  );
235
233
  packageUtils.addOrRemoveDevDependencies(
236
234
  pkg,
237
235
  bundler === "rollup-esbuild" && withTypescript,
238
- ["@pob/rollup-esbuild"]
236
+ ["@pob/rollup-esbuild"],
239
237
  );
240
238
  packageUtils.addOrRemoveDependencies(
241
239
  pkg,
242
240
  (bundler === "tsc" || bundler === "rollup-typescript") && withTypescript,
243
241
  ["tslib"],
244
- "^"
242
+ "^",
245
243
  );
246
244
 
247
245
  packageUtils.addOrRemoveDevDependencies(
248
246
  pkg,
249
- bundler === "rollup" &&
247
+ bundler === "rollup-babel" &&
250
248
  this.options.isApp &&
251
249
  !this.options.isAppLibrary &&
252
250
  this.options.useAppConfig,
253
- ["alp-rollup-plugin-config"]
251
+ ["alp-rollup-plugin-config"],
254
252
  );
255
253
 
256
254
  /* engines */
@@ -265,7 +263,7 @@ export default class CommonTranspilerGenerator extends Generator {
265
263
  console.warn("Setting pkg.sideEffects to true, as it was not defined");
266
264
  } else if (pkg.sideEffects) {
267
265
  console.warn(
268
- "pkg.sideEffects is true, are you sure you can't set it to false ?"
266
+ "pkg.sideEffects is true, are you sure you can't set it to false ?",
269
267
  );
270
268
  }
271
269
 
@@ -284,9 +282,7 @@ export default class CommonTranspilerGenerator extends Generator {
284
282
  // see pkg.exports instead.
285
283
  delete pkg.main;
286
284
  if (!this.options.isApp) {
287
- pkg.types = `./${
288
- this.options.buildDirectory
289
- }/${"definitions/"}index.d.ts`;
285
+ pkg.types = `./${this.options.buildDirectory}/${"definitions/"}index.d.ts`;
290
286
  } else if (this.options.isAppLibrary) {
291
287
  pkg.types = `./${this.options.srcDirectory}/index.ts`;
292
288
  }
@@ -330,7 +326,7 @@ export default class CommonTranspilerGenerator extends Generator {
330
326
  (env) =>
331
327
  env.target === "browser" &&
332
328
  env.version === undefined &&
333
- (!env.formats || env.formats.includes("es"))
329
+ (!env.formats || env.formats.includes("es")),
334
330
  );
335
331
 
336
332
  // Legacy "dev" builds
@@ -521,6 +517,7 @@ export default class CommonTranspilerGenerator extends Generator {
521
517
  writing() {
522
518
  const pkg = this.fs.readJSON(this.destinationPath("package.json"));
523
519
  const entries = pkg.pob.entries || ["index"];
520
+ const envs = pkg.pob.envs || pkg.pob.babelEnvs;
524
521
 
525
522
  this.fs.delete("rollup.config.js");
526
523
  if (
@@ -538,7 +535,7 @@ export default class CommonTranspilerGenerator extends Generator {
538
535
  config: this.options.useAppConfig,
539
536
  outDirectory: this.options.buildDirectory,
540
537
  enableRun: !this.options.isAppLibrary && entries.includes("index"),
541
- }
538
+ },
542
539
  );
543
540
  } else {
544
541
  copyAndFormatTpl(
@@ -548,14 +545,10 @@ export default class CommonTranspilerGenerator extends Generator {
548
545
  {
549
546
  rollupConfigLib: this.bundler,
550
547
  outDirectory: this.options.buildDirectory,
551
- }
548
+ },
552
549
  );
553
550
  }
554
- } else if (
555
- !pkg.pob.babelEnvs ||
556
- pkg.pob.babelEnvs.length === 0 ||
557
- pkg.pob?.bundler === "esbuild"
558
- ) {
551
+ } else if (!envs || envs.length === 0 || pkg.pob?.bundler === "esbuild") {
559
552
  this.fs.delete("rollup.config.mjs");
560
553
  }
561
554