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

Commit 0e164fb

Browse files
author
Achim Schneider
authored
Merge pull request #468 from paritytech/read-example-from-rs
read example code from crate
2 parents 776bcf2 + d5aa98c commit 0e164fb

File tree

9 files changed

+17
-59
lines changed

9 files changed

+17
-59
lines changed

crates/sandbox/src/build_command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn build_execution_command() -> Vec<String> {
131131
"rm -rf {}/contract.* {}/metadata.json",
132132
target_dir, target_dir
133133
);
134-
let build_cmd = "cargo contract build --offline --skip-linting 2>&1".to_string();
134+
let build_cmd = "cargo contract build --offline 2>&1".to_string();
135135
let move_cmd = format!("mv {}/contract.contract {}", target_dir, DOCKER_OUTPUT);
136136

137137
let command = format!("{} && {} && {}", clean_cmd, build_cmd, move_cmd);

crates/sandbox/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub enum FormattingResult {
165165
// CONSTANTS
166166
// -------------------------------------------------------------------------------------------------
167167

168-
const DOCKER_PROCESS_TIMEOUT_HARD: Duration = Duration::from_secs(30);
168+
const DOCKER_PROCESS_TIMEOUT_HARD: Duration = Duration::from_secs(60);
169169

170170
// -------------------------------------------------------------------------------------------------
171171
// TRAIT IMPLEMENTATION

packages/ink-editor/src/example-code.ts

Lines changed: 0 additions & 55 deletions
This file was deleted.

packages/ink-editor/src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import exampleCode from './example-code';
1+
// See: https://github.com/webpack/webpack/issues/12900
2+
import exampleCode from '../../../crates/contract/lib.txt!=!../../../crates/contract/lib.rs';
23
import { InkEditor, InkEditorProps } from './ink-editor';
34
export { exampleCode, InkEditor };
45
export type { InkEditorProps };

packages/ink-editor/src/module.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
declare module 'monaco-editor/esm/vs/basic-languages/rust/rust';
2+
declare module '*.rs';

packages/ink-editor/webpack.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ const webpackConfig = {
4141
},
4242
],
4343
},
44+
{
45+
test: /\.txt$/,
46+
type: 'asset/source',
47+
},
4448
],
4549
},
4650
plugins: [

packages/playground/src/context/side-effects/load-code.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { MessageDispatch } from '../messages/reducer';
33
import { gistLoadRequest } from '@paritytech/ink-editor/api/gists';
44
import { GistCreateResponse } from '@paritytech/commontypes';
55
import qs from 'qs';
6-
import exampleCode from '@paritytech/ink-editor/example-code';
6+
// See: https://github.com/webpack/webpack/issues/12900
7+
import exampleCode from '../../../../../crates/contract/lib.txt!=!../../../../../crates/contract/lib.rs';
78
import { GIST_LOAD_URL } from '~/env';
89

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

6869
const params = parseParams(window.location.search.substring(1));
6970
if (!params.id) {
71+
console.log('!!!!!!', exampleCode);
7072
return exampleCode;
7173
}
7274

packages/playground/src/module.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
declare module 'monaco-editor/esm/vs/basic-languages/rust/rust';
2+
declare module '*.rs';

packages/playground/webpack.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ const localConfig = {
4444
},
4545
],
4646
},
47+
{
48+
test: /\.txt$/,
49+
type: 'asset/source',
50+
},
4751
],
4852
},
4953
optimization: {

0 commit comments

Comments
 (0)