feat: init page from page.js
This commit is contained in:
		
							
								
								
									
										23
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								package.json
									
									
									
									
									
								
							@@ -1,16 +1,27 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@kevisual/page",
 | 
			
		||||
  "version": "1.0.0",
 | 
			
		||||
  "version": "0.0.1",
 | 
			
		||||
  "description": "",
 | 
			
		||||
  "main": "page.js",
 | 
			
		||||
  "type": "module",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "echo \"Error: no test specified\" && exit 1"
 | 
			
		||||
    "build": "rollup -c",
 | 
			
		||||
    "build:app": "npm run build && rsync dist/* ../deploy/dist"
 | 
			
		||||
  },
 | 
			
		||||
  "keywords": [],
 | 
			
		||||
  "author": "",
 | 
			
		||||
  "license": "ISC",
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "page.js": "^4.13.3"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@rollup/plugin-commonjs": "^28.0.1",
 | 
			
		||||
    "@rollup/plugin-node-resolve": "^15.3.0",
 | 
			
		||||
    "@rollup/plugin-typescript": "^12.1.1",
 | 
			
		||||
    "@types/crypto-js": "^4.2.2",
 | 
			
		||||
    "@types/react": "^18.3.12",
 | 
			
		||||
    "rimraf": "^6.0.1",
 | 
			
		||||
    "rollup": "^4.24.3",
 | 
			
		||||
    "rollup-plugin-copy": "^3.5.0",
 | 
			
		||||
    "rollup-plugin-dts": "^6.1.1",
 | 
			
		||||
    "typescript": "^5.6.3"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										47
									
								
								rollup.config.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								rollup.config.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
// rollup.config.js
 | 
			
		||||
 | 
			
		||||
import typescript from '@rollup/plugin-typescript';
 | 
			
		||||
import resolve from '@rollup/plugin-node-resolve';
 | 
			
		||||
import commonjs from '@rollup/plugin-commonjs';
 | 
			
		||||
import copy from 'rollup-plugin-copy';
 | 
			
		||||
import { dts } from 'rollup-plugin-dts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @type {import('rollup').RollupOptions}
 | 
			
		||||
 */
 | 
			
		||||
const config1 = {
 | 
			
		||||
  input: 'src/index.ts', // TypeScript 入口文件
 | 
			
		||||
  output: {
 | 
			
		||||
    file: 'dist/page.js', // 输出文件
 | 
			
		||||
    format: 'es', // 输出格式设置为 ES 模块
 | 
			
		||||
  },
 | 
			
		||||
  plugins: [
 | 
			
		||||
    resolve({
 | 
			
		||||
      browser: true, // 若为浏览器环境,设为 true;若为 Node.js 环境,设为 false
 | 
			
		||||
      // preferBuiltins: false, // 优先使用内置模块
 | 
			
		||||
    }), // 使用 @rollup/plugin-node-resolve 解析 node_modules 中的模块
 | 
			
		||||
    commonjs(), //
 | 
			
		||||
 | 
			
		||||
    typescript({
 | 
			
		||||
      allowImportingTsExtensions: true,
 | 
			
		||||
      noEmit: true,
 | 
			
		||||
      declaration: false,
 | 
			
		||||
    }), // 使用 @rollup/plugin-typescript 处理 TypeScript 文件
 | 
			
		||||
  ],
 | 
			
		||||
  include: ['node_modules/**'],
 | 
			
		||||
  external: [],
 | 
			
		||||
};
 | 
			
		||||
const config1Dts = {
 | 
			
		||||
  input: 'src/index.ts', // TypeScript 入口文件
 | 
			
		||||
  output: {
 | 
			
		||||
    file: 'dist/page.d.ts', // 输出文件
 | 
			
		||||
    format: 'es', // 输出格式设置为 ES 模块
 | 
			
		||||
  },
 | 
			
		||||
  plugins: [
 | 
			
		||||
    dts(), // 生成 .d.ts 类型声明文件
 | 
			
		||||
  ],
 | 
			
		||||
  external: [],
 | 
			
		||||
  include: ['node_modules/**'],
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default [config1, config1Dts];
 | 
			
		||||
							
								
								
									
										1
									
								
								src/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/index.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
export * from './page.js';
 | 
			
		||||
							
								
								
									
										23
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
{
 | 
			
		||||
  "compilerOptions": {
 | 
			
		||||
    "target": "ES2020",
 | 
			
		||||
    "module": "ESNext",
 | 
			
		||||
    "lib": [
 | 
			
		||||
      "ES2020",
 | 
			
		||||
      "DOM",
 | 
			
		||||
      "DOM.Iterable"
 | 
			
		||||
    ],
 | 
			
		||||
    "noEmit": false,
 | 
			
		||||
    "outDir": "dist",
 | 
			
		||||
    "strict": false,
 | 
			
		||||
    "baseUrl": ".",
 | 
			
		||||
    "rootDir": "src",
 | 
			
		||||
    "noUnusedLocals": false,
 | 
			
		||||
    "noUnusedParameters": false,
 | 
			
		||||
    "moduleResolution": "node",
 | 
			
		||||
    "declaration": true
 | 
			
		||||
  },
 | 
			
		||||
  "include": [
 | 
			
		||||
    "src/**/*.ts"
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user