Skip to content

Commit

Permalink
Merge pull request #21 from initia-labs/fix/build
Browse files Browse the repository at this point in the history
fix: build without src dir
  • Loading branch information
SeUkKim authored Dec 2, 2024
2 parents cbb624c + 1263194 commit 3537ae2
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 24 deletions.
9 changes: 9 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,13 @@ export default tseslint.config(
{
ignores: ['dist/**/*', '**/*.config.mjs', '**/*.config.js'],
},
{
files: ['test/**/*.ts'],
languageOptions: {
parserOptions: {
project: ['./tsconfig.eslint.json'],
},
},
},

)
5 changes: 0 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@ module.exports = {
testEnvironment: 'node',
preset: 'ts-jest',
roots: ['<rootDir>/test'],
moduleNameMapper: {
'^builder': '<rootDir>/src/builder.ts',
'^types$': '<rootDir>/src/types',
'^lib$': '<rootDir>/src/lib',
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@initia/builder.js",
"version": "0.2.4",
"version": "0.2.5",
"description": "The JavaScript Move Builder for Initia",
"license": "MIT",
"author": "Initia Foundation",
Expand All @@ -20,7 +20,7 @@
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"files": [
"dist/src",
"dist",
"library"
],
"engines": {
Expand Down
6 changes: 3 additions & 3 deletions src/builder.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/unbound-method */
import ref from '@eleccookie/ref-napi'
import path = require('path')
import * as path from 'path'
import { readFile } from 'fs/promises'
import { handleResponse, createRawErrMsg, libcompiler, libmovevm } from 'lib'
import { handleResponse, createRawErrMsg, libcompiler, libmovevm } from './lib'
import {
ByteSliceViewType,
FFIResult,
Expand All @@ -11,7 +11,7 @@ import {
compilerPayloadBcsType,
testOptBcsType,
TestOptions,
} from 'types'
} from './types'

export class MoveBuilder {
private readonly packagePath: string
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { FFIResult, BuildOptions, TestOptions } from 'types'
export { FFIResult, BuildOptions, TestOptions } from './types'
export * from './builder'
7 changes: 6 additions & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import ref from '@eleccookie/ref-napi'
import { UnmanagedVectorType, FFIResult, MethodType, ErrMsgStruct } from 'types'
import {
UnmanagedVectorType,
FFIResult,
MethodType,
ErrMsgStruct,
} from '../types'
import { Buffer } from 'buffer'

/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
UnmanagedVectorPtr,
ByteSliceViewType,
UnmanagedVectorType,
} from 'types'
} from '../types'

let compilerName: string
let movevmName: string
Expand Down
2 changes: 1 addition & 1 deletion test/build.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path'
import { readFile } from 'fs/promises'
import { MoveBuilder } from 'builder'
import { MoveBuilder } from '../src/builder'

describe('build move package', () => {
const contractDir = path.resolve(__dirname, 'contract/dummy')
Expand Down
2 changes: 1 addition & 1 deletion test/create.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path'
import { MoveBuilder } from 'builder'
import { MoveBuilder } from '../src/builder'

describe('create and clean new move package', () => {
const contractDir = path.resolve(__dirname, 'contract/new')
Expand Down
2 changes: 1 addition & 1 deletion test/script.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path'
import { readFile } from 'fs/promises'
import { MoveBuilder } from 'builder'
import { MoveBuilder } from '../src/builder'

describe('build script and decode', () => {
const contractDir = path.resolve(__dirname, 'contract/script')
Expand Down
2 changes: 1 addition & 1 deletion test/test.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path'
import { MoveBuilder } from 'builder'
import { MoveBuilder } from '../src/builder'

describe('test move package', () => {
const contractDir = path.resolve(__dirname, 'contract/simple')
Expand Down
5 changes: 5 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["src", "test/**/*.ts"],
"exclude": ["node_modules"]
}
17 changes: 12 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@
"skipLibCheck": true,
"strictNullChecks": true,
"sourceMap": true,
"baseUrl": "src",
"sourceRoot": "src",
"outDir": "dist",
"outDir": "./dist",
"rootDir": "src",
"baseUrl": "./",
"typeRoots": [
"src/types",
"node_modules/@types"
]
}
],
"paths": {
"lib": ["lib/index"],
"types": ["types/index"],
"*": ["*"]
},
},
"include": ["src"],
"exclude": ["node_modules","test"]
}

0 comments on commit 3537ae2

Please sign in to comment.