Comments (10)
Can't you just setup your normal lerna project, then cd packages
, then npx typescript-starter
? What am I missing?
from typescript-starter.
FYI. I was trying to use this starter in my monorepo and bumped into some troubles along the way.
the biggest problem was that git treated the library as a submodule, which sometimes behaves nasty.(It took me some time before I discovered CI was failing because the CI service won’t pull the contents in submodule.)
Anyway, my current workflow for using this library in monorepo is
- run
npx typescript-starter my-sub-package
out side of my monorepo. - run
lerna import --flatten
to treat the package as a sub-package in monorepo. - tweek
package.json
formy-sub-package
and addcross-env CI=1
before runningava
(otherwiseava
might fail to pipe stdout tolerna
when I run something likelerna run test --stream
) - delete
.circleci/
and.github/
- change
tsconfig.json
to extend root leveltsconfig.json
(mostly for importing internal dependency usingbaseUrl
andpaths
, you don't need this if it has no internal dependency) - if it is going to be scoped package, do the following
- change
name
inpackage.json
to scoped stile (e.g.@my-namespace/my-sub-package
) - add
"publishConfig": {"access": "public"}
topackage.json
- delete
”config”: “commitizen”
from package.json and removecommitizen
from devDependency
- since I use
commitizen
withcz-lerna-changelog
in the root level
- delete
version
script andstandard-version
- since this conflicts with
lerna publish
. (It tries to rungit tag
more than twice and throws an error)
Hope this will help someone.
from typescript-starter.
I would love to help contribute this feature! Do the project maintainers feel like this issue appropriately identifies all of the feature requirements before I create a pull request?
from typescript-starter.
You might look at how google structures it's nodejs client libs:
https://github.com/GoogleCloudPlatform/google-cloud-node
I'm planning to reproduce a similar structure based on this project
from typescript-starter.
@Alxandr thanks for opening an issue!
I'm not really sure if this repo is the right place for demonstrating a monorepo project structure, but I'd be very open to reviewing a pull request for it. Right now the project is a single node module – did you have an idea of what else / how you'd like it to look as a monorepo?
(Also, thanks – I might need to consider Lerna for the project that inspired this starter.)
from typescript-starter.
No, well, if you ask me a monorepo should be the default nowdays. I originally did development primarily in .NET, and the fact that I have to create multiple repos in node is one of the big pain-points IMHO. Without having looked into it too much, I would guess that mainly you would have to move src
into packages/<module-name>/src
and create a new package.json
at that point, and mark the outer package.json as private and only contain dev-dependencies there.
from typescript-starter.
Now that typescript-starter
has a CLI, @cspotcode's method seems like the best way to do this.
There may be a way for this project to help a little more though, so I'll leave this open for now. Feedback/comments appreciated.
from typescript-starter.
That’d be great! PRs for this are definitely welcome. I don’t really have anything to add other than that it should be optional (so this project can still be used for non-monorepos). Otherwise, feel free to make it work how you want it to work 😄
Let me know if you have any trouble! (I’m happy to help with the tests.)
from typescript-starter.
Hey @bitjson
I looked over this project last weekend to provide a solution for this feature request. I have some questions after working on this project for the first time.
Testing was a little difficult due to manually updating snapshots. Is there a simple way to update the snapshot / hash tests quickly?
My primary point of discussion though is something I didn't expect which was that the project using most of its file contents for building the starter template (rather clever actually). It seems like the cleanest solution here is either segregating the files that are used for building the starter template and the files that are used by the project cli scripts. Another solution could involve moving the project to a mono-repository structure and using the same multi-use concept to support both a mono and multi repo starter template. Let me know your thoughts when you have a moment.
from typescript-starter.
Hey @josephmcasey, thanks for working on it!
While you're developing, you might want to just disable those snapshot tests – they serve to verify that a contributor has confirmed the CLI's output to be correct in each of the configurations. We can wait to update them until the new feature is ready to merge. (And then adding snapshots to confirm that the feature is working gives us a very strong guarantee that simple things like dependency updates don't change the output of the CLI.)
Once you're ready to update the hashes, you can confirm the the build is what you expected, then just copy the hash which the test expected and replace the old one for each modified file. It's a manual process because reviewing the output of each file is also a manual process.
I don't have a strong opinion yet on the best way to go about this. I would also be open to separating the CLI files more from the project files – this was just a simple and expedient way of getting things working.
Have your seen TypeScript 3's new project references? I imagine the best solution for this includes using that feature.
from typescript-starter.
Related Issues (20)
- How can I set up express server typescript-starter HOT 1
- An in-range update of codecov is breaking the build 🚨 HOT 4
- Project Status HOT 6
- node_modules/ava/index.d.ts:5:10 - error TS2339: Property 'observable' does not exist on type 'SymbolConstructor'. HOT 4
- Can't generate docs with circular type HOT 1
- AppVeyor breaks on Node.js v14 HOT 1
- Add support for a GitHub Actions test matrix
- Cannot find namespace 'WebAssembly' HOT 2
- error TS2307: Cannot find module './lib/hash' or its corresponding type declarations. HOT 1
- Cannot find types for node error when running `npm run watch:build` HOT 2
- error TS2688: Cannot find type definition file for 'node'. HOT 4
- How do I generate a nodejs application with this starter? HOT 2
- Why there is a dependency of @bitauth/libauth? HOT 2
- Unexpected end of JSON input Error HOT 1
- Peer dependency mismatch causes project creation to be broken
- The javascript module link redirects to "Laptoptalks..."
- Option to work with ESM (ES Module) only libraries like node-fetch
- `pnpm` support as package manager HOT 4
- @bitauth/libauth dependency in generated project
- New project has errors in node_modules HOT 1
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 typescript-starter.