From 8f5b947e52b9f95a56cdff80b5e9135ed12a00d0 Mon Sep 17 00:00:00 2001 From: linbudu599 Date: Tue, 15 Mar 2022 18:41:56 +0800 Subject: [PATCH] feat: vite plugin starter --- ROADMAP.md | 1 + packages/vite-plugin-starter/package.json | 16 ++++++++++++++++ packages/vite-plugin-starter/src/index.ts | 18 ++++++++++++++++++ packages/vite-plugin-starter/tsconfig.json | 20 ++++++++++++++++++++ pnpm-lock.yaml | 6 ++++++ 5 files changed, 61 insertions(+) create mode 100644 packages/vite-plugin-starter/package.json create mode 100644 packages/vite-plugin-starter/src/index.ts create mode 100644 packages/vite-plugin-starter/tsconfig.json diff --git a/ROADMAP.md b/ROADMAP.md index f1d345b..8de0329 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -19,6 +19,7 @@ - Mobx -> React - MobxStateTree + GraphQL - Workflow: GitHub Actions +- Node Lib ## Scripts diff --git a/packages/vite-plugin-starter/package.json b/packages/vite-plugin-starter/package.json new file mode 100644 index 0000000..b436716 --- /dev/null +++ b/packages/vite-plugin-starter/package.json @@ -0,0 +1,16 @@ +{ + "name": "vite-plugin-starter", + "version": "0.0.1", + "description": "", + "main": "./dist/index.js", + "license": "MIT", + "scripts": { + "build": "tsc", + "dev": "tsnd --respawn --transpile-only src/index.ts", + "watch": "tsc --watch", + "check": "tsc --noEmit" + }, + "devDependencies": { + "vite": "^2.7.2" + } +} diff --git a/packages/vite-plugin-starter/src/index.ts b/packages/vite-plugin-starter/src/index.ts new file mode 100644 index 0000000..f0ad786 --- /dev/null +++ b/packages/vite-plugin-starter/src/index.ts @@ -0,0 +1,18 @@ +import { Plugin } from 'vite'; + +export function vitePluginStarter(options: Record): Plugin { + return { + name: 'vite-plugin-starter', + enforce: 'pre', + apply: (config, env) => true, + config: (config, env) => config, + configResolved: async (config) => {}, + configureServer: (server) => {}, + // resolveId + // load + handleHotUpdate: async (ctx) => {}, + transform: (code: any) => { + return code; + }, + }; +} diff --git a/packages/vite-plugin-starter/tsconfig.json b/packages/vite-plugin-starter/tsconfig.json new file mode 100644 index 0000000..cd82584 --- /dev/null +++ b/packages/vite-plugin-starter/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "lib": [ + "esnext" + ], + "rootDir": "src", + "outDir": "dist", + "esModuleInterop": true, + "skipLibCheck": true, + "declaration": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true + }, + "include": [ + "src" + ] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index adf3cc9..a7592fc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -647,6 +647,12 @@ importers: '@types/react-dom': 17.0.13 typescript: 4.6.2 + packages/vite-plugin-starter: + specifiers: + vite: ^2.7.2 + devDependencies: + vite: 2.8.6 + packages/vite-react-starter: specifiers: '@types/react': ^17.0.33