pob 19.2.0 → 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 (48) hide show
  1. package/CHANGELOG.md +11 -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 +13 -13
  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/core/ci/CoreCIGenerator.js +72 -72
  18. package/lib/generators/core/clean/CoreCleanGenerator.js +4 -4
  19. package/lib/generators/core/editorconfig/CoreEditorConfigGenerator.js +3 -3
  20. package/lib/generators/core/git/CoreGitGenerator.js +43 -43
  21. package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +43 -43
  22. package/lib/generators/core/gitignore/CoreGitignoreGenerator.js +19 -19
  23. package/lib/generators/core/npm/CoreNpmGenerator.js +20 -20
  24. package/lib/generators/core/package/CorePackageGenerator.js +98 -98
  25. package/lib/generators/core/package/askName.js +4 -4
  26. package/lib/generators/core/renovate/CoreRenovateGenerator.js +28 -28
  27. package/lib/generators/core/sort-package/CoreSortPackageGenerator.js +6 -6
  28. package/lib/generators/core/vscode/CoreVSCodeGenerator.js +43 -43
  29. package/lib/generators/core/yarn/CoreYarnGenerator.js +70 -70
  30. package/lib/generators/lib/PobLibGenerator.js +111 -111
  31. package/lib/generators/lib/doc/LibDocGenerator.js +45 -45
  32. package/lib/generators/lib/readme/LibReadmeGenerator.js +21 -21
  33. package/lib/generators/monorepo/PobMonorepoGenerator.js +89 -89
  34. package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +47 -47
  35. package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +38 -38
  36. package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +57 -57
  37. package/lib/generators/pob/PobBaseGenerator.js +81 -81
  38. package/lib/pob-dirname.cjs +1 -1
  39. package/lib/pob.js +143 -143
  40. package/lib/utils/dependenciesPackages.cjs +4 -4
  41. package/lib/utils/ensureJsonFileFormatted.js +5 -5
  42. package/lib/utils/inMonorepo.js +8 -8
  43. package/lib/utils/json5.js +1 -1
  44. package/lib/utils/package.js +43 -43
  45. package/lib/utils/packagejson.cjs +2 -2
  46. package/lib/utils/templateUtils.js +1 -1
  47. package/lib/utils/writeAndFormat.js +9 -10
  48. package/package.json +7 -7
@@ -1,54 +1,54 @@
1
- import remoteUrl from 'git-remote-url';
2
- import githubUsername from 'github-username';
3
- import Generator from 'yeoman-generator';
4
- import * as packageUtils from '../../../utils/package.js';
1
+ import remoteUrl from "git-remote-url";
2
+ import githubUsername from "github-username";
3
+ import Generator from "yeoman-generator";
4
+ import * as packageUtils from "../../../utils/package.js";
5
5
 
