From f7daf7a784cdfdb6f46a83eded7b3d779457fb70 Mon Sep 17 00:00:00 2001
From: yumingqian <591562749@qq.com>
Date: Tue, 3 Aug 2021 11:30:39 +0800
Subject: [PATCH] =?UTF-8?q?'package.json=E5=8F=82=E6=95=B0=E6=9B=B4?=
=?UTF-8?q?=E6=94=B9'?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/time-picker/demos/index.html | 2 +-
components/time-picker/index.html | 2 +-
components/time-picker/package.json | 12 ++-
.../time-picker/scripts/rollup.config.js | 38 -------
.../time-picker/scripts/webpack.build.js | 102 ------------------
components/time-picker/vite.config.js | 14 ++-
6 files changed, 23 insertions(+), 147 deletions(-)
delete mode 100644 components/time-picker/scripts/rollup.config.js
delete mode 100644 components/time-picker/scripts/webpack.build.js
diff --git a/components/time-picker/demos/index.html b/components/time-picker/demos/index.html
index b86e6af56..e6666e9cd 100644
--- a/components/time-picker/demos/index.html
+++ b/components/time-picker/demos/index.html
@@ -11,7 +11,7 @@
-
+
diff --git a/components/time-picker/index.html b/components/time-picker/index.html
index 453280cef..ba25d8d96 100644
--- a/components/time-picker/index.html
+++ b/components/time-picker/index.html
@@ -11,7 +11,7 @@
-
+
diff --git a/components/time-picker/package.json b/components/time-picker/package.json
index cb0663488..b3081ae3c 100644
--- a/components/time-picker/package.json
+++ b/components/time-picker/package.json
@@ -1,5 +1,15 @@
{
- "version": "0.0.0",
+ "name": "@omiu/time-picker",
+ "version": "0.0.1",
+ "main": "dist/index.es.js",
+ "exports": {
+ ".": "./dist/index.es.js"
+ },
+ "types": "types/index.d.ts",
+ "files": [
+ "dist",
+ "types"
+ ],
"scripts": {
"start": "vite",
"build": "tsc && vite build --base=./",
diff --git a/components/time-picker/scripts/rollup.config.js b/components/time-picker/scripts/rollup.config.js
deleted file mode 100644
index eba396f7a..000000000
--- a/components/time-picker/scripts/rollup.config.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import nodeResolve from "rollup-plugin-node-resolve";
-
-import typescript from 'rollup-plugin-typescript';
-import scss from 'rollup-plugin-scss'
-import commonjs from '@rollup/plugin-commonjs';
-const fs = require('fs')
-const license = require("rollup-plugin-license");
-const pkg = require("../package.json");
-const licensePlugin = license({
- banner: `${pkg.name} v${pkg.version} http://omijs.org\r\nFront End Cross-Frameworks Framework.\r\nBy dntzhang https://github.com/dntzhang \r\n Github: https://github.com/Tencent/omi\r\n MIT Licensed.`
-});
-
-export default {
- input: "src/index.tsx",
- output: {
- format: "es",
- file: "./src/index.esm.js",
- name: pkg.name,
- sourcemap: true,
- strict: true
- },
- plugins: [
- nodeResolve({
- main: true
- }),
- scss({
- //output: false,
- output: function (styles, styleNodes) {
- fs.writeFileSync('./src/index.css', styles)
- },
- }),
- typescript(),
- commonjs(),
-
- licensePlugin
- ],
- //external: ['omi','../../icon/esm/date-range']
-};
diff --git a/components/time-picker/scripts/webpack.build.js b/components/time-picker/scripts/webpack.build.js
deleted file mode 100644
index ff4b7bdc4..000000000
--- a/components/time-picker/scripts/webpack.build.js
+++ /dev/null
@@ -1,102 +0,0 @@
-const path = require('path')
-const glob = require('glob')
-const webpack = require('webpack')
-const ProgressBarPlugin = require('progress-bar-webpack-plugin')
-const pkgName = require('../package.json')
-const componentName = pkgName.name.split('/')[1]
-
-const name = 'o-' + componentName
-const library = 'O' + componentName.split('-').map(name => name.charAt(0).toUpperCase() + name.slice(1)).join('')
-
-
-const config = {
- devtool: 'source-map',
- plugins: [
- new ProgressBarPlugin()
- ],
- entry: {
- [name]: './src/index.tsx'
- },
- output: {
- path: path.resolve(__dirname, '../src/'),
- filename: 'index.js',
- libraryTarget: 'umd',
- library: library,
- libraryExport: "default",
- globalObject: 'this'
- },
- mode: 'development',
- module: {
- rules: [{
- test: /\.scss$/,
- use: [
- 'to-string-loader',
- 'css-loader',
- {
- loader: 'resolve-url-loader'
- },
- {
- loader: 'sass-loader',
- options: {
- sourceMap: true,
-
- // mdc-web doesn't use sass-loader's normal syntax for imports
- // across modules, so we add all module directories containing
- // mdc-web components to the Sass include path
- // https://github.com/material-components/material-components-web/issues/351
- includePaths: glob.sync(path.join(__dirname, '../node_modules/@material')).map((dir) => path.dirname(dir))
-
- }
- }
- ]
- },
- {
- test: /\.css$/,
- use: [
- 'to-string-loader',
- 'css-loader',
- {
- loader: 'resolve-url-loader'
- }
- ]
- },
- {
- test: /\.less$/,
- use: [
- 'style-loader',
- 'css-loader',
- {
- loader: 'resolve-url-loader'
- },
- 'less-loader'
- ]
- },
- {
- test: /\.(jpe?g|png|gif|svg)$/i,
- loader: "url-loader"
- },
- {
- test: /\.[t|j]sx?$/,
- use: 'ts-loader',
- exclude: /node_modules/
- }
- ]
- },
- watch: process.argv[3] === 'demo',
- externals: {
- 'omi': {
- commonjs: "omi",
- commonjs2: "omi",
- amd: "omi",
- root: "Omi"
- }
- }
-}
-
-webpack(config, (err, stats) => { // Stats Object
- if (err || stats.hasErrors()) {
- // Handle errors here
- }
- // Done processing
-
-})
diff --git a/components/time-picker/vite.config.js b/components/time-picker/vite.config.js
index 2fb89b7aa..ed516fd35 100644
--- a/components/time-picker/vite.config.js
+++ b/components/time-picker/vite.config.js
@@ -1,20 +1,26 @@
import { resolve } from "path";
+import path from 'path';
-console.log(resolve(__dirname, "/index.html"))
+//console.log(resolve(__dirname, "/index.html"))
export default {
esbuild: {
jsxFactory: "h",
jsxFragment: "Fragment"
},
+ lib: {
+ entry: path.resolve(__dirname, 'src/index.tsx'),
+ name: 'index',
+ formats: ['es'],
+ fileName: (format) => `index.${format}.js`
+ },
build: {
rollupOptions: {
input: {
- main: resolve(__dirname, "demos/index.html"),
- // main:"/demos/index.html"
+ main: resolve(__dirname, "index.html"),
//admin: resolve(__dirname, "admin.html")
},
- // external:['omi'],
+ external:/^omi/,
// output: {
// name: 'core',
// dir: 'dist/lib/core.js',