From bec543f63a339bd1e9475bc2b6696c6dd0ad8f4e Mon Sep 17 00:00:00 2001 From: KieSun Date: Sun, 16 Apr 2023 18:17:11 +0800 Subject: [PATCH 1/2] chore: release ci --- .github/workflows/relesae.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/relesae.yaml b/.github/workflows/relesae.yaml index 2fe190e..a34ce61 100644 --- a/.github/workflows/relesae.yaml +++ b/.github/workflows/relesae.yaml @@ -32,7 +32,7 @@ jobs: id: changesets uses: changesets/action@v1 with: - publish: pnpm run build:lib && pnpm -w run release + publish: pnpm run build:lib && pnpm changeset publish env: GITHUB_TOKEN: ${{ secrets.SOLIVE_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} From ff69aca121e604414a74332751b621991077c94e Mon Sep 17 00:00:00 2001 From: chenchongqiang Date: Mon, 17 Apr 2023 20:09:30 +0800 Subject: [PATCH 2/2] doc: update doc --- apps/demo/craco.config.js | 32 ++-------------------- apps/demo/package.json | 3 +- apps/doc/docs/expansion/index.mdx | 7 +++++ apps/doc/docs/get-started.mdx | 44 ++++++------------------------ apps/next_demo/src/pages/index.tsx | 25 +++++++++-------- pnpm-lock.yaml | 12 ++++++++ 6 files changed, 47 insertions(+), 76 deletions(-) diff --git a/apps/demo/craco.config.js b/apps/demo/craco.config.js index b2ef58d..dcf61ea 100644 --- a/apps/demo/craco.config.js +++ b/apps/demo/craco.config.js @@ -1,5 +1,5 @@ const cracoAlias = require("craco-alias"); -const webpack = require("webpack"); +const nodeExternals = require('webpack-node-externals'); module.exports = { style: { @@ -21,34 +21,8 @@ module.exports = { ], webpack: { configure: (webpackConfig, { env, paths }) => { - // eslint-disable-next-line no-param-reassign - webpackConfig.resolve.fallback = { - "http": require.resolve("stream-http"), - "https": require.resolve("https-browserify"), - "zlib": require.resolve("browserify-zlib"), - "stream": require.resolve("stream-browserify"), - "events": require.resolve("events/"), - "crypto": require.resolve("crypto-browserify"), - "assert": require.resolve("assert/"), - "buffer": require.resolve("buffer/"), - "util": require.resolve("util/"), - "path": require.resolve("path-browserify"), - "tty": require.resolve("tty-browserify"), - "os": require.resolve("os-browserify/browser"), - "punycode": require.resolve("punycode/"), - "fs": false, - "url": require.resolve("url/"), - "net": require.resolve("net-browserify"), - "child_process": false, - async_hooks: false, - rawBody: false, - }; - - webpackConfig.plugins.push( - new webpack.ProvidePlugin({ - Buffer: ["buffer", "Buffer"] - }) - ); + webpackConfig.externalsPresets = {node: true}; + webpackConfig.externals = [nodeExternals()]; return webpackConfig; } } diff --git a/apps/demo/package.json b/apps/demo/package.json index 1a96245..31b8c20 100644 --- a/apps/demo/package.json +++ b/apps/demo/package.json @@ -56,6 +56,7 @@ "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17", "tty-browserify": "^0.0.1", "url": "^0.11.0", - "util": "^0.12.5" + "util": "^0.12.5", + "webpack-node-externals": "^3.0.0" } } diff --git a/apps/doc/docs/expansion/index.mdx b/apps/doc/docs/expansion/index.mdx index 10571b6..5c446a8 100644 --- a/apps/doc/docs/expansion/index.mdx +++ b/apps/doc/docs/expansion/index.mdx @@ -3,3 +3,10 @@ title: 扩展 sidebar_position: 3 hide_title: true --- + +## 扩展 + +import DocCardList from '@theme/DocCardList'; + + + diff --git a/apps/doc/docs/get-started.mdx b/apps/doc/docs/get-started.mdx index a47d28e..e6c824c 100644 --- a/apps/doc/docs/get-started.mdx +++ b/apps/doc/docs/get-started.mdx @@ -15,21 +15,21 @@ import TabItem from '@theme/TabItem'; ```sh -npm install solive +npm install solive-core ``` ```sh -yarn add solive +yarn add solive-core ``` ```sh -pnpm install solive +pnpm install solive-core ``` @@ -44,42 +44,16 @@ pnpm install solive ```js // 使用craco配置: -const webpack = require("webpack"); +const nodeExternals = require('webpack-node-externals'); module.exports = { // ... webpack: { - configure: (webpackConfig, { env, paths }) => { - // eslint-disable-next-line no-param-reassign - webpackConfig.resolve.fallback = { - "http": require.resolve("stream-http"), - "https": require.resolve("https-browserify"), - "zlib": require.resolve("browserify-zlib"), - "stream": require.resolve("stream-browserify"), - "events": require.resolve("events/"), - "crypto": require.resolve("crypto-browserify"), - "assert": require.resolve("assert/"), - "buffer": require.resolve("buffer/"), - "util": require.resolve("util/"), - "path": require.resolve("path-browserify"), - "tty": require.resolve("tty-browserify"), - "os": require.resolve("os-browserify/browser"), - "punycode": require.resolve("punycode/"), - "fs": false, - "url": require.resolve("url/"), - "net": require.resolve("net-browserify"), - "child_process": false, - async_hooks: false, - rawBody: false, - }; - - webpackConfig.plugins.push( - new webpack.ProvidePlugin({ - Buffer: ["buffer", "Buffer"] - }) - ); - return webpackConfig; - } + configure: (webpackConfig, { env, paths }) => { + webpackConfig.externalsPresets = {node: true}; + webpackConfig.externals = [nodeExternals()]; + return webpackConfig; + } } }; diff --git a/apps/next_demo/src/pages/index.tsx b/apps/next_demo/src/pages/index.tsx index e0ff1b4..e78608d 100644 --- a/apps/next_demo/src/pages/index.tsx +++ b/apps/next_demo/src/pages/index.tsx @@ -1,26 +1,29 @@ -import dynamic from "next/dynamic"; +import dynamic from 'next/dynamic'; -import "solive-core/dist/index.css"; +import 'solive-core/dist/index.css'; const Editor = dynamic( - () => { - return import("solive-core"); - }, - { ssr: false } + () => import('solive-core'), + { ssr: false }, ); export default function Home() { return (
- =0.7.0 <0.9.0;\n\n/**\n * @title Storage\n * @dev Store & retrieve value in a variable\n * @custom:dev-run-script ./scripts/deploy_with_ethers.ts\n */\ncontract Storage {\n\n uint256 number;\n\n /**\n * @dev Store value in variable\n * @param num value to store\n */\n function store(uint256 num) public {\n number = num;\n }\n\n /**\n * @dev Return value \n * @return value of 'number'\n */\n function retrieve() public view returns (uint256){\n return number;\n }\n}", - language: "solidity" as any, - } + language: 'solidity' as any, + }, ] - } height="500px" /> + } + height="500px" + />
- ) + ); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e40f12c..db16739 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -122,6 +122,7 @@ importers: url: ^0.11.0 util: ^0.12.5 web-vitals: ^2.1.4 + webpack-node-externals: ^3.0.0 dependencies: '@craco/craco': 7.1.0_uaemxlzga3znd5u3dmtbp5hl4i '@testing-library/jest-dom': 5.16.5 @@ -157,6 +158,7 @@ importers: tty-browserify: r2.cnpmjs.org/tty-browserify/0.0.1 url: r2.cnpmjs.org/url/0.11.0 util: 0.12.5 + webpack-node-externals: r2.cnpmjs.org/webpack-node-externals/3.0.0 apps/doc: specifiers: @@ -218,6 +220,7 @@ importers: solive-core: workspace:* tailwindcss: 3.3.1 typescript: 5.0.4 + webpack-node-externals: ^3.0.0 dependencies: '@headlessui/react': 1.7.13_biqbaboplfbrettd7655fr4n2y '@heroicons/react': 2.0.17_react@18.2.0 @@ -234,6 +237,8 @@ importers: solive-core: link:../../packages/core tailwindcss: 3.3.1_postcss@8.4.21 typescript: 5.0.4 + devDependencies: + webpack-node-externals: r2.cnpmjs.org/webpack-node-externals/3.0.0 packages/compiler-utils: specifiers: @@ -21491,6 +21496,13 @@ packages: clone-deep: r2.cnpmjs.org/clone-deep/4.0.1 wildcard: r2.cnpmjs.org/wildcard/2.0.0 + r2.cnpmjs.org/webpack-node-externals/3.0.0: + resolution: {integrity: sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ==, registry: https://r.cnpmjs.org/, tarball: https://r2.cnpmjs.org/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz} + name: webpack-node-externals + version: 3.0.0 + engines: {node: '>=6'} + dev: true + r2.cnpmjs.org/webpack-sources/1.4.3: resolution: {integrity: sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==, registry: https://r.cnpmjs.org/, tarball: https://r2.cnpmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz} name: webpack-sources