From 9ffa3051f8ac38dedb0f0097c2aaee48d1304c02 Mon Sep 17 00:00:00 2001 From: Mohammad Cheikh Date: Thu, 19 Dec 2024 12:47:50 -0500 Subject: [PATCH] add mjs to prettier config --- examples/with-wallet-stamper/next.config.mjs | 2 +- examples/with-wallet-stamper/src/env.mjs | 4 +- package.json | 4 +- packages/api-key-stamper/rollup.config.mjs | 2 +- packages/cosmjs/rollup.config.mjs | 2 +- packages/crypto/rollup.config.mjs | 2 +- packages/eip-1193-provider/rollup.config.mjs | 2 +- packages/encoding/rollup.config.mjs | 2 +- packages/ethers/rollup.config.mjs | 2 +- packages/http/rollup.config.mjs | 2 +- packages/iframe-stamper/rollup.config.mjs | 2 +- .../rollup.config.mjs | 2 +- packages/sdk-browser/rollup.config.mjs | 2 +- packages/sdk-react/rollup.config.mjs | 70 +++++++++---------- packages/sdk-server/rollup.config.mjs | 2 +- packages/solana/rollup.config.mjs | 2 +- .../rollup.config.mjs | 2 +- packages/viem/rollup.config.mjs | 4 +- packages/wallet-stamper/rollup.config.mjs | 2 +- packages/webauthn-stamper/rollup.config.mjs | 2 +- rollup.config.base.mjs | 28 ++++---- 21 files changed, 69 insertions(+), 73 deletions(-) diff --git a/examples/with-wallet-stamper/next.config.mjs b/examples/with-wallet-stamper/next.config.mjs index 00d9ff991..41dcadbd2 100644 --- a/examples/with-wallet-stamper/next.config.mjs +++ b/examples/with-wallet-stamper/next.config.mjs @@ -1,7 +1,7 @@ /** @type {import('next').NextConfig} */ const nextConfig = { webpack: (config) => { - config.externals.push('pino-pretty', 'lokijs', 'encoding'); + config.externals.push("pino-pretty", "lokijs", "encoding"); return config; }, }; diff --git a/examples/with-wallet-stamper/src/env.mjs b/examples/with-wallet-stamper/src/env.mjs index 8c1769fc4..025b92845 100644 --- a/examples/with-wallet-stamper/src/env.mjs +++ b/examples/with-wallet-stamper/src/env.mjs @@ -1,5 +1,5 @@ -import { createEnv } from '@t3-oss/env-nextjs'; -import { z } from 'zod'; +import { createEnv } from "@t3-oss/env-nextjs"; +import { z } from "zod"; export const env = createEnv({ client: { diff --git a/package.json b/package.json index 29e8f4a5b..db4dae5ce 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "csb:install": "corepack enable && pnpm install -r", "csb:build": "pnpm run build-all", "clean-all": "pnpm run -r clean", - "prettier-all:check": "prettier --check \"**/*.{css,html,js,json,md,ts,tsx,yaml,yml}\" --ignore-path ./.prettierignore", - "prettier-all:write": "prettier --write \"**/*.{css,html,js,json,md,ts,tsx,yaml,yml}\" --ignore-path ./.prettierignore", + "prettier-all:check": "prettier --check \"**/*.{css,html,js,json,md,ts,tsx,yaml,yml,mjs}\" --ignore-path ./.prettierignore", + "prettier-all:write": "prettier --write \"**/*.{css,html,js,json,md,ts,tsx,yaml,yml,mjs}\" --ignore-path ./.prettierignore", "test-all": "pnpm run -r --no-bail test", "typecheck-all": "pnpm run -r typecheck" }, diff --git a/packages/api-key-stamper/rollup.config.mjs b/packages/api-key-stamper/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/api-key-stamper/rollup.config.mjs +++ b/packages/api-key-stamper/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/cosmjs/rollup.config.mjs b/packages/cosmjs/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/cosmjs/rollup.config.mjs +++ b/packages/cosmjs/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/crypto/rollup.config.mjs b/packages/crypto/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/crypto/rollup.config.mjs +++ b/packages/crypto/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/eip-1193-provider/rollup.config.mjs b/packages/eip-1193-provider/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/eip-1193-provider/rollup.config.mjs +++ b/packages/eip-1193-provider/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/encoding/rollup.config.mjs b/packages/encoding/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/encoding/rollup.config.mjs +++ b/packages/encoding/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/ethers/rollup.config.mjs b/packages/ethers/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/ethers/rollup.config.mjs +++ b/packages/ethers/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/http/rollup.config.mjs b/packages/http/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/http/rollup.config.mjs +++ b/packages/http/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/iframe-stamper/rollup.config.mjs b/packages/iframe-stamper/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/iframe-stamper/rollup.config.mjs +++ b/packages/iframe-stamper/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/react-native-passkey-stamper/rollup.config.mjs b/packages/react-native-passkey-stamper/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/react-native-passkey-stamper/rollup.config.mjs +++ b/packages/react-native-passkey-stamper/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/sdk-browser/rollup.config.mjs b/packages/sdk-browser/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/sdk-browser/rollup.config.mjs +++ b/packages/sdk-browser/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/sdk-react/rollup.config.mjs b/packages/sdk-react/rollup.config.mjs index 8edbd6153..bc24ad82d 100644 --- a/packages/sdk-react/rollup.config.mjs +++ b/packages/sdk-react/rollup.config.mjs @@ -1,23 +1,23 @@ -import typescript from '@rollup/plugin-typescript'; -import nodeExternals from 'rollup-plugin-node-externals'; -import path from 'node:path'; -import postcss from 'rollup-plugin-postcss'; -import preserveDirectives from 'rollup-preserve-directives'; -import url from '@rollup/plugin-url'; -import alias from '@rollup/plugin-alias'; -import copy from 'rollup-plugin-copy'; -import postcssImport from 'postcss-import'; +import typescript from "@rollup/plugin-typescript"; +import nodeExternals from "rollup-plugin-node-externals"; +import path from "node:path"; +import postcss from "rollup-plugin-postcss"; +import preserveDirectives from "rollup-preserve-directives"; +import url from "@rollup/plugin-url"; +import alias from "@rollup/plugin-alias"; +import copy from "rollup-plugin-copy"; +import postcssImport from "postcss-import"; const getFormatConfig = (format) => { - const pkgPath = path.join(process.cwd(), 'package.json'); + const pkgPath = path.join(process.cwd(), "package.json"); const __dirname = path.dirname(new URL(import.meta.url).pathname); return { - input: 'src/index.ts', + input: "src/index.ts", output: { format, - dir: 'dist', - entryFileNames: `[name].${format === 'esm' ? 'mjs' : 'js'}`, + dir: "dist", + entryFileNames: `[name].${format === "esm" ? "mjs" : "js"}`, preserveModules: true, sourcemap: true, }, @@ -26,16 +26,16 @@ const getFormatConfig = (format) => { // required for svg assets entries: [ { - find: 'assets', - replacement: path.resolve(__dirname, 'src/assets'), + find: "assets", + replacement: path.resolve(__dirname, "src/assets"), }, ], }), postcss({ // required for css module bundling modules: true, - extensions: ['.css', '.scss'], - use: ['sass'], + extensions: [".css", ".scss"], + use: ["sass"], extract: `styles.${format}.css`, minimize: true, sourceMap: true, @@ -43,42 +43,42 @@ const getFormatConfig = (format) => { }), typescript({ outputToFilesystem: true, - tsconfig: './tsconfig.json', + tsconfig: "./tsconfig.json", compilerOptions: { - outDir: 'dist', + outDir: "dist", composite: false, - declaration: format === 'esm', - declarationMap: format === 'esm', + declaration: format === "esm", + declarationMap: format === "esm", sourceMap: true, }, }), preserveDirectives(), // required for use server and use client directive preservation nodeExternals({ packagePath: pkgPath, - builtinsPrefix: 'ignore', + builtinsPrefix: "ignore", }), url({ // required for fonts and assets include: [ - '**/*.svg', - '**/*.png', - '**/*.jpg', - '**/*.gif', - '**/*.woff', - '**/*.woff2', - '**/*.ttf', - '**/*.eot', + "**/*.svg", + "**/*.png", + "**/*.jpg", + "**/*.gif", + "**/*.woff", + "**/*.woff2", + "**/*.ttf", + "**/*.eot", ], limit: 8192, emitFiles: true, - fileName: 'assets/fonts/[name].[hash][extname]', + fileName: "assets/fonts/[name].[hash][extname]", }), copy({ // required for fonts targets: [ { - src: path.resolve(__dirname, 'src/assets/fonts/**/*'), - dest: path.resolve(__dirname, 'dist/assets/fonts'), + src: path.resolve(__dirname, "src/assets/fonts/**/*"), + dest: path.resolve(__dirname, "dist/assets/fonts"), }, ], verbose: false, @@ -88,8 +88,8 @@ const getFormatConfig = (format) => { }; export default () => { - const esm = getFormatConfig('esm'); - const cjs = getFormatConfig('cjs'); + const esm = getFormatConfig("esm"); + const cjs = getFormatConfig("cjs"); return [esm, cjs]; }; diff --git a/packages/sdk-server/rollup.config.mjs b/packages/sdk-server/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/sdk-server/rollup.config.mjs +++ b/packages/sdk-server/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/solana/rollup.config.mjs b/packages/solana/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/solana/rollup.config.mjs +++ b/packages/solana/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/telegram-cloud-storage-stamper/rollup.config.mjs b/packages/telegram-cloud-storage-stamper/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/telegram-cloud-storage-stamper/rollup.config.mjs +++ b/packages/telegram-cloud-storage-stamper/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/viem/rollup.config.mjs b/packages/viem/rollup.config.mjs index 603a38b8a..23fa423e6 100644 --- a/packages/viem/rollup.config.mjs +++ b/packages/viem/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; -export default (options) => rollup(); \ No newline at end of file +export default (options) => rollup(); diff --git a/packages/wallet-stamper/rollup.config.mjs b/packages/wallet-stamper/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/wallet-stamper/rollup.config.mjs +++ b/packages/wallet-stamper/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/packages/webauthn-stamper/rollup.config.mjs b/packages/webauthn-stamper/rollup.config.mjs index 8e9f6643c..23fa423e6 100644 --- a/packages/webauthn-stamper/rollup.config.mjs +++ b/packages/webauthn-stamper/rollup.config.mjs @@ -1,3 +1,3 @@ -import rollup from '../../rollup.config.base.mjs'; +import rollup from "../../rollup.config.base.mjs"; export default (options) => rollup(); diff --git a/rollup.config.base.mjs b/rollup.config.base.mjs index e558e2ace..b660f8ad6 100644 --- a/rollup.config.base.mjs +++ b/rollup.config.base.mjs @@ -7,41 +7,37 @@ const getFormatConfig = (format) => { /** @type {import('rollup').RollupOptions} */ return { - input: 'src/index.ts', + input: "src/index.ts", output: { format, dir: "dist", - entryFileNames: `[name].${format === 'esm' ? 'mjs' : 'js'}`, + entryFileNames: `[name].${format === "esm" ? "mjs" : "js"}`, preserveModules: true, sourcemap: true, }, plugins: [ typescript({ - tsconfig: './tsconfig.json', + tsconfig: "./tsconfig.json", outputToFilesystem: false, compilerOptions: { outDir: "dist", composite: false, - declaration: format === 'esm', + declaration: format === "esm", declarationMap: format === "esm", sourceMap: true, }, }), nodeExternals({ packagePath: pkgPath, - builtinsPrefix: 'ignore', + builtinsPrefix: "ignore", }), ], - } -} + }; +}; +export default () => { + const esm = getFormatConfig("esm"); + const cjs = getFormatConfig("cjs"); -export default () => { - const esm = getFormatConfig('esm'); - const cjs = getFormatConfig('cjs'); - - return [ - esm, - cjs - ] -} + return [esm, cjs]; +};