Skip to content

Commit

Permalink
add mjs to prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
moe-dev committed Dec 19, 2024
1 parent 5bae210 commit 9ffa305
Show file tree
Hide file tree
Showing 21 changed files with 69 additions and 73 deletions.
2 changes: 1 addition & 1 deletion examples/with-wallet-stamper/next.config.mjs
Original file line number Diff line number Diff line change
@@ -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;
},
};
Expand Down
4 changes: 2 additions & 2 deletions examples/with-wallet-stamper/src/env.mjs
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/api-key-stamper/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/cosmjs/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/crypto/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/eip-1193-provider/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/encoding/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/ethers/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/http/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/iframe-stamper/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/react-native-passkey-stamper/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/sdk-browser/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
70 changes: 35 additions & 35 deletions packages/sdk-react/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -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,
},
Expand All @@ -26,59 +26,59 @@ 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,
plugins: [postcssImport()],
}),
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,
Expand All @@ -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];
};
2 changes: 1 addition & 1 deletion packages/sdk-server/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/solana/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/telegram-cloud-storage-stamper/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
4 changes: 2 additions & 2 deletions packages/viem/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/wallet-stamper/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
2 changes: 1 addition & 1 deletion packages/webauthn-stamper/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import rollup from '../../rollup.config.base.mjs';
import rollup from "../../rollup.config.base.mjs";

export default (options) => rollup();
28 changes: 12 additions & 16 deletions rollup.config.base.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};

0 comments on commit 9ffa305

Please sign in to comment.