-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: Add import path alias. #247
Conversation
type: 'ProfileRelationalCreateInput', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are changes that will end up in the created app after the initial commit (potentially from something like an eslint --fix
). So just made them here so there aren't uncommitted changes just after creating the app.
I.e. you create a bison app, it sets up your repo, builds the project, etc., you cd
into the project folder and git status
, you'll see some uncommitted changes.
@@ -41,7 +41,7 @@ | |||
"test:e2e": "cross-env DOTENV_CONFIG_PATH=.env.test ts-node -r dotenv/config $(yarn bin)/start-server-and-test 'yarn test:server' http://localhost:3001 'yarn cypress:run'", | |||
"test:e2e:local": "cross-env CYPRESS_LOCAL=true CYPRESS_BASE_URL=http://localhost:3000 cypress open", | |||
"test:server": "next start --port 3001", | |||
"ts-node": "ts-node-dev --project tsconfig.cjs.json", | |||
"ts-node": "ts-node-dev --project tsconfig.cjs.json -r tsconfig-paths/register", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what makes ts-node
work with the path alias. Without it, none of the scripts run with ts-node
would be able to use path aliases.
@@ -17,7 +17,11 @@ | |||
"sourceMap": true, | |||
"plugins": [{ "name": "nexus/typescript-language-service" }], | |||
"typeRoots": ["node_modules/@types", "types"], | |||
"rootDir": "." | |||
"rootDir": ".", | |||
"baseUrl": ".", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason tsconfig-paths/register
won't work without a baseUrl
set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the lead on this one! Only thing I think we should do is provide a blurb in the readme for bison users to understand our move to using alias'd paths.
@@ -24,6 +24,7 @@ We're always improving on this, and we welcome suggestions from the community! | |||
- Customizable [Hygen Templates](https://www.hygen.io/) to generate new files | |||
- Fully wired up login/signup pages with client and server-side validation. | |||
- Eslint pre-configured with [Echobind best practices](https://github.com/echobind/eslint-plugin-echobind) | |||
- Import path alias to the root project folder (`@/`) to avoid the need for long relative import paths. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfecto! Thanks for adding this.
Adds a
@/
path alias.Changes
ts-node
npm script to work with the path alias.Checklist