Skip to content

Commit

Permalink
chore: upgrade to node 18 and update all dependencies (#687)
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Hofer <ivan.hofer@outlok.com>
  • Loading branch information
ivanhofer and Ivan Hofer committed Jul 10, 2023
1 parent 1df4d0e commit d26d6c2
Show file tree
Hide file tree
Showing 62 changed files with 2,153 additions and 1,544 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/batch-dependency-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 7.17.0
version: 8.6.7

- name: install node
uses: actions/setup-node@v2
with:
node-version: 16.18.1
node-version: 18.16.1
cache: 'pnpm'

- name: update dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 7.17.0
version: 8.6.7

- name: install node
uses: actions/setup-node@v2
with:
node-version: 16.18.1
node-version: 18.16.1
cache: 'pnpm'

- run: pnpm install --no-save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: install node
uses: actions/setup-node@v2
with:
node-version: 16.18.1
node-version: 18.16.1

- name: install dependencies
run: npm install --no-save
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/example-typesafe-i18n-exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: install node
uses: actions/setup-node@v2
with:
node-version: 16.18.1
node-version: 18.16.1

- name: install dependencies
run: npm install --no-save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: install node
uses: actions/setup-node@v2
with:
node-version: 16.18.1
node-version: 18.16.1

- name: install dependencies
run: npm install --no-save
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/example-typesafe-i18n-formatters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: install node
uses: actions/setup-node@v2
with:
node-version: 16.18.1
node-version: 18.16.1

- name: install dependencies
run: npm install --no-save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: install node
uses: actions/setup-node@v2
with:
node-version: 16.18.1
node-version: 18.16.1

- name: install dependencies
run: npm install --no-save
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/example-typesafe-i18n-importer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: install node
uses: actions/setup-node@v2
with:
node-version: 16.18.1
node-version: 18.16.1

- name: install dependencies
run: npm install --no-save
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 7.17.0
version: 8.6.7

- name: install node
uses: actions/setup-node@v2
with:
node-version: 16.18.1
node-version: 18.16.1
cache: 'pnpm'

- run: pnpm install --no-save
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 7.17.0
version: 8.6.7

- name: install node
uses: actions/setup-node@v2
with:
node-version: 16.18.1
node-version: 18.16.1
cache: 'pnpm'

- run: pnpm install --no-save
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 7.17.0
version: 8.6.7

- name: install node
uses: actions/setup-node@v2
with:
node-version: 16.18.1
node-version: 18.16.1
cache: 'pnpm'

- run: pnpm install --no-save
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.18.1
18.16.1
22 changes: 11 additions & 11 deletions .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,61 @@ module.exports = [
{
name: 'i18n-string',
path: 'dist/i18n.string.min.js',
limit: '987 b',
limit: '945 b',
},
{
name: 'typed-i18n-string',
path: 'dist/i18n.typed.string.min.js',
limit: '991 b',
limit: '949 b',
},
{
name: 'i18n-object',
path: 'dist/i18n.object.min.js',
limit: '1128 b',
limit: '1086 b',
},
{
name: 'typed-i18n-object',
path: 'dist/i18n.typed.object.min.js',
limit: '1134 b',
limit: '1090 b',
},
{
name: 'i18n-instance',
path: 'dist/i18n.instance.min.js',
limit: '1159 b',
limit: '1117 b',
},
{
name: 'all together',
path: 'dist/i18n.all.min.js',
limit: '1233 b',
limit: '1192 b',
},
{
name: 'adapter-angular',
path: 'angular/index.min.mjs',
limit: '1440 b',
limit: '1225 b',
ignore: ['angular'],
},
{
name: 'adapter-react',
path: 'react/index.min.mjs',
limit: '1604 b',
limit: '1560 b',
ignore: ['react'],
},
{
name: 'adapter-solid',
path: 'solid/index.min.mjs',
limit: '1447 b',
limit: '1402 b',
ignore: ['solid-js'],
},
{
name: 'adapter-svelte',
path: 'svelte/index.min.mjs',
limit: '1381 b',
limit: '1339 b',
ignore: ['svelte'],
},
{
name: 'adapter-vue',
path: 'vue/index.min.mjs',
limit: '1299 b',
limit: '1253 b',
ignore: ['vue'],
},
]
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,18 @@ The footprint of the `typesafe-i18n` package is smaller compared to other existi

These parts are bundled into the [core functions](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#usage). The sizes of the core functionalities are:

- [i18nString](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#i18nString): 987 bytes gzipped
- [i18nObject](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#i18nObject): 1128 bytes gzipped
- [i18n](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#i18n): 1159 bytes gzipped
- [i18nString](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#i18nString): 945 bytes gzipped
- [i18nObject](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#i18nObject): 1086 bytes gzipped
- [i18n](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#i18n): 1117 bytes gzipped

Apart from that there can be a small overhead depending on which utilities and wrappers you use.

There also exists a useful wrapper for some frameworks:
- [`typesafe-i18n` angular-service](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-angular): 1440 bytes gzipped
- [`typesafe-i18n` react-context](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-react): 1618 bytes gzipped
- [`typesafe-i18n` solid-context](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-solid): 1449 bytes gzipped
- [`typesafe-i18n` svelte-store](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-svelte): 1381 bytes gzipped
- [`typesafe-i18n` vue-plugin](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-vue): 1299 bytes gzipped
- [`typesafe-i18n` angular-service](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-angular): 1225 bytes gzipped
- [`typesafe-i18n` react-context](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-react): 1560 bytes gzipped
- [`typesafe-i18n` solid-context](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-solid): 1402 bytes gzipped
- [`typesafe-i18n` svelte-store](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-svelte): 1339 bytes gzipped
- [`typesafe-i18n` vue-plugin](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-vue): 1253 bytes gzipped


<!-- ------------------------------------------------------------------------------------------ -->
Expand Down
29 changes: 13 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,23 @@
"prepare": "husky install"
},
"devDependencies": {
"@size-limit/preset-small-lib": "^8.2.4",
"@types/glob": "^7.2.0",
"@types/node": "^16.18.34",
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.59.7",
"eslint": "^8.41.0",
"@size-limit/preset-small-lib": "^8.2.6",
"@types/glob": "^8.1.0",
"@types/node": "^18.16.19",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "5.0.0-alpha.2",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"lint-staged": "^13.2.3",
"markdown-link-check": "^3.11.2",
"prettier": "^2.8.8",
"rimraf": "^3.0.2",
"size-limit": "^8.2.4",
"prettier": "^3.0.0",
"rimraf": "^5.0.1",
"size-limit": "^8.2.6",
"tiny-glob": "^0.2.9",
"tsx": "^3.12.7",
"typescript": "^5.0.4"
"typescript": "^5.1.6"
},
"peerDependencies": {
"typescript": ">=3.5.1"
Expand All @@ -169,8 +169,5 @@
"type": "github",
"url": "https://github.com/sponsors/ivanhofer"
},
"volta": {
"node": "16.18.1",
"npm": "8.5.1"
}
"packageManager": "pnpm@8.6.7"
}
45 changes: 31 additions & 14 deletions packages/adapter-angular/esbuild.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { build } from 'esbuild'
/* eslint-disable no-console */
import { context } from 'esbuild'
import { dirname, resolve } from 'path'
import { fileURLToPath } from 'url'

Expand All @@ -12,18 +13,34 @@ const getPath = (file: string) => resolve(__dirname, file)

const formats = ['esm', 'cjs'] as const

formats.forEach((format) =>
[false, true].forEach((minify) =>
build({
entryPoints: ['./src/index.mts'],
bundle: true,
outfile: getPath(`../../angular/index${minify ? '.min' : ''}.${format === 'esm' ? 'm' : 'c'}js`),
platform: 'browser',
format,
sourcemap: watch,
minify,
watch,
tsconfig: './tsconfig.json',
}).catch(() => process.exit(1)),
const contexts = await Promise.all(
formats.flatMap((format) =>
[false, true].map((minify) =>
context({
entryPoints: ['./src/index.mts'],
bundle: true,
outfile: getPath(`../../angular/index${minify ? '.min' : ''}.${format === 'esm' ? 'm' : 'c'}js`),
platform: 'browser',
format,
sourcemap: watch,
minify,
tsconfig: './tsconfig.json',
}),
),
),
)

for (const ctx of contexts) {
if (watch) {
await ctx.watch()
console.info('👀 watching for changes...')
process.on('exit', async () => {
console.info('🙈 process killed')
await ctx.dispose()
})
} else {
await ctx.rebuild()
console.info('✅ build complete')
await ctx.dispose()
}
}
2 changes: 1 addition & 1 deletion packages/adapter-angular/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@angular-devkit/build-angular": "~15.0.1",
"@angular/cli": "~15.0.1",
"@angular/compiler-cli": "~15.0.1",
"@types/node": "^16.18.3",
"@types/node": "^18.15.11",
"npm-run-all": "^4.1.5",
"typescript": "~4.8.4"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"test": "tsc --noEmit"
},
"devDependencies": {
"esbuild": "^0.15.18",
"esbuild": "^0.18.11",
"tsx": "^3.12.7",
"typescript": "^5.0.4"
"typescript": "^5.1.6"
},
"type": "module"
}
5 changes: 4 additions & 1 deletion packages/adapter-angular/src/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export class I18nServiceRoot<
#locale: L = null as unknown as L
#LL: TF = wrapProxy(getFallbackProxy<TF>())

constructor(private translations: Record<L, T>, private formatters: Record<L, F>) {}
constructor(
private translations: Record<L, T>,
private formatters: Record<L, F>,
) {}

get locale(): L {
return this.#locale
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-node/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"devDependencies": {
"@types/express": "^4.17.17",
"@types/node": "^16.18.12",
"@types/node": "^18.15.11",
"nodemon": "^2.0.20",
"npm-run-all": "^4.1.5",
"ts-node": "^10.9.1",
Expand Down
Loading

0 comments on commit d26d6c2

Please sign in to comment.