feat: 初始化项目

This commit is contained in:
R524809
2026-09-02 17:47:25 +08:00
parent 04c94e75db
commit 1a2caba2b3
51 changed files with 6793 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
{
"name": "@atlas/api",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"build": "tsc -p tsconfig.json",
"dev": "tsx watch src/main.ts",
"start": "node dist/main.js",
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@atlas/contracts": "workspace:*",
"@nestjs/common": "12.0.1",
"@nestjs/core": "12.0.1",
"@nestjs/platform-express": "12.0.1",
"reflect-metadata": "0.2.2",
"rxjs": "7.8.2"
},
"devDependencies": {
"@types/node": "26.3.0",
"tsx": "4.23.13",
"typescript": "7.0.2"
}
}
+12
View File
@@ -0,0 +1,12 @@
import { Controller, Get, Module } from '@nestjs/common';
@Controller('health')
class HealthController {
@Get()
check() {
return { status: 'ok', service: 'api' };
}
}
@Module({ controllers: [HealthController] })
export class AppModule {}
+12
View File
@@ -0,0 +1,12 @@
import 'reflect-metadata';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module.js';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.enableCors({ origin: process.env.WEB_ORIGIN ?? 'http://localhost:8100' });
await app.listen(Number(process.env.API_PORT ?? 8200));
}
void bootstrap();
+11
View File
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"types": ["node"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"include": ["src/**/*.ts"]
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,36 @@
{
"manifest_version": 3,
"name": "Atlas Seller Kit Collector",
"description": "将已确认的来源商品采集到 Atlas 工作空间。",
"version": "0.1.0",
"permissions": [
"storage",
"identity",
"tabs",
"scripting"
],
"host_permissions": [
"*://*.ozon.ru/*",
"*://*.ozon.kz/*",
"*://*.ozon.by/*",
"*://*.1688.com/*",
"*://*.taobao.com/*",
"*://*.tmall.com/*",
"http://localhost/*"
],
"commands": {
"wxt:reload-extension": {
"description": "Reload the extension during development",
"suggested_key": {
"default": "Alt+R"
}
}
},
"background": {
"service_worker": "background.js"
},
"content_security_policy": {
"extension_pages": "script-src 'self' 'wasm-unsafe-eval' http://localhost:3000; object-src 'self';",
"sandbox": "script-src 'self' 'unsafe-inline' 'unsafe-eval' http://localhost:3000; sandbox allow-scripts allow-forms allow-popups allow-modals; child-src 'self';"
}
}
@@ -0,0 +1 @@
var background=(function(){function e(e){return e==null||typeof e==`function`?{main:e}:e}var t=e(()=>{console.info(`Atlas collector background started.`)});globalThis.browser?.runtime?.id?globalThis.browser:globalThis.chrome;var n={debug:(...e)=>([...e],void 0),log:(...e)=>([...e],void 0),warn:(...e)=>([...e],void 0),error:(...e)=>([...e],void 0)},r;try{r=t.main(),r instanceof Promise&&console.warn(`The background's main() function return a promise, but it must be synchronous`)}catch(e){throw n.error(`The background crashed on startup!`),e}return r})();
@@ -0,0 +1 @@
{"manifest_version":3,"name":"Atlas Seller Kit Collector","description":"将已确认的来源商品采集到 Atlas 工作空间。","version":"0.1.0","permissions":["storage","identity"],"host_permissions":["*://*.ozon.ru/*","*://*.ozon.kz/*","*://*.ozon.by/*","*://*.1688.com/*","*://*.taobao.com/*","*://*.tmall.com/*"],"background":{"service_worker":"background.js"}}
+55
View File
@@ -0,0 +1,55 @@
{
"compilerOptions": {
"lib": [
"ESNext",
"DOM",
"DOM.Iterable"
],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",
"moduleResolution": "Bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"paths": {
"@": [
".."
],
"@/*": [
"../*"
],
"~": [
".."
],
"~/*": [
"../*"
],
"@@": [
".."
],
"@@/*": [
"../*"
],
"~~": [
".."
],
"~~/*": [
"../*"
]
}
},
"include": [
"../**/*",
"./wxt.d.ts"
],
"exclude": [
"../**/node_modules",
"../.output"
]
}
+15
View File
@@ -0,0 +1,15 @@
// Generated by wxt
interface ImportMetaEnv {
readonly MANIFEST_VERSION: 2 | 3;
readonly BROWSER: string;
readonly CHROME: boolean;
readonly FIREFOX: boolean;
readonly SAFARI: boolean;
readonly EDGE: boolean;
readonly OPERA: boolean;
readonly COMMAND: "build" | "serve";
readonly ENTRYPOINT: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv
}
+81
View File
@@ -0,0 +1,81 @@
// Generated by wxt
import "wxt/browser";
declare module "wxt/browser" {
/**
* See https://developer.chrome.com/docs/extensions/reference/i18n/#method-getMessage
*/
interface GetMessageOptions {
/**
* See https://developer.chrome.com/docs/extensions/reference/i18n/#method-getMessage
*/
escapeLt?: boolean
}
export interface WxtI18n extends I18n.Static {
/**
* The extension or app ID; you might use this string to construct URLs for resources inside the extension. Even non-localized extensions can use this message.
* Note: You can't use this message in a manifest file.
*
* "<browser.runtime.id>"
*/
getMessage(
messageName: "@@extension_id",
substitutions?: string | string[],
options?: GetMessageOptions,
): string;
/**
* "<browser.i18n.getUiLocale()>"
*/
getMessage(
messageName: "@@ui_locale",
substitutions?: string | string[],
options?: GetMessageOptions,
): string;
/**
* The text direction for the current locale, either "ltr" for left-to-right languages such as English or "rtl" for right-to-left languages such as Japanese.
*
* "<ltr|rtl>"
*/
getMessage(
messageName: "@@bidi_dir",
substitutions?: string | string[],
options?: GetMessageOptions,
): string;
/**
* If the @@bidi_dir is "ltr", then this is "rtl"; otherwise, it's "ltr".
*
* "<rtl|ltr>"
*/
getMessage(
messageName: "@@bidi_reversed_dir",
substitutions?: string | string[],
options?: GetMessageOptions,
): string;
/**
* If the @@bidi_dir is "ltr", then this is "left"; otherwise, it's "right".
*
* "<left|right>"
*/
getMessage(
messageName: "@@bidi_start_edge",
substitutions?: string | string[],
options?: GetMessageOptions,
): string;
/**
* If the @@bidi_dir is "ltr", then this is "right"; otherwise, it's "left".
*
* "<right|left>"
*/
getMessage(
messageName: "@@bidi_end_edge",
substitutions?: string | string[],
options?: GetMessageOptions,
): string;
getMessage(
messageName: "@@extension_id" | "@@ui_locale" | "@@bidi_dir" | "@@bidi_reversed_dir" | "@@bidi_start_edge" | "@@bidi_end_edge",
substitutions?: string | string[],
options?: GetMessageOptions,
): string;
}
}
+21
View File
@@ -0,0 +1,21 @@
// Generated by wxt
// Types for the #import virtual module
declare module '#imports' {
export { browser, Browser } from 'wxt/browser';
export { storage, WxtStorage, WxtStorageItem, StorageArea, StorageItemKey, StorageAreaChanges, MigrationError } from 'wxt/utils/storage';
export { getAppConfig, useAppConfig } from 'wxt/utils/app-config';
export { ContentScriptContext, WxtWindowEventMap } from 'wxt/utils/content-script-context';
export { createIframeUi, IframeContentScriptUi, IframeContentScriptUiOptions } from 'wxt/utils/content-script-ui/iframe';
export { createIntegratedUi, IntegratedContentScriptUi, IntegratedContentScriptUiOptions } from 'wxt/utils/content-script-ui/integrated';
export { createShadowRootUi, ShadowRootContentScriptUi, ShadowRootContentScriptUiOptions } from 'wxt/utils/content-script-ui/shadow-root';
export { ContentScriptUi, ContentScriptUiOptions, ContentScriptOverlayAlignment, ContentScriptAppendMode, ContentScriptInlinePositioningOptions, ContentScriptOverlayPositioningOptions, ContentScriptModalPositioningOptions, ContentScriptPositioningOptions, ContentScriptAnchoredOptions, AutoMountOptions, StopAutoMount, AutoMount } from 'wxt/utils/content-script-ui/types';
export { defineAppConfig, WxtAppConfig } from 'wxt/utils/define-app-config';
export { defineBackground } from 'wxt/utils/define-background';
export { defineContentScript } from 'wxt/utils/define-content-script';
export { defineUnlistedScript } from 'wxt/utils/define-unlisted-script';
export { defineWxtPlugin } from 'wxt/utils/define-wxt-plugin';
export { injectScript, ScriptPublicPath, InjectScriptOptions } from 'wxt/utils/inject-script';
export { InvalidMatchPattern, MatchPattern } from 'wxt/utils/match-patterns';
export { useState, useCallback, useMemo, useEffect, useRef, useContext, useReducer } from 'react';
export { fakeBrowser } from 'wxt/testing/fake-browser';
}
+58
View File
@@ -0,0 +1,58 @@
// Generated by wxt
export {}
declare global {
const ContentScriptContext: typeof import('wxt/utils/content-script-context').ContentScriptContext
const InvalidMatchPattern: typeof import('wxt/utils/match-patterns').InvalidMatchPattern
const MatchPattern: typeof import('wxt/utils/match-patterns').MatchPattern
const browser: typeof import('wxt/browser').browser
const createIframeUi: typeof import('wxt/utils/content-script-ui/iframe').createIframeUi
const createIntegratedUi: typeof import('wxt/utils/content-script-ui/integrated').createIntegratedUi
const createShadowRootUi: typeof import('wxt/utils/content-script-ui/shadow-root').createShadowRootUi
const defineAppConfig: typeof import('wxt/utils/define-app-config').defineAppConfig
const defineBackground: typeof import('wxt/utils/define-background').defineBackground
const defineContentScript: typeof import('wxt/utils/define-content-script').defineContentScript
const defineUnlistedScript: typeof import('wxt/utils/define-unlisted-script').defineUnlistedScript
const defineWxtPlugin: typeof import('wxt/utils/define-wxt-plugin').defineWxtPlugin
const fakeBrowser: typeof import('wxt/testing/fake-browser').fakeBrowser
const getAppConfig: typeof import('wxt/utils/app-config').getAppConfig
const injectScript: typeof import('wxt/utils/inject-script').injectScript
const storage: typeof import('wxt/utils/storage').storage
const useAppConfig: typeof import('wxt/utils/app-config').useAppConfig
const useCallback: typeof import('react').useCallback
const useContext: typeof import('react').useContext
const useEffect: typeof import('react').useEffect
const useMemo: typeof import('react').useMemo
const useReducer: typeof import('react').useReducer
const useRef: typeof import('react').useRef
const useState: typeof import('react').useState
}
// for type re-export
declare global {
// @ts-ignore
export type { Browser } from 'wxt/browser'
import('wxt/browser')
// @ts-ignore
export type { WxtStorage, WxtStorageItem, StorageArea, StorageItemKey, StorageAreaChanges, MigrationError } from 'wxt/utils/storage'
import('wxt/utils/storage')
// @ts-ignore
export type { WxtWindowEventMap } from 'wxt/utils/content-script-context'
import('wxt/utils/content-script-context')
// @ts-ignore
export type { IframeContentScriptUi, IframeContentScriptUiOptions } from 'wxt/utils/content-script-ui/iframe'
import('wxt/utils/content-script-ui/iframe')
// @ts-ignore
export type { IntegratedContentScriptUi, IntegratedContentScriptUiOptions } from 'wxt/utils/content-script-ui/integrated'
import('wxt/utils/content-script-ui/integrated')
// @ts-ignore
export type { ShadowRootContentScriptUi, ShadowRootContentScriptUiOptions } from 'wxt/utils/content-script-ui/shadow-root'
import('wxt/utils/content-script-ui/shadow-root')
// @ts-ignore
export type { ContentScriptUi, ContentScriptUiOptions, ContentScriptOverlayAlignment, ContentScriptAppendMode, ContentScriptInlinePositioningOptions, ContentScriptOverlayPositioningOptions, ContentScriptModalPositioningOptions, ContentScriptPositioningOptions, ContentScriptAnchoredOptions, AutoMountOptions, StopAutoMount, AutoMount } from 'wxt/utils/content-script-ui/types'
import('wxt/utils/content-script-ui/types')
// @ts-ignore
export type { WxtAppConfig } from 'wxt/utils/define-app-config'
import('wxt/utils/define-app-config')
// @ts-ignore
export type { ScriptPublicPath, InjectScriptOptions } from 'wxt/utils/inject-script'
import('wxt/utils/inject-script')
}
+14
View File
@@ -0,0 +1,14 @@
// Generated by wxt
import "wxt/browser";
declare module "wxt/browser" {
export type PublicPath =
| ""
| "/"
| "/background.js"
type HtmlPublicPath = Extract<PublicPath, `${string}.html`>
export interface WxtRuntime {
getURL(path: PublicPath): string;
getURL(path: `${HtmlPublicPath}${string}`): string;
}
}
+8
View File
@@ -0,0 +1,8 @@
// Generated by wxt
/// <reference types="wxt/vite-builder-env" />
/// <reference types="@wxt-dev/module-react" />
/// <reference path="./types/paths.d.ts" />
/// <reference path="./types/i18n.d.ts" />
/// <reference path="./types/globals.d.ts" />
/// <reference path="./types/imports-module.d.ts" />
/// <reference path="./types/imports.d.ts" />
+3
View File
@@ -0,0 +1,3 @@
export default defineBackground(() => {
console.info('Atlas collector background started.');
});
+23
View File
@@ -0,0 +1,23 @@
{
"name": "@atlas/extension",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"build": "wxt build",
"dev": "wxt",
"typecheck": "wxt prepare && tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@atlas/contracts": "workspace:*",
"@wxt-dev/module-react": "1.2.2",
"react": "19.2.8",
"react-dom": "19.2.8"
},
"devDependencies": {
"@types/react": "19.2.18",
"@types/react-dom": "19.2.5",
"typescript": "7.0.2",
"wxt": "0.21.4"
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react-jsx",
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", ".wxt/**/*.ts"]
}
+18
View File
@@ -0,0 +1,18 @@
import { defineConfig } from 'wxt';
export default defineConfig({
modules: ['@wxt-dev/module-react'],
manifest: {
name: 'Atlas Seller Kit Collector',
description: '将已确认的来源商品采集到 Atlas 工作空间。',
permissions: ['storage', 'identity'],
host_permissions: [
'*://*.ozon.ru/*',
'*://*.ozon.kz/*',
'*://*.ozon.by/*',
'*://*.1688.com/*',
'*://*.taobao.com/*',
'*://*.tmall.com/*',
],
},
});
+12
View File
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Atlas Seller Kit</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
+25
View File
@@ -0,0 +1,25 @@
{
"name": "@atlas/web",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"build": "tsc -b && vite build",
"dev": "vite",
"typecheck": "tsc -b --pretty false"
},
"dependencies": {
"antd": "6.6.2",
"axios": "1.20.0",
"react": "19.2.8",
"react-dom": "19.2.8",
"react-router-dom": "7.18.3"
},
"devDependencies": {
"@types/react": "19.2.18",
"@types/react-dom": "19.2.5",
"@vitejs/plugin-react": "6.1.1",
"typescript": "7.0.2",
"vite": "8.2.2"
}
}
+21
View File
@@ -0,0 +1,21 @@
import { App as AntdApp, ConfigProvider, Typography } from 'antd';
import { createRoot } from 'react-dom/client';
import 'antd/dist/reset.css';
function Root() {
return (
<ConfigProvider>
<AntdApp>
<main style={{ margin: '64px auto', maxWidth: 840, padding: '0 24px' }}>
<Typography.Title>Atlas Seller Kit</Typography.Title>
<Typography.Paragraph>
卖家商品工作台初始化完成。账户、平台上下文和门店模块将在此基础上实现。
</Typography.Paragraph>
</main>
</AntdApp>
</ConfigProvider>
);
}
createRoot(document.getElementById('root')!).render(<Root />);
+3
View File
@@ -0,0 +1,3 @@
/// <reference types="vite/client" />
declare module '*.css';
+12
View File
@@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",
"lib": ["ES2023", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"noEmit": true,
"allowImportingTsExtensions": false
},
"include": ["src", "vite.config.ts"]
}
+15
View File
@@ -0,0 +1,15 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
server: {
port: Number(process.env.WEB_PORT ?? 8100),
proxy: {
'/api': {
target: process.env.API_ORIGIN ?? 'http://localhost:8200',
changeOrigin: true,
},
},
},
});
+20
View File
@@ -0,0 +1,20 @@
{
"name": "@atlas/worker",
"version": "0.1.0",
"private": true,
"scripts": {
"build": "tsc -p tsconfig.json",
"dev": "tsx watch src/main.ts",
"start": "node dist/main.js",
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@atlas/contracts": "workspace:*",
"bullmq": "6.3.4"
},
"devDependencies": {
"@types/node": "26.3.0",
"tsx": "4.23.13",
"typescript": "7.0.2"
}
}
+20
View File
@@ -0,0 +1,20 @@
import { Queue } from 'bullmq';
const connection = { url: process.env.REDIS_URL ?? 'redis://localhost:6379' };
const dispatchQueue = new Queue('atlas-dispatch', { connection });
async function bootstrap() {
await dispatchQueue.waitUntilReady();
console.info(
'Atlas Worker is ready; it will consume transactional-outbox events after that module exists.',
);
}
void bootstrap();
async function shutdown() {
await dispatchQueue.close();
}
process.once('SIGINT', () => void shutdown());
process.once('SIGTERM', () => void shutdown());
+9
View File
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"types": ["node"]
},
"include": ["src/**/*.ts"]
}