Skip to content

Commit

Permalink
Merge pull request #18 from WTFAcademy/dev
Browse files Browse the repository at this point in the history
update doc
  • Loading branch information
chongqiangchen authored Apr 17, 2023
2 parents 8c5071a + ff69aca commit 9e5a3d7
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/relesae.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
32 changes: 3 additions & 29 deletions apps/demo/craco.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const cracoAlias = require("craco-alias");
const webpack = require("webpack");
const nodeExternals = require('webpack-node-externals');

module.exports = {
style: {
Expand All @@ -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;
}
}
Expand Down
3 changes: 2 additions & 1 deletion apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
7 changes: 7 additions & 0 deletions apps/doc/docs/expansion/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ title: 扩展
sidebar_position: 3
hide_title: true
---

## 扩展

import DocCardList from '@theme/DocCardList';

<DocCardList />

44 changes: 9 additions & 35 deletions apps/doc/docs/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ import TabItem from '@theme/TabItem';
<TabItem value="npm" label="Npm">

```sh
npm install solive
npm install solive-core
```

</TabItem>
<TabItem value="Yarn" label="Yarn">

```sh
yarn add solive
yarn add solive-core
```

</TabItem>
<TabItem value="Pnpm" label="Pnpm">

```sh
pnpm install solive
pnpm install solive-core
```

</TabItem>
Expand All @@ -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;
}
}
};

Expand Down
25 changes: 14 additions & 11 deletions apps/next_demo/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<main>
<Editor id="1" modelInfos={
<Editor
id="1"
modelInfos={
[
{
filename: '_Storage.sol',
// eslint-disable-next-line max-len
value: "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=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"
/>
</main>
)
);
}
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 comments on commit 9e5a3d7

@vercel
Copy link

@vercel vercel bot commented on 9e5a3d7 Apr 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

solive-doc – ./

solive-doc.vercel.app
solive-doc-wtfacademy.vercel.app
solive-doc-git-main-wtfacademy.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 9e5a3d7 Apr 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.