Преглед изворни кода

Switch approach for next.js bundling

Copy blank next.js project to amanuensis internal.
master
TheoryOfNekomata пре 9 месеци
родитељ
комит
db60f78562
26 измењених фајлова са 423 додато и 973 уклоњено
  1. +7
    -1
      .amanuensis/components/Wrapper.tsx
  2. +0
    -4
      packages/amanuensis/.gitignore
  3. +0
    -9
      packages/amanuensis/default/components/Wrapper.tsx
  4. +3
    -23
      packages/amanuensis/package.json
  5. +0
    -10
      packages/amanuensis/pages/_app.tsx
  6. +0
    -36
      packages/amanuensis/pages/index.tsx
  7. +5
    -84
      packages/amanuensis/src/commands/analyze.ts
  8. +77
    -0
      packages/amanuensis/src/commands/init.ts
  9. +118
    -0
      packages/amanuensis/src/commands/refresh.ts
  10. +4
    -4
      packages/amanuensis/src/commands/serve.ts
  11. +4
    -2
      packages/amanuensis/src/index.ts
  12. +4
    -0
      packages/amanuensis/src/next/.eslintrc.json
  13. +35
    -0
      packages/amanuensis/src/next/.gitignore
  14. +15
    -0
      packages/amanuensis/src/next/components/Wrapper.tsx
  15. +25
    -0
      packages/amanuensis/src/next/next.config.js
  16. +25
    -0
      packages/amanuensis/src/next/package.json
  17. +5
    -0
      packages/amanuensis/src/next/pages/_app.tsx
  18. +13
    -0
      packages/amanuensis/src/next/pages/_document.tsx
  19. BIN
      packages/amanuensis/src/next/public/favicon.ico
  20. +1
    -0
      packages/amanuensis/src/next/public/next.svg
  21. +1
    -0
      packages/amanuensis/src/next/public/vercel.svg
  22. +23
    -0
      packages/amanuensis/src/next/tsconfig.json
  23. +1
    -20
      packages/amanuensis/src/utils/data.ts
  24. +1
    -3
      packages/amanuensis/tsconfig.eslint.json
  25. +2
    -5
      packages/amanuensis/tsconfig.json
  26. +54
    -772
      pnpm-lock.yaml

+ 7
- 1
.amanuensis/components/Wrapper.tsx Прегледај датотеку

