File tree 3 files changed +15
-12
lines changed
3 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-scripts-rust" ,
3
- "version" : " 2.0.16 " ,
3
+ "version" : " 2.0.17 " ,
4
4
"description" : " Configuration and scripts for using Rust with Create React App" ,
5
5
"repository" : " thomashorrobin/create-react-app-rust" ,
6
6
"license" : " MIT" ,
65
65
"sass-loader" : " 7.1.0" ,
66
66
"style-loader" : " 0.23.0" ,
67
67
"terser-webpack-plugin" : " 1.1.0" ,
68
+ "toml-js" : " 0.0.8" ,
68
69
"url-loader" : " 1.1.1" ,
69
70
"wasm-loader" : " ^1.3.0" ,
70
71
"webpack" : " 4.19.1" ,
Original file line number Diff line number Diff line change 1
1
const execSync = require ( 'child_process' ) . execSync ;
2
2
const chalk = require ( 'chalk' ) ;
3
3
const commandExistsSync = require ( 'command-exists' ) . sync ;
4
+ const fs = require ( 'fs' ) ;
5
+ const toml = require ( 'toml-js' ) ;
4
6
5
7
module . exports = {
6
8
build : ( ) => {
@@ -23,6 +25,17 @@ module.exports = {
23
25
console . log ( `${ chalk . bold . red ( 'error installing wasm-gc' ) } please install manually ${ chalk . red ( 'cargo install wasm-gc' ) } ')` ) ;
24
26
}
25
27
}
28
+ execSync (
29
+ 'cargo init --lib' ,
30
+ { stdio : 'inherit' }
31
+ ) ;
32
+ fs . readFile ( 'Cargo.toml' , function ( err , data ) {
33
+ var cargo = toml . parse ( data ) ;
34
+ cargo . lib = { } ;
35
+ cargo . lib [ 'crate-type' ] = [ 'cdylib' ] ;
36
+ cargo . lib . path = 'src/App.rs' ;
37
+ fs . writeFile ( 'Cargo.toml' , toml . dump ( cargo ) , err => console . log ( err ) ) ;
38
+ } ) ;
26
39
execSync (
27
40
'rustup target add wasm32-unknown-unknown --toolchain nightly' ,
28
41
{ stdio : 'inherit' }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments