@@ -42,7 +42,11 @@ const compilerDir = path.join(__dirname, "..");
42
42
const compilerVersion = require ( path . join ( compilerDir , "package.json" ) ) . version ;
43
43
const assemblyDir = path . join ( projectDir , "assembly" ) ;
44
44
const tsconfigFile = path . join ( assemblyDir , "tsconfig.json" ) ;
45
- const tsconfigBase = path . relative ( assemblyDir , path . join ( compilerDir , "std" , "assembly.json" ) ) ;
45
+ let tsconfigBase = path . relative ( assemblyDir , path . join ( compilerDir , "std" , "assembly.json" ) ) ;
46
+ if ( / ^ ( \. \. [ / \\ ] ) * n o d e _ m o d u l e s [ / \\ ] a s s e m b l y s c r i p t [ / \\ ] / . test ( tsconfigBase ) ) {
47
+ // Use node resolution if the compiler is a normal dependency
48
+ tsconfigBase = "assemblyscript/std/assembly.json" ;
49
+ }
46
50
const entryFile = path . join ( assemblyDir , "index.ts" ) ;
47
51
const buildDir = path . join ( projectDir , "build" ) ;
48
52
const testsDir = path . join ( projectDir , "tests" ) ;
@@ -247,7 +251,7 @@ function ensureGitignore() {
247
251
}
248
252
249
253
function ensurePackageJson ( ) {
250
- console . log ( "- Making sure that 'package.json' contains the build commands..." )
254
+ console . log ( "- Making sure that 'package.json' contains the build commands..." ) ;
251
255
const entryPath = path . relative ( projectDir , entryFile ) . replace ( / \\ / g, "/" ) ;
252
256
const buildUntouched = "asc " + entryPath + " -b build/untouched.wasm -t build/untouched.wat --sourceMap --debug" ;
253
257
const buildOptimized = "asc " + entryPath + " -b build/optimized.wasm -t build/optimized.wat --sourceMap --optimize" ;
0 commit comments