pob 19.2.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.
- package/CHANGELOG.md +59 -0
- package/lib/generators/app/PobAppGenerator.js +124 -122
- package/lib/generators/app/e2e-testing/AppE2ETestingGenerator.js +11 -11
- package/lib/generators/app/ignorePaths.js +25 -24
- package/lib/generators/app/nextjs/AppNextjsGenerator.js +9 -9
- package/lib/generators/app/remix/AppRemixGenerator.js +7 -7
- package/lib/generators/common/babel/CommonBabelGenerator.js +167 -151
- package/lib/generators/common/format-lint/CommonLintGenerator.js +185 -180
- package/lib/generators/common/format-lint/updateEslintConfig.js +9 -9
- package/lib/generators/common/husky/CommonHuskyGenerator.js +44 -44
- package/lib/generators/common/husky/templates/lint-staged.config.js.txt +1 -1
- package/lib/generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js +44 -44
- package/lib/generators/common/release/CommonReleaseGenerator.js +40 -39
- package/lib/generators/common/release/templates/workflow-release.yml.ejs +2 -2
- package/lib/generators/common/testing/CommonTestingGenerator.js +193 -191
- package/lib/generators/common/testing/templates/index.js +3 -3
- package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +160 -167
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +79 -75
- package/lib/generators/core/ci/CoreCIGenerator.js +70 -75
- package/lib/generators/core/clean/CoreCleanGenerator.js +4 -4
- package/lib/generators/core/editorconfig/CoreEditorConfigGenerator.js +3 -3
- package/lib/generators/core/git/CoreGitGenerator.js +42 -42
- package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +41 -41
- package/lib/generators/core/gitignore/CoreGitignoreGenerator.js +19 -23
- package/lib/generators/core/npm/CoreNpmGenerator.js +19 -19
- package/lib/generators/core/package/CorePackageGenerator.js +94 -94
- package/lib/generators/core/package/askName.js +4 -4
- package/lib/generators/core/renovate/CoreRenovateGenerator.js +26 -26
- package/lib/generators/core/sort-package/CoreSortPackageGenerator.js +5 -5
- package/lib/generators/core/vscode/CoreVSCodeGenerator.js +39 -38
- package/lib/generators/core/yarn/CoreYarnGenerator.js +82 -77
- package/lib/generators/lib/PobLibGenerator.js +127 -125
- package/lib/generators/lib/doc/LibDocGenerator.js +40 -40
- package/lib/generators/lib/readme/LibReadmeGenerator.js +19 -19
- package/lib/generators/monorepo/PobMonorepoGenerator.js +87 -86
- package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +44 -40
- package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +35 -35
- package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +60 -56
- package/lib/generators/pob/PobBaseGenerator.js +83 -83
- package/lib/pob-dirname.cjs +1 -1
- package/lib/pob.js +112 -112
- package/lib/utils/dependenciesPackages.cjs +4 -4
- package/lib/utils/ensureJsonFileFormatted.js +5 -5
- package/lib/utils/inMonorepo.js +8 -8
- package/lib/utils/json5.js +1 -1
- package/lib/utils/package.js +37 -37
- package/lib/utils/packagejson.js +5 -0
- package/lib/utils/writeAndFormat.js +8 -9
- package/package.json +23 -19
- package/lib/utils/packagejson.cjs +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,65 @@
|
|
|
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
|
+
## [21.0.0](https://github.com/christophehurpeau/pob/compare/pob@20.0.0...pob@21.0.0) (2024-06-07)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* **deps:** use async prettier or prettier/sync
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add package yarn-version ([e2e8be6](https://github.com/christophehurpeau/pob/commit/e2e8be65fd50f9084c519fd07503748a1d970509))
|
|
15
|
+
* **deps:** update @pob/eslint-config to v56 (major) ([#2036](https://github.com/christophehurpeau/pob/issues/2036)) ([b26302b](https://github.com/christophehurpeau/pob/commit/b26302bd6dbf9bf4da2e97238c59ae80282ad9a4))
|
|
16
|
+
* **deps:** update dependency @rollup/plugin-run to v3.1.0 ([#2079](https://github.com/christophehurpeau/pob/issues/2079)) ([c2ef4fa](https://github.com/christophehurpeau/pob/commit/c2ef4fa22322952dcb626a5d99bc16e141684cd0))
|
|
17
|
+
* **deps:** update dependency conventional-changelog-conventionalcommits to v8 ([#2033](https://github.com/christophehurpeau/pob/issues/2033)) ([e7a568e](https://github.com/christophehurpeau/pob/commit/e7a568e4fabea00955bc6f005d85088f947f58cb))
|
|
18
|
+
* **deps:** update dependency esbuild to v0.21.0 ([#2040](https://github.com/christophehurpeau/pob/issues/2040)) ([dc252dc](https://github.com/christophehurpeau/pob/commit/dc252dc815dd450e2687e3f5784c3604bcfbab3c))
|
|
19
|
+
* **deps:** update dependency glob to v10.4.0 ([#2061](https://github.com/christophehurpeau/pob/issues/2061)) ([05dd06f](https://github.com/christophehurpeau/pob/commit/05dd06f1fb51d3cff0b95d6457fb9060d5d2db29))
|
|
20
|
+
* **deps:** update dependency prettier to v3 ([#1698](https://github.com/christophehurpeau/pob/issues/1698)) ([a65e641](https://github.com/christophehurpeau/pob/commit/a65e6418d4b80680b753a773b02925603df8ea12))
|
|
21
|
+
* **deps:** update dependency prettier to v3.3.0 ([#2071](https://github.com/christophehurpeau/pob/issues/2071)) ([04f24c3](https://github.com/christophehurpeau/pob/commit/04f24c33fcab0472cc830675696c219ee5ba14f9))
|
|
22
|
+
* **deps:** update dependency yeoman-generator to v7.2.0 ([#2063](https://github.com/christophehurpeau/pob/issues/2063)) ([a5b8748](https://github.com/christophehurpeau/pob/commit/a5b8748fecedff6291475656672feb1766c60e5f))
|
|
23
|
+
* migrate pob.babelEnvs to pob.envs + pob.bundler ([6baa9bb](https://github.com/christophehurpeau/pob/commit/6baa9bb986a1321beefcf9de3de566c285e548d1))
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* commit build of yarn-version ([539f4b2](https://github.com/christophehurpeau/pob/commit/539f4b2e12d8df4dc5cec272a24343721f4d2bdb))
|
|
28
|
+
* **deps:** update dependency esbuild to v0.21.1 ([#2042](https://github.com/christophehurpeau/pob/issues/2042)) ([2c47629](https://github.com/christophehurpeau/pob/commit/2c476296d1ecabaf272461df0901786bcea07aab))
|
|
29
|
+
* **deps:** update dependency esbuild to v0.21.2 ([#2051](https://github.com/christophehurpeau/pob/issues/2051)) ([8e8596f](https://github.com/christophehurpeau/pob/commit/8e8596f11350ee7e152ebec5603295edea8e6da7))
|
|
30
|
+
* **deps:** update dependency esbuild to v0.21.3 ([#2055](https://github.com/christophehurpeau/pob/issues/2055)) ([f27179c](https://github.com/christophehurpeau/pob/commit/f27179c5d6f4259a2885ee9097cf857b73849cef))
|
|
31
|
+
* **deps:** update dependency esbuild to v0.21.4 ([#2065](https://github.com/christophehurpeau/pob/issues/2065)) ([984e479](https://github.com/christophehurpeau/pob/commit/984e479c1958c224bc584936c13908578563e29d))
|
|
32
|
+
* **deps:** update dependency glob to v10.3.14 ([#2047](https://github.com/christophehurpeau/pob/issues/2047)) ([201fff2](https://github.com/christophehurpeau/pob/commit/201fff2e3def4a8c7344af403464e7bf16eb44bc))
|
|
33
|
+
* **deps:** update dependency glob to v10.3.15 ([#2050](https://github.com/christophehurpeau/pob/issues/2050)) ([8142969](https://github.com/christophehurpeau/pob/commit/8142969c29cda5fb5f8cf924522fd719ac0278d7))
|
|
34
|
+
* **deps:** update dependency glob to v10.3.16 ([#2056](https://github.com/christophehurpeau/pob/issues/2056)) ([d5ce7c0](https://github.com/christophehurpeau/pob/commit/d5ce7c0922a93a188250eb5e6a5eb8b14ac76630))
|
|
35
|
+
* **deps:** update dependency glob to v10.4.1 ([#2062](https://github.com/christophehurpeau/pob/issues/2062)) ([c9eb614](https://github.com/christophehurpeau/pob/commit/c9eb614f8b0906bf4757bb21ed2bed570dbf55c4))
|
|
36
|
+
* **deps:** update dependency lint-staged to v15.2.4 ([#2057](https://github.com/christophehurpeau/pob/issues/2057)) ([3266770](https://github.com/christophehurpeau/pob/commit/3266770fc90c82ccc25cd0bce67106063cf38b51))
|
|
37
|
+
* **deps:** update dependency lint-staged to v15.2.5 ([#2066](https://github.com/christophehurpeau/pob/issues/2066)) ([0c5396b](https://github.com/christophehurpeau/pob/commit/0c5396b73c9a99e37964c9752f2f55b4079f888e))
|
|
38
|
+
* **deps:** update dependency mem-fs-editor to v11.0.1 ([#2060](https://github.com/christophehurpeau/pob/issues/2060)) ([a4824cb](https://github.com/christophehurpeau/pob/commit/a4824cb89b8d94846ac7eb4ca062a500cadcc606))
|
|
39
|
+
* **deps:** update dependency prettier to v3.3.1 ([#2078](https://github.com/christophehurpeau/pob/issues/2078)) ([57ecb30](https://github.com/christophehurpeau/pob/commit/57ecb301bc6dded8e9063c1e3afc9f6f04d023b1))
|
|
40
|
+
* **deps:** update dependency semver to v7.6.1 ([#2041](https://github.com/christophehurpeau/pob/issues/2041)) ([17b20a3](https://github.com/christophehurpeau/pob/commit/17b20a3a352e4fbcda88d2e43938a8dbafe0667c))
|
|
41
|
+
* **deps:** update dependency semver to v7.6.2 ([#2048](https://github.com/christophehurpeau/pob/issues/2048)) ([e4a50f3](https://github.com/christophehurpeau/pob/commit/e4a50f3c11b87306ed30ec0cbcdd8f6f23a4ac75))
|
|
42
|
+
* **deps:** update dependency yeoman-environment to v4.4.1 ([#2073](https://github.com/christophehurpeau/pob/issues/2073)) ([528734e](https://github.com/christophehurpeau/pob/commit/528734e27f1f0b59ab5f5d87ff98e95385168b72))
|
|
43
|
+
* **deps:** update yarn monorepo ([#2045](https://github.com/christophehurpeau/pob/issues/2045)) ([bfce168](https://github.com/christophehurpeau/pob/commit/bfce1680e6df15f6a57e83fefc39e1257bf8f6e3))
|
|
44
|
+
* fix for CommonTestingGenerator ([e7f93df](https://github.com/christophehurpeau/pob/commit/e7f93df65007fe8a6e5faac6fd3d796adf6d3233))
|
|
45
|
+
* fix yarn-version command ([87e25ca](https://github.com/christophehurpeau/pob/commit/87e25cae86d3730f14e50e6370efe69bd2e21814))
|
|
46
|
+
* **pob:** leave default compressionLevel config ([3d4c5d1](https://github.com/christophehurpeau/pob/commit/3d4c5d1e92ec1194dec99e768c2743e085c1fa94))
|
|
47
|
+
* **pob:** missing await ([f91682b](https://github.com/christophehurpeau/pob/commit/f91682b72016733065d7d505c6be5d4fddad25d8))
|
|
48
|
+
* update json5 ([4034c94](https://github.com/christophehurpeau/pob/commit/4034c947a1111021ee037144cefbee0cd39b9d33))
|
|
49
|
+
Version bump for dependency: @pob/sort-pkg
|
|
50
|
+
Version bump for dependency: yarn-workspace-utils
|
|
51
|
+
Version bump for dependency: @pob/root
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## [20.0.0](https://github.com/christophehurpeau/pob/compare/pob@19.2.0...pob@20.0.0) (2024-05-05)
|
|
55
|
+
|
|
56
|
+
Note: no notable changes
|
|
57
|
+
|
|
58
|
+
Version bump for dependency: sort-eslint-config
|
|
59
|
+
Version bump for dependency: sort-object
|
|
60
|
+
Version bump for dependency: sort-pkg
|
|
61
|
+
Version bump for dependency: yarn-workspace-utils
|
|
62
|
+
Version bump for dependency: root
|
|
63
|
+
|
|
64
|
+
|
|
6
65
|
## [19.2.0](https://github.com/christophehurpeau/pob/compare/pob@19.1.1...pob@19.2.0) (2024-05-05)
|
|
7
66
|
|
|
8
67
|
|
|
@@ -1,186 +1,188 @@
|
|
|
1
|
-
import { execSync } from
|
|
2
|
-
import { platform } from
|
|
3
|
-
import Generator from
|
|
4
|
-
import inMonorepo from
|
|
5
|
-
import * as packageUtils from
|
|
6
|
-
import { appIgnorePaths } from
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
import { platform } from "node:process";
|
|
3
|
+
import Generator from "yeoman-generator";
|
|
4
|
+
import inMonorepo from "../../utils/inMonorepo.js";
|
|
5
|
+
import * as packageUtils from "../../utils/package.js";
|
|
6
|
+
import { appIgnorePaths } from "./ignorePaths.js";
|
|
7
7
|
|
|
8
8
|
const appsWithTypescript = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
"alp",
|
|
10
|
+
"next.js",
|
|
11
|
+
"remix",
|
|
12
|
+
"pobpack",
|
|
13
|
+
"expo",
|
|
14
|
+
"yarn-plugin",
|
|
15
15
|
];
|
|
16
|
-
const appsWithBrowser = [
|
|
16
|
+
const appsWithBrowser = ["alp", "next.js", "remix"];
|
|
17
17
|
|
|
18
18
|
export default class PobAppGenerator extends Generator {
|
|
19
19
|
constructor(args, opts) {
|
|
20
20
|
super(args, opts);
|
|
21
21
|
|
|
22
|
-
this.option(
|
|
22
|
+
this.option("updateOnly", {
|
|
23
23
|
type: Boolean,
|
|
24
24
|
required: false,
|
|
25
25
|
default: false,
|
|
26
|
-
|
|
26
|
+
description: "Avoid asking questions",
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
this.option(
|
|
29
|
+
this.option("fromPob", {
|
|
30
30
|
type: Boolean,
|
|
31
31
|
required: false,
|
|
32
32
|
default: false,
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
this.option(
|
|
35
|
+
this.option("packageManager", {
|
|
36
36
|
type: String,
|
|
37
|
-
default:
|
|
38
|
-
|
|
37
|
+
default: "yarn",
|
|
38
|
+
description: "yarn or npm",
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
this.option(
|
|
41
|
+
this.option("yarnNodeLinker", {
|
|
42
42
|
type: String,
|
|
43
43
|
required: false,
|
|
44
|
-
default:
|
|
45
|
-
|
|
44
|
+
default: "node-modules",
|
|
45
|
+
description:
|
|
46
|
+
"Defines what linker should be used for installing Node packages (useful to enable the node-modules plugin), one of: pnp, node-modules.",
|
|
46
47
|
});
|
|
47
48
|
|
|
48
|
-
this.option(
|
|
49
|
+
this.option("disableYarnGitCache", {
|
|
49
50
|
type: Boolean,
|
|
50
51
|
required: false,
|
|
51
52
|
default: false,
|
|
52
|
-
|
|
53
|
+
description:
|
|
54
|
+
"Disable git cache. See https://yarnpkg.com/features/caching#offline-mirror.",
|
|
53
55
|
});
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
initializing() {
|
|
57
59
|
this.appConfig =
|
|
58
|
-
this.config.get(
|
|
60
|
+
this.config.get("app") || this.config.get("pob-app-config");
|
|
59
61
|
|
|
60
|
-
this.config.delete(
|
|
62
|
+
this.config.delete("pob-app-config"); // deprecated
|
|
61
63
|
|
|
62
64
|
// see lib, in case the app migrating from a lib when app were not available
|
|
63
|
-
this.config.delete(
|
|
64
|
-
this.config.delete(
|
|
65
|
-
this.fs.delete(
|
|
66
|
-
this.config.delete(
|
|
65
|
+
this.config.delete("pob"); // deprecated
|
|
66
|
+
this.config.delete("pob-config"); // deprecated
|
|
67
|
+
this.fs.delete(".pob.json"); // deprecated
|
|
68
|
+
this.config.delete("pob-lib-config"); // in case coming from lib
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
async prompting() {
|
|
70
72
|
const config = this.appConfig;
|
|
71
73
|
|
|
72
74
|
if (config && this.options.updateOnly) {
|
|
73
|
-
this.config.set(
|
|
75
|
+
this.config.set("app", this.appConfig);
|
|
74
76
|
this.config.save();
|
|
75
77
|
return;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
this.appConfig = await this.prompt([
|
|
79
81
|
{
|
|
80
|
-
type:
|
|
81
|
-
name:
|
|
82
|
-
message:
|
|
83
|
-
default: (config && config.type) ||
|
|
82
|
+
type: "list",
|
|
83
|
+
name: "type",
|
|
84
|
+
message: "What kind of app is this ?",
|
|
85
|
+
default: (config && config.type) || "alp",
|
|
84
86
|
choices: [
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
"alp",
|
|
88
|
+
"pobpack",
|
|
89
|
+
"next.js",
|
|
90
|
+
"remix",
|
|
91
|
+
"node",
|
|
92
|
+
"node-library", // monorepo library for app. Not a real library
|
|
93
|
+
"untranspiled-library", // monorepo library for app. Not a real library
|
|
94
|
+
"alp-node",
|
|
95
|
+
"expo",
|
|
96
|
+
"other",
|
|
95
97
|
],
|
|
96
98
|
},
|
|
97
99
|
{
|
|
98
|
-
type:
|
|
99
|
-
name:
|
|
100
|
-
message:
|
|
100
|
+
type: "confirm",
|
|
101
|
+
name: "export",
|
|
102
|
+
message: "Use next export ?",
|
|
101
103
|
default: false,
|
|
102
|
-
when: (values) => values.type ===
|
|
104
|
+
when: (values) => values.type === "next.js",
|
|
103
105
|
},
|
|
104
106
|
{
|
|
105
|
-
type:
|
|
106
|
-
name:
|
|
107
|
-
message:
|
|
107
|
+
type: "confirm",
|
|
108
|
+
name: "testing",
|
|
109
|
+
message: "Do you want testing ?",
|
|
108
110
|
default:
|
|
109
111
|
!config || config.testing === undefined ? false : config.testing,
|
|
110
112
|
},
|
|
111
113
|
{
|
|
112
|
-
type:
|
|
113
|
-
name:
|
|
114
|
-
message:
|
|
114
|
+
type: "confirm",
|
|
115
|
+
name: "codecov",
|
|
116
|
+
message: "Do you want codecov ?",
|
|
115
117
|
default: !config || false,
|
|
116
118
|
when: (values) => values.testing,
|
|
117
119
|
},
|
|
118
120
|
{
|
|
119
|
-
type:
|
|
120
|
-
name:
|
|
121
|
-
message:
|
|
121
|
+
type: "confirm",
|
|
122
|
+
name: "ci",
|
|
123
|
+
message: "Do you want ci ?",
|
|
122
124
|
default: !config || config.ci === undefined ? true : config.ci,
|
|
123
125
|
when: () => !inMonorepo,
|
|
124
126
|
},
|
|
125
127
|
]);
|
|
126
128
|
|
|
127
|
-
this.config.set(
|
|
129
|
+
this.config.set("app", this.appConfig);
|
|
128
130
|
this.config.save();
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
default() {
|
|
132
134
|
const srcDirectory =
|
|
133
|
-
this.appConfig.type ===
|
|
135
|
+
this.appConfig.type === "yarn-plugin" ? "sources" : "src";
|
|
134
136
|
const isAppLibrary =
|
|
135
|
-
this.appConfig.type ===
|
|
136
|
-
this.appConfig.type ===
|
|
137
|
+
this.appConfig.type === "node-library" ||
|
|
138
|
+
this.appConfig.type === "untranspiled-library";
|
|
137
139
|
|
|
138
140
|
if (
|
|
139
|
-
this.appConfig.type ===
|
|
140
|
-
this.appConfig.type ===
|
|
141
|
-
this.appConfig.type ===
|
|
141
|
+
this.appConfig.type === "node" ||
|
|
142
|
+
this.appConfig.type === "node-library" ||
|
|
143
|
+
this.appConfig.type === "alp-node"
|
|
142
144
|
) {
|
|
143
|
-
this.composeWith(
|
|
145
|
+
this.composeWith("pob:common:babel", {
|
|
144
146
|
updateOnly: this.options.updateOnly,
|
|
145
147
|
onlyLatestLTS: true,
|
|
146
148
|
isApp: true,
|
|
147
149
|
isAppLibrary,
|
|
148
|
-
useAppConfig: this.appConfig.type ===
|
|
150
|
+
useAppConfig: this.appConfig.type === "alp-node",
|
|
149
151
|
testing: this.appConfig.testing,
|
|
150
152
|
documentation: false,
|
|
151
153
|
fromPob: this.options.fromPob,
|
|
152
|
-
buildDirectory:
|
|
154
|
+
buildDirectory: "build",
|
|
153
155
|
});
|
|
154
|
-
this.composeWith(
|
|
156
|
+
this.composeWith("pob:common:transpiler", {
|
|
155
157
|
updateOnly: this.options.updateOnly,
|
|
156
158
|
onlyLatestLTS: true,
|
|
157
159
|
isApp: true,
|
|
158
160
|
isAppLibrary,
|
|
159
|
-
useAppConfig: this.appConfig.type ===
|
|
161
|
+
useAppConfig: this.appConfig.type === "alp-node",
|
|
160
162
|
testing: this.appConfig.testing,
|
|
161
163
|
documentation: false,
|
|
162
164
|
fromPob: this.options.fromPob,
|
|
163
165
|
srcDirectory,
|
|
164
|
-
buildDirectory:
|
|
166
|
+
buildDirectory: "build",
|
|
165
167
|
});
|
|
166
168
|
}
|
|
167
169
|
|
|
168
|
-
const pkg = this.fs.readJSON(this.destinationPath(
|
|
170
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
169
171
|
|
|
170
172
|
if (!inMonorepo || inMonorepo.root) {
|
|
171
|
-
this.composeWith(
|
|
173
|
+
this.composeWith("pob:common:husky", {});
|
|
172
174
|
}
|
|
173
175
|
|
|
174
|
-
const
|
|
176
|
+
const envs = (pkg.pob && (pkg.pob.babelEnvs || pkg.pob.envs)) || [];
|
|
175
177
|
const babel =
|
|
176
|
-
|
|
178
|
+
envs.length > 0 || appsWithTypescript.includes(this.appConfig.type);
|
|
177
179
|
const typescript = babel || pkg.pob?.typescript;
|
|
178
180
|
const node = true;
|
|
179
181
|
const browser =
|
|
180
182
|
appsWithBrowser.includes(this.appConfig.type) ||
|
|
181
|
-
(babel &&
|
|
183
|
+
(babel && envs.some((env) => env.target === "browser"));
|
|
182
184
|
const jsx =
|
|
183
|
-
|
|
185
|
+
envs.length > 0 && pkg.pob.jsx !== undefined
|
|
184
186
|
? pkg.pob.jsx
|
|
185
187
|
: packageUtils.hasReact(pkg);
|
|
186
188
|
|
|
@@ -193,58 +195,58 @@ export default class PobAppGenerator extends Generator {
|
|
|
193
195
|
pkg,
|
|
194
196
|
).filter(Boolean);
|
|
195
197
|
|
|
196
|
-
this.composeWith(
|
|
198
|
+
this.composeWith("pob:common:typescript", {
|
|
197
199
|
enable: typescript,
|
|
198
200
|
isApp: true,
|
|
199
201
|
isAppLibrary,
|
|
200
|
-
nextConfig: this.appConfig.type ===
|
|
202
|
+
nextConfig: this.appConfig.type === "next.js",
|
|
201
203
|
// nextjs now supports src
|
|
202
|
-
rootDir: this.appConfig.type ===
|
|
204
|
+
rootDir: this.appConfig.type === "expo" ? "." : srcDirectory,
|
|
203
205
|
srcDirectory,
|
|
204
206
|
builddefs: false,
|
|
205
207
|
dom: browser,
|
|
206
208
|
jsx,
|
|
207
|
-
jsxPreserve: this.appConfig.type ===
|
|
208
|
-
forceExcludeNodeModules: this.appConfig.type ===
|
|
209
|
-
forceAllowJs: this.appConfig.type ===
|
|
209
|
+
jsxPreserve: this.appConfig.type === "next.js",
|
|
210
|
+
forceExcludeNodeModules: this.appConfig.type === "next.js",
|
|
211
|
+
forceAllowJs: this.appConfig.type === "next.js",
|
|
210
212
|
updateOnly: this.options.updateOnly,
|
|
211
213
|
resolveJsonModule: true,
|
|
212
214
|
onlyLatestLTS: true,
|
|
213
215
|
baseUrl: (() => {
|
|
214
216
|
if (
|
|
215
|
-
this.appConfig.type ===
|
|
216
|
-
this.appConfig.type ===
|
|
217
|
-
this.appConfig.type ===
|
|
218
|
-
this.appConfig.type ===
|
|
217
|
+
this.appConfig.type === "alp" ||
|
|
218
|
+
this.appConfig.type === "pobpack" ||
|
|
219
|
+
this.appConfig.type === "alp-node" ||
|
|
220
|
+
this.appConfig.type === "next.js"
|
|
219
221
|
) {
|
|
220
222
|
return `./${srcDirectory}`;
|
|
221
223
|
}
|
|
222
|
-
if (this.appConfig.type ===
|
|
223
|
-
return
|
|
224
|
+
if (this.appConfig.type === "remix") {
|
|
225
|
+
return ".";
|
|
224
226
|
}
|
|
225
|
-
return
|
|
227
|
+
return "";
|
|
226
228
|
})(),
|
|
227
229
|
plugins: (() => {
|
|
228
|
-
if (this.appConfig.type ===
|
|
229
|
-
return
|
|
230
|
+
if (this.appConfig.type === "next.js") {
|
|
231
|
+
return "next";
|
|
230
232
|
}
|
|
231
|
-
return
|
|
233
|
+
return "";
|
|
232
234
|
})(),
|
|
233
235
|
additionalIncludes: (() => {
|
|
234
236
|
// if (this.appConfig.type === 'next.js') {
|
|
235
237
|
// return '.next/types/**/*.ts';
|
|
236
238
|
// }
|
|
237
|
-
return
|
|
239
|
+
return "";
|
|
238
240
|
})(),
|
|
239
241
|
});
|
|
240
242
|
|
|
241
|
-
this.composeWith(
|
|
243
|
+
this.composeWith("pob:common:remove-old-dependencies");
|
|
242
244
|
|
|
243
245
|
const enableReleasePlease =
|
|
244
246
|
!inMonorepo && this.appConfig.testing && this.appConfig.ci;
|
|
245
247
|
|
|
246
|
-
if (this.appConfig.type !==
|
|
247
|
-
this.composeWith(
|
|
248
|
+
if (this.appConfig.type !== "remix") {
|
|
249
|
+
this.composeWith("pob:common:testing", {
|
|
248
250
|
enable: this.appConfig.testing,
|
|
249
251
|
disableYarnGitCache: this.options.disableYarnGitCache,
|
|
250
252
|
enableReleasePlease,
|
|
@@ -252,11 +254,11 @@ export default class PobAppGenerator extends Generator {
|
|
|
252
254
|
runner: this.appConfig.testing
|
|
253
255
|
? (inMonorepo
|
|
254
256
|
? inMonorepo.pobMonorepoConfig.testRunner
|
|
255
|
-
: this.appConfig.testRunner) ||
|
|
257
|
+
: this.appConfig.testRunner) || "jest"
|
|
256
258
|
: undefined,
|
|
257
|
-
e2eTesting: this.appConfig.e2e ?
|
|
259
|
+
e2eTesting: this.appConfig.e2e ? "." : "",
|
|
258
260
|
typescript,
|
|
259
|
-
build: typescript && this.appConfig.type !==
|
|
261
|
+
build: typescript && this.appConfig.type !== "expo",
|
|
260
262
|
documentation: false,
|
|
261
263
|
codecov: this.appConfig.codecov,
|
|
262
264
|
ci: this.appConfig.ci,
|
|
@@ -267,11 +269,11 @@ export default class PobAppGenerator extends Generator {
|
|
|
267
269
|
srcDirectory,
|
|
268
270
|
});
|
|
269
271
|
|
|
270
|
-
this.composeWith(
|
|
272
|
+
this.composeWith("pob:app:e2e-testing", {
|
|
271
273
|
enable: this.appConfig.e2e,
|
|
272
274
|
});
|
|
273
275
|
|
|
274
|
-
this.composeWith(
|
|
276
|
+
this.composeWith("pob:common:format-lint", {
|
|
275
277
|
isApp: true,
|
|
276
278
|
documentation: false,
|
|
277
279
|
testing: this.appConfig.testing,
|
|
@@ -284,16 +286,16 @@ export default class PobAppGenerator extends Generator {
|
|
|
284
286
|
enableSrcResolver: true,
|
|
285
287
|
packageManager: this.options.packageManager,
|
|
286
288
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
287
|
-
rootIgnorePaths: ignorePaths.join(
|
|
289
|
+
rootIgnorePaths: ignorePaths.join("\n"),
|
|
288
290
|
srcDirectory,
|
|
289
|
-
buildDirectory: this.appConfig.type ===
|
|
291
|
+
buildDirectory: this.appConfig.type === "expo" ? ".expo" : "build",
|
|
290
292
|
});
|
|
291
293
|
|
|
292
|
-
this.composeWith(
|
|
294
|
+
this.composeWith("pob:common:release", {
|
|
293
295
|
enable:
|
|
294
296
|
!inMonorepo &&
|
|
295
297
|
this.appConfig.testing &&
|
|
296
|
-
pkg.name !==
|
|
298
|
+
pkg.name !== "yarn-plugin-conventional-version",
|
|
297
299
|
enablePublish: false,
|
|
298
300
|
withBabel: babel,
|
|
299
301
|
isMonorepo: false,
|
|
@@ -304,7 +306,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
304
306
|
});
|
|
305
307
|
}
|
|
306
308
|
|
|
307
|
-
this.composeWith(
|
|
309
|
+
this.composeWith("pob:core:vscode", {
|
|
308
310
|
root: !inMonorepo,
|
|
309
311
|
monorepo: false,
|
|
310
312
|
packageManager: this.options.packageManager,
|
|
@@ -315,45 +317,45 @@ export default class PobAppGenerator extends Generator {
|
|
|
315
317
|
});
|
|
316
318
|
|
|
317
319
|
// only for gitignore
|
|
318
|
-
if (this.fs.exists(
|
|
319
|
-
ignorePaths.push(
|
|
320
|
+
if (this.fs.exists(".env.example")) {
|
|
321
|
+
ignorePaths.push("/.env*", "!/.env.example");
|
|
320
322
|
}
|
|
321
323
|
|
|
322
|
-
this.composeWith(
|
|
324
|
+
this.composeWith("pob:core:gitignore", {
|
|
323
325
|
root: !inMonorepo || inMonorepo.root,
|
|
324
326
|
documentation: false,
|
|
325
327
|
testing: this.appConfig.testing,
|
|
326
328
|
withBabel: babel,
|
|
327
|
-
paths: ignorePaths.join(
|
|
329
|
+
paths: ignorePaths.join("\n"),
|
|
328
330
|
buildInGit: false,
|
|
329
331
|
});
|
|
330
332
|
|
|
331
|
-
this.composeWith(
|
|
333
|
+
this.composeWith("pob:core:npm", { enable: false });
|
|
332
334
|
|
|
333
335
|
switch (this.appConfig.type) {
|
|
334
|
-
case
|
|
335
|
-
this.composeWith(
|
|
336
|
+
case "next.js":
|
|
337
|
+
this.composeWith("pob:app:nextjs", {
|
|
336
338
|
export: this.appConfig.export,
|
|
337
339
|
});
|
|
338
340
|
break;
|
|
339
|
-
case
|
|
340
|
-
this.composeWith(
|
|
341
|
+
case "remix":
|
|
342
|
+
this.composeWith("pob:app:remix", {});
|
|
341
343
|
break;
|
|
342
344
|
// no default
|
|
343
345
|
}
|
|
344
346
|
|
|
345
|
-
if (platform !==
|
|
347
|
+
if (platform !== "win32") {
|
|
346
348
|
execSync(
|
|
347
|
-
`rm -Rf ${[
|
|
349
|
+
`rm -Rf ${["lib-*", "coverage", "docs", "dist"]
|
|
348
350
|
.filter(Boolean)
|
|
349
|
-
.join(
|
|
351
|
+
.join(" ")}`,
|
|
350
352
|
);
|
|
351
353
|
}
|
|
352
354
|
}
|
|
353
355
|
|
|
354
356
|
writing() {
|
|
355
357
|
// Re-read the content at this point because a composed generator might modify it.
|
|
356
|
-
const pkg = this.fs.readJSON(this.destinationPath(
|
|
358
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
357
359
|
|
|
358
360
|
// if (isNpm) {
|
|
359
361
|
// if (!pkg.engines) pkg.engines = {};
|
|
@@ -363,8 +365,8 @@ export default class PobAppGenerator extends Generator {
|
|
|
363
365
|
delete pkg.engines.yarn;
|
|
364
366
|
}
|
|
365
367
|
|
|
366
|
-
this.fs.writeJSON(this.destinationPath(
|
|
368
|
+
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
367
369
|
|
|
368
|
-
this.composeWith(
|
|
370
|
+
this.composeWith("pob:core:sort-package");
|
|
369
371
|
}
|
|
370
372
|
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import Generator from
|
|
2
|
-
import * as packageUtils from
|
|
1
|
+
import Generator from "yeoman-generator";
|
|
2
|
+
import * as packageUtils from "../../../utils/package.js";
|
|
3
3
|
// import * as templateUtils from '../../../utils/templateUtils.js';
|
|
4
|
-
import { writeAndFormatJson } from
|
|
4
|
+
import { writeAndFormatJson } from "../../../utils/writeAndFormat.js";
|
|
5
5
|
|
|
6
6
|
export default class AppE2ETestingGenerator extends Generator {
|
|
7
7
|
constructor(args, opts) {
|
|
8
8
|
super(args, opts);
|
|
9
9
|
|
|
10
|
-
this.option(
|
|
10
|
+
this.option("enable", {
|
|
11
11
|
type: Boolean,
|
|
12
12
|
default: true,
|
|
13
|
-
|
|
13
|
+
description: "enable e2e testing",
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
this.option(
|
|
16
|
+
this.option("ci", {
|
|
17
17
|
type: Boolean,
|
|
18
18
|
required: true,
|
|
19
|
-
|
|
19
|
+
description: "ci",
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
writing() {
|
|
24
|
-
const pkg = this.fs.readJSON(this.destinationPath(
|
|
24
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
25
25
|
|
|
26
26
|
packageUtils.addOrRemoveDevDependencies(pkg, this.options.enable, [
|
|
27
|
-
|
|
27
|
+
"@playwright/test",
|
|
28
28
|
]);
|
|
29
29
|
|
|
30
30
|
packageUtils.addOrRemoveScripts(pkg, this.options.enable, {
|
|
31
|
-
|
|
31
|
+
"test:e2e": "playwright test",
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
// templateUtils.addOrRemoveTemplate(
|
|
@@ -40,6 +40,6 @@ export default class AppE2ETestingGenerator extends Generator {
|
|
|
40
40
|
if (this.options.enable) {
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
writeAndFormatJson(this.fs, this.destinationPath(
|
|
43
|
+
writeAndFormatJson(this.fs, this.destinationPath("package.json"), pkg);
|
|
44
44
|
}
|
|
45
45
|
}
|