Skip to content

Commit 1cd081e

Browse files
committed
Removed redundant "resolveJsonModule" in tsconfig.test.json, as it's already in tsconfig.json which it extends, marked node module imports as explicit ("node:(...)"), added types to some scripts for IDE hints.
1 parent 234d699 commit 1cd081e

File tree

7 files changed

+28
-19
lines changed

7 files changed

+28
-19
lines changed

packages/autocomplete-client/rollup.config.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { resolve } from 'node:path'
12
import commonjs from '@rollup/plugin-commonjs'
23
import nodeResolve from '@rollup/plugin-node-resolve'
3-
import { resolve } from 'path'
44
import babel from 'rollup-plugin-babel'
55
import { terser } from 'rollup-plugin-terser'
66
import typescript from 'rollup-plugin-typescript2'
@@ -14,7 +14,8 @@ const env = process.env.NODE_ENV || 'development'
1414
const ROOT = resolve(__dirname, '.')
1515
const INPUT = 'src/index.ts'
1616

17-
const PLUGINS = [
17+
/** @type {import('rollup').Plugin[]} */
18+
const COMMON_PLUGINS = [
1819
typescript({
1920
useTsconfigDeclarationDir: true,
2021
tsconfigOverride: {
@@ -31,7 +32,9 @@ const PLUGINS = [
3132
},
3233
}),
3334
]
34-
module.exports = [
35+
36+
/** @type {import('rollup').RollupOptions[]} */
37+
const ROLLUP_OPTIONS = [
3538
// browser-friendly IIFE build
3639
{
3740
input: INPUT, // directory to transpilation of typescript
@@ -47,7 +50,7 @@ module.exports = [
4750
sourcemap: env === 'production', // create sourcemap for error reporting in production mode
4851
},
4952
plugins: [
50-
...PLUGINS,
53+
...COMMON_PLUGINS,
5154
nodeResolve({
5255
mainFields: ['jsnext', 'browser', 'main'],
5356
preferBuiltins: true,
@@ -84,7 +87,9 @@ module.exports = [
8487
],
8588
plugins: [
8689
env === 'production' ? terser() : {}, // will minify the file in production mode
87-
...PLUGINS,
90+
...COMMON_PLUGINS,
8891
],
8992
},
9093
]
94+
95+
module.exports = ROLLUP_OPTIONS

packages/autocomplete-client/scripts/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* This file only purpose is to execute any build related tasks
33
*/
44

5-
const { resolve, normalize } = require('path')
6-
const { readFileSync, writeFileSync } = require('fs')
5+
const { resolve, normalize } = require('node:path')
6+
const { readFileSync, writeFileSync } = require('node:fs')
77
const pkg = require('../package.json')
88

99
const ROOT = resolve(__dirname, '..')

packages/autocomplete-client/scripts/update_version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const pkg = require('../package.json')
2-
const fs = require('fs')
3-
const path = require('path')
2+
const fs = require('node:fs')
3+
const path = require('node:path')
44

55
const version = pkg.version
66
const fileContents = `export const PACKAGE_VERSION = '${version}'

packages/instant-meilisearch/rollup.config.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { resolve } from 'node:path'
12
import commonjs from '@rollup/plugin-commonjs'
23
import nodeResolve from '@rollup/plugin-node-resolve'
3-
import { resolve } from 'path'
44
import babel from 'rollup-plugin-babel'
55
import { terser } from 'rollup-plugin-terser'
66
import typescript from 'rollup-plugin-typescript2'
@@ -14,7 +14,8 @@ const env = process.env.NODE_ENV || 'development'
1414
const ROOT = resolve(__dirname, '.')
1515
const INPUT = 'src/index.ts'
1616

17-
const PLUGINS = [
17+
/** @type {import('rollup').Plugin[]} */
18+
const COMMON_PLUGINS = [
1819
typescript({
1920
useTsconfigDeclarationDir: true,
2021
tsconfigOverride: {
@@ -31,7 +32,9 @@ const PLUGINS = [
3132
},
3233
}),
3334
]
34-
module.exports = [
35+
36+
/** @type {import('rollup').RollupOptions[]} */
37+
const ROLLUP_OPTIONS = [
3538
// browser-friendly IIFE build
3639
{
3740
input: INPUT, // directory to transpilation of typescript
@@ -51,7 +54,7 @@ module.exports = [
5154
},
5255
},
5356
plugins: [
54-
...PLUGINS,
57+
...COMMON_PLUGINS,
5558
nodeResolve({
5659
mainFields: ['jsnext', 'browser', 'main'],
5760
preferBuiltins: true,
@@ -89,7 +92,9 @@ module.exports = [
8992
],
9093
plugins: [
9194
env === 'production' ? terser() : {}, // will minify the file in production mode
92-
...PLUGINS,
95+
...COMMON_PLUGINS,
9396
],
9497
},
9598
]
99+
100+
module.exports = ROLLUP_OPTIONS

packages/instant-meilisearch/scripts/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* This file only purpose is to execute any build related tasks
33
*/
44

5-
const { resolve, normalize } = require('path')
6-
const { readFileSync, writeFileSync } = require('fs')
5+
const { resolve, normalize } = require('node:path')
6+
const { readFileSync, writeFileSync } = require('node:fs')
77
const pkg = require('../package.json')
88

99
const ROOT = resolve(__dirname, '..')

packages/instant-meilisearch/scripts/update_version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const pkg = require('../package.json')
2-
const fs = require('fs')
3-
const path = require('path')
2+
const fs = require('node:fs')
3+
const path = require('node:path')
44

55
const version = pkg.version
66
const fileContents = `export const PACKAGE_VERSION = '${version}'

packages/instant-meilisearch/tsconfig.test.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"suppressImplicitAnyIndexErrors": true,
5-
"resolveJsonModule": true
65
},
76
"include": [
87
"./**/*"

0 commit comments

Comments
 (0)