From 88c8a408b5cc54e40e0fda284d637efa1e6028bb Mon Sep 17 00:00:00 2001 From: alt0 Date: Tue, 18 Oct 2022 01:31:40 +0800 Subject: [PATCH] feat: module resolve feat: module resolve fix: logger repository fix: module resolve chore: add workflow for module resolve chore: update workflow env chore: update workflow install chore: update workflow env for npm token chore: test docker chore: update workflow env --- .../workflows/build-with-module-resolve.yml | 122 ++++++++++++ .github/workflows/build.yml | 6 +- .gitignore | 2 + .npmrc | 3 + .pnpmfile.cjs | 28 +++ README.md | 21 ++ package.json | 2 +- packages/app/next.config.js | 6 +- packages/app/package.json | 2 + packages/app/src/pages/_app.tsx | 14 +- packages/logger/next-env.d.ts | 5 + packages/logger/package.json | 32 +++ packages/logger/pages/index.tsx | 10 + packages/logger/src/Logger.tsx | 9 + packages/logger/src/index.ts | 1 + packages/logger/tsconfig.json | 25 +++ pnpm-lock.yaml | 185 ++++++++++++------ scripts/module-resolve/ci.js | 13 ++ scripts/module-resolve/module-resolve.tmpl.js | 11 ++ 19 files changed, 426 insertions(+), 71 deletions(-) create mode 100644 .github/workflows/build-with-module-resolve.yml create mode 100644 .npmrc create mode 100644 .pnpmfile.cjs create mode 100644 packages/logger/next-env.d.ts create mode 100644 packages/logger/package.json create mode 100644 packages/logger/pages/index.tsx create mode 100644 packages/logger/src/Logger.tsx create mode 100644 packages/logger/src/index.ts create mode 100644 packages/logger/tsconfig.json create mode 100644 scripts/module-resolve/ci.js create mode 100644 scripts/module-resolve/module-resolve.tmpl.js diff --git a/.github/workflows/build-with-module-resolve.yml b/.github/workflows/build-with-module-resolve.yml new file mode 100644 index 0000000000..6b278ed96d --- /dev/null +++ b/.github/workflows/build-with-module-resolve.yml @@ -0,0 +1,122 @@ +name: Build With Module Resolve + +on: + push: + branches: [feat/track] + pull_request: + branches: [master] + +# Cancels all previous workflow runs for pull requests that have not completed. +# See https://docs.github.com/en/actions/using-jobs/using-concurrency +concurrency: + # The concurrency group contains the workflow name and the branch name for + # pull requests or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +jobs: + build: + name: Lint nad Build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: pnpm/action-setup@v2 + with: + version: 'latest' + + - name: Use Node.js + uses: actions/setup-node@v2 + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_AUTH_TOKEN }} + with: + node-version: 18.x + cache: 'pnpm' + + - run: node scripts/module-resolve/ci.js + + - name: Restore cache + uses: actions/cache@v3 + with: + path: | + .next/cache + # Generate a new cache whenever packages or source files change. + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} + # If source files changed but packages didn't, rebuild from a prior cache. + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}- + + - name: Install dependencies + run: pnpm install --no-frozen-lockfile + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_AUTH_TOKEN }} + + - name: Lint + run: | + pnpm lint --max-warnings=0 + + # - name: Test + # run: pnpm test + + - name: Build + run: pnpm build + + - name: Export + run: pnpm export + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + path: ./packages/app/out + + push_to_registry: + # See https://docs.github.com/en/actions/publishing-packages/publishing-docker-images + name: Push Docker image to Docker Hub + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + needs: build + + permissions: + contents: read + packages: write + + env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + IMAGE_TAG: canary-pro-${{ github.sha }} + IMAGE_TAG_LATEST: nightly-pro-latest + + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: artifact + path: packages/app/out/ + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + ${{ env.IMAGE_TAG }} + ${{ env.IMAGE_TAG_LATEST }} + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: true + file: ./.github/deployment/Dockerfile + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af528d430b..d12324895e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build on: push: - branches: [master] + branches: [feat/track] pull_request: branches: [master] @@ -27,6 +27,8 @@ jobs: - name: Use Node.js uses: actions/setup-node@v2 + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_AUTH_TOKEN }} with: node-version: 18.x cache: 'pnpm' @@ -44,6 +46,8 @@ jobs: - name: Install dependencies run: pnpm install + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_AUTH_TOKEN }} - name: Lint run: | diff --git a/.gitignore b/.gitignore index 5fa933f85e..924094754b 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,5 @@ Thumbs.db .next out/ + +module-resolve.js diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000000..22f155c102 --- /dev/null +++ b/.npmrc @@ -0,0 +1,3 @@ +@toeverything:registry=https://npm.pkg.github.com +//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} +always-auth=true \ No newline at end of file diff --git a/.pnpmfile.cjs b/.pnpmfile.cjs new file mode 100644 index 0000000000..4873d9492c --- /dev/null +++ b/.pnpmfile.cjs @@ -0,0 +1,28 @@ +const fs = require('fs'); + +function getCustomize() { + const customed = fs.existsSync('./module-resolve.js'); + if (!customed) { + return null; + } + const script = require('./module-resolve.js'); + return script && script.resolve; +} + +const customize = getCustomize(); + +function readPackage(pkg) { + if (!customize) { + return pkg; + } + + const customizedPkg = customize(pkg); + + return customizedPkg; +} + +module.exports = { + hooks: { + readPackage, + }, +}; diff --git a/README.md b/README.md index 03842fac0b..488b260089 100644 --- a/README.md +++ b/README.md @@ -1 +1,22 @@ # Pathfinder + +## Build + +### Replace Modules +You can create `module-resolve.js` in project root dir to replace some package to better implements. Example: + +``` +function resolve(pkg) { + if (pkg.dependencies && pkg.dependencies['@toeverything/track']) { + pkg.dependencies['@toeverything/track'] = '^0.0.1'; + } + + return pkg; +} + +module.exports = { + resolve, +}; +``` + +***After modify/create this file, please delete the `node_modules`, then run `pnpm install` again*** \ No newline at end of file diff --git a/package.json b/package.json index 8416d80fad..fcb59f2287 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "dev": "pnpm --filter @pathfinder/app dev", - "build": "pnpm --filter @pathfinder/app build", + "build": "pnpm -r build", "export": "pnpm --filter @pathfinder/app export", "start": "pnpm --filter @pathfinder/app start", "lint": "pnpm --filter @pathfinder/app lint" diff --git a/packages/app/next.config.js b/packages/app/next.config.js index 85bb0ff287..c0fcfd65d9 100644 --- a/packages/app/next.config.js +++ b/packages/app/next.config.js @@ -1,8 +1,10 @@ +const withTM = require('next-transpile-modules')(['@toeverything/pathfinder-logger']); + /** @type {import('next').NextConfig} */ -const nextConfig = { +const nextConfig = withTM({ productionBrowserSourceMaps: true, reactStrictMode: false, swcMinify: false, -}; +}); module.exports = nextConfig; diff --git a/packages/app/package.json b/packages/app/package.json index cd200c5982..94167bc213 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -20,9 +20,11 @@ "@mui/base": "^5.0.0-alpha.87", "@mui/material": "^5.8.6", "@mui/icons-material": "^5.10.9", + "@toeverything/pathfinder-logger": "workspace:@pathfinder/logger@*", "css-spring": "^4.1.0", "lit": "^2.3.1", "next": "12.3.1", + "next-transpile-modules": "^9.1.0", "prettier": "^2.7.1", "quill": "^1.3.7", "quill-cursors": "^4.0.0", diff --git a/packages/app/src/pages/_app.tsx b/packages/app/src/pages/_app.tsx index b56c143a59..3aaf96efb7 100644 --- a/packages/app/src/pages/_app.tsx +++ b/packages/app/src/pages/_app.tsx @@ -4,6 +4,7 @@ import '../../public/globals.css'; import '../../public/variable.css'; import './temporary.css'; import { EditorProvider } from '@/components/editor-provider'; +import { Logger } from '@toeverything/pathfinder-logger'; const ThemeProvider = dynamic(() => import('@/styles/themeProvider'), { ssr: false, @@ -11,11 +12,14 @@ const ThemeProvider = dynamic(() => import('@/styles/themeProvider'), { function MyApp({ Component, pageProps }: AppProps) { return ( - - - - - + <> + + + + + + + ); } diff --git a/packages/logger/next-env.d.ts b/packages/logger/next-env.d.ts new file mode 100644 index 0000000000..4f11a03dc6 --- /dev/null +++ b/packages/logger/next-env.d.ts @@ -0,0 +1,5 @@ +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/packages/logger/package.json b/packages/logger/package.json new file mode 100644 index 0000000000..2e1cb19a60 --- /dev/null +++ b/packages/logger/package.json @@ -0,0 +1,32 @@ +{ + "name": "@pathfinder/logger", + "version": "0.0.1", + "description": "", + "type": "module", + "main": "dist/src/index.js", + "types": "dist/src/index.d.ts", + "exports": { + "./src/*": "./dist/src/*.js", + ".": "./dist/src/index.js" + }, + "scripts": { + "dev": "next dev", + "build": "tsc --project ./tsconfig.json" + }, + "keywords": [], + "author": "", + "license": "ISC", + "repository": { + "type": "git", + "url": "git+https://github.com/toeverything/AFFINE-pathfinder.git" + }, + "dependencies": { + "next": "^12.3.1", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@types/react": "^18.0.21", + "typescript": "^4.8.4" + } +} diff --git a/packages/logger/pages/index.tsx b/packages/logger/pages/index.tsx new file mode 100644 index 0000000000..da378dfab3 --- /dev/null +++ b/packages/logger/pages/index.tsx @@ -0,0 +1,10 @@ +import { Logger } from '../src'; + +const Page = () => { + return ( +
+

