Comments (4)
On a related note I am interested in trying this out on my project but alongside this particular problem (we use src/
as an alias for source code and keep every import absolute), in addition our structure is a monorepo via yarn workspaces
- as such if I update file locations in one of the subpackages the other subpackages need to change their references to the shared repo as well. Probably a sufficiently separate issue to be its own ticket, but maybe if we could lock down some files/imports as the "public surface" of a package that might be useful too.
from destiny.
@osdiab Hi, what are you using to alias src/
? Typescript's aliases? We're trying to find every possible ways to tweak the js imports so Destiny would be able to resolve non-vanilla js imports (see #123) out of the box.
in addition our structure is a monorepo via yarn workspaces
This is already tracked in #70.
from destiny.
My company basically relies on baseUrl
to do it:
- for our api (
packages/api/
), we just set thebaseUrl
to.
at the project root, and restrict theinclude
field to["src"]
{
"extends": "./tsconfig.api.base.json",
"compilerOptions": {
// ...
"baseUrl": "."
},
"references": [{ "path": "../common/" }],
"include": ["src", "types"]
}
- for the api's tests (
packages/api/__tests__/
), it has its owntsconfig
that extends the API'stsconfig
, but includes the API itself as a project reference.
{
"extends": "../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"types": ["jest", "node"]
},
"references": [{ "path": "../" }, { "path": "../../common" }],
"include": ["./", "../types"]
}
- for our frontend web app (
packages/website/
), which usescreate-react-app
, we can only setbaseUrl
tosrc/
(thats a CRA limitation). So, we placed our code all inpackages/website/src/@app
and refer to web app code as@app/path/to/ReactComponent
.
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
// ...
"baseUrl": "./src",
},
"references": [{ "path": "../common" }],
"include": ["src"]
}
For imports internal to these packages, that covers our use case! EDIT: for imports across subpackages, ie from API to common package, we rely on yarn
workspaces, which routes imports to files via each subpackage's package.json
name
property - but I assume that might be harder to account for.
from destiny.
Thank you! I've added Yarn workspaces and TSC's baseUrl
to the list in #123.
from destiny.
Related Issues (20)
- Different folder structure results in Windows vs Linux: missing src folder HOT 3
- Wrong shared file location HOT 1
- Documentation on best/common way to integrate into a project HOT 1
- Incompatible with TypeScript projects HOT 6
- Markdown support
- remote.require() HOT 1
- Benchmarking Destiny on CI
- collapse top level index folder HOT 10
- Why use this project over webpack? HOT 4
- Dynamic Import Problem HOT 1
- Cannot find import .yml file in svelte import HOT 3
- Tests are failing in Windows HOT 3
- Support for Dart
- bug: file movement HOT 6
- Module with its leaf dependencies in same folder HOT 1
- Destiny folder depth limit
- Error in dynamic path imports HOT 1
- Feature request - Allow placing files being fractalized _inside_ the folder
- Alternatives to destiny (project seems abandoned) HOT 3
- Would this eslint rule help destiny? `single-export-per-file`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from destiny.