Skip to content

Commit 16ee0c3

Browse files
committed
chore: fix workflow and add CodeSandbox to readme
1 parent 399ef33 commit 16ee0c3

File tree

3 files changed

+34
-29
lines changed

3 files changed

+34
-29
lines changed

.github/workflows/npm-publish.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
33

4-
name: '@smakss/random-string'
4+
name: "@smakss/random-string"
55

66
on:
77
release:
@@ -11,21 +11,21 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v1
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
1616
with:
17-
node-version: 12
17+
node-version: 16
1818

1919
publish-npm:
2020
needs: build
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v2
24-
- uses: actions/setup-node@v1
23+
- uses: actions/checkout@v3
24+
- uses: actions/setup-node@v3
2525
with:
26-
node-version: 12
26+
node-version: 16
2727
registry-url: https://registry.npmjs.org/
28-
scope: '@smakss'
28+
scope: "@smakss"
2929
- run: npm publish
3030
env:
3131
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
@@ -34,12 +34,12 @@ jobs:
3434
needs: build
3535
runs-on: ubuntu-latest
3636
steps:
37-
- uses: actions/checkout@v2
38-
- uses: actions/setup-node@v1
37+
- uses: actions/checkout@v3
38+
- uses: actions/setup-node@v3
3939
with:
40-
node-version: 12
40+
node-version: 16
4141
registry-url: https://npm.pkg.github.com/
42-
scope: '@smakss'
42+
scope: "@smakss"
4343
- run: npm publish
4444
env:
4545
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

Readme.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ yarn add @smakss/random-string
1717
to include it with common js module you should do this:
1818

1919
```js
20-
var randomString = require('@smakss/random-string');
20+
var randomString = require("@smakss/random-string");
2121
```
2222

2323
and to include it with ECMAscript module you can simply do this one:
2424

2525
```js
26-
import randomString from '@smakss/random-string';
26+
import randomString from "@smakss/random-string";
2727
```
2828

2929
## Examples of usage
@@ -37,24 +37,29 @@ randomString();
3737

3838
// Result: 'epTfoad497&p'
3939
```
40+
4041
<sub>**NOTE:** If the input params were empty the length of string will be selected randomly between 1-20.<sub>
4142

4243
Generate a random string with a length of 10:
4344

4445
```js
45-
randomString(10);
46+
randomString(10);
4647

47-
// Result: 'BD@Z8dKf2%'
48+
// Result: 'BD@Z8dKf2%'
4849
```
4950

5051
You can provide both length and allowed characters:
5152

5253
```js
53-
randomString(10, 'abCD#@');
54+
randomString(10, "abCD#@");
5455

5556
// Result: 'b@@#aDaC##'
5657
```
5758

5859
## Demo
5960

6061
You can check the [working demo](https://runkit.com/smakss/random-string) in runkit.
62+
63+
or
64+
65+
[![View @smakss/random-string](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/smakss-random-string-xlf6d2?fontsize=14&hidenavigation=1&theme=dark)

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
{
2-
"name": "@smakss/random-string",
3-
"version": "1.2.3",
2+
"author": "SMAKSS",
3+
"bugs": {
4+
"url": "https://github.com/SMAKSS/random-string/issues"
5+
},
46
"description": "Generates random dummy string with random length.",
5-
"type": "module",
6-
"main": "index.cjs",
77
"exports": {
88
"import": "./index.mjs",
99
"require": "./index.cjs"
1010
},
11-
"repository": {
12-
"type": "git",
13-
"url": "git+https://github.com/SMAKSS/random-string.git"
14-
},
11+
"homepage": "https://github.com/SMAKSS/random-string#readme",
1512
"keywords": [
1613
"npm",
1714
"yarn",
@@ -23,10 +20,13 @@
2320
"EcmaScript",
2421
"random-string"
2522
],
26-
"author": "SMAKSS",
2723
"license": "MIT",
28-
"bugs": {
29-
"url": "https://github.com/SMAKSS/random-string/issues"
24+
"main": "index.cjs",
25+
"name": "@smakss/random-string",
26+
"repository": {
27+
"type": "git",
28+
"url": "git+https://github.com/SMAKSS/random-string.git"
3029
},
31-
"homepage": "https://github.com/SMAKSS/random-string#readme"
30+
"type": "module",
31+
"version": "1.2.4"
3232
}

0 commit comments

Comments
 (0)