Skip to content

Commit

Permalink
Fix two critical bug, updated ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
greatsquare0 committed Oct 22, 2024
1 parent 4a2a680 commit bae293c
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ jobs:
name: Checkout
uses: actions/checkout@v3

- id: setup-bun
name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- id: setup-pnpm
name: Setup pnpm
uses: pnpm/action-setup@v4
Expand Down
5 changes: 2 additions & 3 deletions __tests__/download_tweego.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,14 @@ describe('Tweego download and setup', () => {
expect(content[0]).toEqual(archiveName)
})

it('Should correctly unzip the archive', { timeout: 32000 }, async () => {
it('Should correctly unzip the archive', async () => {
await downloadTweego()
await extractTweego()
expect(existsSync(getTweegoBinariePath())).toEqual(true)
})

describe.todo(
'Should correctly download specified storyformats',
{ timeout: 99999 },
async () => {
let path = ''

Expand All @@ -83,7 +82,7 @@ describe('Tweego download and setup', () => {

rmSync(path, { recursive: true, force: true })
await downloadCustomStoryFormats()
}, 99999)
})

const cases = defaultConfig.setup!.storyFormats!.formats!

Expand Down
4 changes: 2 additions & 2 deletions __tests__/run_tweego.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Run Tweego', () => {
beforeEach(async () => {
viChdir(resolve(process.cwd(), `${nanoid(6)}/`))
await setupTweego()
}, 32000)
})

afterEach(() => {
rmSync(process.cwd(), { recursive: true, force: true })
Expand Down Expand Up @@ -82,7 +82,7 @@ describe('Run Tweego', () => {
}
)
}
}, 999999)
})

afterAll(() => {
rmSync(path, { recursive: true, force: true })
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tweenode",
"version": "0.2.2",
"version": "0.2.3",
"description": "A neat JS wrapper for Tweego",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
23 changes: 12 additions & 11 deletions src/handle_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,25 @@ export const loadConfig = async (
return defaultConfig as TweenodeConfig
}

const config = await import(configPath)
const imported = await import(configPath)

const config = imported.default
cache = config
return config
}

export const defaultConfig: Partial<TweenodeConfig> = {
build: {
output: {
mode: 'string'
mode: 'string',
},
input: {
storyDir: ''
}
storyDir: '',
},
},
setup: {
tweegoBinaries: {
version: '2.1.1'
version: '2.1.1',
},
storyFormats: {
useTweegoBuiltin: false,
Expand All @@ -94,17 +95,17 @@ export const defaultConfig: Partial<TweenodeConfig> = {
version: '2.37.0',
local: false,
src: 'https://github.com/tmedwards/sugarcube-2/releases/download/v2.37.0/sugarcube-2.37.0-for-twine-2.1-local.zip',
createFolder: false
createFolder: false,
},
{
name: 'harlowe4-unstable',
version: '4.0.0',
src: 'https://twine2.neocities.org/harlowe4-unstable.js',
createFolder: true
}
]
}
}
createFolder: true,
},
],
},
},
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/run_tweego.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export class Tweenode {
try {
this.childProcess = spawn(this.tweegoBinariePath, args, {
detached: true,
env: {
...process.env,
TWEEGO_PATH: resolve(getTweenodeFolderPath(), 'storyformats'),
},
})
this.isRunning = true
} catch (error) {
Expand Down
2 changes: 2 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
setupFiles: ['./__tests__/vitest.setup.ts'],
testTimeout: process.platform == 'win32' ? 50000 : 10000,
hookTimeout: process.platform == 'win32' ? 50000 : 10000,
},
})

0 comments on commit bae293c

Please sign in to comment.