Skip to content

Commit 0424758

Browse files
authored
build: use rslib for bundling (#2)
1 parent 0571d40 commit 0424758

File tree

10 files changed

+1580
-2543
lines changed

10 files changed

+1580
-2543
lines changed

.eslintrc.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ jobs:
77
runs-on: ${{ matrix.os }}
88
strategy:
99
matrix:
10-
node: ['12.x', '14.x', '16.x']
10+
node: ["20.x", "22.x"]
1111
os: [ubuntu-latest]
1212

1313
steps:
1414
- uses: actions/checkout@v2
1515
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
1616
with:
17-
version: 6.10.0
18-
- uses: actions/setup-node@v2
17+
version: 10
18+
- uses: actions/setup-node@v4
1919
with:
20-
node-version: '14'
21-
cache: 'pnpm'
20+
node-version: ${{ matrix.node }}
21+
cache: "pnpm"
2222
- run: pnpm install
2323
- run: pnpm coverage
2424
- run: pnpm build
2525
- name: Coveralls
2626
uses: coverallsapp/github-action@master
2727
with:
28-
github-token: ${{ secrets.GITHUB_TOKEN }}
28+
github-token: ${{ secrets.GITHUB_TOKEN }}

.prettierignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ Inspired by python named formatter function, replace text inside a string based
99
In a CommonJS environment
1010

1111
```javascript
12-
const Formatter = require('string-object-formatter');
12+
const Formatter = require("string-object-formatter");
1313
```
1414

1515
Using `import`
1616

1717
```javascript
18-
import Formatter from 'string-object-formatter';
18+
import Formatter from "string-object-formatter";
1919
```
2020

2121
#### Default delimiters
2222

2323
```javascript
2424
const formatter = new Formatter();
25-
const toFormat = 'My name is {firstName} {lastName}';
25+
const toFormat = "My name is {firstName} {lastName}";
2626
const formatted = formatter.format(toFormat, {
27-
firstName: 'John',
28-
lastName: 'Doe',
27+
firstName: "John",
28+
lastName: "Doe",
2929
});
3030

3131
// formatted is 'My name is John Doe'
@@ -34,11 +34,11 @@ const formatted = formatter.format(toFormat, {
3434
#### Custom delimiters
3535

3636
```javascript
37-
const formatter = new Formatter('{{', '}}');
38-
const toFormat = 'My name is {{firstName}} {{lastName}}';
37+
const formatter = new Formatter("{{", "}}");
38+
const toFormat = "My name is {{firstName}} {{lastName}}";
3939
const formatted = formatter.format(toFormat, {
40-
firstName: 'John',
41-
lastName: 'Doe',
40+
firstName: "John",
41+
lastName: "Doe",
4242
});
4343

4444
// formatted is 'My name is John Doe'
@@ -52,7 +52,6 @@ const formatted = formatter.format(toFormat, {
5252

5353
### Properties
5454

55-
- [silent](#silent)
5655
- [endDelimiter](#enddelimiter)
5756
- [startDelimiter](#startdelimiter)
5857

@@ -72,22 +71,15 @@ Creates an instance of Formatter.
7271

7372
#### Parameters:
7473

75-
| Name | Type | Default value |
76-
| :--------------- | :-------- | :------------ |
77-
| `startDelimiter` | _string_ | '{' |
78-
| `endDelimiter` | _string_ | '}' |
79-
| `silent` | _boolean_ | false |
74+
| Name | Type | Default value |
75+
| :--------------- | :------- | :------------ |
76+
| `startDelimiter` | _string_ | '{' |
77+
| `endDelimiter` | _string_ | '}' |
8078

8179
**Returns:** [_default_](#)
8280

8381
## Properties
8482

85-
### silent
86-
87-
**silent**: _boolean_
88-
89-
---
90-
9183
### endDelimiter
9284

9385
**endDelimiter**: _string_

biome.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"vcs": {
7+
"enabled": true,
8+
"clientKind": "git",
9+
"useIgnoreFile": true
10+
},
11+
"formatter": {
12+
"indentStyle": "space"
13+
},
14+
"javascript": {
15+
"formatter": {
16+
"quoteStyle": "single"
17+
}
18+
},
19+
"css": {
20+
"parser": {
21+
"cssModules": true
22+
}
23+
},
24+
"linter": {
25+
"enabled": true,
26+
"rules": {
27+
"recommended": true
28+
}
29+
}
30+
}

package.json

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,30 @@
22
"name": "string-object-formatter",
33
"version": "3.0.0",
44
"description": "Python inspired named template formatter for Javascript strings",
5-
"main": "./dist/index.js",
6-
"module": "./dist/index.mjs",
5+
"type": "module",
76
"exports": {
8-
"require": "./dist/index.js",
9-
"import": "./dist/index.mjs"
7+
".": {
8+
"types": "./dist/index.d.ts",
9+
"import": "./dist/index.js",
10+
"require": "./dist/index.cjs"
11+
}
1012
},
13+
"main": "./dist/index.cjs",
14+
"module": "./dist/index.js",
1115
"types": "./dist/index.d.ts",
1216
"files": [
13-
"dist",
14-
"src"
17+
"dist"
1518
],
19+
"scripts": {
20+
"build": "rslib build",
21+
"check": "biome check --write",
22+
"dev": "rslib build --watch",
23+
"format": "biome format --write",
24+
"test": "vitest run",
25+
"coverage": "vitest run --coverage",
26+
"docs": "typedoc src/index.ts --readme none --gitRevision master --plugin typedoc-plugin-markdown",
27+
"prepublish": "pnpm run build"
28+
},
1629
"sideEffects": false,
1730
"author": "Alberto Rico",
1831
"license": "MIT",
@@ -21,36 +34,14 @@
2134
"url": "https://github.com/alrico88/string-object-formatter"
2235
},
2336
"devDependencies": {
24-
"@typescript-eslint/eslint-plugin": "^4.33.0",
25-
"@typescript-eslint/parser": "^4.33.0",
26-
"@vitest/coverage-c8": "^0.24.3",
37+
"@biomejs/biome": "^1.9.4",
38+
"@rslib/core": "^0.6.7",
39+
"@vitest/coverage-c8": "^0.24.5",
2740
"coveralls": "^3.1.1",
28-
"eslint": "^7.32.0",
29-
"eslint-config-airbnb-base": "^14.2.1",
30-
"eslint-config-airbnb-typescript": "^14.0.2",
31-
"eslint-config-prettier": "^8.5.0",
32-
"eslint-plugin-import": "^2.26.0",
33-
"tsup": "^6.2.3",
34-
"typedoc": "^0.23.16",
35-
"typedoc-plugin-markdown": "^3.13.6",
36-
"typescript": "^4.8.4",
37-
"vitest": "^0.24.3"
38-
},
39-
"scripts": {
40-
"dev": "pnpm run build -- --watch src",
41-
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
42-
"test": "vitest run",
43-
"coverage": "vitest run --coverage",
44-
"lint": "eslint --cache --fix --ignore-path .gitignore --ext .ts,.js src",
45-
"docs": "typedoc src/index.ts --readme README.md --gitRevision master",
46-
"prepublish": "pnpm run build",
47-
"coveralls": "vitest run --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
48-
},
49-
"prettier": {
50-
"printWidth": 80,
51-
"semi": true,
52-
"singleQuote": true,
53-
"trailingComma": "es5"
41+
"typedoc": "^0.23.28",
42+
"typedoc-plugin-markdown": "^3.17.1",
43+
"typescript": "^5.8.3",
44+
"vitest": "^0.24.5"
5445
},
5546
"keywords": [
5647
"strings",

0 commit comments

Comments
 (0)