In the early modern period, the rapid expansion of army sizes drastically increased the number of men rulers needed to arm, usually with muskets; how were the actual guns manufactured before industrial technology and organization methods? Was a town gunsmith as ubiquitous as the town butcher or cooper or cobbler, or did you have large arms companies producing them in batches?
In the cases of colonial America, firearms were a sort of "kit" production, like what modern AR markets are like. Some smiths were able to manufacture their own locks (the action, in this era flintlock muskets were more common than wheellock muskets) while some would order in a prefabricated lock, typically from Britain. If you could create a reusable cast to produce a lock, then you could churn out more muskets. Barrels were not rifled, so the smith would flatten out iron or steel for the barrel, heat it, and bend the barrel blank around a rod or hammer out the right shape before heating the seam to seal it. Finally, the gunsmith also had to have woodworking skills, as they would then assemble the stock, chassis, and hand guards for the maker for final assembly. Once the musket was put together, barrel bands were added to keep the barrel and wood from separating.
So for "mass production" purposes, as each piece had to be fitted and parts weren't necessarily interchangeable, you were more likely to have a smith make all the locks, the barrel, the wood body, and the bands to assemble a rifle in one shop than have many working together in an assembly line.
For pre-cast actions (such as those imported from Germany or England), life was a little simpler. Instead of having to cast a lock for each firearm, the smith could focus on fitting the barrel and stock to an action. By the US Civil War when percussion caps were in common usage, the flint was replaced with a solid hammer and the steel (which flint struck across to create a shower of sparks) was replaced by a nipple to direct the percussion cap's ignition into the flash pan. Because this conversion was fairly simple, it was very easy for a gunsmith to take an old flintlock and make a new hammer and nipple, leaving the remainder of the rifle intact.
In respect to the European world, most muskets and arms would come from state owned factories that employed people to manufacture guns. This is best reflected in the French musket, known as the Charlieville simply from the fact that the muskets were made in the Royal armory at Charileville.
These muskets would be produced in batches with tens of thousands being made every year per royal foundry. As well as other weapons such as swords, pistols, and artillery guns. By the 18th century, arms manufacturing became a state run business.