未验证 提交 6bc70fd5 编写于 作者: P Peter Pan 提交者: GitHub

build: remove mock data from distribution (#988)

上级 a458c01a
......@@ -54,4 +54,4 @@ export const SNOWPACK_PUBLIC_DEFAULT_LANGUAGE = process.env.DEFAULT_LANGUAGE ||
// theme
export const SNOWPACK_PUBLIC_THEME = process.env.THEME || '';
// demo
export const DEMO = '';
export const SERVER = '';
......@@ -38,7 +38,6 @@ function isWorkspace() {
const iconsPath = path.dirname(resolve.sync(cwd, '@visualdl/icons'));
const netronPath = path.dirname(resolve.sync(cwd, '@visualdl/netron'));
const wasmPath = path.dirname(resolve.sync(cwd, '@visualdl/wasm'));
const mockPath = path.dirname(resolve.sync(cwd, '@visualdl/mock'));
const dest = path.resolve(cwd, './dist/__snowpack__/link/packages');
/** @type {import("snowpack").SnowpackUserConfig } */
......@@ -101,14 +100,6 @@ export default {
{
source: [path.join(wasmPath, '*.{js,wasm}')],
destination: path.join(dest, 'wasm/dist')
},
{
source: ['./{data,assets}/**/*'],
destination: path.join(dest, 'mock'),
options: {
cwd: mockPath,
parents: true
}
}
]
}
......
......@@ -56,7 +56,7 @@ function render() {
}
}
if (import.meta.env.MODE === 'development' && !import.meta.env.DEMO) {
if (import.meta.env.MODE === 'development' && !import.meta.env.SERVER) {
import('@visualdl/mock').then(async ({initMock}) => {
await initMock();
render();
......
......@@ -14,6 +14,8 @@
* limitations under the License.
*/
import 'isomorphic-fetch';
import {fileURLToPath} from 'url';
import path from 'path';
......
......@@ -41,6 +41,7 @@
},
"dependencies": {
"fetch-mock": "9.11.0",
"isomorphic-fetch": "3.0.0",
"mime-types": "2.1.31"
},
"devDependencies": {
......
......@@ -27,6 +27,7 @@ const cwd = path.dirname(fileURLToPath(import.meta.url));
config();
process.env.SERVER = '1';
const isDev = process.env.NODE_ENV === 'development';
const isDemo = !!process.env.DEMO;
......
......@@ -7280,6 +7280,14 @@ isobject@^3.0.0, isobject@^3.0.1:
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
isomorphic-fetch@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4"
integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==
dependencies:
node-fetch "^2.6.1"
whatwg-fetch "^3.4.1"
isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
......@@ -12049,6 +12057,11 @@ webpack@5.38.1:
watchpack "^2.2.0"
webpack-sources "^2.3.0"
whatwg-fetch@^3.4.1:
version "3.6.2"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz#dced24f37f2624ed0281725d51d0e2e3fe677f8c"
integrity sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==
whatwg-url@^6.5.0:
version "6.5.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册