File tree Expand file tree Collapse file tree 20 files changed +526
-205
lines changed Expand file tree Collapse file tree 20 files changed +526
-205
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "overrides": [
3
+ {
4
+ "files": "*.ts",
5
+ "parser": "@typescript-eslint/parser",
6
+ "rules": {
7
+ "no-unused-vars": "off",
8
+ "no-useless-constructor": "off",
9
+ "@typescript-eslint/no-unused-vars": "error",
10
+ "@typescript-eslint/no-useless-constructor": "error"
11
+ }
12
+ }
13
+ ],
14
+ "parserOptions": {
15
+ "ecmaVersion": 2017,
16
+ "sourceType": "module"
17
+ },
18
+ "plugins": [
19
+ "@typescript-eslint/eslint-plugin"
20
+ ]
21
+ }
Original file line number Diff line number Diff line change 39
39
- run : npm install
40
40
- run : npm test
41
41
- run : npm run coverage
42
+ esm :
43
+ runs-on : ubuntu-latest
44
+ steps :
45
+ - uses : actions/checkout@v2
46
+ - uses : actions/setup-node@v1
47
+ with :
48
+ node-version : ' 14.x'
49
+ - run : npm install
50
+ - run : npm run test:esm
51
+ deno :
52
+ runs-on : ubuntu-latest
53
+ steps :
54
+ - uses : actions/checkout@v2
55
+ - uses : actions/setup-node@v1
56
+ with :
57
+ node-version : 14
58
+ - run : npm install
59
+ - run : npm run compile
60
+ - uses : denolib/setup-deno@v2
61
+ - run : |
62
+ deno --version
63
+ deno test --allow-read test/deno/y18n-test.ts
Original file line number Diff line number Diff line change 7
7
release-please :
8
8
runs-on : ubuntu-latest
9
9
steps :
10
- - uses : GoogleCloudPlatform/release-please-action@v1.6.3
10
+ - uses : bcoe/release-please-action@v2.0.0
11
+ id : release
11
12
with :
12
13
token : ${{ secrets.GITHUB_TOKEN }}
13
14
release-type : node
14
15
package-name : y18n
16
+ - uses : actions/checkout@v2
17
+ - uses : actions/setup-node@v1
18
+ with :
19
+ node-version : 14
20
+ - run : npm install
21
+ - run : npm run compile
22
+ - name : push Deno release
23
+ run : |
24
+ git config user.name github-actions[bot]
25
+ git config user.email 41898282+github-actions[bot]@users.noreply.github.com
26
+ git remote add gh-token "https://${{ secrets.GITHUB_TOKEN}}@github.com/yargs/y18n.git"
27
+ git checkout -b deno
28
+ git add -f build
29
+ git commit -a -m 'chore: ${{ steps.release.outputs.tag_name }} release'
30
+ git push origin +deno
31
+ git tag -a ${{ steps.release.outputs.tag_name }}-deno -m 'chore: ${{ steps.release.outputs.tag_name }} release'
32
+ git push origin ${{ steps.release.outputs.tag_name }}-deno
33
+ if : ${{ steps.release.outputs.release_created }}
34
+ - uses : actions/setup-node@v1
35
+ with :
36
+ node-version : 14
37
+ registry-url : ' https://external-dot-oss-automation.appspot.com/'
38
+ if : ${{ steps.release.outputs.release_created }}
39
+ - run : npm install
40
+ if : ${{ steps.release.outputs.release_created }}
41
+ - run : npm publish
42
+ env :
43
+ NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
44
+ if : ${{ steps.release.outputs.release_created }}
Original file line number Diff line number Diff line change 1
1
.DS_Store
2
2
node_modules
3
3
.nyc_output
4
+ build
4
5
coverage
5
6
package-lock.json
7
+ example. *
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -48,6 +48,23 @@ output:
48
48
49
49
` 2 fishes foo `
50
50
51
+ ## Deno Example
52
+
53
+ As of ` v5 ` ` y18n ` supports [ Deno] ( https://github.com/denoland/deno ) :
54
+
55
+ ``` typescript
56
+ import y18n from " https://deno.land/x/y18n/deno.ts" ;
57
+
58
+ const __ = y18n ({
59
+ locale: ' pirate' ,
60
+ directory: ' ./test/locales'
61
+ }).__
62
+
63
+ console .info (__ ` Hi, ${' Ben' } ${' Coe' }! ` )
64
+ ```
65
+
66
+ You will need to run with ` --allow-read ` to load alternative locales.
67
+
51
68
## JSON Language Files
52
69
53
70
The JSON language files should be stored in a ` ./locales ` folder.
Original file line number Diff line number Diff line change
1
+ import { y18n as _y18n } from './build/lib/index.js'
2
+ import { Y18NOpts } from './build/lib/index.d.ts'
3
+ import shim from './lib/platform-shims/deno.ts'
4
+
5
+ const y18n = ( opts : Y18NOpts ) => {
6
+ return _y18n ( opts , shim )
7
+ }
8
+
9
+ export default y18n
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import shim from './build/lib/platform-shims/node.js'
2
+ import { y18n as _y18n } from './build/lib/index.js'
3
+
4
+ const y18n = ( opts ) => {
5
+ return _y18n ( opts , shim )
6
+ }
7
+
8
+ export default y18n
Original file line number Diff line number Diff line change
1
+ import { y18n as _y18n , Y18NOpts } from './index.js'
2
+ import nodePlatformShim from './platform-shims/node.js'
3
+
4
+ const y18n = ( opts : Y18NOpts ) => {
5
+ return _y18n ( opts , nodePlatformShim )
6
+ }
7
+
8
+ export default y18n
You can’t perform that action at this time.
0 commit comments