Skip to content

Commit 8eec00f

Browse files
committed
fix: generate correct links for scoped packages
1 parent 6f68f56 commit 8eec00f

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

generators/typescript/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class TypescriptGenerator extends Generator {
2020
{
2121
type: 'input',
2222
name: 'name',
23-
message: 'Your project name',
23+
message: 'Your package name',
2424
default: path.basename(this.destinationRoot()), // Default to current folder name
2525
},
2626
{
@@ -46,6 +46,7 @@ export default class TypescriptGenerator extends Generator {
4646
this.props = await this.prompt(prompts);
4747

4848
const prefix = this.props.org === 'mljs' ? 'ml-' : '';
49+
this.props.repoName = this.props.name.split('/').at(-1);
4950
this.props.npmName = prefix + this.props.name;
5051
}
5152

@@ -90,12 +91,12 @@ export default class TypescriptGenerator extends Generator {
9091
devDependencies,
9192
repository: {
9293
type: 'git',
93-
url: `git+https://github.com/${this.props.org}/${this.props.name}.git`,
94+
url: `git+https://github.com/${this.props.org}/${this.props.repoName}.git`,
9495
},
9596
bugs: {
96-
url: `https://github.com/${this.props.org}/${this.props.name}/issues`,
97+
url: `https://github.com/${this.props.org}/${this.props.repoName}/issues`,
9798
},
98-
homepage: `https://github.com/${this.props.org}/${this.props.name}#readme`,
99+
homepage: `https://github.com/${this.props.org}/${this.props.repoName}#readme`,
99100
});
100101
}
101102

@@ -106,6 +107,7 @@ export default class TypescriptGenerator extends Generator {
106107
const year = date.getFullYear();
107108
const camelName = camelCase(this.props.name);
108109
const includes = {
110+
repoName: this.props.repoName,
109111
npmName: this.props.npmName,
110112
name: this.props.name,
111113
org: this.props.org,
@@ -156,10 +158,9 @@ export default class TypescriptGenerator extends Generator {
156158
this.destinationPath('.github/workflows/release.yml'),
157159
);
158160
this.fs.copy(this.templatePath('npmrc'), this.destinationPath('.npmrc'));
159-
this.fs.copyTpl(
161+
this.fs.copy(
160162
this.templatePath('gitignore'),
161163
this.destinationPath('.gitignore'),
162-
includes,
163164
);
164165
this.fs.copyTpl(
165166
this.templatePath('LICENSE'),
@@ -171,10 +172,9 @@ export default class TypescriptGenerator extends Generator {
171172
this.destinationPath('README.md'),
172173
includes,
173174
);
174-
this.fs.copyTpl(
175+
this.fs.copy(
175176
this.templatePath('vitest.config.ts'),
176177
this.destinationPath('vitest.config.ts'),
177-
includes,
178178
);
179179
}
180180
}

generators/typescript/templates/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
[![NPM version](https://img.shields.io/npm/v/<%= npmName %>.svg)](https://www.npmjs.com/package/<%= npmName %>)
44
[![npm download](https://img.shields.io/npm/dm/<%= npmName %>.svg)](https://www.npmjs.com/package/<%= npmName %>)
5-
[![test coverage](https://img.shields.io/codecov/c/github/<%= org %>/<%= name %>.svg)](https://codecov.io/gh/<%= org %>/<%= name %>)
6-
[![license](https://img.shields.io/npm/l/<%= npmName %>.svg)](https://github.com/<%= org %>/<%= name %>/blob/main/LICENSE)
5+
[![test coverage](https://img.shields.io/codecov/c/github/<%= org %>/<%= repoName %>.svg)](https://codecov.io/gh/<%= org %>/<%= repoName %>)
6+
[![license](https://img.shields.io/npm/l/<%= npmName %>.svg)](https://github.com/<%= org %>/<%= repoName %>/blob/main/LICENSE)
77

88
<%= description %>.
99

0 commit comments

Comments
 (0)