Gerenciamento de dependência de JavaScript

Gerenciamento de dependência de JavaScript



Olá! Meu nome é Slava Fomin, sou desenvolvedor líder da DomClick. Durante meus 16 anos de prática, estive na vanguarda do surgimento e desenvolvimento do JavaScript como padrão e ecossistema. Em nossa empresa, usamos JavaScript, em primeiro lugar, para desenvolvimento avançado de front-end e conseguimos experimentar um número bastante grande de diferentes tecnologias, ferramentas e abordagens, além de obter muitas fotos. O resultado desse trabalho meticuloso foi a experiência mais valiosa que quero compartilhar com você.



, , , . , , . , , .



, :



  • , .
  • .
  • semver .
  • , .
  • (resolving).
  • .
  • .
  • , .
  • lock- .
  • , .
  • , .
  • CI/CD.
  • .


, !



… , ; , , , , , , , …



, , -, , . , - , ?



-, - . , , , Angular, React, Express, Lodash, Webpack , .



JavaScript



« », ( jQuery) , . , : . , . .



, , . , , .



Node.js



- Node.js, , , JavaScript-, front-end , , SSR . , Node.js (Node Package Manager, npm), , JavaScript.



, ESM JavaScript : script . Node . CommonJS ( «/ JavaScript», CJS), - . Node (Node.js module resolution algorithm) , .





, Node.js , - JavaScript-.



: npm- — JavaScript. . .



, , , , npm registry. npm registry, registry.npmjs.org. npm registry ( ). , registry. ( npm).



npm.



, . , (, lodash), , (, webpack).



. , . , , , . , :





npm ls — , : HTTP- Express ( ) Lodash ( ). , debug 4 . deduped , npm ( ).



Node Unix, - , . , , . , node_modules, . , JavaScript :







? , , -: package.json. , :



  • , ,
  • ,
  • URL , URL git-, URL -,
  • ,
  • , ,
  • ,
  • ,
  • (scripts) ,
  • . (. ).


package.json.





, :



  • dependencies,
  • devDependencies,
  • peerDependencies,
  • optionalDependencies.


JSON-, , — , .



:



{
  "dependencies": {
    "lodash": "^4.17.15",
    "chalk": "~2.3",
    "debug": ">2 <4",
  },
}


.



dependencies



dependencies , . Node.js. - , import { get } from 'lodash', dependencies. , , .



devDependencies



devDependencies , , . , typescript, webpack, eslint . , .



peerDependencies



peerDependencies . , Webpack, peerDependencies webpack, .



, , , .



peerDependencies , , . , . , , Webpack, .



optionalDependencies



optionalDependencies , . , .



, , , try… require… catch.



front-end



. , Node.js, , , . , front-end .



- , npm- front-end , , : «» , node npm.



front-end . , front-end Node.js.



Node.js- , npm registry, , . dependencies .



front-end npm registry, () , , CDN. -, npm front-end , . private: true, , npm-registry. , . . «» .



front-end dependencies , , : dependencies , , , lodash, react, date-fns . ., devDependencies — , : webpack, eslint, @types . .



, , Node.js! , , , devDependencies. .





npm semver ( Semantic Versioning ( )).



, : (major) , (minor) patch-:





: 3.12.1.



, , , .



patch- , , .



minor- , , .



major- , API, , , , . CHANGELOG .





1.0.0, , 0.0.3 0.1.2, semver : .





JavaScript: , , . , semver, .






All Articles