diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5544878..50a182b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,15 +14,18 @@ jobs: uses: actions/setup-node@v3 with: node-version: 16.x - registry-url: 'https://registry.npmjs.org' + registry-url: "https://registry.npmjs.org" - name: Install dependencies run: npm ci + - name: Patch package + run: npm run patch + - name: Build run: npm run build - name: Publish run: npm publish env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 1e4993b..dc94c7a 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "draft-pad", - "version": "0.2.0", + "version": "0.2.1", "private": false, "main": "dist/index.js", - "types": "dist/src/index.d.ts", + "types": "dist/index.d.ts", "author": "slot-dumpling", "dependencies": { "@react-hook/size": "^2.1.2", @@ -18,7 +18,7 @@ "scripts": { "build": "webpack", "dev": "webpack --config webpack.dev.js", - "postinstall": "patch-package" + "patch": "patch-package" }, "devDependencies": { "@types/heap": "^0.2.31", diff --git a/tsconfig.json b/tsconfig.json index 27a628d..4bb486e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,7 @@ "moduleResolution": "node", "allowSyntheticDefaultImports": true, "sourceMap": true, - "declaration": true, - "declarationMap": true - } + "declaration": true + }, + "exclude": ["webpack.*", "dist/*"] } diff --git a/webpack.config.js b/webpack.config.js index c55ade2..1ac3b02 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,5 @@ var path = require("path"); -const TerserPlugin = require("terser-webpack-plugin"); -const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); +// const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); module.exports = { mode: "production", @@ -20,14 +19,7 @@ module.exports = { }, { test: /\.(png|jpg|gif|svg)$/i, - use: [ - { - loader: "url-loader", - options: { - limit: true, - }, - }, - ], + use: "url-loader", }, { test: /\.css$/, @@ -41,5 +33,7 @@ module.exports = { externals: { react: "react", "react-dom": "react-dom", + immutable: "immutable", }, + // plugins: [new BundleAnalyzerPlugin()], }; diff --git a/webpack.dev.js b/webpack.dev.js index 0de5487..c40a8fd 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -1,51 +1,6 @@ var path = require("path"); -const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); +const config = require("./webpack.config"); +config.mode = "development"; +config.watch = true; -module.exports = { - mode: "development", - entry: "./src/index.tsx", - output: { - path: path.resolve("dist"), - filename: "index.js", - libraryTarget: "commonjs2", - }, - devtool: "source-map", - module: { - rules: [ - { - test: /\.tsx?$/, - use: { - loader: "ts-loader", - options: { - compilerOptions: { module: "ESNext", target: "ESNext" }, - }, - }, - exclude: /node_modules/, - }, - { - test: /\.(png|jpg|gif|svg)$/i, - use: [ - { - loader: "url-loader", - options: { - limit: true, - }, - }, - ], - }, - { - test: /\.css$/, - use: ["style-loader", "css-loader"], - }, - ], - }, - resolve: { - extensions: [".tsx", ".ts", ".js"], - }, - externals: { - react: "react", - "react-dom": "react-dom", - }, - plugins: [new BundleAnalyzerPlugin()], - watch: true, -}; +module.exports = config;