Track Example

+ +
+ ); +}; diff --git a/packages/logger/src/Logger.tsx b/packages/logger/src/Logger.tsx new file mode 100644 index 0000000000..21db5d263c --- /dev/null +++ b/packages/logger/src/Logger.tsx @@ -0,0 +1,9 @@ +import { useEffect } from 'react'; + +export const Logger = () => { + useEffect(() => { + console.log('@pathfinder/logger: Render Track'); + }, []); + + return null; +}; diff --git a/packages/logger/src/index.ts b/packages/logger/src/index.ts new file mode 100644 index 0000000000..3e96d48eeb --- /dev/null +++ b/packages/logger/src/index.ts @@ -0,0 +1 @@ +export { Logger } from './Logger'; diff --git a/packages/logger/tsconfig.json b/packages/logger/tsconfig.json new file mode 100644 index 0000000000..063354ba92 --- /dev/null +++ b/packages/logger/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ESNext", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": false, + "esModuleInterop": true, + "module": "ESNext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "experimentalDecorators": true, + "declaration": true, + "baseUrl": ".", + "rootDir": ".", + "outDir": "./dist" + }, + "include": ["next-env.d.ts", "src/**/*.ts", "pages/**/*.tsx"], + "exclude": ["node_modules", "dist"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b40fe92f85..353742c2b4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,17 +4,22 @@ importers: .: specifiers: + '@toeverything/track': ^0.0.1 eslint: 8.22.0 eslint-config-next: 12.3.1 eslint-config-prettier: ^8.5.0 eslint-plugin-prettier: ^4.2.1 prettier: ^2.7.1 + typescript: 4.2.4 + dependencies: + '@toeverything/track': 0.0.1 devDependencies: eslint: 8.22.0 - eslint-config-next: 12.3.1_eslint@8.22.0 + eslint-config-next: 12.3.1_5qnjiidcar3zhltuqkapawl5tq eslint-config-prettier: 8.5.0_eslint@8.22.0 eslint-plugin-prettier: 4.2.1_i2cojdczqdiurzgttlwdgf764e prettier: 2.7.1 + typescript: 4.2.4 packages/app: specifiers: @@ -28,6 +33,7 @@ importers: '@mui/base': ^5.0.0-alpha.87 '@mui/icons-material': ^5.10.9 '@mui/material': ^5.8.6 + '@toeverything/pathfinder-logger': workspace:@pathfinder/logger@* '@types/node': 18.7.18 '@types/react': 18.0.20 '@types/react-dom': 18.0.6 @@ -38,6 +44,7 @@ importers: eslint-plugin-prettier: ^4.2.1 lit: ^2.3.1 next: 12.3.1 + next-transpile-modules: ^9.1.0 prettier: ^2.7.1 quill: ^1.3.7 quill-cursors: ^4.0.0 @@ -55,9 +62,11 @@ importers: '@mui/base': 5.0.0-alpha.101_7ey2zzynotv32rpkwno45fsx4e '@mui/icons-material': 5.10.9_5fncb4nagb4cvvcnwamw2rozfa '@mui/material': 5.10.9_af5ln35zuaotaffazii6n6bke4 + '@toeverything/pathfinder-logger': link:../logger css-spring: 4.1.0 lit: 2.4.0 next: 12.3.1_biqbaboplfbrettd7655fr4n2y + next-transpile-modules: 9.1.0 prettier: 2.7.1 quill: 1.3.7 quill-cursors: 4.0.0 @@ -73,6 +82,21 @@ importers: eslint-plugin-prettier: 4.2.1_i2cojdczqdiurzgttlwdgf764e typescript: 4.8.3 + packages/logger: + specifiers: + '@types/react': ^18.0.21 + next: ^12.3.1 + react: ^18.2.0 + react-dom: ^18.2.0 + typescript: ^4.8.4 + dependencies: + next: 12.3.1_biqbaboplfbrettd7655fr4n2y + react: 18.2.0 + react-dom: 18.2.0_react@18.2.0 + devDependencies: + '@types/react': 18.0.21 + typescript: 4.8.4 + packages: /@babel/code-frame/7.18.6: @@ -758,6 +782,14 @@ packages: '@types/scheduler': 0.16.2 csstype: 3.1.1 + /@types/react/18.0.21: + resolution: {integrity: sha512-7QUCOxvFgnD5Jk8ZKlUAhVcRj7GuJRjnjjiY/IUBWKgOlnvDvTMLD4RTF7NPyVmbRhNrbomZiOepg7M/2Kj1mA==} + dependencies: + '@types/prop-types': 15.7.5 + '@types/scheduler': 0.16.2 + csstype: 3.1.1 + dev: true + /@types/scheduler/0.16.2: resolution: {integrity: sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==} @@ -765,6 +797,26 @@ packages: resolution: {integrity: sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==} dev: false + /@typescript-eslint/parser/5.38.0_5qnjiidcar3zhltuqkapawl5tq: + resolution: {integrity: sha512-/F63giJGLDr0ms1Cr8utDAxP2SPiglaD6V+pCOcG35P2jCqdfR7uuEhz1GIC3oy4hkUF8xA1XSXmd9hOh/a5EA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/scope-manager': 5.38.0 + '@typescript-eslint/types': 5.38.0 + '@typescript-eslint/typescript-estree': 5.38.0_typescript@4.2.4 + debug: 4.3.4 + eslint: 8.22.0 + typescript: 4.2.4 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/parser/5.38.0_76twfck5d7crjqrmw4yltga7zm: resolution: {integrity: sha512-/F63giJGLDr0ms1Cr8utDAxP2SPiglaD6V+pCOcG35P2jCqdfR7uuEhz1GIC3oy4hkUF8xA1XSXmd9hOh/a5EA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -785,25 +837,6 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.38.0_eslint@8.22.0: - resolution: {integrity: sha512-/F63giJGLDr0ms1Cr8utDAxP2SPiglaD6V+pCOcG35P2jCqdfR7uuEhz1GIC3oy4hkUF8xA1XSXmd9hOh/a5EA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/scope-manager': 5.38.0 - '@typescript-eslint/types': 5.38.0 - '@typescript-eslint/typescript-estree': 5.38.0 - debug: 4.3.4 - eslint: 8.22.0 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/scope-manager/5.38.0: resolution: {integrity: sha512-ByhHIuNyKD9giwkkLqzezZ9y5bALW8VNY6xXcP+VxoH4JBDKjU5WNnsiD4HJdglHECdV+lyaxhvQjTUbRboiTA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -817,7 +850,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.38.0: + /@typescript-eslint/typescript-estree/5.38.0_typescript@4.2.4: resolution: {integrity: sha512-6P0RuphkR+UuV7Avv7MU3hFoWaGcrgOdi8eTe1NwhMp2/GjUJoODBTRWzlHpZh6lFOaPmSvgxGlROa0Sg5Zbyg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -832,7 +865,8 @@ packages: globby: 11.1.0 is-glob: 4.0.3 semver: 7.3.7 - tsutils: 3.21.0 + tsutils: 3.21.0_typescript@4.2.4 + typescript: 4.2.4 transitivePeerDependencies: - supports-color dev: true @@ -877,7 +911,6 @@ packages: /acorn/8.8.0: resolution: {integrity: sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==} engines: {node: '>=0.4.0'} - hasBin: true dev: true /ajv/6.12.6: @@ -1220,6 +1253,14 @@ packages: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} dev: true + /enhanced-resolve/5.10.0: + resolution: {integrity: sha512-T0yTFjdpldGY8PmuXXR0PyQ1ufZpEGiHVrp7zHKB7jdR4qlmZHhONVM5AQOAWXuF/w3dnHbEQVrNptJgt7F+cQ==} + engines: {node: '>=10.13.0'} + dependencies: + graceful-fs: 4.2.10 + tapable: 2.2.1 + dev: false + /err-code/3.0.1: resolution: {integrity: sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA==} dev: false @@ -1274,6 +1315,11 @@ packages: is-symbol: 1.0.4 dev: true + /escalade/3.1.1: + resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} + engines: {node: '>=6'} + dev: false + /escape-string-regexp/1.0.5: resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} engines: {node: '>=0.8.0'} @@ -1283,6 +1329,31 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} + /eslint-config-next/12.3.1_5qnjiidcar3zhltuqkapawl5tq: + resolution: {integrity: sha512-EN/xwKPU6jz1G0Qi6Bd/BqMnHLyRAL0VsaQaWA7F3KkjAgZHi4f1uL1JKGWNxdQpHTW/sdGONBd0bzxUka/DJg==} + peerDependencies: + eslint: ^7.23.0 || ^8.0.0 + typescript: '>=3.3.1' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@next/eslint-plugin-next': 12.3.1 + '@rushstack/eslint-patch': 1.2.0 + '@typescript-eslint/parser': 5.38.0_5qnjiidcar3zhltuqkapawl5tq + eslint: 8.22.0 + eslint-import-resolver-node: 0.3.6 + eslint-import-resolver-typescript: 2.7.1_2iahngt3u2tkbdlu6s4gkur3pu + eslint-plugin-import: 2.26.0_dz6mtv6jua3j7xbldvgsafodwi + eslint-plugin-jsx-a11y: 6.6.1_eslint@8.22.0 + eslint-plugin-react: 7.31.8_eslint@8.22.0 + eslint-plugin-react-hooks: 4.6.0_eslint@8.22.0 + typescript: 4.2.4 + transitivePeerDependencies: + - eslint-import-resolver-webpack + - supports-color + dev: true + /eslint-config-next/12.3.1_76twfck5d7crjqrmw4yltga7zm: resolution: {integrity: sha512-EN/xwKPU6jz1G0Qi6Bd/BqMnHLyRAL0VsaQaWA7F3KkjAgZHi4f1uL1JKGWNxdQpHTW/sdGONBd0bzxUka/DJg==} peerDependencies: @@ -1308,30 +1379,6 @@ packages: - supports-color dev: true - /eslint-config-next/12.3.1_eslint@8.22.0: - resolution: {integrity: sha512-EN/xwKPU6jz1G0Qi6Bd/BqMnHLyRAL0VsaQaWA7F3KkjAgZHi4f1uL1JKGWNxdQpHTW/sdGONBd0bzxUka/DJg==} - peerDependencies: - eslint: ^7.23.0 || ^8.0.0 - typescript: '>=3.3.1' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@next/eslint-plugin-next': 12.3.1 - '@rushstack/eslint-patch': 1.2.0 - '@typescript-eslint/parser': 5.38.0_eslint@8.22.0 - eslint: 8.22.0 - eslint-import-resolver-node: 0.3.6 - eslint-import-resolver-typescript: 2.7.1_2iahngt3u2tkbdlu6s4gkur3pu - eslint-plugin-import: 2.26.0_dz6mtv6jua3j7xbldvgsafodwi - eslint-plugin-jsx-a11y: 6.6.1_eslint@8.22.0 - eslint-plugin-react: 7.31.8_eslint@8.22.0 - eslint-plugin-react-hooks: 4.6.0_eslint@8.22.0 - transitivePeerDependencies: - - eslint-import-resolver-webpack - - supports-color - dev: true - /eslint-config-prettier/8.5.0_eslint@8.22.0: resolution: {integrity: sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==} hasBin: true @@ -1531,7 +1578,6 @@ packages: /eslint/8.22.0: resolution: {integrity: sha512-ci4t0sz6vSRKdmkOGmprBo6fmI4PrphDFMy5JEq/fNS0gQkJM3rLmrqcp8ipMcdobH3KtUP40KniAE9W19S4wA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - hasBin: true dependencies: '@eslint/eslintrc': 1.3.2 '@humanwhocodes/config-array': 0.10.4 @@ -1790,6 +1836,10 @@ packages: slash: 3.0.0 dev: true + /graceful-fs/4.2.10: + resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==} + dev: false + /grapheme-splitter/1.0.4: resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} dev: true @@ -1841,7 +1891,6 @@ packages: /html-tokenize/2.0.1: resolution: {integrity: sha512-QY6S+hZ0f5m1WT8WffYN+Hg+xm/w5I8XeUcAq/ZYP5wVC8xbKi4Whhru3FtrAebD5EhBW8rmFzkDI6eCAuFe2w==} - hasBin: true dependencies: buffer-from: 0.1.2 inherits: 2.0.4 @@ -2015,7 +2064,6 @@ packages: /js-yaml/4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} - hasBin: true dependencies: argparse: 2.0.1 dev: true @@ -2034,7 +2082,6 @@ packages: /json5/1.0.1: resolution: {integrity: sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==} - hasBin: true dependencies: minimist: 1.2.6 dev: true @@ -2114,7 +2161,6 @@ packages: /loose-envify/1.4.0: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} - hasBin: true dependencies: js-tokens: 4.0.0 @@ -2128,7 +2174,6 @@ packages: /marked/4.1.1: resolution: {integrity: sha512-0cNMnTcUJPxbA6uWmCmjWz4NJRe/0Xfk2NhXCUHjew9qJzFN20krFnsUe7QynwqOwa5m1fZ4UDg0ycKFVC0ccw==} engines: {node: '>= 12'} - hasBin: true dev: false /merge2/1.4.1: @@ -2181,6 +2226,13 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true + /next-transpile-modules/9.1.0: + resolution: {integrity: sha512-yzJji65xDqcIqjvx5vPJcs1M+MYQTzLM1pXH/qf8Q88ohx+bwVGDc1AeV+HKr1NwvMCNTpwVPSFI7cA5WdyeWA==} + dependencies: + enhanced-resolve: 5.10.0 + escalade: 3.1.1 + dev: false + /next/12.3.1_biqbaboplfbrettd7655fr4n2y: resolution: {integrity: sha512-l7bvmSeIwX5lp07WtIiP9u2ytZMv7jIeB8iacR28PuUEFG5j0HGAPnMqyG5kbZNBG2H7tRsrQ4HCjuMOPnANZw==} engines: {node: '>=12.22.0'} @@ -2401,7 +2453,6 @@ packages: /prettier/2.7.1: resolution: {integrity: sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==} engines: {node: '>=10.13.0'} - hasBin: true /process-nextick-args/2.0.1: resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} @@ -2542,7 +2593,6 @@ packages: /resolve/1.22.1: resolution: {integrity: sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==} - hasBin: true dependencies: is-core-module: 2.10.0 path-parse: 1.0.7 @@ -2550,7 +2600,6 @@ packages: /resolve/2.0.0-next.4: resolution: {integrity: sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==} - hasBin: true dependencies: is-core-module: 2.10.0 path-parse: 1.0.7 @@ -2564,7 +2613,6 @@ packages: /rimraf/3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} - hasBin: true dependencies: glob: 7.2.3 dev: true @@ -2591,13 +2639,11 @@ packages: /semver/6.3.0: resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==} - hasBin: true dev: true /semver/7.3.7: resolution: {integrity: sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==} engines: {node: '>=10'} - hasBin: true dependencies: lru-cache: 6.0.0 dev: true @@ -2751,6 +2797,11 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} + /tapable/2.2.1: + resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} + engines: {node: '>=6'} + dev: false + /text-table/0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} dev: true @@ -2795,13 +2846,14 @@ packages: resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} dev: false - /tsutils/3.21.0: + /tsutils/3.21.0_typescript@4.2.4: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 + typescript: 4.2.4 dev: true /tsutils/3.21.0_typescript@4.8.3: @@ -2832,12 +2884,23 @@ packages: engines: {node: '>=10'} dev: true + /typescript/4.2.4: + resolution: {integrity: sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==} + engines: {node: '>=4.2.0'} + dev: true + /typescript/4.8.3: resolution: {integrity: sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==} engines: {node: '>=4.2.0'} hasBin: true dev: true + /typescript/4.8.4: + resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==} + engines: {node: '>=4.2.0'} + hasBin: true + dev: true + /unbox-primitive/1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} dependencies: @@ -2882,7 +2945,6 @@ packages: /which/2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} - hasBin: true dependencies: isexe: 2.0.0 dev: true @@ -2927,7 +2989,6 @@ packages: /y-webrtc/10.2.3: resolution: {integrity: sha512-X7a6c56/jWhEI8LHLmT3LgzwbPA4r8h46pdVvV+55EQJhi+K6RfmisWgj7h6/2gkB0yveq7iDxlmyrYGnAKW/Q==} engines: {node: '>=12'} - hasBin: true dependencies: lib0: 0.2.52 simple-peer: 9.11.1 diff --git a/scripts/module-resolve/ci.js b/scripts/module-resolve/ci.js new file mode 100644 index 0000000000..44c57a08d8 --- /dev/null +++ b/scripts/module-resolve/ci.js @@ -0,0 +1,13 @@ +const fs = require('fs'); +const path = require('path'); + +const templatePath = path.resolve(__dirname, 'module-resolve.tmpl.js'); +const destinationPath = path.resolve(__dirname, '../../module-resolve.js'); + +console.log('template path', templatePath); +console.log('destination path', destinationPath); + +fs.copyFileSync( + templatePath, + destinationPath +); diff --git a/scripts/module-resolve/module-resolve.tmpl.js b/scripts/module-resolve/module-resolve.tmpl.js new file mode 100644 index 0000000000..bc0ecaa6dc --- /dev/null +++ b/scripts/module-resolve/module-resolve.tmpl.js @@ -0,0 +1,11 @@ +function resolve(pkg) { + if (pkg.dependencies && pkg.dependencies['@toeverything/pathfinder-logger']) { + pkg.dependencies['@toeverything/pathfinder-logger'] = 'latest'; + } + + return pkg; +} + +module.exports = { + resolve, +};