Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
<img src="https://img.shields.io/badge/boringcodes-verified-brightgreen?style=flat-square">
</a>
</div>

<img src="banner.png">
</div>

## Installation

Make sure `yeoman` is installed:
Make sure `yeoman` is installed

```sh
$ yarn global add yo
Expand All @@ -43,22 +45,26 @@ $ yarn global add generator-create-package

## Usage

With [yo](https://github.com/yeoman/yo):
Create a new directory

```sh
$ mkdir package-name
```

Then navigate to the created directory and run the following command to generate source

```sh
$ yo create-package
```

This scaffolds out:

```
├── CHANGELOG.md
├── README.md
├── package.json
├── rollup.config.js
├── src
│   ├── index.ts
│   └── package-name
│   └── index.ts
├── .huskyrc
├── package.json
├── rollup.config.js
├── tsconfig.json
└── tslint.json
```
Expand Down
Binary file added banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 36 additions & 7 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,53 @@ module.exports = class extends Generator {
yosay(`Welcome to the astounding ${chalk.red(pkg.name)} generator!`),
);

const gitName = this.user.git.name() || 'organization';
const gitEmail = this.user.git.email() || 'hi@domain.com';
const githubUsername = await (async () => {
try {
const username = await this.user.github.username();

return username;
} catch (err) {
return 'organization';
}
})();
const prompts = [
{
type: 'input',
name: 'elementName',
message: 'What is the name of your package?',
default: 'my-awesome-package',
default: this.appname,
},
{
type: 'input',
name: 'elementDescription',
message: 'Give us some small description of your package',
default: '',
message: 'Description of your package?',
default: 'My awesome package',
},
{
type: 'input',
name: 'elementHomepageUrl',
message: 'Package homepage URL?',
default: `https://github.com/${githubUsername}/${this.appname}`,
},
{
type: 'input',
name: 'elementBugsUrl',
message: 'Bugs tracking site?',
default: `https://github.com/${githubUsername}/${this.appname}/issues`,
},
{
type: 'input',
name: 'elementAuthor',
message: 'Who is the author of this package?',
default: '',
message: 'Author of this package?',
default: `${gitName} \<${gitEmail}\>`,
},
{
type: 'input',
name: 'elementRepositoryUrl',
message: 'Package repository URL?',
default: `https://github.com/${githubUsername}/${this.appname}.git`,
},
];

Expand All @@ -39,13 +68,13 @@ module.exports = class extends Generator {

writing() {
this.fs.copyTpl(
[this.templatePath('**')],
[this.templatePath('**/*.*')],
this.destinationPath(),
this.props,
);
}

install() {
this.installDependencies();
this.yarnInstall();
}
};
5 changes: 0 additions & 5 deletions generators/app/templates/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions generators/app/templates/README.md

This file was deleted.

12 changes: 5 additions & 7 deletions generators/app/templates/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "<%= elementName %>",
"description": "<%= elementDescription %>",
"version": "0.0.0",
"private": true,
"license": "MIT",
"author": "<%= elementAuthor %>",
"repository": "",
"bugs": "",
"description": "<%= elementDescription %>",
"homepage": "<%= elementHomepageUrl %>",
"bugs": "<%= elementBugsUrl %>",
"author": "<%- elementAuthor %>",
"repository": "<%= elementRepositoryUrl %>",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"files": [
Expand All @@ -25,7 +24,6 @@
"release:patch": "yarn release --release-as patch"
},
"devDependencies": {
"@types/isomorphic-fetch": "^0.0.35",
"husky": "^2.3.0",
"rollup": "^1.12.3",
"rollup-plugin-async": "^1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion generators/app/templates/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './package-name';
export default {};
1 change: 0 additions & 1 deletion generators/app/templates/src/package-name/index.ts

This file was deleted.