@@ -1,4 +1,10 @@
export const Wrapper = ({
import {FC, ReactNode} from 'react';

export interface WrapperProps {
children: ReactNode;
}

export const Wrapper: FC<WrapperProps> = ({
children,
}) => {
return (


+ 0
- 4
packages/amanuensis/.gitignore Прегледај датотеку

@@ -105,9 +105,5 @@ dist
.tern-port

.npmrc
.next/
types/
.amanuensis/
components/
pages/**/*.md
pages/**/*.mdx

+ 0
- 9
packages/amanuensis/default/components/Wrapper.tsx Прегледај датотеку

@@ -1,9 +0,0 @@
export const Wrapper = ({
children,
}) => {
return (
<div>
{children}
</div>
)
};

+ 3
- 23
packages/amanuensis/package.json Прегледај датотеку

@@ -17,8 +17,6 @@
],
"devDependencies": {
"@types/node": "^18.14.1",
"@types/react": "^18.2.18",
"@types/react-dom": "18.2.6",
"@types/yargs": "^17.0.24",
"eslint": "^8.35.0",
"eslint-config-lxsmnsyc": "^0.5.0",
@@ -54,33 +52,15 @@
"access": "public"
},
"dependencies": {
"@mdx-js/loader": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@next/mdx": "^13.4.12",
"execa": "^7.2.0",
"glob": "^10.3.3",
"minimatch": "^9.0.3",
"mkdirp": "^3.0.1",
"next": "13.4.7",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^8.0.7",
"typedoc": "^0.24.8",
"yargs": "^17.7.2",
"@tesseract-design/web-action-react": "workspace:*",
"@tesseract-design/web-base": "workspace:*",
"@tesseract-design/web-blob-react": "workspace:*",
"@tesseract-design/web-choice-react": "workspace:*",
"@tesseract-design/web-color-react": "workspace:*",
"@tesseract-design/web-formatted-react": "workspace:*",
"@tesseract-design/web-freeform-react": "workspace:*",
"@tesseract-design/web-information-react": "workspace:*",
"@tesseract-design/web-multichoice-react": "workspace:*",
"@tesseract-design/web-navigation-react": "workspace:*",
"@tesseract-design/web-number-react": "workspace:*",
"@tesseract-design/web-temporal-react": "workspace:*"
"yargs": "^17.7.2"
},
"types": "./dist/types/src/index.d.ts",
"types": "./dist/types/index.d.ts",
"main": "./dist/cjs/production/index.js",
"module": "./dist/esm/production/index.js",
"exports": {
@@ -91,7 +71,7 @@
},
"require": "./dist/cjs/production/index.js",
"import": "./dist/esm/production/index.js",
"types": "./dist/types/src/index.d.ts"
"types": "./dist/types/index.d.ts"
}
},
"typesVersions": {


+ 0
- 10
packages/amanuensis/pages/_app.tsx Прегледај датотеку

@@ -1,10 +0,0 @@
import type { AppProps } from 'next/app';
import { FC } from 'react';

const App: FC = ({ Component, pageProps }: AppProps) => {
return (
<Component {...pageProps} />
);
};

export default App;

+ 0
- 36
packages/amanuensis/pages/index.tsx Прегледај датотеку

@@ -1,36 +0,0 @@
import {GetStaticProps, NextPage} from 'next';
import ReactMarkdown from 'react-markdown';
import {Wrapper} from '../components/Wrapper';
import {getReadmeText} from '../utils/data';

interface IndexPageProps {
readmeType: 'markdown';
readmeText: string;
}

const IndexPage: NextPage<IndexPageProps> = ({
readmeType,
readmeText,
}) => {
return (
<Wrapper>
{readmeType === 'markdown' && (
<ReactMarkdown>
{readmeText}
</ReactMarkdown>
)}
</Wrapper>
);
};

export const getStaticProps: GetStaticProps<IndexPageProps> = async () => {
const readmeText = await getReadmeText();
return {
props: {
readmeType: 'markdown',
readmeText,
},
};
};

export default IndexPage;

packages/amanuensis/commands/generate.ts → packages/amanuensis/src/commands/analyze.ts Прегледај датотеку

@@ -1,10 +1,7 @@
import {
cp, readFile, rm, stat, writeFile,
} from 'fs/promises';
import { dirname, resolve } from 'path';
import { readFile, stat, writeFile } from 'fs/promises';
import { resolve } from 'path';
import { Argv } from 'yargs';
import { Stats } from 'fs';
import { mkdirp } from 'mkdirp';
import { getPackages, TypedocData } from '../utils/data';

const ensureTypedocJson = async (typedocPath: string) => {
@@ -66,75 +63,6 @@ const produceGroupings = async () => {
process.stdout.write(`File written to ${typedocDataJsonPath}\n`);
};

const linkComponents = async () => {
process.stdout.write('Linking components...\n');

const projectCwd = resolve(process.cwd(), '.amanuensis');
const defaultCwd = resolve(__dirname, '..', '..', '..', 'default');
const destCwd = resolve(__dirname, '..', '..', '..');
const componentsList = [
'components/Wrapper.tsx',
];

try {
await rm(resolve(destCwd, 'components'), { recursive: true });
} catch {
// noop
}
await Promise.all(componentsList.map(async (componentPath) => {
const destPath = resolve(destCwd, componentPath);
let baseCwd = projectCwd;

try {
await stat(resolve(baseCwd, componentPath));
} catch (errRaw) {
const err = errRaw as NodeJS.ErrnoException;
if (err.code === 'ENOENT') {
baseCwd = defaultCwd;
}
}

await mkdirp(dirname(destPath));
await cp(
resolve(baseCwd, componentPath),
destPath,
);
process.stdout.write(`Linked ${componentPath}\n`);
}));

const typedocDataJsonPath = resolve(__dirname, '..', '..', '..', '.amanuensis', 'data.json');
const typedocDataJson = await readFile(typedocDataJsonPath, 'utf-8');
const typedocData = JSON.parse(typedocDataJson) as TypedocData;

await Promise.all(
typedocData.packages.map(async (pkg: any) => {
await mkdirp(resolve(destCwd, 'pages', pkg.basePath));
await Promise.all(
pkg.markdown.map(async (m: any) => {
const srcPath = resolve(process.cwd(), pkg.basePath, m.filePath);
const destPath = resolve(destCwd, 'pages', pkg.basePath, m.name);
console.log(srcPath);
await cp(srcPath, destPath);
}),
);
}),
);

// try {
// await rm(resolve(destCwd, 'pages'), { recursive: true });
// } catch {
// // noop
// }
//
// await cp(
// resolve(defaultCwd, 'pages'),
// resolve(destCwd, 'pages'),
// { recursive: true },
// );

process.stdout.write('done\n');
};

export const description = 'Generate documentation from typedoc.json' as const;

export enum GenerateReturnCode {
@@ -142,10 +70,9 @@ export enum GenerateReturnCode {
NO_TYPEDOC_JSON = -1,
COULD_NOT_GENERATE_TYPEDOC_DATA = -2,
COULD_NOT_PRODUCE_GROUPINGS = -3,
COULD_NOT_GENERATE_PAGES = -4,
}

export interface GenerateArgs {
export interface AnalyzeArgs {
typedocJsonPath?: string;
subcommands?: string[];
}
@@ -156,7 +83,7 @@ export const builder = (yargs: Argv) => yargs
alias: 't',
});

const generate = async (args: GenerateArgs) => {
const analyze = async (args: AnalyzeArgs) => {
const {
typedocJsonPath = resolve(process.cwd(), 'typedoc.json'),
} = args;
@@ -179,13 +106,7 @@ const generate = async (args: GenerateArgs) => {
return GenerateReturnCode.COULD_NOT_PRODUCE_GROUPINGS;
}

try {
await linkComponents();
} catch {
return GenerateReturnCode.COULD_NOT_GENERATE_PAGES;
}

return GenerateReturnCode.SUCCESS;
};

export default generate;
export default analyze;

+ 77
- 0
packages/amanuensis/src/commands/init.ts Прегледај датотеку

@@ -0,0 +1,77 @@
import { cp } from 'fs/promises';
import { resolve } from 'path';
import { Argv } from 'yargs';

const copyFiles = async () => {
const srcPath = resolve(__dirname, '..', '..', '..', 'src', 'next');
const destPath = resolve(__dirname, '..', '..', '..', '.amanuensis', 'next');
await cp(srcPath, destPath, { recursive: true });
};

interface PackageManager {
name: string;
testCmd: [string, string[]];
installCmd: [string, string[]];
}

const packageManagers: PackageManager[] = [
{
name: 'pnpm',
testCmd: ['pnpm', ['--version']],
installCmd: ['pnpm', ['install', '--ignore-workspace']],
},
{
name: 'yarn',
testCmd: ['yarn', ['--version']],
installCmd: ['yarn', ['install']],
},
{
name: 'npm',
testCmd: ['npm', ['--version']],
installCmd: ['npm', ['install']],
},
];

const installDependencies = async () => {
const { execa } = await import('execa');

const selectedPackageManagerIndex = await packageManagers.reduce(
async (prevPmPromise, pkgm, i) => {
const prevPm = await prevPmPromise;
const { testCmd } = pkgm;
const testPm = await execa(...testCmd);
if (testPm.exitCode === 0 && prevPm === -1) {
return i;
}
return prevPm;
},
Promise.resolve(-1),
);

if (selectedPackageManagerIndex < 0) {
process.stderr.write('No package manager found\n');
process.exit(-1);
}

const { [selectedPackageManagerIndex]: selectedPackageManager } = packageManagers;
const cwd = resolve(__dirname, '..', '..', '..', '.amanuensis', 'next');
process.stdout.write(`In path: ${cwd}\n`);
process.stdout.write(`Installing dependencies with ${selectedPackageManager.name}\n`);
await execa(
selectedPackageManager.installCmd[0],
selectedPackageManager.installCmd[1],
{ cwd },
);
};

export const description = 'Initialize a new Amanuensis project' as const;

export const builder = (yargsBuilder: Argv) => yargsBuilder;

const init = async () => {
await copyFiles();
await installDependencies();
return 0;
};

export default init;

+ 118
- 0
packages/amanuensis/src/commands/refresh.ts Прегледај датотеку

@@ -0,0 +1,118 @@
import {
cp, readFile, rm, stat, writeFile,
} from 'fs/promises';
import { dirname, resolve, basename, extname, join } from 'path';
import { Argv } from 'yargs';
import { mkdirp } from 'mkdirp';
import { TypedocData } from '../utils/data';

const linkComponents = async () => {
process.stdout.write('Linking components...\n');

const projectCwd = resolve(process.cwd(), '.amanuensis');
const defaultCwd = resolve(__dirname, '..', '..', '..', 'src', 'next');
const destCwd = resolve(__dirname, '..', '..', '..', '.amanuensis', 'next');
const componentsList = [
'components/Wrapper.tsx',
];

try {
await rm(resolve(destCwd, 'content'), { recursive: true });
} catch {
// noop
}
await Promise.all(componentsList.map(async (componentPath) => {
const destPath = resolve(destCwd, componentPath);
let baseCwd = projectCwd;

try {
await stat(resolve(baseCwd, componentPath));
} catch (errRaw) {
const err = errRaw as NodeJS.ErrnoException;
if (err.code === 'ENOENT') {
baseCwd = defaultCwd;
}
}

await mkdirp(dirname(destPath));
await cp(
resolve(baseCwd, componentPath),
destPath,
);
process.stdout.write(`Linked ${componentPath}\n`);
}));

const typedocDataJsonPath = resolve(__dirname, '..', '..', '..', '.amanuensis', 'data.json');
const typedocDataJson = await readFile(typedocDataJsonPath, 'utf-8');
const typedocData = JSON.parse(typedocDataJson) as TypedocData;

await Promise.all(
typedocData.packages.map(async (pkg: any) => {
await mkdirp(resolve(destCwd, 'content', pkg.basePath));
await mkdirp(resolve(destCwd, 'pages', pkg.basePath));
await Promise.all(
pkg.markdown.map(async (m: any) => {
const srcPath = resolve(process.cwd(), pkg.basePath, m.filePath);
const destPath = resolve(destCwd, 'content', pkg.basePath, m.name);
const pageDestPath = resolve(destCwd, 'pages', pkg.basePath, `${basename(m.name, extname(m.name))}.tsx`);
await cp(srcPath, destPath);
await writeFile(
pageDestPath,
`import {NextPage} from 'next';
import {Wrapper} from '@/components/Wrapper';
import Content from '@/${join('content', pkg.basePath, m.name)}';

const IndexPage: NextPage = () => {
return (
<Wrapper>
<Content />
</Wrapper>
);
};

export default IndexPage;
`,
// todo fix problem when building with import aliases
// todo find a way to build with tailwind
// todo link components to next project
);
}),
);
}),
);

const srcPath = resolve(process.cwd(), 'README.md');
const destPath = resolve(destCwd, 'content', 'index.md');
await cp(srcPath, destPath);

process.stdout.write('done\n');
};

export const description = 'Generate documentation from typedoc.json' as const;

export enum GenerateReturnCode {
SUCCESS = 0,
COULD_NOT_GENERATE_PAGES = -1,
}

export interface RefreshArgs {
subcommands?: string[];
}

export const builder = (yargs: Argv) => yargs
.option('typedocJsonPath', {
type: 'string',
alias: 't',
});

const refresh = async (args: RefreshArgs) => {
try {
await linkComponents();
} catch {
return GenerateReturnCode.COULD_NOT_GENERATE_PAGES;
}

return GenerateReturnCode.SUCCESS;
};

export default refresh;

packages/amanuensis/commands/serve.ts → packages/amanuensis/src/commands/serve.ts Прегледај датотеку

@@ -6,8 +6,8 @@ const DEFAULT_PORT = 3000 as const;
const buildApp = async () => {
process.stdout.write('Building app...\n');

const cwd = resolve(__dirname, '..', '..', '..');
const nextBinPath = resolve(__dirname, '..', '..', '..', 'node_modules', '.bin', 'next');
const cwd = resolve(__dirname, '..', '..', '..', '.amanuensis', 'next');
const nextBinPath = resolve(__dirname, '..', '..', '..', '.amanuensis', 'next', 'node_modules', '.bin', 'next');
const { execa } = await import('execa');

await execa(nextBinPath, ['build'], {
@@ -23,8 +23,8 @@ const serveApp = async (port: number) => {
process.stdout.write(`Using port: ${port}...\n`);
process.stdout.write('Serving app...\n');

const cwd = resolve(__dirname, '..', '..', '..');
const nextBinPath = resolve(__dirname, '..', '..', '..', 'node_modules', '.bin', 'next');
const cwd = resolve(__dirname, '..', '..', '..', '.amanuensis', 'next');
const nextBinPath = resolve(__dirname, '..', '..', '..', '.amanuensis', 'next', 'node_modules', '.bin', 'next');
const { execa } = await import('execa');

await execa(nextBinPath, ['start', '-p', port.toString()], {

+ 4
- 2
packages/amanuensis/src/index.ts Прегледај датотеку

@@ -5,8 +5,10 @@ import yargs from 'yargs';

const main = async (args: string[]) => {
const COMMANDS = {
serve: await import('../commands/serve'),
generate: await import('../commands/generate'),
init: await import('./commands/init'),
serve: await import('./commands/serve'),
analyze: await import('./commands/analyze'),
refresh: await import('./commands/refresh'),
};

const yargsBuilder = Object.entries(COMMANDS).reduce(


+ 4
- 0
packages/amanuensis/src/next/.eslintrc.json Прегледај датотеку

@@ -0,0 +1,4 @@
{
"root": true,
"extends": "next/core-web-vitals"
}

+ 35
- 0
packages/amanuensis/src/next/.gitignore Прегледај датотеку

@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

+ 15
- 0
packages/amanuensis/src/next/components/Wrapper.tsx Прегледај датотеку

@@ -0,0 +1,15 @@
import {FC, ReactNode} from 'react';

export interface WrapperProps {
children: ReactNode;
}

export const Wrapper: FC<WrapperProps> = ({
children,
}) => {
return (
<div>
{children}
</div>
)
};

+ 25
- 0
packages/amanuensis/src/next/next.config.js Прегледај датотеку

@@ -0,0 +1,25 @@
// next.config.js

const withMDX = require('@next/mdx')({
extension: /\.mdx?$/,
options: {
// If you use remark-gfm, you'll need to use next.config.mjs
// as the package is ESM only
// https://github.com/remarkjs/remark-gfm#install
remarkPlugins: [],
rehypePlugins: [],
// If you use `MDXProvider`, uncomment the following line.
// providerImportSource: "@mdx-js/react",
},
})

/** @type {import('next').NextConfig} */
const nextConfig = {
// Configure pageExtensions to include md and mdx
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
// Optionally, add any other Next.js config below
reactStrictMode: true,
}

// Merge MDX config with Next.js config
module.exports = withMDX(nextConfig)

+ 25
- 0
packages/amanuensis/src/next/package.json Прегледај датотеку

@@ -0,0 +1,25 @@
{
"name": "next",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@mdx-js/loader": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@next/mdx": "^13.4.12",
"@types/node": "20.4.7",
"@types/react": "18.2.18",
"@types/react-dom": "18.2.6",
"eslint": "8.46.0",
"eslint-config-next": "13.4.7",
"next": "13.4.7",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "5.1.6"
}
}

+ 5
- 0
packages/amanuensis/src/next/pages/_app.tsx Прегледај датотеку

@@ -0,0 +1,5 @@
import type { AppProps } from 'next/app'

export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}

+ 13
- 0
packages/amanuensis/src/next/pages/_document.tsx Прегледај датотеку

@@ -0,0 +1,13 @@
import { Html, Head, Main, NextScript } from 'next/document'

export default function Document() {
return (
<Html lang="en">
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}

BIN
packages/amanuensis/src/next/public/favicon.ico Прегледај датотеку

Before After

+ 1
- 0
packages/amanuensis/src/next/public/next.svg Прегледај датотеку

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>

+ 1
- 0
packages/amanuensis/src/next/public/vercel.svg Прегледај датотеку

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>

+ 23
- 0
packages/amanuensis/src/next/tsconfig.json Прегледај датотеку

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}

packages/amanuensis/utils/data.ts → packages/amanuensis/src/utils/data.ts Прегледај датотеку

@@ -38,25 +38,6 @@ export interface TypedocData {
};
}

export const getReadmeText = async (cwd = process.cwd()) => {
const typedocDataJsonPath = resolve(cwd, '.amanuensis', 'data.json');
const typedocDataJson = await readFile(typedocDataJsonPath, 'utf-8');
const typedocData = JSON.parse(typedocDataJson) as {
typedocData: {
readme: { kind: string, text: string }[]
}
};
return typedocData.typedocData.readme.reduce(
(theText, node) => {
if (node.kind === 'text') {
return `${theText}${node.text}`;
}
return theText;
},
'',
);
};

export const getPackages = async (cwd = process.cwd()) => {
const configPath = resolve(cwd, '.amanuensis', 'config.json');
const configString = await readFile(configPath, 'utf-8');
@@ -136,6 +117,6 @@ export const getFileSources = async (cwd = process.cwd()) => {
({ sourceFileName }) => !sourceFileName.startsWith('node_modules'),
);
const firstPartySourceFiles = firstPartySources.map(({ sourceFileName }) => sourceFileName);
const uniqueFirstPartySourceFiles = [...new Set(firstPartySourceFiles)];
const uniqueFirstPartySourceFiles = Array.from(new Set(firstPartySourceFiles));
return uniqueFirstPartySourceFiles;
};

+ 1
- 3
packages/amanuensis/tsconfig.eslint.json Прегледај датотеку

@@ -1,8 +1,6 @@
{
"exclude": [
"node_modules",
"pages/**",
"components/**"
"node_modules"
],
"include": ["src", "types", "test"],
"compilerOptions": {


+ 2
- 5
packages/amanuensis/tsconfig.json Прегледај датотеку

@@ -1,8 +1,6 @@
{
"exclude": [
"node_modules",
"pages/**",
"components/**",
],
"include": [
"src",
@@ -16,21 +14,20 @@
"importHelpers": true,
"declaration": true,
"sourceMap": true,
"rootDir": ".",
"rootDir": "./src/",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"jsx": "preserve",
"jsx": "react",
"esModuleInterop": true,
"target": "es2018",
"allowJs": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"resolveJsonModule": true,
"isolatedModules": true
}


+ 54
- 772
pnpm-lock.yaml
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


Loading…
Откажи
Сачувај