-
-
Notifications
You must be signed in to change notification settings - Fork 618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ink 3 ❤️ #311
Comments
Hello. I am very new to this library but I love it already! I am currently trying to migrate the ink-select-input and I am running into this issue:
If anyone has any thoughts as to why that would be a great help. |
@Eastonboy99 Fixed via #313. When you update to |
Pushed several more pre-releases, which:
Migrated these components today:
Also migrated Emoj to Ink 3 (sindresorhus/emoj#46). |
Migrated my CLI to v3 without much issue. Biggest migration is the Thanks for the update 🙏 Even text wrapping seems to work much better. |
Let me help you migrate some useful components to Ink 3. |
Published 3.0.0-5 with a fix for rendering text changes and exiting the app. Oh, and there's a new logo! |
Released in |
This might be more of a "Help me set up my babel config" question, but I can't seem to run Jest tests using Here's my {
"presets": ["@babel/env", "@babel/react", "@babel/preset-typescript"],
"plugins": ["@babel/transform-runtime"]
} Here's my test: import React from 'react'
import { render } from 'ink-testing-library'
import { App } from '../App'
describe('APP', () => {
it('returns the name of the game', () => {
// Arrange
const { lastFrame } = render(<App />)
// Assert
expect(lastFrame()).toMatchSnapshot()
})
}) And here's the app: import React from 'react'
import { render, Text } from 'ink'
export const App = () => {
return <Text>foo!</Text>
}
render(<App />) I get the following error:
Sorry if I'm missing something obvious. Love the project! ❤️ |
@thephilwells Huh, seems like Jest is patching the global Thanks for trying out Ink 3! |
Hey @thephilwells, I was wrong, testing in Jest seems to be fine -> vadimdemedes/ink-testing-library#13. Are you using the latest version of Jest? |
Jest's custom console does |
Hello, I was using the Ink There is this weird issue which I noticed, the Cli.tsx import React from 'react';
import { App } from './containers/App';
import { render } from 'ink';
import clear from 'clear';
const initialize = () => {
// Clear terminal
clear();
// Render the container
render(<App />);
}
initialize() App.tsx import React, { Component } from 'react';
import { Box, Text } from 'ink';
import BigText from 'ink-big-text';
interface Props {}
interface State {
counter: number
}
export class App extends Component<Props, State> {
state = {
counter: 0
}
constructor(props) {
super(props);
setInterval(() => {
this.setState({ counter: ++this.state.counter })
}, 100)
}
render() {
return (
<Box flexDirection="column">
<BigText colors={["#2196F3", "#212121"]} font="block" text="TEST CLI"/>
<Text bold>Welcome to Test CLI</Text>
<Text bold>Counter: {this.state.counter}</Text>
<Text bold>End</Text>
</Box>
);
}
} I used Windows Terminal with SSH. |
Hey @pepperkick, that looks odd, but I wasn't able to reproduce it on Mac with iTerm 2. I even sped it up to increment every 10ms instead of 100ms and it still wasn't flickering: I modified code a bit, I doubt that'll help it, but still: class App extends React.Component {
constructor(props) {
super(props);
this.state = {
counter: 0
};
}
render() {
return (
<Box flexDirection="column">
<BigText colors={['#2196F3', '#212121']} font="block" text="TEST CLI" />
<Text bold>Welcome to Test CLI</Text>
<Text bold>Counter: {this.state.counter}</Text>
<Text bold>End</Text>
</Box>
);
}
componentDidMount() {
this.timer = setInterval(() => {
this.setState(previousState => ({
counter: previousState.counter + 1
}));
}, 10);
}
componentWillUnmount() {
clearInterval(this.timer);
}
} |
@pepperkick Oh wait, are you running Ink somewhere else and you're SSHed into that machine? That would definitely explain the flickering, because there's latency and you're updating a screen quite often. Could you clarify your setup? Also, have you tried other terminal apps? |
@SimenB I think it could be something else in @thephilwells's setup, because I've tried running Ink inside Jest an it worked fine -> vadimdemedes/ink-testing-library#13. You are right though, I'll make sure to open an issue in Jest's repo if we confirm the root cause. |
Hey @vadimdemedes,
Yes, the application is running on another machine and I am connecting via SSH to that machine to view the output. My end application will be running over SSH most of the time.
I tried some other terminals, and it does seem like the issue is only on Windows Terminal over SSH. I will try some more scenarios and see if there are any more issues like this. This library is actually really awesome! |
Ink 3 is out! Read the full announcement at https://vadimdemedes.com/posts/ink-3 :) Thanks everyone for testing it out, reporting bugs and submitting PRs! I'm going to close this issue, but feel free to open new ones. |
OMG yes! I had to do this manually. Love that this is in core 🙏 |
I believe this is worth adding here so anyone else won't spend an hour for debugging. If you are seeing those |
Opening this umbrella issue for you folks to test drive pre-release of Ink 3 - https://github.com/vadimdemedes/ink/releases/tag/v3.0.0-0! Latest docs are in readme and you can install it via:
I haven't migrated any of the 3rd-party components to work with Ink 3 yet, but if you want to migrate a component or two, that's always greatly appreciated! Don't forget to release it as a major version and keep a link to previous docs for those who are still on Ink 2.
Let me know if there are any breaking changes that weren't described in the release notes above. Basically, if anything comes up, just post here and let's talk.
The text was updated successfully, but these errors were encountered: