Skip to content

Commit

Permalink
Fix config file types
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Nov 3, 2021
1 parent 76e6d00 commit 7ea7bd2
Show file tree
Hide file tree
Showing 22 changed files with 21 additions and 21 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ module.exports = {
{
files: [
'packages/create-docusaurus/templates/**/*.js',
'packages/create-docusaurus/templates/**/*.cjs',
'packages/create-docusaurus/templates/**/*.ts',
'packages/create-docusaurus/templates/**/*.tsx',
],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions jest.config.js → jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

const path = require('path');

const ignorePatterns = [
'/node_modules/',
'__fixtures__',
Expand All @@ -21,7 +19,7 @@ const ignorePatterns = [
];

module.exports = {
rootDir: path.resolve(__dirname),
rootDir: __dirname,
verbose: true,
testURL: 'http://localhost/',
testEnvironment: 'node',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "root",
"private": true,
"type": "module",
"workspaces": [
"packages/*",
"website",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const config = {
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
sidebarPath: './sidebars.js',
// Please change this to your repo.
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
},
Expand All @@ -33,7 +33,7 @@ const config = {
'https://github.com/facebook/docusaurus/edit/main/website/blog/',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
customCss: './src/css/custom.css',
},
}),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

const OFF = 0;
const WARNING = 1;
const ERROR = 2;

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const config = {
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
sidebarPath: './sidebars.js',
// Please change this to your repo.
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
},
Expand Down Expand Up @@ -149,4 +149,4 @@ const config = {
}),
};

module.exports = config;
export default config;
2 changes: 1 addition & 1 deletion packages/create-docusaurus/templates/facebook/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Create as many sidebars as you want.
*/

module.exports = {
export default {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],

Expand Down
2 changes: 1 addition & 1 deletion packages/create-docusaurus/templates/shared/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ const sidebars = {
*/
};

module.exports = sidebars;
export default sidebars;
2 changes: 2 additions & 0 deletions packages/create-docusaurus/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "ES2019",
"module": "ESNext",
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
"rootDir": "src",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

export default {
module.exports = {
env: {
// USED FOR NODE/RUNTIME
// maybe we should differenciate both cases because
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/

const {extractThemeCodeMessages} = require('./update-code-translations');
const path = require('path');
const fs = require('fs-extra');
const {mapValues, pickBy} = require('lodash');
import {extractThemeCodeMessages} from './update-code-translations';
import fs from 'fs-extra';
import {mapValues, pickBy} from 'lodash';

// Seems the 5s default timeout fails sometimes
jest.setTimeout(15000);
Expand All @@ -18,7 +17,7 @@ describe('update-code-translations', () => {
const baseMessages = pickBy(
JSON.parse(
await fs.readFile(
path.join(__dirname, 'codeTranslations', 'base.json'),
new URL('./codeTranslations/base.json', import.meta.url).pathname,
),
),
(_, key) => !key.endsWith('___DESCRIPTION'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import path from 'path';
import {ConfigAPI, TransformOptions} from '@babel/core';

function getTransformOptions(isServer: boolean): TransformOptions {
const path = require('path');

function getTransformOptions(isServer) {
const absoluteRuntimePath = path.dirname(
require.resolve(`@babel/runtime/package.json`),
);
Expand Down Expand Up @@ -68,9 +68,9 @@ function getTransformOptions(isServer: boolean): TransformOptions {
};
}

function babelPresets(api: ConfigAPI): TransformOptions {
function babelPresets(api) {
const callerName = api.caller((caller) => caller?.name);
return getTransformOptions(callerName === 'server');
}

export default babelPresets;
module.exports = babelPresets;
File renamed without changes.
File renamed without changes.

0 comments on commit 7ea7bd2

Please sign in to comment.