Skip to content

Commit

Permalink
chore: integrate maskbook (#31)
Browse files Browse the repository at this point in the history
* chore: migrate bg worker

* fix: global type

* chore: migrate main, plugin-host, setup

* chore: code style

* chore: adjust register plugin

* chore: code style

* fix: type

* fix: ci

* fix: cspell

* chore: register

* chore: ci checkout submodules

* fix: ci

* fix: type

* fix: type

* fix: es type

* refactor: configs

* fix: nextjs build

* chore: install webpack

* fix: build errors

* chore: upgrade @standard-crypto/farcaster-js

* chore: clean up postinstall

* chore: next.config.js

	#

* chore: tailwind.config.js

* fix: tailwind

* fix: prettier

* refactor: cspell

* chore: lock file

* fix: prettier

* fix: polyfills

* fix: cspell

* fix: eslint

* fix: prettier

* fix: build errors

- remove next-auth
- esm

* chore: mui

* fix: type errors

* fix: cspell

* chore: cleanup

* fix: pkg lost

* chore: build on vercel

* chore: install pnpm

* chore: prettier

* fix: gitignore

* fix: vercel build

* fix: pkg path

* chore: update script

* fix: prettier
  • Loading branch information
guanbinrui authored Nov 14, 2023
1 parent 6ec4c0f commit 9bad25c
Show file tree
Hide file tree
Showing 120 changed files with 5,199 additions and 1,195 deletions.
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
next.config.js
postcss.config.js
tailwind.config.js
postcss.config.cjs
tailwind.config.cjs

src/maskbook
public/js
35 changes: 21 additions & 14 deletions .github/workflows/cspell.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
name: CSpell Check

on:
push:
push:

jobs:
spellcheck:
runs-on: ubuntu-latest
spellcheck:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'true'

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.9.0'
- name: Authenticate NPM
uses: DimensionDev/github-token-action@latest
with:
registry: true

- name: Install dependencies
run: npm ci
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.9.0'

- name: Run CSpell
run: npx cspell "**/*"
- name: Install dependencies
run: npm ci

- name: Run CSpell
run: npx cspell "**/*"
35 changes: 21 additions & 14 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
name: ESLint Check

on:
push:
push:

jobs:
eslint:
runs-on: ubuntu-latest
eslint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'true'

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.9.0'
- name: Authenticate NPM
uses: DimensionDev/github-token-action@latest
with:
registry: true

- name: Install dependencies
run: npm ci
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.9.0'

- name: Run ESLint
run: npx eslint . --ext .js,.jsx,.ts,.tsx
- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npx eslint . --ext .js,.jsx,.ts,.tsx
7 changes: 7 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'true'

- name: Authenticate NPM
uses: DimensionDev/github-token-action@latest
with:
registry: true

- name: Set up Node.js
uses: actions/setup-node@v2
Expand Down
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@dimensiondev:registry=https://npm.pkg.github.com/
resolution-mode=time-based
ignore-scripts=true
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ build/

# Ignore all files of a specific type in a specific directory
public/*.html
public/js/polyfills/*.js

# Ignore specific files in a directory
src/specialFile.js
Expand Down
35 changes: 31 additions & 4 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,69 @@
"language": "en",
"words": [
"arbitrum",
"artblocks",
"cacheable",
"canonicalize",
"deeplink",
"enhanceable",
"farcaster",
"immer",
"merkle",
"nextid",
"pageable",
"recaster",
"recasters",
"urlcat",
"upvotes",
"solana",
"unfollow",
"unmirror",
"unvote",
"upvotes",
"urlcat",
"vcent",
"viem",
"wagmi",
"warpcast",
"zustand"
],
"ignoreWords": [
"cyberconnect",
"dimensiondev",
"flac",
"headlessui",
"heroicons",
"holoflows",
"imgur",
"ittr",
"maskbook",
"maskbox",
"masknet",
"nextauth",
"nocheck",
"profilecard",
"quicktime",
"rainbowkit",
"redpacket",
"scenechange",
"servie",
"sinonjs",
"tailwindcss",
"tailwindui",
"thefireflyapp",
"typecheck"
"transak",
"typecheck",
"IDBP"
],
"flagWords": [],
"ignorePaths": ["node_modules/**", "dist/**", "build/**", ".next/**", "public/svg/**"],
"ignorePaths": [
"scripts/**",
"package.json",
"node_modules/**",
"dist/**",
"build/**",
".next/**",
"public/svg/**",
"public/js/**",
"src/maskbook"
],
"overrides": []
}
3 changes: 3 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ declare namespace NodeJS {

FARCASTER_SIGNER_FID: string;
FARCASTER_SIGNER_MNEMONIC: string;

WEB3_CONSTANTS_RPC: string;
MASK_SENTRY_DSN: string;
}
}
5 changes: 5 additions & 0 deletions globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="./src/maskbook/packages/encryption/src/internal.d.ts" />
/// <reference types="./src/maskbook/packages/polyfills/types/__all.d.ts" />
/// <reference types="./src/maskbook/packages/polyfills/types/dom.d.ts" />
/// <reference types="./src/maskbook/packages/polyfills/types/firefox.d.ts" />
/// <reference types="./src/maskbook/packages/web3-telemetry/src/env.d.ts" />
23 changes: 0 additions & 23 deletions next-auth.d.ts

This file was deleted.

93 changes: 78 additions & 15 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
/* cspell:disable */

import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
import { createRequire } from 'module';
import CopyPlugin from 'copy-webpack-plugin';

const require = createRequire(import.meta.url);
const __dirname = fileURLToPath(dirname(import.meta.url));
const outputPath = fileURLToPath(new URL('./public', import.meta.url));
const polyfillsFolderPath = join(outputPath, './js/polyfills');

/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
dangerouslyAllowSVG: true,
domains: ['images.unsplash.com', 'tailwindui.com', 'pbs.twimg.com'],
export default {
experimental: {
esmExternals: true,
},
webpack: (config, context) => {
if (config.plugins) {
config.plugins.push(
new context.webpack.IgnorePlugin({
resourceRegExp: /^(lokijs|pino-pretty|encoding)$/,
}),
);
}
return config;
images: {
dangerouslyAllowSVG: false,
remotePatterns: [
{
hostname: 'images.unsplash.com',
},
{
hostname: 'tailwindui.com',
},
{
hostname: 'pbs.twimg.com',
},
],
},
async headers() {
return [
Expand All @@ -29,6 +42,56 @@ const nextConfig = {
},
];
},
};
webpack: (config, context) => {
if (!config.plugins) config.plugins = [];
if (!config.module.rules) config.module.rules = [];

module.exports = nextConfig;
config.plugins.push(
...[
new context.webpack.IgnorePlugin({
resourceRegExp: /^(lokijs|pino-pretty|encoding)$/,
}),
new context.webpack.DefinePlugin({
'process.env.WEB3_CONSTANTS_RPC': process.env.WEB3_CONSTANTS_RPC ?? '{}',
'process.env.MASK_SENTRY_DSN': process.env.MASK_SENTRY_DSN ?? '{}',
'process.env.NODE_DEBUG': 'undefined',
'process.version': JSON.stringify('0.1.0'),
}),
new CopyPlugin({
patterns: [
{
context: join(__dirname, './src/maskbook/packages/polyfills/dist/'),
from: '*.js',
to: polyfillsFolderPath,
},
],
}),
],
);

config.experiments = {
...config.experiments,
backCompat: false,
asyncWebAssembly: true,
};
config.resolve.extensionAlias = {
...config.resolve.extensionAlias,
'.js': ['.js', '.ts', '.tsx'],
'.mjs': ['.mts', '.mjs'],
};
config.resolve.extensions = ['.js', '.ts', '.tsx'];
config.resolve.conditionNames = ['mask-src', '...'];
config.resolve.fallback = {
...config.resolve.fallback,
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer'),
zlib: require.resolve('zlib-browserify'),
'text-encoding': require.resolve('@sinonjs/text-encoding'),
};

return config;
},
};
Loading

0 comments on commit 9bad25c

Please sign in to comment.