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.
- package/CHANGELOG.md +22 -0
- package/lib/generators/app/PobAppGenerator.js +120 -120
- package/lib/generators/app/e2e-testing/AppE2ETestingGenerator.js +11 -11
- package/lib/generators/app/ignorePaths.js +24 -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 +146 -146
- package/lib/generators/common/format-lint/CommonLintGenerator.js +185 -185
- package/lib/generators/common/format-lint/updateEslintConfig.js +14 -15
- package/lib/generators/common/husky/CommonHuskyGenerator.js +44 -44
- package/lib/generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js +44 -44
- package/lib/generators/common/release/CommonReleaseGenerator.js +40 -40
- package/lib/generators/common/testing/CommonTestingGenerator.js +190 -190
- package/lib/generators/common/testing/templates/index.js +3 -3
- package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +163 -163
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +79 -79
- package/lib/generators/common/typescript/templates/tsconfig.js.json.ejs +12 -0
- package/lib/generators/core/ci/CoreCIGenerator.js +72 -72
- 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 +43 -43
- package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +43 -43
- package/lib/generators/core/gitignore/CoreGitignoreGenerator.js +19 -19
- package/lib/generators/core/npm/CoreNpmGenerator.js +20 -20
- package/lib/generators/core/package/CorePackageGenerator.js +98 -98
- package/lib/generators/core/package/askName.js +4 -4
- package/lib/generators/core/renovate/CoreRenovateGenerator.js +28 -28
- package/lib/generators/core/sort-package/CoreSortPackageGenerator.js +6 -6
- package/lib/generators/core/vscode/CoreVSCodeGenerator.js +43 -43
- package/lib/generators/core/yarn/CoreYarnGenerator.js +70 -70
- package/lib/generators/lib/PobLibGenerator.js +111 -111
- package/lib/generators/lib/doc/LibDocGenerator.js +45 -45
- package/lib/generators/lib/readme/LibReadmeGenerator.js +21 -21
- package/lib/generators/monorepo/PobMonorepoGenerator.js +89 -89
- package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +47 -47
- package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +38 -38
- package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +57 -57
- package/lib/generators/pob/PobBaseGenerator.js +81 -81
- package/lib/pob-dirname.cjs +1 -1
- package/lib/pob.js +143 -143
- 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 +43 -43
- package/lib/utils/packagejson.cjs +2 -2
- package/lib/utils/templateUtils.js +1 -1
- package/lib/utils/writeAndFormat.js +9 -10
- package/package.json +10 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import sortConfig from
|
|
1
|
+
import sortConfig from "@pob/sort-eslint-config";
|
|
2
2
|
|
|
3
3
|
function updateOverrides(config, testsOverride) {
|
|
4
4
|
const existingTestsOverrideIndex = !config.overrides
|
|
@@ -8,7 +8,7 @@ function updateOverrides(config, testsOverride) {
|
|
|
8
8
|
? (override) => override.env && override.env.jest
|
|
9
9
|
: (override) =>
|
|
10
10
|
override?.env?.jest ||
|
|
11
|
-
override.extends?.includes(testsOverride.extends[0])
|
|
11
|
+
override.extends?.includes(testsOverride.extends[0])
|
|
12
12
|
);
|
|
13
13
|
if (!testsOverride) {
|
|
14
14
|
if (existingTestsOverrideIndex !== -1) {
|
|
@@ -45,29 +45,28 @@ function updateParserAndPlugins(
|
|
|
45
45
|
config,
|
|
46
46
|
useTypescript,
|
|
47
47
|
globalEslint,
|
|
48
|
-
relativePath
|
|
48
|
+
relativePath
|
|
49
49
|
) {
|
|
50
50
|
if (useTypescript) {
|
|
51
51
|
// webstorm uses this to detect eslint .ts compat
|
|
52
|
-
config.parser =
|
|
53
|
-
config.plugins = [
|
|
52
|
+
config.parser = "@typescript-eslint/parser";
|
|
53
|
+
config.plugins = ["@typescript-eslint"];
|
|
54
54
|
|
|
55
55
|
if (!globalEslint) {
|
|
56
56
|
config.parserOptions = {
|
|
57
|
-
project:
|
|
57
|
+
project: "./tsconfig.json",
|
|
58
58
|
createDefaultProgram: true, // fix for lint-staged
|
|
59
59
|
};
|
|
60
60
|
} else {
|
|
61
61
|
config.parserOptions = {
|
|
62
|
-
//
|
|
63
|
-
EXPERIMENTAL_useProjectService: true,
|
|
62
|
+
// EXPERIMENTAL_useProjectService: true,
|
|
64
63
|
project: `${relativePath}/tsconfig.json`,
|
|
65
64
|
};
|
|
66
65
|
}
|
|
67
66
|
} else {
|
|
68
67
|
if (
|
|
69
|
-
config.parser ===
|
|
70
|
-
config.parser ===
|
|
68
|
+
config.parser === "typescript-eslint-parser" ||
|
|
69
|
+
config.parser === "@typescript-eslint/parser"
|
|
71
70
|
) {
|
|
72
71
|
delete config.parser;
|
|
73
72
|
}
|
|
@@ -76,8 +75,8 @@ function updateParserAndPlugins(
|
|
|
76
75
|
}
|
|
77
76
|
if (
|
|
78
77
|
config.plugins &&
|
|
79
|
-
(config.plugins[0] ===
|
|
80
|
-
config.plugins[0] ===
|
|
78
|
+
(config.plugins[0] === "typescript" ||
|
|
79
|
+
config.plugins[0] === "@typescript-eslint")
|
|
81
80
|
) {
|
|
82
81
|
config.plugins.splice(0, 1);
|
|
83
82
|
}
|
|
@@ -127,7 +126,7 @@ export default function updateEslintConfig(
|
|
|
127
126
|
settings,
|
|
128
127
|
ignorePatterns,
|
|
129
128
|
relativePath,
|
|
130
|
-
}
|
|
129
|
+
}
|
|
131
130
|
) {
|
|
132
131
|
config.root = true;
|
|
133
132
|
config.extends = [
|
|
@@ -135,7 +134,7 @@ export default function updateEslintConfig(
|
|
|
135
134
|
...(config?.extends && Array.isArray(config.extends)
|
|
136
135
|
? config.extends.filter(
|
|
137
136
|
(extendsValue) =>
|
|
138
|
-
extendsValue ===
|
|
137
|
+
extendsValue === "@pob/eslint-config-typescript/allow-unsafe"
|
|
139
138
|
)
|
|
140
139
|
: []),
|
|
141
140
|
];
|
|
@@ -144,7 +143,7 @@ export default function updateEslintConfig(
|
|
|
144
143
|
config,
|
|
145
144
|
useTypescript,
|
|
146
145
|
globalEslint,
|
|
147
|
-
relativePath
|
|
146
|
+
relativePath
|
|
148
147
|
);
|
|
149
148
|
config = updateOverrides(config, testsOverride);
|
|
150
149
|
if (settings) {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { readlinkSync, rmSync } from
|
|
2
|
-
import Generator from
|
|
3
|
-
import inMonorepo from
|
|
4
|
-
import * as packageUtils from
|
|
1
|
+
import { readlinkSync, rmSync } from "node:fs";
|
|
2
|
+
import Generator from "yeoman-generator";
|
|
3
|
+
import inMonorepo from "../../../utils/inMonorepo.js";
|
|
4
|
+
import * as packageUtils from "../../../utils/package.js";
|
|
5
5
|
|
|
6
6
|
export default class CommonHuskyGenerator extends Generator {
|
|
7
7
|
constructor(args, opts) {
|
|
8
8
|
super(args, opts);
|
|
9
9
|
|
|
10
|
-
this.option(
|
|
10
|
+
this.option("destination", {
|
|
11
11
|
type: String,
|
|
12
12
|
required: false,
|
|
13
|
-
default:
|
|
14
|
-
desc:
|
|
13
|
+
default: "",
|
|
14
|
+
desc: "Destination of the generated files.",
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
writing() {
|
|
19
|
-
rmSync(
|
|
19
|
+
rmSync("git-hooks", { recursive: true, force: true });
|
|
20
20
|
|
|
21
|
-
const gitHookDestination = this.destinationPath(
|
|
21
|
+
const gitHookDestination = this.destinationPath(".git/hooks/pre-commit");
|
|
22
22
|
let isSymlink;
|
|
23
23
|
|
|
24
24
|
try {
|
|
@@ -29,68 +29,68 @@ export default class CommonHuskyGenerator extends Generator {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
if (isSymlink) {
|
|
32
|
-
this.fs.delete(
|
|
33
|
-
this.fs.delete(
|
|
34
|
-
this.fs.delete(
|
|
35
|
-
this.fs.delete(
|
|
32
|
+
this.fs.delete(".git/hooks/prepare-commit-msg");
|
|
33
|
+
this.fs.delete(".git/hooks/post-checkout");
|
|
34
|
+
this.fs.delete(".git/hooks/post-merge");
|
|
35
|
+
this.fs.delete(".git/hooks/pre-commit");
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
this.fs.delete(
|
|
39
|
-
this.fs.delete(
|
|
40
|
-
this.fs.delete(
|
|
41
|
-
this.fs.delete(
|
|
42
|
-
if (this.fs.exists(
|
|
38
|
+
this.fs.delete(".git-hooks/prepare-commit-msg");
|
|
39
|
+
this.fs.delete(".git-hooks/post-checkout");
|
|
40
|
+
this.fs.delete(".git-hooks/post-merge");
|
|
41
|
+
this.fs.delete(".git-hooks/pre-commit");
|
|
42
|
+
if (this.fs.exists(".git-hooks")) this.fs.delete(".git-hooks");
|
|
43
43
|
|
|
44
|
-
if (this.fs.exists(this.destinationPath(
|
|
45
|
-
this.fs.delete(this.destinationPath(
|
|
44
|
+
if (this.fs.exists(this.destinationPath(".huskyrc.js"))) {
|
|
45
|
+
this.fs.delete(this.destinationPath(".huskyrc.js"));
|
|
46
46
|
}
|
|
47
|
-
if (this.fs.exists(this.destinationPath(
|
|
48
|
-
this.fs.delete(this.destinationPath(
|
|
47
|
+
if (this.fs.exists(this.destinationPath("husky.config.js"))) {
|
|
48
|
+
this.fs.delete(this.destinationPath("husky.config.js"));
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
if (this.fs.exists(this.destinationPath(
|
|
51
|
+
if (this.fs.exists(this.destinationPath("lint-staged.config.cjs"))) {
|
|
52
52
|
this.fs.move(
|
|
53
|
-
this.destinationPath(
|
|
54
|
-
this.destinationPath(
|
|
53
|
+
this.destinationPath("lint-staged.config.cjs"),
|
|
54
|
+
this.destinationPath("lint-staged.config.js")
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
const pkg = this.fs.readJSON(this.destinationPath(
|
|
59
|
-
packageUtils.removeDevDependencies(pkg, [
|
|
58
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
59
|
+
packageUtils.removeDevDependencies(pkg, ["husky"]);
|
|
60
60
|
|
|
61
61
|
if (!inMonorepo || inMonorepo.root) {
|
|
62
|
-
if (pkg.name !==
|
|
62
|
+
if (pkg.name !== "pob-monorepo") {
|
|
63
63
|
packageUtils.removeDevDependencies(pkg, [
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
"@pob/repo-config",
|
|
65
|
+
"repository-check-dirty",
|
|
66
66
|
]);
|
|
67
|
-
packageUtils.addDevDependencies(pkg, [
|
|
67
|
+
packageUtils.addDevDependencies(pkg, ["@pob/root"]);
|
|
68
68
|
// packageUtils.addOrRemoveDevDependencies(pkg, inMonorepo, {
|
|
69
69
|
// '@commitlint/config-lerna-scopes': '6.1.3',
|
|
70
70
|
// });
|
|
71
71
|
|
|
72
|
-
if (pkg.type !==
|
|
72
|
+
if (pkg.type !== "module") {
|
|
73
73
|
this.fs.copy(
|
|
74
|
-
this.templatePath(
|
|
75
|
-
this.destinationPath(
|
|
74
|
+
this.templatePath("lint-staged.config.cjs.txt"),
|
|
75
|
+
this.destinationPath("lint-staged.config.js")
|
|
76
76
|
);
|
|
77
77
|
} else {
|
|
78
78
|
this.fs.copy(
|
|
79
|
-
this.templatePath(
|
|
80
|
-
this.destinationPath(
|
|
79
|
+
this.templatePath("lint-staged.config.js.txt"),
|
|
80
|
+
this.destinationPath("lint-staged.config.js")
|
|
81
81
|
);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
pkg.commitlint = {
|
|
86
86
|
extends: [
|
|
87
|
-
|
|
87
|
+
"@pob/commitlint-config",
|
|
88
88
|
// '@commitlint/config-lerna-scopes',
|
|
89
89
|
].filter(Boolean),
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
if (pkg.name !==
|
|
93
|
-
packageUtils.addDevDependencies(pkg, [
|
|
92
|
+
if (pkg.name !== "pob-monorepo") {
|
|
93
|
+
packageUtils.addDevDependencies(pkg, ["@pob/commitlint-config"]);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
// if (packageUtils.hasLerna(pkg)) {
|
|
@@ -103,10 +103,10 @@ export default class CommonHuskyGenerator extends Generator {
|
|
|
103
103
|
// this.fs.delete('.git/hooks/husky.local.sh');
|
|
104
104
|
} else {
|
|
105
105
|
packageUtils.removeDevDependencies(pkg, [
|
|
106
|
-
pkg.name !==
|
|
107
|
-
|
|
106
|
+
pkg.name !== "pob" && "@pob/root",
|
|
107
|
+
"@pob/commitlint-config",
|
|
108
108
|
]);
|
|
109
|
-
this.fs.delete(this.destinationPath(
|
|
109
|
+
this.fs.delete(this.destinationPath("lint-staged.config.cjs"));
|
|
110
110
|
|
|
111
111
|
delete pkg.commitlint;
|
|
112
112
|
}
|
|
@@ -122,10 +122,10 @@ export default class CommonHuskyGenerator extends Generator {
|
|
|
122
122
|
delete pkg.scripts.postrewrite;
|
|
123
123
|
delete pkg.scripts.postpublish;
|
|
124
124
|
}
|
|
125
|
-
delete pkg[
|
|
125
|
+
delete pkg["lint-staged"];
|
|
126
126
|
delete pkg.husky;
|
|
127
127
|
|
|
128
|
-
this.fs.writeJSON(this.destinationPath(
|
|
128
|
+
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
end() {}
|
|
@@ -1,54 +1,54 @@
|
|
|
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
|
|
|
4
4
|
export default class CommonRemoveOldDependenciesGenerator extends Generator {
|
|
5
5
|
writing() {
|
|
6
|
-
const pkg = this.fs.readJSON(this.destinationPath(
|
|
6
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
7
7
|
|
|
8
8
|
// old pob dependencies
|
|
9
|
-
packageUtils.removeDependencies(pkg, [
|
|
9
|
+
packageUtils.removeDependencies(pkg, ["flow-runtime"]);
|
|
10
10
|
packageUtils.removeDevDependencies(pkg, [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
11
|
+
"tcomb",
|
|
12
|
+
"tcomb-forked",
|
|
13
|
+
"flow-runtime",
|
|
14
|
+
"flow-bin",
|
|
15
|
+
"springbokjs-library",
|
|
16
|
+
"babel-preset-es2015",
|
|
17
|
+
"babel-preset-es2015-webpack",
|
|
18
|
+
"babel-preset-es2015-node5",
|
|
19
|
+
"babel-preset-es2015-node6",
|
|
20
|
+
"babel-preset-pob",
|
|
21
|
+
"babel-preset-latest",
|
|
22
|
+
"babel-preset-latest-node",
|
|
23
|
+
"babel-preset-stage-0",
|
|
24
|
+
"babel-preset-stage-1",
|
|
25
|
+
"babel-preset-modern-browsers-stage-1",
|
|
26
|
+
"babel-preset-flow",
|
|
27
|
+
"babel-preset-flow-tcomb",
|
|
28
|
+
"babel-preset-flow-tcomb-forked",
|
|
29
|
+
"babel-plugin-typecheck",
|
|
30
|
+
"babel-plugin-defines",
|
|
31
|
+
"babel-plugin-import-rename",
|
|
32
|
+
"babel-plugin-discard-module-references",
|
|
33
|
+
"babel-plugin-remove-dead-code",
|
|
34
|
+
"babel-plugin-react-require",
|
|
35
|
+
"babel-preset-react",
|
|
36
|
+
"babel-preset-pob-react",
|
|
37
|
+
"komet",
|
|
38
|
+
"komet-karma",
|
|
39
|
+
"@commitlint/cli",
|
|
40
|
+
"@commitlint/config-conventional",
|
|
41
|
+
"lint-staged",
|
|
42
|
+
"yarnhook",
|
|
43
|
+
"yarn-deduplicate", // in @pob/root (for yarn 1)
|
|
44
|
+
"yarn-berry-deduplicate", // use yarn dedupe with yarn 2
|
|
45
|
+
"yarn-update-lock",
|
|
46
|
+
"@pob/version",
|
|
47
|
+
"pob-release",
|
|
48
|
+
"eslint-plugin-typescript",
|
|
49
|
+
"xunit-file",
|
|
50
50
|
]);
|
|
51
51
|
|
|
52
|
-
this.fs.writeJSON(this.destinationPath(
|
|
52
|
+
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -1,81 +1,81 @@
|
|
|
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
|
|
|
4
4
|
export default class CommonReleaseGenerator extends Generator {
|
|
5
5
|
constructor(args, opts) {
|
|
6
6
|
super(args, opts);
|
|
7
7
|
|
|
8
|
-
this.option(
|
|
8
|
+
this.option("enable", {
|
|
9
9
|
type: Boolean,
|
|
10
10
|
required: true,
|
|
11
|
-
desc:
|
|
11
|
+
desc: "If releasing is enabled",
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
this.option(
|
|
14
|
+
this.option("enablePublish", {
|
|
15
15
|
type: Boolean,
|
|
16
16
|
required: true,
|
|
17
|
-
desc:
|
|
17
|
+
desc: "If publish on npm is enabled",
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
this.option(
|
|
20
|
+
this.option("withBabel", {
|
|
21
21
|
type: Boolean,
|
|
22
22
|
required: false,
|
|
23
23
|
default: undefined,
|
|
24
|
-
desc:
|
|
24
|
+
desc: "Babel enabled.",
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
this.option(
|
|
27
|
+
this.option("withTypescript", {
|
|
28
28
|
type: Boolean,
|
|
29
29
|
required: false,
|
|
30
30
|
default: undefined,
|
|
31
|
-
desc:
|
|
31
|
+
desc: "Typescript enabled.",
|
|
32
32
|
});
|
|
33
|
-
this.option(
|
|
33
|
+
this.option("isMonorepo", {
|
|
34
34
|
type: Boolean,
|
|
35
35
|
default: false,
|
|
36
|
-
desc:
|
|
36
|
+
desc: "is monorepo",
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
this.option(
|
|
39
|
+
this.option("enableYarnVersion", {
|
|
40
40
|
type: Boolean,
|
|
41
41
|
default: true,
|
|
42
|
-
desc:
|
|
42
|
+
desc: "enable yarn version conventional commits",
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
this.option(
|
|
45
|
+
this.option("ci", {
|
|
46
46
|
type: Boolean,
|
|
47
47
|
required: true,
|
|
48
|
-
desc:
|
|
48
|
+
desc: "ci with github actions",
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
this.option(
|
|
51
|
+
this.option("disableYarnGitCache", {
|
|
52
52
|
type: Boolean,
|
|
53
53
|
required: false,
|
|
54
54
|
default: false,
|
|
55
|
-
desc:
|
|
55
|
+
desc: "Disable git cache. See https://yarnpkg.com/features/caching#offline-mirror.",
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
this.option(
|
|
58
|
+
this.option("updateOnly", {
|
|
59
59
|
type: Boolean,
|
|
60
60
|
required: false,
|
|
61
61
|
default: false,
|
|
62
|
-
desc:
|
|
62
|
+
desc: "Avoid asking questions",
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
writing() {
|
|
67
|
-
const pkg = this.fs.readJSON(this.destinationPath(
|
|
67
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
68
68
|
|
|
69
69
|
if (this.options.enable && this.options.ci) {
|
|
70
70
|
const useLegacyName = this.fs.exists(
|
|
71
|
-
this.destinationPath(
|
|
71
|
+
this.destinationPath(".github/workflows/publish.yml")
|
|
72
72
|
);
|
|
73
73
|
|
|
74
|
-
const name = useLegacyName ?
|
|
74
|
+
const name = useLegacyName ? "publish.yml" : "release.yml";
|
|
75
75
|
|
|
76
76
|
// TODO rename release (release = version + publish)
|
|
77
77
|
this.fs.copyTpl(
|
|
78
|
-
this.templatePath(
|
|
78
|
+
this.templatePath("workflow-release.yml.ejs"),
|
|
79
79
|
this.destinationPath(`.github/workflows/${name}`),
|
|
80
80
|
{
|
|
81
81
|
enablePublish: this.options.enablePublish,
|
|
@@ -84,49 +84,49 @@ export default class CommonReleaseGenerator extends Generator {
|
|
|
84
84
|
isMonorepo: this.options.isMonorepo,
|
|
85
85
|
isMonorepoIndependent:
|
|
86
86
|
this.options.isMonorepo &&
|
|
87
|
-
(!pkg.version || pkg.version ===
|
|
88
|
-
}
|
|
87
|
+
(!pkg.version || pkg.version === "0.0.0"),
|
|
88
|
+
}
|
|
89
89
|
);
|
|
90
90
|
} else {
|
|
91
|
-
this.fs.delete(this.destinationPath(
|
|
92
|
-
this.fs.delete(this.destinationPath(
|
|
91
|
+
this.fs.delete(this.destinationPath(".github/workflows/publish.yml"));
|
|
92
|
+
this.fs.delete(this.destinationPath(".github/workflows/release.yml"));
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
packageUtils.removeDevDependencies(pkg, [
|
|
95
|
+
packageUtils.removeDevDependencies(pkg, ["standard-version"]);
|
|
96
96
|
packageUtils.removeScripts(pkg, [
|
|
97
|
-
|
|
98
|
-
pkg.name ===
|
|
97
|
+
"release",
|
|
98
|
+
pkg.name === "pob-dependencies" ? null : "preversion",
|
|
99
99
|
]);
|
|
100
100
|
|
|
101
|
-
if (pkg.scripts.version ===
|
|
101
|
+
if (pkg.scripts.version === "pob-version") {
|
|
102
102
|
delete pkg.scripts.version;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
if (this.options.enable && !this.options.ci) {
|
|
106
106
|
packageUtils.addScripts(pkg, {
|
|
107
107
|
preversion: [
|
|
108
|
-
|
|
108
|
+
"yarn run lint",
|
|
109
109
|
this.options.withBabel ||
|
|
110
|
-
(this.options.withTypescript &&
|
|
111
|
-
|
|
110
|
+
(this.options.withTypescript && "yarn run build"),
|
|
111
|
+
"repository-check-dirty",
|
|
112
112
|
]
|
|
113
113
|
.filter(Boolean)
|
|
114
|
-
.join(
|
|
114
|
+
.join(" && "),
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
if (
|
|
119
119
|
this.fs.exists(
|
|
120
|
-
this.destinationPath(
|
|
120
|
+
this.destinationPath(".github/workflows/release-please.yml")
|
|
121
121
|
)
|
|
122
122
|
) {
|
|
123
123
|
this.fs.delete(
|
|
124
|
-
this.destinationPath(
|
|
124
|
+
this.destinationPath(".github/workflows/release-please.yml")
|
|
125
125
|
);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
this.fs.delete(this.destinationPath(
|
|
128
|
+
this.fs.delete(this.destinationPath(".release-please-manifest.json"));
|
|
129
129
|
|
|
130
|
-
this.fs.writeJSON(this.destinationPath(
|
|
130
|
+
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
131
131
|
}
|
|
132
132
|
}
|