Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
Update the template
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Aug 17, 2022
1 parent f531a25 commit a70da9e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
10 changes: 5 additions & 5 deletions app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "module",<% if (cli) { %>
"bin": "cli.js",<% } else { %>"exports": "./index.js",<% } %>
"engines": {
"node": ">=12"
"node": ">=14.16"
},
"scripts": {
"test": "xo && <% if (nyc) { %>nyc <% } %>ava"
Expand All @@ -27,13 +27,13 @@
""
],
"dependencies": {<% if (cli) { %>
"meow": "^9.0.0"
"meow": "^10.1.3"
<% } %>},
"devDependencies": {
"ava": "^3.15.0",<% if (codecov) { %>
"codecov": "^3.7.2",<% } %><% if (nyc) { %>
"ava": "^4.3.1",<% if (codecov) { %>
"codecov": "^3.8.3",<% } %><% if (nyc) { %>
"nyc": "^15.1.0",<% } %>
"xo": "^0.38.0"
"xo": "^0.51.0"
}<% if (codecov) { %>,
"nyc": {
"reporter": [
Expand Down
2 changes: 1 addition & 1 deletion app/templates/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ const cli = meow(`
}
});

console.log(<%= camelModuleName %>(cli.input[0] || 'unicorns'));
console.log(<%= camelModuleName %>(cli.input[0] ?? 'unicorns'));
11 changes: 6 additions & 5 deletions app/templates/github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ jobs:
fail-fast: false
matrix:
node-version:
- 18
- 16
- 14
- 12
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test<% if (codecov) { %>
- uses: codecov/codecov-action@v1
if: matrix.node-version == 14
- uses: codecov/codecov-action@v3
if: matrix.node-version == 16
with:
fail_ci_if_error: true<% } %>
6 changes: 2 additions & 4 deletions app/templates/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const unicornFun = (input, {postfix = 'rainbows'} = {}) => {
export default function unicornFun(input, {postfix = 'rainbows'} = {}) {
if (typeof input !== 'string') {
throw new TypeError(`Expected a string, got ${typeof input}`);
}

return `${input} & ${postfix}`;
};

export default unicornFun;
}
14 changes: 7 additions & 7 deletions app/templates/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
## Install

```
$ npm install <%= moduleName %>
```sh
npm install <%= moduleName %>
```

## Usage
Expand All @@ -31,17 +31,17 @@ Lorem ipsum.

Type: `object`

##### foo
##### postfix

Type: `boolean`\
Default: `false`
Type: `string`\
Default: `'rainbows'`

Lorem ipsum.<% if (cli) { %>

## CLI

```
$ npm install --global <%= moduleName %>
```sh
npm install --global <%= moduleName %>
```

```
Expand Down
2 changes: 1 addition & 1 deletion app/templates/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test('title', t => {
<%= camelModuleName %>(123);
}, {
instanceOf: TypeError,
message: 'Expected a string, got number'
message: 'Expected a string, got number',
});

t.is(<%= camelModuleName %>('unicorns'), 'unicorns & rainbows');
Expand Down

0 comments on commit a70da9e

Please # to comment.