Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

read example code from crate #468

Merged
merged 7 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/sandbox/src/build_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn build_execution_command() -> Vec<String> {
"rm -rf {}/contract.* {}/metadata.json",
target_dir, target_dir
);
let build_cmd = "cargo contract build --offline --skip-linting 2>&1".to_string();
let build_cmd = "cargo contract build --offline 2>&1".to_string();
let move_cmd = format!("mv {}/contract.contract {}", target_dir, DOCKER_OUTPUT);

let command = format!("{} && {} && {}", clean_cmd, build_cmd, move_cmd);
Expand Down
2 changes: 1 addition & 1 deletion crates/sandbox/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub enum FormattingResult {
// CONSTANTS
// -------------------------------------------------------------------------------------------------

const DOCKER_PROCESS_TIMEOUT_HARD: Duration = Duration::from_secs(30);
const DOCKER_PROCESS_TIMEOUT_HARD: Duration = Duration::from_secs(60);

// -------------------------------------------------------------------------------------------------
// TRAIT IMPLEMENTATION
Expand Down
55 changes: 0 additions & 55 deletions packages/ink-editor/src/example-code.ts

This file was deleted.

3 changes: 2 additions & 1 deletion packages/ink-editor/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import exampleCode from './example-code';
// See: https://github.com/webpack/webpack/issues/12900
import exampleCode from '../../../crates/contract/lib.txt!=!../../../crates/contract/lib.rs';
import { InkEditor, InkEditorProps } from './ink-editor';
export { exampleCode, InkEditor };
export type { InkEditorProps };
1 change: 1 addition & 0 deletions packages/ink-editor/src/module.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
declare module 'monaco-editor/esm/vs/basic-languages/rust/rust';
declare module '*.rs';
4 changes: 4 additions & 0 deletions packages/ink-editor/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ const webpackConfig = {
},
],
},
{
test: /\.txt$/,
type: 'asset/source',
},
],
},
plugins: [
Expand Down
4 changes: 3 additions & 1 deletion packages/playground/src/context/side-effects/load-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { MessageDispatch } from '../messages/reducer';
import { gistLoadRequest } from '@paritytech/ink-editor/api/gists';
import { GistCreateResponse } from '@paritytech/commontypes';
import qs from 'qs';
import exampleCode from '@paritytech/ink-editor/example-code';
// See: https://github.com/webpack/webpack/issues/12900
import exampleCode from '../../../../../crates/contract/lib.txt!=!../../../../../crates/contract/lib.rs';
import { GIST_LOAD_URL } from '~/env';

type Params = { id?: string };
Expand Down Expand Up @@ -67,6 +68,7 @@ export async function loadCode(state: State, dispatch: Dispatch): Promise<string

const params = parseParams(window.location.search.substring(1));
if (!params.id) {
console.log('!!!!!!', exampleCode);
return exampleCode;
}

Expand Down
1 change: 1 addition & 0 deletions packages/playground/src/module.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
declare module 'monaco-editor/esm/vs/basic-languages/rust/rust';
declare module '*.rs';
4 changes: 4 additions & 0 deletions packages/playground/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ const localConfig = {
},
],
},
{
test: /\.txt$/,
type: 'asset/source',
},
],
},
optimization: {
Expand Down