Skip to content

Commit

Permalink
chore: Use Babel for transpilation and fix tsc type-checking
Browse files Browse the repository at this point in the history
  • Loading branch information
cmfcmf committed Nov 10, 2024
1 parent 4f28632 commit 33bb759
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 1 addition & 5 deletions packages/docusaurus-search-local/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
const assert = require("assert");

module.exports = (api) => {
const isTest = api.env("test");
assert(isTest, "babel.config.js is only used for testing with jest!");
api.cache.never();

return {
// Jest
presets: [
["@babel/preset-env", { targets: { node: "current" } }],
"@babel/preset-typescript",
Expand Down
5 changes: 3 additions & 2 deletions packages/docusaurus-search-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.21.0",
"@docusaurus/core": "catalog:",
"@docusaurus/module-type-aliases": "catalog:",
"@docusaurus/plugin-content-blog": "catalog:",
"@docusaurus/plugin-content-docs": "catalog:",
Expand All @@ -75,8 +76,8 @@
"typescript": "^5.0.0"
},
"scripts": {
"build:client": "tsc --project tsconfig.client.json && copyfiles --up 1 src/client/**/*.css lib",
"build:server": "tsc --project tsconfig.server.json && copyfiles --up 1 src/lunr.js src/server/lunr-generator.js lib",
"build:client": "tsc --project tsconfig.client.json && copyfiles --up 1 src/lunr.js src/client/**/*.css lib",
"build:server": "tsc --project tsconfig.server.json && babel src/server --out-dir lib/server --extensions .ts,.js,.tsx,.jsx,.cjs,.mjs && copyfiles --up 1 src/lunr.js src/server/lunr-generator.js lib",
"dev": "concurrently --names client,server --prefix-colors blue,green pnpm:dev:client pnpm:dev:server",
"dev:client": "concurrently --names tsc,cp pnpm:dev:client:tsc pnpm:dev:client:cp",
"dev:client:tsc": "tsc --project tsconfig.client.json --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-search-local/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ESNext",
"module":"ESNext",
"module": "ESNext",
"lib": ["ESNext", "DOM"],

// Declarations break Docusaurus' 'write-translations' command (#163, #129, #145)
Expand Down
5 changes: 4 additions & 1 deletion packages/docusaurus-search-local/tsconfig.server.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "ESNext",
"lib": ["ESNext", "DOM"]
"lib": ["ESNext", "DOM"],
"module": "Preserve",
"moduleResolution": "Bundler",
"noEmit": true
},
"include": ["src/server/**/*"]
}

0 comments on commit 33bb759

Please sign in to comment.