6
6
  export default class CoreGitGenerator extends Generator {
7
7
  constructor(args, opts) {
8
8
  super(args, opts);
9
9
 
10
- this.option('shouldCreate', {
10
+ this.option("shouldCreate", {
11
11
  type: Boolean,
12
12
  required: false,
13
- default: '',
14
- desc: 'Should create the repo on github',
13
+ default: "",
14
+ desc: "Should create the repo on github",
15
15
  });
16
16
 
17
- this.option('onlyLatestLTS', {
17
+ this.option("onlyLatestLTS", {
18
18
  type: Boolean,
19
19
  required: true,
20
- desc: 'only latest lts',
20
+ desc: "only latest lts",
21
21
  });
22
22
 
23
- this.option('splitCIJobs', {
23
+ this.option("splitCIJobs", {
24
24
  type: Boolean,
25
25
  required: true,
26
- desc: 'split CI jobs for faster result',
26
+ desc: "split CI jobs for faster result",
27
27
  });
28
28
  }
29
29
 
30
30
  async initializing() {
31
- let originUrl = await remoteUrl(this.destinationPath(), 'origin').catch(
32
- () => '',
31
+ let originUrl = await remoteUrl(this.destinationPath(), "origin").catch(
32
+ () => ""
33
33
  );
34
34
 
35
35
  if (!originUrl) {
36
- const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
36
+ const pkg = this.fs.readJSON(this.destinationPath("package.json"), {});
37
37
  originUrl = pkg.repository;
38
38
  }
39
39
 
40
40
  this.originUrl = originUrl;
41
41
  const match =
42
42
  originUrl &&
43
- typeof originUrl === 'string' &&
43
+ typeof originUrl === "string" &&
44
44
  originUrl.match(
45
- /^(?:git@|https?:\/\/)(?:([^./:]+)(?:\.com)?[/:])?([^/:]+)\/([^./:]+)(?:.git)?/,
45
+ /^(?:git@|https?:\/\/)(?:([^./:]+)(?:\.com)?[/:])?([^/:]+)\/([^./:]+)(?:.git)?/
46
46
  );
47
47
  if (!match) return;
48
48
  const [, gitHost, gitAccount, repoName] = match;
49
- this.gitHost = gitHost || 'github';
49
+ this.gitHost = gitHost || "github";
50
50
  this.gitHostAccount = gitAccount;
51
- if (repoName !== 'undefined') {
51
+ if (repoName !== "undefined") {
52
52
  this.repoName = repoName;
53
53
  }
54
54
  }
@@ -63,15 +63,15 @@ export default class CoreGitGenerator extends Generator {
63
63
 
64
64
  const { gitHost } = await this.prompt([
65
65
  {
66
- type: 'list',
67
- name: 'gitHost',
68
- message: 'Which git host service would you like ?',
69
- default: this.gitHost || (this.originUrl ? 'none' : 'github'),
66
+ type: "list",
67
+ name: "gitHost",
68
+ message: "Which git host service would you like ?",
69
+ default: this.gitHost || (this.originUrl ? "none" : "github"),
70
70
  choices: [
71
- { value: 'none', name: !this.originUrl ? 'none' : "don't change" },
72
- 'github',
73
- 'bitbucket',
74
- 'gitlab',
71
+ { value: "none", name: !this.originUrl ? "none" : "don't change" },
72
+ "github",
73
+ "bitbucket",
74
+ "gitlab",
75
75
  ],
76
76
  },
77
77
  ]);
@@ -79,19 +79,19 @@ export default class CoreGitGenerator extends Generator {
79
79
  this.gitHost = gitHost;
80
80
 
81
81
  if (!this.gitHostAccount) {
82
- if (this.gitHost === 'github') {
83
- const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
82
+ if (this.gitHost === "github") {
83
+ const pkg = this.fs.readJSON(this.destinationPath("package.json"), {});
84
84
  const author = packageUtils.parsePkgAuthor(pkg);
85
85
  this.gitHostAccount = await githubUsername(author.email).catch(
86
- () => '',
86
+ () => ""
87
87
  );
88
88
  }
89
89
  }
90
90
 
91
- if (this.gitHost !== 'none') {
91
+ if (this.gitHost !== "none") {
92
92
  const { gitHostAccount } = await this.prompt({
93
- name: 'gitHostAccount',
94
- message: 'username or organization',
93
+ name: "gitHostAccount",
94
+ message: "username or organization",
95
95
  default: this.gitHostAccount,
96
96
  });
97
97
 
@@ -100,8 +100,8 @@ export default class CoreGitGenerator extends Generator {
100
100
  }
101
101
 
102
102
  default() {
103
- if (this.gitHost === 'github') {
104
- this.composeWith('pob:core:git:github', {
103
+ if (this.gitHost === "github") {
104
+ this.composeWith("pob:core:git:github", {
105
105
  shouldCreate: !this.originUrl,
106
106
  gitHostAccount: this.gitHostAccount,
107
107
  repoName: this.repoName,
@@ -112,13 +112,13 @@ export default class CoreGitGenerator extends Generator {
112
112
  }
113
113
 
114
114
  writing() {
115
- console.log('git: writing');
115
+ console.log("git: writing");
116
116
 
117
- if (this.gitHost === 'none') {
117
+ if (this.gitHost === "none") {
118
118
  return;
119
119
  }
120
120
 
121
- const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
121
+ const pkg = this.fs.readJSON(this.destinationPath("package.json"), {});
122
122
  const repoName = this.repoName || this.options.name || pkg.name;
123
123
 
124
124
  if (!pkg.homepage && this.gitHostAccount) {
@@ -131,22 +131,22 @@ export default class CoreGitGenerator extends Generator {
131
131
  pkg.repository = repository;
132
132
  }
133
133
 
134
- this.fs.writeJSON(this.destinationPath('package.json'), pkg);
134
+ this.fs.writeJSON(this.destinationPath("package.json"), pkg);
135
135
 
136
136
  const cwd = this.destinationPath();
137
137
 
138
138
  this.initGitRepository =
139
- this.spawnCommandSync('git', ['status'], {
139
+ this.spawnCommandSync("git", ["status"], {
140
140
  cwd,
141
- stdio: 'ignore',
141
+ stdio: "ignore",
142
142
  reject: false,
143
143
  }).status === 128;
144
144
  if (this.initGitRepository) {
145
- this.spawnCommandSync('git', ['init'], { cwd });
145
+ this.spawnCommandSync("git", ["init"], { cwd });
146
146
 
147
147
  if (!this.originUrl) {
148
148
  let repoSSH = pkg.repository;
149
- if (pkg.repository && !pkg.repository.includes('.git')) {
149
+ if (pkg.repository && !pkg.repository.includes(".git")) {
150
150
  /* this.spawnCommandSync('curl', [
151
151
  '--silent',
152
152
  '--write-out',
@@ -163,7 +163,7 @@ export default class CoreGitGenerator extends Generator {
163
163
  repoSSH = pkg.repository;
164
164
  }
165
165
 
166
- this.spawnCommandSync('git', ['remote', 'add', 'origin', repoSSH], {
166
+ this.spawnCommandSync("git", ["remote", "add", "origin", repoSSH], {
167
167
  cwd,
168
168
  });
169
169
  }
@@ -1,14 +1,14 @@
1
1
  /* eslint-disable camelcase */
2
2
 
3
- import Generator from 'yeoman-generator';
4
- import { ciContexts } from '../../../ci/CoreCIGenerator.js';
3
+ import Generator from "yeoman-generator";
4
+ import { ciContexts } from "../../../ci/CoreCIGenerator.js";
5
5
  // const packageUtils = require('../../../../../utils/package');
6
6
 
7
7
  const GITHUB_TOKEN = process.env.POB_GITHUB_TOKEN;
8
8
 
9
9
  const postJson = (url, jsonBody) =>
10
10
  fetch(`https://api.github.com/${url}`, {
11
- method: 'POST',
11
+ method: "POST",
12
12
  body: JSON.stringify(jsonBody),
13
13
  headers: {
14
14
  authorization: `token ${GITHUB_TOKEN}`,
@@ -17,7 +17,7 @@ const postJson = (url, jsonBody) =>
17
17
 
18
18
  const putJson = (url, jsonBody) =>
19
19
  fetch(`https://api.github.com/${url}`, {
20
- method: 'PUT',
20
+ method: "PUT",
21
21
  body: JSON.stringify(jsonBody),
22
22
  headers: {
23
23
  authorization: `token ${GITHUB_TOKEN}`,
@@ -25,7 +25,7 @@ const putJson = (url, jsonBody) =>
25
25
  }).then((res) => (res.ok ? res.json() : null));
26
26
 
27
27
  const configureProtectionRule = async (owner, repo, onlyLatestLTS) => {
28
- for (const branch of ['main', 'master']) {
28
+ for (const branch of ["main", "master"]) {
29
29
  try {
30
30
  await putJson(`repos/${owner}/${repo}/branches/${branch}/protection`, {
31
31
  required_status_checks: {
@@ -39,11 +39,11 @@ const configureProtectionRule = async (owner, repo, onlyLatestLTS) => {
39
39
  allow_force_pushes: true, // false
40
40
  allow_deletions: false,
41
41
  });
42
- if (branch === 'master') {
42
+ if (branch === "master") {
43
43
  console.warn('You should rename your "master" branch to "main"');
44
44
  }
45
45
  } catch (error) {
46
- if (branch === 'main') {
46
+ if (branch === "main") {
47
47
  console.error(`Failed to configure ${branch} branch protection`);
48
48
  console.error(error.stack || error.message || error);
49
49
  }
@@ -58,48 +58,48 @@ const githubRepoConfig = {
58
58
  allow_auto_merge: true,
59
59
  delete_branch_on_merge: true,
60
60
  use_squash_pr_title_as_default: true,
61
- squash_merge_commit_title: 'PR_TITLE',
62
- squash_merge_commit_message: 'BLANK',
61
+ squash_merge_commit_title: "PR_TITLE",
62
+ squash_merge_commit_message: "BLANK",
63
63
  };
64
64
 
65
65
  export default class CoreGitGithubGenerator extends Generator {
66
66
  constructor(args, opts) {
67
67
  super(args, opts);
68
68
 
69
- this.option('shouldCreate', {
69
+ this.option("shouldCreate", {
70
70
  type: Boolean,
71
71
  required: false,
72
- default: '',
73
- desc: 'Should create the repo on github',
72
+ default: "",
73
+ desc: "Should create the repo on github",
74
74
  });
75
75
 
76
- this.option('gitHostAccount', {
76
+ this.option("gitHostAccount", {
77
77
  type: String,
78
78
  required: true,
79
- desc: 'host account',
79
+ desc: "host account",
80
80
  });
81
81
 
82
- this.option('repoName', {
82
+ this.option("repoName", {
83
83
  type: String,
84
84
  required: true,
85
- desc: 'repo name',
85
+ desc: "repo name",
86
86
  });
87
87
 
88
- this.option('onlyLatestLTS', {
88
+ this.option("onlyLatestLTS", {
89
89
  type: Boolean,
90
90
  required: true,
91
- desc: 'only latest lts',
91
+ desc: "only latest lts",
92
92
  });
93
93
 
94
- this.option('splitCIJobs', {
94
+ this.option("splitCIJobs", {
95
95
  type: Boolean,
96
96
  required: true,
97
- desc: 'split CI jobs for faster result',
97
+ desc: "split CI jobs for faster result",
98
98
  });
99
99
 
100
- if (!GITHUB_TOKEN && process.env.CI !== 'true') {
100
+ if (!GITHUB_TOKEN && process.env.CI !== "true") {
101
101
  throw new Error(
102
- 'Missing POB_GITHUB_TOKEN. Create one with https://github.com/settings/tokens/new?scopes=repo&description=POB%20Generator and add it in your env variables.',
102
+ "Missing POB_GITHUB_TOKEN. Create one with https://github.com/settings/tokens/new?scopes=repo&description=POB%20Generator and add it in your env variables."
103
103
  );
104
104
  }
105
105
  }
@@ -109,16 +109,16 @@ export default class CoreGitGithubGenerator extends Generator {
109
109
  const owner = this.options.gitHostAccount;
110
110
  const repo = this.options.repoName;
111
111
 
112
- const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
113
- const name = pkg.name.endsWith('-monorepo')
114
- ? pkg.name.slice(0, -'-monorepo'.length)
112
+ const pkg = this.fs.readJSON(this.destinationPath("package.json"), {});
113
+ const name = pkg.name.endsWith("-monorepo")
114
+ ? pkg.name.slice(0, -"-monorepo".length)
115
115
  : pkg.name;
116
116
 
117
117
  if (this.options.shouldCreate) {
118
118
  try {
119
119
  if (this.options.shouldCreate) {
120
120
  try {
121
- await postJson('user/repos', {
121
+ await postJson("user/repos", {
122
122
  name,
123
123
  description: pkg.description,
124
124
  homepage: null,
@@ -127,39 +127,39 @@ export default class CoreGitGithubGenerator extends Generator {
127
127
  ...githubRepoConfig,
128
128
  });
129
129
  } catch (error) {
130
- console.error('Failed to create repository');
130
+ console.error("Failed to create repository");
131
131
  console.error(error.stack || error.message || error);
132
132
  }
133
133
  }
134
134
 
135
135
  const cwd = this.destinationPath();
136
136
  try {
137
- this.spawnCommandSync('git', ['add', '--all', '.'], { cwd });
137
+ this.spawnCommandSync("git", ["add", "--all", "."], { cwd });
138
138
  } catch (error) {
139
- this.spawnCommandSync('git', ['init'], { cwd });
140
- this.spawnCommandSync('git', ['add', '--all', '.'], { cwd });
139
+ this.spawnCommandSync("git", ["init"], { cwd });
140
+ this.spawnCommandSync("git", ["add", "--all", "."], { cwd });
141
141
  this.spawnCommandSync(
142
- 'git',
142
+ "git",
143
143
  [
144
- 'remote',
145
- 'add',
146
- 'origin',
144
+ "remote",
145
+ "add",
146
+ "origin",
147
147
  `git@github.com:christophehurpeau/${name}.git`,
148
148
  ],
149
- { cwd },
149
+ { cwd }
150
150
  );
151
- console.error('Failed to create repository');
151
+ console.error("Failed to create repository");
152
152
  console.error(error.stack || error.message || error);
153
153
  }
154
154
  this.spawnCommandSync(
155
- 'git',
156
- ['commit', '-m', 'chore: initial commit [skip ci]'],
157
- { cwd },
155
+ "git",
156
+ ["commit", "-m", "chore: initial commit [skip ci]"],
157
+ { cwd }
158
158
  );
159
- this.spawnCommandSync('git', ['branch', '-M', 'main'], {
159
+ this.spawnCommandSync("git", ["branch", "-M", "main"], {
160
160
  cwd,
161
161
  });
162
- this.spawnCommandSync('git', ['push', '-u', 'origin', 'main'], {
162
+ this.spawnCommandSync("git", ["push", "-u", "origin", "main"], {
163
163
  cwd,
164
164
  });
165
165
 
@@ -169,11 +169,11 @@ export default class CoreGitGithubGenerator extends Generator {
169
169
  // names: pkg.keywords,
170
170
  // });
171
171
  } catch (error) {
172
- console.error('Failed to create github repository');
172
+ console.error("Failed to create github repository");
173
173
  console.error(error.stack || error.message || error);
174
174
  }
175
175
  } else {
176
- console.log('sync github info');
176
+ console.log("sync github info");
177
177
 
178
178
  await postJson(`repos/${owner}/${repo}`, {
179
179
  name: repo,
@@ -1,61 +1,61 @@
1
- import Generator from 'yeoman-generator';
1
+ import Generator from "yeoman-generator";
2
2
 
3
3
  export default class CoreGitignoreGenerator extends Generator {
4
4
  constructor(args, opts) {
5
5
  super(args, opts);
6
6
 
7
- this.option('root', {
7
+ this.option("root", {
8
8
  type: Boolean,
9
9
  required: false,
10
10
  default: true,
11
- desc: 'Root package.',
11
+ desc: "Root package.",
12
12
  });
13
13
 
14
- this.option('documentation', {
14
+ this.option("documentation", {
15
15
  type: Boolean,
16
16
  required: false,
17
17
  default: false,
18
- desc: 'Documentation enabled.',
18
+ desc: "Documentation enabled.",
19
19
  });
20
20
 
21
- this.option('testing', {
21
+ this.option("testing", {
22
22
  type: Boolean,
23
23
  required: false,
24
24
  default: false,
25
- desc: 'Testing enabled.',
25
+ desc: "Testing enabled.",
26
26
  });
27
27
 
28
- this.option('withBabel', {
28
+ this.option("withBabel", {
29
29
  type: Boolean,
30
30
  required: false,
31
31
  default: undefined,
32
- desc: 'Babel enabled.',
32
+ desc: "Babel enabled.",
33
33
  });
34
34
 
35
- this.option('paths', {
35
+ this.option("paths", {
36
36
  type: String,
37
37
  required: false,
38
- default: '',
39
- desc: 'Paths ignored.',
38
+ default: "",
39
+ desc: "Paths ignored.",
40
40
  });
41
41
 
42
- this.option('typescript', {
42
+ this.option("typescript", {
43
43
  type: Boolean,
44
44
  required: false,
45
45
  default: true,
46
- desc: 'Typescript use.',
46
+ desc: "Typescript use.",
47
47
  });
48
48
 
49
- this.option('buildInGit', {
49
+ this.option("buildInGit", {
50
50
  type: Boolean,
51
51
  required: false,
52
52
  default: true,
53
- desc: 'Build is saved in git.',
53
+ desc: "Build is saved in git.",
54
54
  });
55
55
  }
56
56
 
57
57
  writing() {
58
- const dest = this.destinationPath('.gitignore');
58
+ const dest = this.destinationPath(".gitignore");
59
59
  const withBabel = this.options.withBabel;
60
60
  // if (withBabel === undefined) {
61
61
  // const babelEnvs = (pkg.pob && pkg.pob.babelEnvs) || [];
@@ -70,12 +70,12 @@ export default class CoreGitignoreGenerator extends Generator {
70
70
  ) {
71
71
  this.fs.delete(dest);
72
72
  } else {
73
- this.fs.copyTpl(this.templatePath('gitignore.ejs'), dest, {
73
+ this.fs.copyTpl(this.templatePath("gitignore.ejs"), dest, {
74
74
  root: this.options.root,
75
75
  documentation: this.options.documentation,
76
76
  testing: this.options.testing,
77
77
  withBabel,
78
- tsTestUtil: 'ts-node',
78
+ tsTestUtil: "ts-node",
79
79
  typescript: withBabel || this.options.typescript,
80
80
  paths: this.options.paths,
81
81
  buildInGit: this.options.buildInGit,
@@ -1,41 +1,41 @@
1
- import Generator from 'yeoman-generator';
1
+ import Generator from "yeoman-generator";
2
2
 
3
3
  export default class CoreNpmGenerator extends Generator {
4
4
  constructor(args, opts) {
5
5
  super(args, opts);
6
6
 
7
- this.option('enable', {
7
+ this.option("enable", {
8
8
  type: Boolean,
9
9
  required: false,
10
10
  default: true,
11
- desc: 'Enable npm',
11
+ desc: "Enable npm",
12
12
  });
13
13
 
14
- this.option('srcDirectory', {
14
+ this.option("srcDirectory", {
15
15
  type: String,
16
16
  required: true,
17
- default: 'lib',
18
- desc: 'src directory to include in published files',
17
+ default: "lib",
18
+ desc: "src directory to include in published files",
19
19
  });
20
20
 
21
- this.option('distDirectory', {
21
+ this.option("distDirectory", {
22
22
  type: String,
23
23
  required: false,
24
- desc: 'dist directory to include in published files',
24
+ desc: "dist directory to include in published files",
25
25
  });
26
26
  }
27
27
 
28
28
  writing() {
29
- const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
29
+ const pkg = this.fs.readJSON(this.destinationPath("package.json"), {});
30
30
 
31
31
  if (!pkg.private && this.options.enable) {
32
32
  this.fs.copyTpl(
33
- this.templatePath('npmignore.ejs'),
34
- this.destinationPath('.npmignore'),
35
- {},
33
+ this.templatePath("npmignore.ejs"),
34
+ this.destinationPath(".npmignore"),
35
+ {}
36
36
  );
37
- } else if (this.fs.exists(this.destinationPath('.npmignore'))) {
38
- this.fs.delete(this.destinationPath('.npmignore'));
37
+ } else if (this.fs.exists(this.destinationPath(".npmignore"))) {
38
+ this.fs.delete(this.destinationPath(".npmignore"));
39
39
  }
40
40
 
41
41
  if (!pkg.private && this.options.enable) {
@@ -45,18 +45,18 @@ export default class CoreNpmGenerator extends Generator {
45
45
  ]);
46
46
 
47
47
  if (pkg.bin) {
48
- files.add('bin');
48
+ files.add("bin");
49
49
  }
50
50
 
51
51
  if (pkg.exports) {
52
52
  Object.values(pkg.exports).forEach((value) => {
53
53
  if (
54
- typeof value === 'string' &&
55
- value.startsWith('./') &&
56
- value !== './package.json' &&
54
+ typeof value === "string" &&
55
+ value.startsWith("./") &&
56
+ value !== "./package.json" &&
57
57
  ![...files].some((file) => value.startsWith(`./${file}/`))
58
58
  ) {
59
- files.add(value.slice('./'.length));
59
+ files.add(value.slice("./".length));
60
60
  }
61
61
  });
62
62
  }
@@ -73,6 +73,6 @@ export default class CoreNpmGenerator extends Generator {
73
73
  delete pkg.files;
74
74
  }
75
75
 
76
- this.fs.writeJSON(this.destinationPath('package.json'), pkg);
76
+ this.fs.writeJSON(this.destinationPath("package.json"), pkg);
77
77
  }
78
78
  }