├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .travis.yml ├── COLLABORATORS.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── assets ├── images │ └── Workshopper screen.png ├── registry-update │ └── store │ │ └── @linclark │ │ └── pkg │ │ ├── package.json │ │ └── pkg-1.0.3.tgz └── registry │ └── store │ ├── @linclark │ └── pkg │ │ ├── package.json │ │ └── pkg-1.0.2.tgz │ └── wrappy │ ├── package.json │ └── wrappy-1.0.1.tgz ├── i18n ├── en.json ├── es.json ├── fr.json ├── ja.json ├── ko.json └── zh-cn.json ├── index.js ├── lib ├── _config.yaml └── registry.js ├── menu.json ├── package.json ├── problems ├── 00-install-npm │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ ├── problem.zh-cn.txt │ ├── skip.en.txt │ ├── skip.es.txt │ ├── skip.fr.txt │ ├── skip.ja.txt │ ├── skip.ko.txt │ └── skip.zh-cn.txt ├── 01-dev-environment │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ ├── problem.zh-cn.txt │ ├── success.en.txt │ ├── success.es.txt │ ├── success.fr.txt │ ├── success.ja.txt │ ├── success.ko.txt │ └── success.zh-cn.txt ├── 02-login │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ └── problem.zh-cn.txt ├── 03-start-a-project │ ├── continue.en.txt │ ├── continue.es.txt │ ├── continue.fr.txt │ ├── continue.ja.txt │ ├── continue.ko.txt │ ├── continue.zh-cn.txt │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ ├── problem.zh-cn.txt │ ├── suggestion.en.txt │ ├── suggestion.es.txt │ ├── suggestion.fr.txt │ ├── suggestion.ja.txt │ ├── suggestion.ko.txt │ └── suggestion.zh-cn.txt ├── 04-install-a-module │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ └── problem.zh-cn.txt ├── 05-listing-dependencies │ ├── continue.en.txt │ ├── continue.es.txt │ ├── continue.fr.txt │ ├── continue.ja.txt │ ├── continue.ko.txt │ ├── continue.zh-cn.txt │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ └── problem.zh-cn.txt ├── 06-npm-test │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ └── problem.zh-cn.txt ├── 07-package-niceties │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ └── problem.zh-cn.txt ├── 08-publish │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ ├── problem.zh-cn.txt │ ├── success.en.txt │ ├── success.es.txt │ ├── success.fr.txt │ ├── success.ja.txt │ ├── success.ko.txt │ └── success.zh-cn.txt ├── 09-version │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ └── problem.zh-cn.txt ├── 10-publish-again │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ └── problem.zh-cn.txt ├── 11-dist-tag │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ ├── problem.zh-cn.txt │ ├── success.en.txt │ ├── success.es.txt │ ├── success.fr.txt │ ├── success.ja.txt │ ├── success.ko.txt │ └── success.zh-cn.txt ├── 12-dist-tag-removal │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ ├── problem.zh-cn.txt │ ├── success.en.txt │ ├── success.es.txt │ ├── success.fr.txt │ ├── success.ja.txt │ ├── success.ko.txt │ └── success.zh-cn.txt ├── 13-outdated │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ ├── problem.zh-cn.txt │ ├── success.en.txt │ ├── success.es.txt │ ├── success.fr.txt │ ├── success.ja.txt │ ├── success.ko.txt │ └── success.zh-cn.txt ├── 14-update │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ └── problem.zh-cn.txt ├── 15-rm │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ ├── problem.zh-cn.txt │ ├── success.en.txt │ ├── success.es.txt │ ├── success.fr.txt │ ├── success.ja.txt │ ├── success.ko.txt │ └── success.zh-cn.txt └── 16-finale │ ├── index.js │ ├── problem.en.txt │ ├── problem.es.txt │ ├── problem.fr.txt │ ├── problem.ja.txt │ ├── problem.ko.txt │ ├── problem.zh-cn.txt │ ├── success.en.txt │ ├── success.es.txt │ ├── success.fr.txt │ ├── success.ja.txt │ ├── success.ko.txt │ └── success.zh-cn.txt └── workshop-npmrc /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | registry.pid 2 | test 3 | node_modules -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | script: 2 | - "npm test" 3 | 4 | language: node_js 5 | 6 | node_js: 7 | - "node" 8 | 9 | sudo: false 10 | cache: 11 | directories: 12 | - node_modules 13 | -------------------------------------------------------------------------------- /COLLABORATORS.md: -------------------------------------------------------------------------------- 1 | # Collaborators 2 | - [isaacs](https://github.com/isaacs) 3 | - [linclark](https://github.com/linclark) 4 | - [pathogen-](https://github.com/pathogen-) 5 | - [pippinlee](https://github.com/pippinlee) 6 | - [ashleygwilliams](https://github.com/ashleygwilliams) 7 | - [yashdeeph709](https://github.com/yashdeeph709) 8 | - [zeke](https://github.com/zeke) 9 | - [mirandaio](https://github.com/mirandaio) 10 | - [emilabraham](https://github.com/emilabraham) 11 | - [johnbrett](https://github.com/johnbrett) 12 | - [petert82](https://github.com/petert82) 13 | - [martinheidegger](https://github.com/martinheidegger) 14 | - [watilde](https://github.com/watilde) 15 | - [bengl](https://github.com/bengl) 16 | - [cakenggt](https://github.com/cakenggt) 17 | - [erictleung](https://github.com/erictleung) 18 | - [llkats](https://github.com/llkats) 19 | - [johndeyrup](https://github.com/johndeyrup) 20 | - [antosan](https://github.com/antosan) 21 | - [zkat](https://github.com/zkat) 22 | - [zucchinidev](https://github.com/zucchinidev) 23 | - [stefanmaric](https://github.com/stefanmaric) 24 | - [daudich](https://github.com/daudich) 25 | - [cedced19](https://github.com/cedced19) 26 | - [ungoldman](https://github.com/ungoldman) 27 | - [EmmaRamirez](https://github.com/EmmaRamirez) 28 | - [schellingerhout](https://github.com/schellingerhout) 29 | - [eunsucking](https://github.com/eunsucking) 30 | - [yous](https://github.com/yous) 31 | - [marocchino](https://github.com/marocchino) 32 | - [MJayJang](https://github.com/MJayJang) -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Code contributions are welcome and highly encouraged! For instructions on and help with creating a great pull request, please read the [workshopper contributing document](https://github.com/workshopper/org/blob/master/CONTRIBUTING.md). 4 | 5 | If you have questions about contributing, please create an issue. 6 | 7 | ## Lead Maintainers 8 | 9 | The role of lead maintainers is to triage and categorize issues, answer questions about contributing to the repository, review and give feedback on PRs, and maintain the quality of a workshopper's codebase and repository. 10 | 11 | [Current Lead Maintainers](https://github.com/orgs/workshopper/teams/how-to-npm-leads) 12 | 13 | ### Volunteer 14 | 15 | Submitting many PRs? Please volunteer to lead this repository! Lead maintainers are selected in the philosophy of [Open Open Source](http://openopensource.org/): 16 | 17 | > Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter and Contributors 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 15 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # how-to-npm 2 | [![Build Status](https://travis-ci.org/workshopper/how-to-npm.svg?branch=master)](https://travis-ci.org/workshopper/how-to-npm) 3 | [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/workshopper/how-to-npm?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) 5 | 6 | A module to teach you how to module. 7 | 8 | ## PREREQUISITES 9 | 10 | To use this project, you'll need NodeJS. Visit http://www.nodejs.org to 11 | download and learn more! 12 | 13 | ## USAGE 14 | 15 | ``` 16 | npm i -g how-to-npm 17 | how-to-npm 18 | ``` 19 | 20 | ![Workshopper screen](assets/images/Workshopper%20screen.png) 21 | 22 | This will walk you through the basics of setting up a working 23 | environment, installing dependencies, logging into npm, publishing a 24 | module, and so on, all from the safety of your own laptop. 25 | 26 | ## OPEN OPEN SOURCE 27 | 28 | This is an [open open source project]. Individuals making significant 29 | and valuable contributions are given commit-access to the project to 30 | contribute as they see fit. 31 | 32 | [open open source project]: http://openopensource.org/ 33 | -------------------------------------------------------------------------------- /assets/images/Workshopper screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workshopper/how-to-npm/3b1d8cee8966a106f001570ee23a9d6604364c39/assets/images/Workshopper screen.png -------------------------------------------------------------------------------- /assets/registry-update/store/@linclark/pkg/package.json: -------------------------------------------------------------------------------- 1 | {"_id":"@linclark/pkg","_rev":"4-6e4f29c8caa5d7a61ba60df317d48ef1","name":"@linclark/pkg","description":"An empty package for the how-to-npm workshopper to use.","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"@linclark/pkg","version":"1.0.0","description":"An empty package for the how-to-npm workshopper to use.","author":{"name":"Lin Clark"},"license":"ISC","_id":"@linclark/pkg@1.0.0","scripts":{},"_shasum":"c741209d9f8e959168f4a698c6d569212054db7c","_from":".","_npmVersion":"2.9.1","_nodeVersion":"0.10.35","_npmUser":{"name":"linclark","email":"lin.w.clark@gmail.com"},"dist":{"shasum":"c741209d9f8e959168f4a698c6d569212054db7c","tarball":"http://registry.npmjs.org/@linclark/pkg/-/pkg-1.0.0.tgz"},"maintainers":[{"name":"linclark","email":"lin.w.clark@gmail.com"}],"directories":{}},"1.0.1":{"name":"@linclark/pkg","version":"1.0.1","description":"An empty package for the how-to-npm workshopper to use.","author":{"name":"Lin Clark"},"license":"ISC","_id":"@linclark/pkg@1.0.1","scripts":{},"_shasum":"2f10c9ae04e61a7efa9fb43097352808321705a0","_from":".","_npmVersion":"2.9.1","_nodeVersion":"0.10.35","_npmUser":{"name":"linclark","email":"lin.w.clark@gmail.com"},"dist":{"shasum":"2f10c9ae04e61a7efa9fb43097352808321705a0","tarball":"http://registry.npmjs.org/@linclark/pkg/-/pkg-1.0.1.tgz"},"maintainers":[{"name":"linclark","email":"lin.w.clark@gmail.com"}],"directories":{}},"1.0.2":{"name":"@linclark/pkg","version":"1.0.2","description":"An empty package for the how-to-npm workshopper to use.","main":"index.js","author":{"name":"Lin Clark"},"license":"ISC","_id":"@linclark/pkg@1.0.2","scripts":{},"_shasum":"d031778d174e04874a2c8eaba5928898a1d50292","_from":".","_npmVersion":"2.9.1","_nodeVersion":"0.10.35","_npmUser":{"name":"linclark","email":"lin.w.clark@gmail.com"},"dist":{"shasum":"d031778d174e04874a2c8eaba5928898a1d50292","tarball":"http://registry.npmjs.org/@linclark/pkg/-/pkg-1.0.2.tgz"},"maintainers":[{"name":"linclark","email":"lin.w.clark@gmail.com"}],"directories":{}},"1.0.3":{"name":"@linclark/pkg","version":"1.0.3","description":"An empty package for the how-to-npm workshopper to use.","main":"index.js","author":{"name":"Lin Clark"},"license":"ISC","_id":"@linclark/pkg@1.0.3","scripts":{},"_shasum":"10522cbf65290707c61cb5d66ad18221c8a40db8","_from":".","_npmVersion":"2.9.1","_nodeVersion":"0.10.35","_npmUser":{"name":"linclark","email":"lin.w.clark@gmail.com"},"dist":{"shasum":"10522cbf65290707c61cb5d66ad18221c8a40db8","tarball":"http://registry.npmjs.org/@linclark/pkg/-/pkg-1.0.3.tgz"},"maintainers":[{"name":"linclark","email":"lin.w.clark@gmail.com"}],"directories":{}}},"readme":"ERROR: No README data found!","maintainers":[{"name":"linclark","email":"lin.w.clark@gmail.com"}],"time":{"modified":"2015-05-21T20:33:33.857Z","created":"2015-05-21T16:34:50.033Z","1.0.0":"2015-05-21T16:34:50.033Z","1.0.1":"2015-05-21T16:36:33.580Z","1.0.2":"2015-05-21T20:16:45.507Z","1.0.3":"2015-05-21T20:33:33.857Z"},"author":{"name":"Lin Clark"},"license":"ISC","readmeFilename":"","_attachments":{}} 2 | -------------------------------------------------------------------------------- /assets/registry-update/store/@linclark/pkg/pkg-1.0.3.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workshopper/how-to-npm/3b1d8cee8966a106f001570ee23a9d6604364c39/assets/registry-update/store/@linclark/pkg/pkg-1.0.3.tgz -------------------------------------------------------------------------------- /assets/registry/store/@linclark/pkg/package.json: -------------------------------------------------------------------------------- 1 | {"_id":"@linclark/pkg","_rev":"3-6b1588cc0c82adb7a1dd3edaa5b24d92","name":"@linclark/pkg","description":"An empty package for the how-to-npm workshopper to use.","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@linclark/pkg","version":"1.0.0","description":"An empty package for the how-to-npm workshopper to use.","author":{"name":"Lin Clark"},"license":"ISC","_id":"@linclark/pkg@1.0.0","scripts":{},"_shasum":"c741209d9f8e959168f4a698c6d569212054db7c","_from":".","_npmVersion":"2.9.1","_nodeVersion":"0.10.35","_npmUser":{"name":"linclark","email":"lin.w.clark@gmail.com"},"dist":{"shasum":"c741209d9f8e959168f4a698c6d569212054db7c","tarball":"http://registry.npmjs.org/@linclark/pkg/-/pkg-1.0.0.tgz"},"maintainers":[{"name":"linclark","email":"lin.w.clark@gmail.com"}],"directories":{}},"1.0.1":{"name":"@linclark/pkg","version":"1.0.1","description":"An empty package for the how-to-npm workshopper to use.","author":{"name":"Lin Clark"},"license":"ISC","_id":"@linclark/pkg@1.0.1","scripts":{},"_shasum":"2f10c9ae04e61a7efa9fb43097352808321705a0","_from":".","_npmVersion":"2.9.1","_nodeVersion":"0.10.35","_npmUser":{"name":"linclark","email":"lin.w.clark@gmail.com"},"dist":{"shasum":"2f10c9ae04e61a7efa9fb43097352808321705a0","tarball":"http://registry.npmjs.org/@linclark/pkg/-/pkg-1.0.1.tgz"},"maintainers":[{"name":"linclark","email":"lin.w.clark@gmail.com"}],"directories":{}},"1.0.2":{"name":"@linclark/pkg","version":"1.0.2","description":"An empty package for the how-to-npm workshopper to use.","main":"index.js","author":{"name":"Lin Clark"},"license":"ISC","_id":"@linclark/pkg@1.0.2","scripts":{},"_shasum":"d031778d174e04874a2c8eaba5928898a1d50292","_from":".","_npmVersion":"2.9.1","_nodeVersion":"0.10.35","_npmUser":{"name":"linclark","email":"lin.w.clark@gmail.com"},"dist":{"shasum":"d031778d174e04874a2c8eaba5928898a1d50292","tarball":"http://registry.npmjs.org/@linclark/pkg/-/pkg-1.0.2.tgz"},"maintainers":[{"name":"linclark","email":"lin.w.clark@gmail.com"}],"directories":{}}},"readme":"ERROR: No README data found!","maintainers":[{"name":"linclark","email":"lin.w.clark@gmail.com"}],"time":{"modified":"2015-05-21T20:16:45.507Z","created":"2015-05-21T16:34:50.033Z","1.0.0":"2015-05-21T16:34:50.033Z","1.0.1":"2015-05-21T16:36:33.580Z","1.0.2":"2015-05-21T20:16:45.507Z"},"author":{"name":"Lin Clark"},"license":"ISC","readmeFilename":"","_attachments":{}} 2 | -------------------------------------------------------------------------------- /assets/registry/store/@linclark/pkg/pkg-1.0.2.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workshopper/how-to-npm/3b1d8cee8966a106f001570ee23a9d6604364c39/assets/registry/store/@linclark/pkg/pkg-1.0.2.tgz -------------------------------------------------------------------------------- /assets/registry/store/wrappy/package.json: -------------------------------------------------------------------------------- 1 | {"_id":"wrappy","_rev":"4-76cc20c0663a83245743762dbe477eb0","name":"wrappy","description":"Callback wrapping utility","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"wrappy","version":"1.0.0","description":"Callback wrapping utility","main":"wrappy.js","directories":{"test":"test"},"dependencies":{},"devDependencies":{"tap":"^0.4.12"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"https://github.com/npm/wrappy"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","bugs":{"url":"https://github.com/npm/wrappy/issues"},"homepage":"https://github.com/npm/wrappy","gitHead":"2a0cf2a39be2ebb4a53f2f87db739d98f2a5ebc5","_id":"wrappy@1.0.0","_shasum":"8aae4fc6b4cd6be32a4553985bcf32b3ee131e4e","_from":".","_npmVersion":"2.0.0","_nodeVersion":"0.10.31","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"dist":{"shasum":"8aae4fc6b4cd6be32a4553985bcf32b3ee131e4e","tarball":"http://localhost:15443/wrappy/-/wrappy-1.0.0.tgz"}},"1.0.1":{"name":"wrappy","version":"1.0.1","description":"Callback wrapping utility","main":"wrappy.js","directories":{"test":"test"},"dependencies":{},"devDependencies":{"tap":"^0.4.12"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"https://github.com/npm/wrappy"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","bugs":{"url":"https://github.com/npm/wrappy/issues"},"homepage":"https://github.com/npm/wrappy","gitHead":"006a8cbac6b99988315834c207896eed71fd069a","_id":"wrappy@1.0.1","_shasum":"1e65969965ccbc2db4548c6b84a6f2c5aedd4739","_from":".","_npmVersion":"2.0.0","_nodeVersion":"0.10.31","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"dist":{"shasum":"1e65969965ccbc2db4548c6b84a6f2c5aedd4739","tarball":"http://localhost:15443/wrappy/-/wrappy-1.0.1.tgz"}}},"readme":"# wrappy\u000a\u000aCallback wrapping utility\u000a\u000a## USAGE\u000a\u000a```javascript\u000avar wrappy = require(\"wrappy\")\u000a\u000a// var wrapper = wrappy(wrapperFunction)\u000a\u000a// make sure a cb is called only once\u000a// See also: http://npm.im/once for this specific use case\u000avar once = wrappy(function (cb) {\u000a var called = false\u000a return function () {\u000a if (called) return\u000a called = true\u000a return cb.apply(this, arguments)\u000a }\u000a})\u000a\u000afunction printBoo () {\u000a console.log('boo')\u000a}\u000a// has some rando property\u000aprintBoo.iAmBooPrinter = true\u000a\u000avar onlyPrintOnce = once(printBoo)\u000a\u000aonlyPrintOnce() // prints 'boo'\u000aonlyPrintOnce() // does nothing\u000a\u000a// random property is retained!\u000aassert.equal(onlyPrintOnce.iAmBooPrinter, true)\u000a```\u000a","maintainers":[{"name":"isaacs","email":"i@izs.me"}],"time":{"modified":"2014-09-18T23:13:15.838Z","created":"2014-09-18T22:59:23.410Z","1.0.0":"2014-09-18T22:59:23.410Z","1.0.1":"2014-09-18T23:13:15.838Z"},"homepage":"https://github.com/npm/wrappy","repository":{"type":"git","url":"https://github.com/npm/wrappy"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"bugs":{"url":"https://github.com/npm/wrappy/issues"},"license":"ISC","readmeFilename":"README.md","_attachments":{}} 2 | -------------------------------------------------------------------------------- /assets/registry/store/wrappy/wrappy-1.0.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workshopper/how-to-npm/3b1d8cee8966a106f001570ee23a9d6604364c39/assets/registry/store/wrappy/wrappy-1.0.1.tgz -------------------------------------------------------------------------------- /i18n/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "install-npm": { 3 | "verifying": "verifying that npm is installed...", 4 | "missing": "It looks like npm is not installed.", 5 | "npm-problem": "Uh oh! npm had a problem!", 6 | "version-verified": "You have version {{version}} installed. Great!\nNow let's see what the latest version is... wait for it...", 7 | "latest-version": "The latest npm is: {{version}}", 8 | "upgrade": "You have version {{version}}, but the latest is {{latest}}\nRun `npm install npm -g` to upgrade it\n(You can also just skip this if you want)", 9 | "success": "Congratulations!\nYou have a recent version of npm installed!" 10 | }, 11 | "dev-environment": { 12 | "err_workshopper": "It looks like you are in the root of the workshopper.", 13 | "err_home": "It looks like you are in your home directory.", 14 | "hint": "That is not wise. Please make a new dir, and use that.", 15 | "no_package": "Seems like the `package.json` is missing. Did you run `npm init`?" 16 | }, 17 | "login": { 18 | "whoami_err": "Uh oh!\nIt looks like something went wrong", 19 | "logged_out": "Hm... I don't see a login here\nDid you run `npm adduser` to create the account?", 20 | "success": "Congratulations, {{user}}!\nYou are the proud owner of an imaginary new npm account!\nUse it wisely. Never in anger. Always for the Good.\n\nWith this sweet power comes much responsibility, which is\nsufficiently different from Spiderman's thing that Marvel\nhopefully won't sue us.\n\nExcelsior!" 21 | }, 22 | "start-a-project": { 23 | "no_package": "No package.json found.\nPlease run `npm init` in your working directory.", 24 | "success": "Congratulations!\nYou created a project! View the package.json file to see it.", 25 | "extra_credit": "EXTRA CREDIT! Nicely done." 26 | }, 27 | "install-a-module": { 28 | "error": "Uh oh! Looks like it didn't install right.\nThe error I got was: \n{{{error}}}\nMake sure you use the `npm install @linclark/pkg` command\nto install the `@linclark/pkg` module.", 29 | "success": "Congratulations! You installed it." 30 | }, 31 | "listing-dependencies": { 32 | "usage": "Please run:\n`how-to-npm verify OK` if everything is ok,\nor:\n`how-to-npm verify NOT OK` otherwise.", 33 | "ok_not": "Sorry, no. Everything is not ok!\nTry running `npm ls` and viewing the error.", 34 | "not_ok_not": "Hmm...\nWell, there may indeed be a lot wrong with the world,\nbut your package.json and node_modules folder are fine.", 35 | "success": "Looks like you fixed the problem. Fantastic!\nNote that `npm ls` is a lot calmer now." 36 | }, 37 | "npm-test": { 38 | "section_missing": "Oops! You don't have a `scripts.test` section in your\npackage.json file. Edit it, and try again.", 39 | "running": "Running your test script...", 40 | "running_done": "...done!", 41 | "error": "Uh oh! The test failed!\nTry creating a test that actually works.", 42 | "success": "Congratulations! You wrote a test that passes!\nWriting a test that is actually GOOD is left for another time." 43 | }, 44 | "package-niceties": { 45 | "problem": "Not quite!\nThere's still a problem to fix.", 46 | "error": "Uh oh!\nIt looks like something went wrong", 47 | "success": "Looking sharp!\nA package without a readme and some metadata is like a\nbunch of JavaScript without instructions or git repo links." 48 | }, 49 | "publish": { 50 | "error": "Uh oh!\nIt looks like you didn't successfully publish the\n {{name}}\npackage. Try again!" 51 | }, 52 | "version": { 53 | "invalid_semver": "Looks like your package.json has an invalid version!\nUse `npm help semver` to learn more about version numbers\nYour current version number is: {{version}}\n", 54 | "old_version": "Uh oh!\nThe version is still {{version}}\nCheck `npm help version` for a handy util to do this.", 55 | "success": "Great job!\nRun `how-to-npm` for the next exciting challenge!" 56 | }, 57 | "publish-again": { 58 | "not_republished": "Whoops!\nLooks like you did not publish the package again\nTry running `npm publish` and then verifying again.", 59 | "current_missing": "Hmm... I see that you published more than once, but\nthe current version ({{version}}) is not in the set.\nHere's what I see in there:\n{{{found}}}\nTry publishing again!", 60 | "success": "Wow! You are well on your way to becoming a regular\nTJames \"Substack\" Halidaychuk! There's no stopping you!\nRun `how-to-npm` to go to the next step." 61 | }, 62 | "dist-tag": { 63 | "success": "Uh oh, looks like you still only have a single dist-tag.\nUse `npm help dist-tag` to learn how to add another one." 64 | }, 65 | "dist-tag-removal": { 66 | "too_many": "Uh oh, looks like you have some extra dist-tags there.\nUse `npm help dist-tag` to learn how to remove them.", 67 | "version_mismatch": "Oops! Your \"latest\" tag still points at the most recent\nrelease, {{version}}.\nPoint that somewhere else, and re-run `how-to-npm verify`\n\nUse `npm help dist-tag` to learn more about how to do it." 68 | }, 69 | "outdated": { 70 | "no_package": "Run `how-to-npm verify PKG` but replace `PKG` with the name\nof the package that is outdated", 71 | "wrong_package": "Nope, it's not {{{pkg}}}. Try again!" 72 | }, 73 | "update": { 74 | "outdated": "Oops! You are still using the outdated version!", 75 | "success": "Awesome! You're up to date!\nRun `how-to-npm` to move on to the next exercise" 76 | }, 77 | "rm": { 78 | "dependencies_left": "Looks like there are some deps still hanging around", 79 | "package_json_left": "You removed the files, but not the entries in package.json" 80 | }, 81 | "finale": { 82 | "todo": "It looks like you still have more work to do. Finish\nthe following exercises before you can start this:" 83 | }, 84 | "error": { 85 | "not_setup": "Looks like you are not ready for this one yet!\nGo back to the `01 Dev Environment` lesson to set up\nyour working directory.", 86 | "wrong_folder": "Uh oh!\nIt looks like you are in the wrong folder.\nPlease cd into {{cwd}}\nand then try again'" 87 | }, 88 | "exercise": { 89 | "00 Install npm": "00 Install npm", 90 | "01 Dev Environment": "01 Dev Environment", 91 | "02 Login": "02 Login", 92 | "03 Start A Project": "03 Start A Project", 93 | "04 Install A Module": "04 Install A Module", 94 | "05 Listing Dependencies": "05 Listing Dependencies", 95 | "06 npm Test": "06 npm Test", 96 | "07 Package Niceties": "07 Package Niceties", 97 | "08 Publish": "08 Publish", 98 | "09 Version": "09 Version", 99 | "10 Publish Again": "10 Publish Again", 100 | "11 Dist Tag": "11 Dist Tag", 101 | "12 Dist Tag Removal": "12 Dist Tag Removal", 102 | "13 Outdated": "13 Outdated", 103 | "14 Update": "14 Update", 104 | "15 Rm": "15 Rm", 105 | "16 Finale": "16 Finale" 106 | }, 107 | "menu": { 108 | "reset-registry": "RESET REGISTRY" 109 | }, 110 | "reset": "Successfully reset registry" 111 | } 112 | -------------------------------------------------------------------------------- /i18n/es.json: -------------------------------------------------------------------------------- 1 | { 2 | "install-npm": { 3 | "verifying": "verificando que npm está instalado...", 4 | "missing": "Parece que npm no está instalado.", 5 | "npm-problem": "¡Ups! npm tuvo un problema!", 6 | "version-verified": "Tienes la versión {{version}} instalada. ¡Bien!\nAhora veamos cuál es la versión más reciente... dame un momento...", 7 | "latest-version": "La version más reciente de npm es: {{version}}.", 8 | "upgrade": "Tu versión actual es {{version}}, pero la más reciente es {{latest}}.\nEjecuta `npm install npm -g` para traerla al día.\n(Puedes saltar este paso si quieres)", 9 | "success": "¡Felicidades!\n¡Tienes una versión reciente de npm instalada!" 10 | }, 11 | "dev-environment": { 12 | "err_workshopper": "Parece que estás en la raíz del workshopper.", 13 | "err_home": "Parece que estás en tu directorio de inicio.", 14 | "hint": "Eso no es buena idea. Haz un directorio nuevo y usa eso.", 15 | "no_package": "Parece que te falta un `package.json`. ¿Ejecutaste `npm init`?" 16 | }, 17 | "login": { 18 | "whoami_err": "¡Ups!\n¡Pasó algo mal!", 19 | "logged_out": "Bueno... Yo no veo una cuenta activa aquí. ¿Usaste `npm adduser` para crear una cuenta nueva?", 20 | "success": "¡Felicidades, {{user}}!\n¡Tienes ahora en tu posesión una cuenta nueva de npm!\nÚsala con sabiduría. Nunca con coraje. Siempre para el bien.\n\nPero en serio, espero que la disfrutes.💚" 21 | }, 22 | "start-a-project": { 23 | "no_package": "No encontré un package.json.\nPor favor ejecuta `npm init` en tu directorio actual.", 24 | "success": "¡Felicidades! 🎉\nHas creado un proyecto! Abre el package.json para ver sus contenidos.", 25 | "extra_credit": "¡BONO! Muy bien hecho.👏" 26 | }, 27 | "install-a-module": { 28 | "error": "¡Ups! Parece que no instaló bien.\nEl error que recibí fue: {{{error}}}\nAsegúrate que estás usando el comando `npm install @linclark/pkg`\npara instalar el paquete `@linclark/pkg`.", 29 | "success": "¡Felicidades! Lo instalaste.👍" 30 | }, 31 | "listing-dependencies": { 32 | "usage": "Ejecuta:\n`how-to-npm verify OK` si todo está bien,\nó:\n`how-to-npm verify NOT OK` si no.", 33 | "ok_not": "Lo siento, no. Todo no está bien. 😭\nTrata de ejecutar `npm ls` y lee el error.", 34 | "not_ok_not": "Bueno...\nPues bien, parece que está muy mal el mundo de hoy en día,\npero tu package.json y tu directorio node_modules parecen que están bien.", 35 | "success": "¡Vale, parece que arreglaste el problema!\nVéase lo calmado que está `npm ls` ahora. 😎" 36 | }, 37 | "npm-test": { 38 | "section_missing": "¡Ups! No tienes una sección `scripts.test` en tu package.json. Edítalo, y trata de nuevo.", 39 | "running": "Ejecutando tu script de prueba, `test`...", 40 | "running_done": "...¡y ya acabamos!", 41 | "error": "¡Qué mal! ¡La prueba falló!\n Trata de crear una prueba que funcione de verdad.", 42 | "success": "¡Enhorabuena! Escribiste una prueba que pasa!\nEl caso de como escribir pruebas buenas lo dejamos para otro momento." 43 | }, 44 | "package-niceties": { 45 | "problem": "¡Más o menos!\nTodavía hay un problema que arreglar.", 46 | "error": "¡Qué mal!\nParece que algo falló.", 47 | "success": "¡Oye, qué bien!\nUn paquete sin README y alguna metadata es como\nun montón de JavaScript sin instrucciones o enlaces a repositorios de git." 48 | }, 49 | "publish": { 50 | "error": "Mmm...\nMe parece que no lograste publicar el\npaquete {{name}}. ¡Inténtalo de nuevo!" 51 | }, 52 | "version": { 53 | "invalid_semver": "¡Parece que tu package.json tiene una versión inválida!\nUsa `npm help semver` para aprender más sobre números de versión.\nTu version actual es: {{version}}\n", 54 | "old_version": "¡Uy que mal!\nLa version todavía sigue siendo {{version}}\nChequea `npm help version` para aprender sobre una herramienta que puede ayudar.", 55 | "success": "¡Qué guay!\nEjecuta `how-to-npm` para el próximo reto." 56 | }, 57 | "publish-again": { 58 | "not_republished": "¡Ups!\nParece que no publicaste el paquete de nuevo.\nTrata `npm publish` y verifica de nuevo.", 59 | "current_missing": "🤔... Veo que publicaste más de una vez, pero\nla versión corriente ({{version}}) no está en la lista.\nEsto es lo que veo:\n{{{found}}}\n¡Trata publicando de nuevo!", 60 | "success": "¡Wow! Te quedó brutal. No hay quien te detenga.💪\nEjecuta `how-to-npm` para it al próximo paso." 61 | }, 62 | "dist-tag": { 63 | "success": "Oh no, parece que todavía tienes sólamente un dist-tag.\nUsa `npm help dist-tag` para aprender cómo añadir otro." 64 | }, 65 | "dist-tag-removal": { 66 | "too_many": "Parece que tienes unos dist-tags extras ahí.\nLee `npm help dist-tag` para aprender como removerlos.", 67 | "version_mismatch": "🙃Tu dist-tag \"latest\" todavía apunta a la última versión, {{version}}.\nAsigna una versión diferente, y vuelve a ejecutar `how-to-npm verify`.\n\nUsa `npm help dist-tag` para ver más sobre como hacerlo." 68 | }, 69 | "outdated": { 70 | "no_package": "Haz `how-to-npm verify PKG` pero con `PKG` siendo el nombre\ndel paquete viejo.", 71 | "wrong_package": "Nop, no es {{{pkg}}}. ¡Inténtalo de nuevo!" 72 | }, 73 | "update": { 74 | "outdated": "Qué mal. Todavía estás usando la versión vieja.", 75 | "success": "¡Wepa! ¡Todo al día!\nHaz `how-to-npm` para ir al próximo ejercicio." 76 | }, 77 | "rm": { 78 | "dependencies_left": "Parece que tienes algunas dependencias por ahí todavía.", 79 | "package_json_left": "Removiste los ficheros, pero no los campos en package.json." 80 | }, 81 | "finale": { 82 | "todo": "Parece que te faltan cosas que hacer todavía.\nTermina los siguientes ejercicios antes de empezar con este:" 83 | }, 84 | "error": { 85 | "not_setup": "¡Parece que te falta algo para poder hacer este!\nVuelve al primer ejercicio `01 Ambiente de Desarrollo` para\npreparar tu directorio de trabajo.", 86 | "wrong_folder": "Parece que estás en el directorio incorrecto.\nHaz `cd {{cwd}}` y trata de nuevo." 87 | }, 88 | "exercise": { 89 | "00 Install npm": "00 Instala npm", 90 | "01 Dev Environment": "01 Ambiente de Desarrollo", 91 | "02 Login": "02 Login", 92 | "03 Start A Project": "03 Empieza un Proyecto", 93 | "04 Install A Module": "04 Instala un Paquete", 94 | "05 Listing Dependencies": "05 Enumera las Dependencias", 95 | "06 npm Test": "06 Pruebas con npm test", 96 | "07 Package Niceties": "07 Chulerías de Paquetes", 97 | "08 Publish": "08 Publica tu Propio Paquete", 98 | "09 Version": "09 Versión", 99 | "10 Publish Again": "10 Publícalo de Nuevo", 100 | "11 Dist Tag": "11 Dist Tags", 101 | "12 Dist Tag Removal": "12 Removiendo Dist Tags", 102 | "13 Outdated": "13 Encuentra Paquetes Viejos", 103 | "14 Update": "14 Trae Paquetes al Día", 104 | "15 Rm": "15 Removiendo Paquetes", 105 | "16 Finale": "16 Fin" 106 | }, 107 | "menu": { 108 | "reset-registry": "REINICIAR REGISTRO" 109 | }, 110 | "reset": "Registro ha sido reiniciado." 111 | } 112 | -------------------------------------------------------------------------------- /i18n/fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "install-npm": { 3 | "verifying": "vérification de la bonne installation de npm...", 4 | "missing": "Il semble que npm ne soit pas installé.", 5 | "npm-problem": "Uh oh! npm a un problème !", 6 | "version-verified": "Vous avez la version {{version}} d'installé. Bon!\nMaintenant regardons quelle est la dernière version... patientez...", 7 | "latest-version": "La dernière version de npm est: {{version}}", 8 | "upgrade": "Vous avez la version {{version}}, mais la dernière est {{latest}}\nLancez `npm install npm -g` pour le mettre à jour\n(Vous pouvez également passer cela si vous le souhaitez)", 9 | "success": "Félicitations !\nVous avez une version récente de npm installé !" 10 | }, 11 | "dev-environment": { 12 | "err_workshopper": "Il semblerait que vous soyez dans la racine du workshopper.", 13 | "err_home": "Il semblerait que vous soyez dans votre répertoire personnel.", 14 | "hint": "Ce n'est pas bon. Créez, s'il vous plaît un nouveau dossier, et utilisez le.", 15 | "no_package": "Il semblerait que le fichier `package.json` soit manquant. Avez-vous lancer `npm init`?" 16 | }, 17 | "login": { 18 | "whoami_err": "Uh oh!\nIl semblerait que quelque chose ce soit mal passé.", 19 | "logged_out": "Hm... Je ne vois pas d'utilisateur ici\nAvez-vous lancer `npm adduser` pour créer le compte?", 20 | "success": "Félicitations, {{user}}!\nVous êtes le fier propriétaire d'un nouveau compte npm imaginaire!\nFaites-en bon usage. Jamais dans la colère. Toujours pour le bien.\n\nAvec cette douce puissance vient beaucoup de responsabilité, ce qui est\nsuffisamment différent de la devise de Spider-Man\n pour que nous puissions espérer que Marvel ne nous poursuive pas.\n\nContinuons!" 21 | }, 22 | "start-a-project": { 23 | "no_package": "Aucun package.json trouvé.\nS'il vous plaît lancez `npm init` dans votre répertoire de travail.", 24 | "success": "Félicitations!\nVous avez créé un projet! Consultez le fichier package.json pour voir cela.", 25 | "extra_credit": "BONUS! Bien exécuté." 26 | }, 27 | "install-a-module": { 28 | "error": "Uh oh! Il semble que cela ne s'est pas installé correctement.\nL'erreur que j'ai eu: \n{{{error}}}\nAssurrez vous d'avoir exécuté la commande `npm install @linclark/pkg` \nafin d'installer le module `@linclark/pkg`.", 29 | "success": "Félicitations! Vous avez installé cela." 30 | }, 31 | "listing-dependencies": { 32 | "usage": "S'il vous plaît exécutez:\n`how-to-npm verify OK` si tout est bon,\nou:\n`how-to-npm verify NOT OK` sinon.", 33 | "ok_not": "Désolé, non. Tout n'est pas bon !\nEssayez d'exécutez `npm ls` et regardez l'erreur.", 34 | "not_ok_not": "Hmm...\nBon, il peut en effet y avoir beaucoup de mal avec le monde,\nmais votre fichier package.json et votre dossier node_modules sont bon.", 35 | "success": "Regardez, il semble que vous avez solutionné le problème. Fantastique!\nNotez que `npm ls` est beaucoup plus calme maintenant." 36 | }, 37 | "npm-test": { 38 | "section_missing": "Oops! Vous n'avez pas de section `scripts.test` dans votre\nfichier package.json file. Éditez le, et essayez à nouveau.", 39 | "running": "Exécution de votre script de test...", 40 | "running_done": "...terminé!", 41 | "error": "Uh oh! Le test a échoué!\nEssayez de créer un test qui fonctionne réellement.", 42 | "success": "Félicitations! Vous avez écrit un test qui fonctionne!\nÉcrire un test qui est réellement BON reste à faire pour plus tard." 43 | }, 44 | "package-niceties": { 45 | "problem": "Pas assez!\nIl reste toujours un problème à résoudre.", 46 | "error": "Uh oh!\nIl semble que quelque chose se soit mal passé", 47 | "success": "Regardez précisément!\nUn paquet sans fichier lisez-moi et certaines métadonnées est comme un\npaquet de JavaScript sans instructions ni liens à un dépôt git." 48 | }, 49 | "publish": { 50 | "error": "Uh oh!\nIl semble que vous n'avez pas publié le\n package {{name}}\n. Essayez encore !" 51 | }, 52 | "version": { 53 | "invalid_semver": "On dirait que votre package.json a une version non valide !\nUtilisez `npm help semver` pour en savoir plus sur les numéros de version\nVotre version actuelle: {{version}}\n", 54 | "old_version": "Uh oh!\nLa version est toujours {{version}}\nVerifiez `npm help version` pour un utilitaire pratique pour faire cela.", 55 | "success": "Bon travail!\nLancez `how-to-npm` pour le prochain défi passionnant !" 56 | }, 57 | "publish-again": { 58 | "not_republished": "Oups !\nOn dirait que vous n'avez pas encore publié le package\nEssayez d'exécuter `npm publish` et ensuite vérifiez à nouveau.", 59 | "current_missing": "Hmm... Je vois que vous avez publié plus d'une fois, mais\nla version actuelle ({{version}}) n'est pas comprise.\nVoici ce que je voix ici:\n{{{found}}}\nEssayez de publier à nouveau !", 60 | "success": "Wow! Vous êtes sur le bon chemin pour devenir un régulier\nTJames \"Substack\" Halidaychuk! Rien ne vous arrêtes!\nLancez `how-to-npm` pour aller à la prochaine étape." 61 | }, 62 | "dist-tag": { 63 | "success": "Uh oh, il semblerait que vous avez seulement un simple dist-tag.\nUtilisez `npm help dist-tag` pour apprendre comment en ajouter un autre." 64 | }, 65 | "dist-tag-removal": { 66 | "too_many": "Uh oh, il semblerait que vous avez quelque dist-tags supplémentaire ici.\nUtilisez `npm help dist-tag` pour apprendre comment les supprimer.", 67 | "version_mismatch": "Oups! Votre \"dernier\" tag pointe toujours à la plus récente\nparution, {{version}}.\nPointez cela ailleur, et relancez `how-to-npm verify`\n\nUtilisez `npm help dist-tag` pour apprendre comment faire cela." 68 | }, 69 | "outdated": { 70 | "no_package": "Lancez `how-to-npm verify PKG` mais remplacez `PKG` par le nom\ndu package qui est obselète", 71 | "wrong_package": "Nan, ce n'est pas {{{pkg}}}. Essayer encore !" 72 | }, 73 | "update": { 74 | "outdated": "Oups! Vous utilisez toujours la version obselète !", 75 | "success": "Impressionnant! Vous êtes à jour!\nLancez `how-to-npm` pour passer à l'exercice suivant" 76 | }, 77 | "rm": { 78 | "dependencies_left": "On dirait qu'il y a des dépendances qui reste tout de même", 79 | "package_json_left": "Vous avez supprimé les fichiers, mais pas les entrées dans package.json" 80 | }, 81 | "finale": { 82 | "todo": "On dirait que vous avez encore du travail à faire. Terminez les exercices suivants avant de commencer:" 83 | }, 84 | "error": { 85 | "not_setup": "On dirait que vous n'êtes pas encore prêt pour celui-ci !\nRetournez à la leçons `01 Environnement de développement` pour mettre en place\nvotre dossier de travail.", 86 | "wrong_folder": "Uh oh!\nIl semble que vous êtes dans le mauvais dossier.\nS'il vous plaît faites un cd vers {{cwd}}\net puis essayer à nouveau'" 87 | }, 88 | "exercise": { 89 | "00 Install npm": "00 Installer npm", 90 | "01 Dev Environment": "01 Environnement de développement", 91 | "02 Login": "02 Identification", 92 | "03 Start A Project": "03 Démarrer un projet", 93 | "04 Install A Module": "04 Installer un module", 94 | "05 Listing Dependencies": "05 Lister les dépendances", 95 | "06 npm Test": "06 npm Test", 96 | "07 Package Niceties": "07 Subtilités des packages", 97 | "08 Publish": "08 Publier", 98 | "09 Version": "09 Version", 99 | "10 Publish Again": "10 Publier à nouveau", 100 | "11 Dist Tag": "11 Dist Tag", 101 | "12 Dist Tag Removal": "12 Supprimer un dist Tag", 102 | "13 Outdated": "13 Packages obselètes", 103 | "14 Update": "14 Mise à jour", 104 | "15 Rm": "15 Suppréssion de packages", 105 | "16 Finale": "16 Conclusion" 106 | }, 107 | "menu": { 108 | "reset-registry": "RÉINITIALISATION DU REGISTRE" 109 | }, 110 | "reset": "Réinitialisation exécuté avec succès" 111 | } 112 | -------------------------------------------------------------------------------- /i18n/ja.json: -------------------------------------------------------------------------------- 1 | { 2 | "install-npm": { 3 | "verifying": "npm がインストールされているか確認しています。", 4 | "missing": "npm がインストールされていないようです。", 5 | "npm-problem": "おっと!npm コマンドを実行したらエラーが発生してしまいました。", 6 | "version-verified": "あなたは {{version}} をしています。 いいですね!\nでは、最新のバージョンを確認してみましょう。少々お待ちください...。", 7 | "latest-version": "最新のバージョンは {{version}} です。", 8 | "upgrade": "あなたは {{version}} をインストールしていますが、 最新版は {{latest}} です。\n`npm install npm -g` を実行して最新版をインストールしてください。\n(この課題をスキップしたい場合は、`how-to-npm verify skip` を実行してください。)", 9 | "success": "おめでとうございます!\nあなたは最新版の npm をインストールしています。" 10 | }, 11 | "dev-environment": { 12 | "err_workshopper": "あなたはワークショッパーのルートディレクトリにいるようです。", 13 | "err_home": "あなたはホームディレクトリにいるようです。", 14 | "hint": "そこで作業するのは賢明ではありません。新しいディレクトリを作成し、それを使ってください。", 15 | "no_package": "`package.json` が見つかりません。\n`npm init` を実行しましたか?" 16 | }, 17 | "login": { 18 | "whoami_err": "おっと!\n何かエラーがあるようです。", 19 | "logged_out": "うーん... まだログインしてないようです。\nアカウントを作成するのに `npm adduser` を実行しましたか?", 20 | "success": "{{user}} さん、おめでとうございます!\nあなたは擬似的にアカウントの作成を完了しました!\n賢明に使いましょう。怒りに身を任せてはいけません。良いことのために使いましょう。\n\nこの大いなる力には、責任が伴います。\nこの表現には元ネタがあるようですが、あまり気にしなくて大丈夫です。" 21 | }, 22 | "start-a-project": { 23 | "no_package": "package.json が見当たりません。\n`npm init` をプロジェクトのルートディレクトリで実行してください。", 24 | "success": "おめでとうございます!\nプロジェクトの作成に成功しました! package.json を確認してみてください。", 25 | "extra_credit": "追加の課題も合格です!素晴らしい進捗です。" 26 | }, 27 | "install-a-module": { 28 | "error": "おっと、モジュールが正しくインストールできなかったようです。\n発生したエラー:\n{{{error}}}\n`@linclark/pkg` モジュールをインストールするために\n`npm install @linclark/pkg` と正しくコマンドを実行できているか確認してください。", 29 | "success": "おめでとうございます!インストールが完了しました。" 30 | }, 31 | "listing-dependencies": { 32 | "usage": "問題がなければ:\n`how-to-npm verify OK`\nそうでなければ:\n`how-to-npm verify NOT OK`\nを実行してください。", 33 | "ok_not": "残念ながら、まだ問題があるようです。\n`npm ls` を実行して、エラーの内容を確認してみましょう。", 34 | "not_ok_not": "えっと...\nその、 世の中うまくいかないこともありますが\n少なくともあなたの package.json と node_modules はいい感じですよ。", 35 | "success": "問題を修正できたみたいですね。素晴らしいです!\nもう `npm ls` は静かになりましたね。" 36 | }, 37 | "npm-test": { 38 | "section_missing": "おっと、あなたの package.json には `script.test` フィールドがありません。\n編集してもう一度トライしてみてください。", 39 | "running": "あなたの test スクリプトを実行しています...。", 40 | "running_done": "...完了しました!", 41 | "error": "あぁ!テストが失敗しました。実際に動作するテストを指定してください。", 42 | "success": "おめでとうございます!あなたの書いたテストは正しく動作しました。\n空いた時間でテストを書くのは非常に価値のある時間です。" 43 | }, 44 | "package-niceties": { 45 | "problem": "まだ編集が完了していないようです。", 46 | "error": "おっと!なにかがエラーを起こしているようです。", 47 | "success": "整いましたね!README や他のメタデータが欠けているパッケージは、使い方の説明や git リポジトリのリンクのない\n大量の JavaScript のようなものです。" 48 | }, 49 | "publish": { 50 | "error": "おっと!\nあなたの {{name}} パッケージは正しく公開されていないようです。\nもう一度トライしてみてください。" 51 | }, 52 | "version": { 53 | "invalid_semver": "バージョンのフォーマットが不正なようです。\n`npm help semver` を実行してバージョンフォーマットについて調べてみてください。\nあなたの現在のバージョン番号: {{version}}\n", 54 | "old_version": "おっと!\nバージョンが {{version}} のままです。\n`npm help version` を実行してバージョンの更新方法を調べてみましょう。", 55 | "success": "グッジョブ!\n`how-to-npm` を実行して次の課題に進みましょう。" 56 | }, 57 | "publish-again": { 58 | "not_republished": "おーっと!\nパッケージの更新を公開していないようですね。\n`npm publish` を実行して再度確認してみてください。", 59 | "current_missing": "うーん... あなたは2回以上更新したようですが、\n現在のバージョンである ({{version}}) はまだ公開されていないようですね。\nこちらが確認した公開されているバージョン一覧はこちらです:\n{{{found}}}\n改めて公開してみてください!", 60 | "success": "わお!これであなたも未来の\nTJames \"Substack\" Halidaychuk ですね!もう誰もあなたを止められない\n`how-to-npm` を実行して次の課題にいきましょう。" 61 | }, 62 | "dist-tag": { 63 | "success": "おっと、配布用のタグがまだ一つしかないようです。\n`npm help dist-tag` を使用して、どうやってタグを追加するのか調べてみて下さい。" 64 | }, 65 | "dist-tag-removal": { 66 | "too_many": "まだ余計な配布用のタグがあるようです。\n`npm help dist-tag` を使って、タグを消す方法を確認してみてください。", 67 | "version_mismatch": "おっと、\"latest\" がまだ最新のリリースを指したままのようです。\n Version: {{version}}.\n最新以外のものを指すようにしてから `how-to-npm verify` を再度実行してください。\n\n`npm help dist-tag` を実行すると、タグの削除方法を学べます。" 68 | }, 69 | "outdated": { 70 | "no_package": "`how-to-npm verify PKG` を実行してください。ただし、`PKG` を\n古くなってしまったパッケージ名と置き換えて。", 71 | "wrong_package": "違います。{{{pkg}}} ではありません。もう一度!" 72 | }, 73 | "update": { 74 | "outdated": "おっと、まだ古いバージョンを使っていますね。", 75 | "success": "すばらしい。最新版にできました。\n`how-to-npm` を実行して次の課題に進んでください。" 76 | }, 77 | "rm": { 78 | "dependencies_left": "依存パッケージがまだ残っているようです。", 79 | "package_json_left": "ファイル自体は取り除けましたが, package.json 内のエントリーが残っているようです。" 80 | }, 81 | "finale": { 82 | "todo": "まだやることがあるみたいですよ。\nゴールする前に、以下の課題にもトライしてみて下さい:" 83 | }, 84 | "error": { 85 | "not_setup": "まだこの準備が整っていないようですね!\n最初の `01 Dev Environment` に戻って環境構築をしてみて下さい。", 86 | "wrong_folder": "間違ったディレクトリにいるようです。\n{{cwd}} に移動してもう一度トライしてみてください。" 87 | }, 88 | "exercise": { 89 | "00 Install npm": "00 npm をインストール", 90 | "01 Dev Environment": "01 開発環境の準備", 91 | "02 Login": "02 ログイン", 92 | "03 Start A Project": "03 プロジェクトをはじめる", 93 | "04 Install A Module": "04 モジュールをインストール", 94 | "05 Listing Dependencies": "05 パッケージの一覧", 95 | "06 npm Test": "06 テストを実行する", 96 | "07 Package Niceties": "07 正しいパッケージ", 97 | "08 Publish": "08 パッケージの公開", 98 | "09 Version": "09 バージョンの管理", 99 | "10 Publish Again": "10 パッケージの更新", 100 | "11 Dist Tag": "11 タグの追加", 101 | "12 Dist Tag Removal": "12 タグの削除", 102 | "13 Outdated": "13 パッケージの鮮度", 103 | "14 Update": "14 パッケージの更新", 104 | "15 Rm": "15 パッケージの削除", 105 | "16 Finale": "16 最後に" 106 | }, 107 | "menu": { 108 | "reset-registry": "ワークショップをやり直す" 109 | }, 110 | "reset": "進捗をリセットしました" 111 | } 112 | -------------------------------------------------------------------------------- /i18n/ko.json: -------------------------------------------------------------------------------- 1 | { 2 | "install-npm": { 3 | "verifying": "npm이 설치되어있는지 확인하고 있습니다...", 4 | "missing": "npm이 설치되어있지 않은 것 같습니다.", 5 | "npm-problem": "이런! npm명령어 실행 에러가 발생했습니다.", 6 | "version-verified": "현재 {{version}} 버전을 사용하고 있습니다. 멋져요!\n그럼 최신 버전을 확인해 보겠습니다. 잠시 기다려주세요...", 7 | "latest-version": "최신 버전은 {{version}}입니다.", 8 | "upgrade": "현재 {{version}} 버전을 사용하고 있습니다만, 최신 버전은 {{latest}}입니다.\n`npm install npm -g`을 실행해 최신 버전을 설치해주세요.\n(이 과제를 건너뛰고 싶으시면, `how-to-npm verify skip`을 실행해주세요.)", 9 | "success": "축하합니다!\n현재 최신 버전의 npm이 설치되어 있습니다." 10 | }, 11 | "dev-environment": { 12 | "err_workshopper": "현재 workshopper의 루트 디렉터리에 있는 것 같습니다.", 13 | "err_home": "현재 홈 디렉터리에 있는 것 같습니다.", 14 | "hint": "여기서 작업하는 건 바람직하지 않습니다. 새로운 디렉터리를 만들어서 작업 해주세요.", 15 | "no_package": "`package.json`을 찾을 수 없습니다.\n`npm init`을 실행하셨나요?" 16 | }, 17 | "login": { 18 | "whoami_err": "이런!\n뭔가 잘못된 것 같습니다.", 19 | "logged_out": "음... 아직 로그인하지 않은 것 같군요.\n`npm adduser`를 실행해서 계정을 만드셨나요?", 20 | "success": "{{user}} 님, 축하합니다!\n새로운 가상 계정이 만들어졌습니다!\n현명하게 사용하십시오. 분노에 몸을 맡겨선 안 됩니다. 좋은 일을 위해 사용하세요.\n\n강력한 힘은 큰 책임이 뒤따릅니다.\n뭔가의 패러디인 것 같군요. 크게 신경 안 쓰셔도 됩니다 ^_^" 21 | }, 22 | "start-a-project": { 23 | "no_package": "package.json을 찾을 수 없습니다.\n`npm init`을 프로젝트 루트 디렉터리에서 실행해주세요.", 24 | "success": "축하합니다!\n프로젝트를 성공적으로 생성하였습니다! package.json을 확인해주세요.", 25 | "extra_credit": "추가과제를 완료하였습니다. 멋져요!" 26 | }, 27 | "install-a-module": { 28 | "error": "이런, 모듈이 정상적으로 설치되어있지 않은 것 같습니다.\n발생한 에러:\n{{{error}}}\n`@linclark/pkg` 모듈을 설치하기 위해서,\n`npm install @linclark/pkg`라고 명령어를 입력했는지 확인해주세요.", 29 | "success": "축하합니다! 설치를 완료하였습니다." 30 | }, 31 | "listing-dependencies": { 32 | "usage": "문제가 없다면:\n`how-to-npm verify OK`\n문제가 있다면:\n`how-to-npm verify NOT OK`\n을 실행해주세요.", 33 | "ok_not": "유감이지만, 문제가 있는 것 같습니다.\n`npm ls`를 실행해서, 에러 내용을 확인해주세요.", 34 | "not_ok_not": "음...\n확실히, 세상엔 잘못된 것들이 많습니다만\n적어도 당신이 만든 package.json과 node_modules는 괜찮은 것 같군요.", 35 | "success": "문제가 해결된 것 같군요. 훌륭합니다!\n이제 `npm ls`가 얌전해지겠군요." 36 | }, 37 | "npm-test": { 38 | "section_missing": "이런, package.json 파일에 `script.test` 필드가 없습니다.\n수정하시고, 다시 한번 시도해주세요.", 39 | "running": "test 스크립트를 실행하고 있습니다...", 40 | "running_done": "...실행완료!", 41 | "error": "앗! 테스트가 실패했습니다. 실제로 작동하는 테스트를 만들어주세요.", 42 | "success": "축하합니다! 테스트가 정상적으로 작동하였습니다.\n남은 시간에 테스트를 작성하는 것은, 실제로 매우 중요한 작업입니다." 43 | }, 44 | "package-niceties": { 45 | "problem": "아직 수정해야 할 문제가 있는 것 같습니다.", 46 | "error": "앗! 뭔가 잘못된 것 같습니다.", 47 | "success": "괜찮은 것 같군요! README와 메타데이터가 없는 패키지는, 사용법이나 git repository 링크가 없는\n대량의 JavaScript와 같습니다." 48 | }, 49 | "publish": { 50 | "error": "이런!\n당신의 {{name}} 패키지는 성공적으로 배포되지 않았습니다.\n다시 한번 시도해주세요." 51 | }, 52 | "version": { 53 | "invalid_semver": "버전의 형식이 잘못된 것 같습니다.\n`npm help semver`을 실행하여 버전 형식을 조사해보세요.\n현재 버전 번호: {{version}}\n", 54 | "old_version": "이런!\n버전이 {{version}}인 그대로입니다.\n`npm help version`을 실행하여 버전 갱신방법을 조사해보세요.", 55 | "success": "잘하셨어요!\n`how-to-npm`을 실행하여 다음 과제에 도전하세요." 56 | }, 57 | "publish-again": { 58 | "not_republished": "이런!\n갱신된 패키지를 배포하지 않은 것 같군요.\n`npm publish`을 실행하여 다시 확인해주세요.", 59 | "current_missing": "음... 2번이상 배포신 것 같습니다만,\n현재 버전인 ({{version}})은 아직 배포되어 있지 않은 것 같군요.\n현재 확인되는 배포 버전은 다음과 같습니다.\n{{{found}}}\n다시 배포를 해주세요!", 60 | "success": "와우! 이걸로 당신도 미래의\nTJames \"Substack\" Halidaychuk이군요! 이제 아무도 당신을 막을 수 없습니다.\n`how-to-npm`을 실행하여 다음 과제에 도전하세요." 61 | }, 62 | "dist-tag": { 63 | "success": "이런, 배포용 태그가 아직 1개밖에 존재하지 않습니다.\n`npm help dist-tag`를 실행하여 어떻게 태그를 추가하는지 조사해보세요." 64 | }, 65 | "dist-tag-removal": { 66 | "too_many": "아직 불필요한 배포용 태그가 존재합니다.\n`npm help dist-tag`를 실행하여 어떻게 태그를 지우는지 조사해보세요.", 67 | "version_mismatch": "이런,\"latest\"가 아직 최신 릴리스를 가리키고 있습니다.\n 버전: {{version}}.\n'최신 릴리스 이외의 것을 지정한 뒤에 'how-to-npm verify`를 다시 실행해주세요.\n\n`npm help dist-tag`를 실행하면 삭제할 태그를 조사할 수 있습니다." 68 | }, 69 | "outdated": { 70 | "no_package": "`how-to-npm verify PKG`를 실행해주세요. 단 `PKG`를\n구식이 되어버린 패키지 이름과 치환해주세요.", 71 | "wrong_package": "틀립니다. {{{pkg}}}가 아니에요. 다시 한번!" 72 | }, 73 | "update": { 74 | "outdated": "이런, 아직 오래된 버전을 사용하고 있군요.", 75 | "success": "멋져요. 현재 최신버전입니다.\n`how-to-npm`을 실행하여 다음 과제에 도전하세요." 76 | }, 77 | "rm": { 78 | "dependencies_left": "의존 패키지가 아직 남아 있는 것 같습니다.", 79 | "package_json_left": "파일 자체는 지웠습니다만, package.json 내의 엔트리가 남아있는 것 같습니다." 80 | }, 81 | "finale": { 82 | "todo": "아직 해야할 일이 있는 것 같군요.\n다음 과제들을 완료해주세요." 83 | }, 84 | "error": { 85 | "not_setup": "아직 준비되지 않은 것 같군요!\n`01 Dev Environment`로 돌아가서 환경구축을 해주세요.", 86 | "wrong_folder": "잘못된 디렉터리에 있는 것 같습니다.\n{{cwd}}으로 이동해서 다시 한번 해보세요." 87 | }, 88 | "exercise": { 89 | "00 Install npm": "00 npm 설치", 90 | "01 Dev Environment": "01 개발환경준비", 91 | "02 Login": "02 로그인", 92 | "03 Start A Project": "03 프로젝트 시작", 93 | "04 Install A Module": "04 모듈 설치", 94 | "05 Listing Dependencies": "05 패키지 리스트", 95 | "06 npm Test": "06 테스트", 96 | "07 Package Niceties": "07 올바른 패키지", 97 | "08 Publish": "08 패키지 배포", 98 | "09 Version": "09 패키지 버전 관리", 99 | "10 Publish Again": "10 패키지 재배포", 100 | "11 Dist Tag": "11 태그 추가", 101 | "12 Dist Tag Removal": "12 태그 삭제", 102 | "13 Outdated": "13 패키지의 버전 상태", 103 | "14 Update": "14 패키지 갱신", 104 | "15 Rm": "15 패키지 삭제", 105 | "16 Finale": "16 마지막으로" 106 | }, 107 | "menu": { 108 | "reset-registry": "워크숍을 다시 시작합니다." 109 | }, 110 | "reset": "진행 과정이 초기화되었습니다." 111 | } 112 | -------------------------------------------------------------------------------- /i18n/zh-cn.json: -------------------------------------------------------------------------------- 1 | { 2 | "install-npm": { 3 | "verifying": "正在验证 npm 是否已安装...", 4 | "missing": "看来 npm 还没有安装。", 5 | "npm-problem": "啊哦!npm 有问题!", 6 | "version-verified": "太好了!您已安装 npm,版本是 {{version}}。\n\n现在让我们看看最新版本是什么...请耐心等待一下...", 7 | "latest-version": "最新的 npm 是: {{version}}", 8 | "upgrade": "您已安装版本 {{version}},但最新的是 {{latest}}。\n\n运行 \"npm install npm -g\" 来升级它。\n(如果您不愿意升级,可以直接跳过)", 9 | "success": "恭喜您!\n您已经安装了 npm 的最新版本!" 10 | }, 11 | "dev-environment": { 12 | "err_workshopper": "现在好像在 workshopper 的根目录中。", 13 | "err_home": "现在好像在您的家目录中。", 14 | "hint": "这是不对的。请创建一个新文件夹并使用它。", 15 | "no_package": "似乎缺少了 \"package.json\" 文件。您运行 \"npm init\" 了吗?" 16 | }, 17 | "login": { 18 | "whoami_err": "哎呀!\n似乎出了什么问题。", 19 | "logged_out": "嗯... 未发现登录用户\n\n您是否运行 \"npm adduser\" 创建了账户?", 20 | "success": "恭喜您,{{user}}!\n您已经是一个 npm 新账户的拥有者!\n\n好好利用它!勿以善小而不为,勿以恶小而为之。\n\n这种美妙的力量将带给您很多责任。这与蜘蛛侠的奇迹完全不同,希望这是漫威不会起诉我们的地方。\n太棒了!" 21 | }, 22 | "start-a-project": { 23 | "no_package": "没有找到 package.json 文件。\n请在您的工作目录下运行 \"npm init\"", 24 | "success": "\n恭喜您!\n您已经创建了一个新项目!项目的信息可以在 package.json 中看到。", 25 | "extra_credit": "锦上添花! 您做得很棒。" 26 | }, 27 | "install-a-module": { 28 | "error": "啊哦! 看来安装的不正确。\n错误提示:\n{{{error}}}\n务必使用 \"npm install @linclark/pkg\" 命令\n来安装 \"@linclark/pkg\" 模块。", 29 | "success": "恭喜!您完成了安装!" 30 | }, 31 | "listing-dependencies": { 32 | "usage": "如果一切 OK,请运行:\n\"how-to-npm verify OK\",\n否则,运行:\n\"how-to-npm verify NOT OK\"。", 33 | "ok_not": "对不起,出错了!\n请运行 \"npm ls\" 查看错误信息。", 34 | "not_ok_not": "嗯...\n虽然确实还存在许多问题,但您的 package.json 和 node_modules 文件夹却没有问题。", 35 | "success": "看来您已经把问题解决了。非常好!\n注意,现在 \"npm ls\" 平静多了。" 36 | }, 37 | "npm-test": { 38 | "section_missing": "哎呀!在您的 package.json 文件里没有 `scripts.test` 字段。\n编辑它,并重新尝试。", 39 | "running": "正在运行测试脚本...", 40 | "running_done": "...完成!", 41 | "error": "啊哦!测试失败了!\n尝试创建一个真正有效的测试。", 42 | "success": "恭喜!您完成了一个测试!\n编写一个真实有用的测试代码,将留待日后完成。" 43 | }, 44 | "package-niceties": { 45 | "problem": "还没有全部完成。\n还有一个问题要解决。", 46 | "error": "哦!\n似乎出什么问题了。", 47 | "success": "成功了!\n 一个缺少 README 文件和一些元数据的包,就像一堆缺少说明或者 Git 仓库链接的 JavaScript 代码文件" 48 | }, 49 | "publish": { 50 | "error": "很遗憾!\n您未能成功发布\n {{name}}\n软件包。再试一次吧!" 51 | }, 52 | "version": { 53 | "invalid_semver": "版本格式似乎不正确!\n使用 `npm help semver` 了解更多关于版本号的帮助信息\n您当前的版本号是: {{version}}\n", 54 | "old_version": "天啊!版本号仍旧是 {{version}}\n运行 `npm help version` 以了解如何更新版本。", 55 | "success": "太棒了!\n运行 `how-to-npm` 继续下一个令人兴奋的挑战吧!" 56 | }, 57 | "publish-again": { 58 | "not_republished": "天啊!\n貌似您没有再次发布新的软件包。\n尝试运行 `npm publish` 并再次验证。", 59 | "current_missing": "嗯... 我看见您发布了两次,可是\n当前版本 ({{version}}) 还没有发布。\n这是已发布的版本列表:\n{{{found}}}\n请重新发布!", 60 | "success": "哇...!您也能成为未来的 TJames \"Substack\" Halidaychuk 啊!没有人能阻止您!!\n\n运行 `how-to-npm` 挑战下一个练习。" 61 | }, 62 | "dist-tag": { 63 | "success": "哦,看来您还是只有一个标签。\n使用 `npm help dist-tag` 学习如何添加标签。" 64 | }, 65 | "dist-tag-removal": { 66 | "too_many": "哦,看来您有一些额外的标签。\n使用 `npm help dist-tag` 学习如何移除它们。", 67 | "version_mismatch": "哎呀!您的 \"latest\" 标签仍然指向最新的发布:{{version}} \n把它指向 {{version}} 以外的其他地方,并重新运行 `how-to-npm verify`\n\n使用 `npm help dist-tag` 学习更多的相关知识。" 68 | }, 69 | "outdated": { 70 | "no_package": "运行 `how-to-npm verify PKG` 将 `PKG` 替换为\n已过时的软件包名称", 71 | "wrong_package": "不对,它不是 {{{pkg}}}。再试一次!" 72 | }, 73 | "update": { 74 | "outdated": "哎呀!您还在使用过时的版本!", 75 | "success": "太棒了!您拥有了最新版本!\n运行 `how-to-npm` 继续下一个练习。" 76 | }, 77 | "rm": { 78 | "dependencies_left": "依赖的软件包似乎仍存在。", 79 | "package_json_left": "您删除了软件包,但没有删除 package.json 中的条目" 80 | }, 81 | "finale": { 82 | "todo": "看起来您还有很多工作要做。在开始之前完成以下练习: " 83 | }, 84 | "error": { 85 | "not_setup": "看起来您还没准备好!\n返回到 \"01 准备开发环境\"这一关,设置您的工作目录。", 86 | "wrong_folder": "哦!\n您在错误的文件夹里 \n请 cd 到 {{cwd}}\n然后重新尝试。" 87 | }, 88 | "exercise": { 89 | "00 Install npm": "00 安装 npm", 90 | "01 Dev Environment": "01 准备开发环境", 91 | "02 Login": "02 登录", 92 | "03 Start A Project": "03 开始一个项目", 93 | "04 Install A Module": "04 安装模块", 94 | "05 Listing Dependencies": "05 依赖项列表", 95 | "06 npm Test": "06 npm 测试", 96 | "07 Package Niceties": "07 软件包的细节", 97 | "08 Publish": "08 发布", 98 | "09 Version": "09 版本", 99 | "10 Publish Again": "10 再次发布", 100 | "11 Dist Tag": "11 添加标签", 101 | "12 Dist Tag Removal": "12 移除标签", 102 | "13 Outdated": "13 检测旧版本", 103 | "14 Update": "14 更新", 104 | "15 Rm": "15 移除", 105 | "16 Finale": "16 结尾" 106 | }, 107 | "menu": { 108 | "reset-registry": "重置注册表" 109 | }, 110 | "reset": "成功重置注册表" 111 | } 112 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var updateNotifier = require('update-notifier') 4 | var pkg = require('./package.json') 5 | var notifier = updateNotifier({ 6 | pkg: pkg, 7 | updateCheckInterval: 1000 * 60 * 60 * 24 // 1 day 8 | }) 9 | 10 | if (notifier.update) { 11 | notifier.notify() 12 | process.exit(0) 13 | } 14 | 15 | var adventure = require('workshopper-adventure/adventure') 16 | var shop = module.exports = adventure({ 17 | name: 'how-to-npm', 18 | languages: ['en', 'es', 'ja', 'fr', 'ko', 'zh-cn'], 19 | appDir: __dirname, 20 | menu: { 21 | bg: 'white', 22 | fg: 'red' 23 | }, 24 | version: require('./package.json').version, 25 | commands: [{ 26 | name: 'reset-registry', 27 | handler: function (workshopper) { 28 | // Reset a bit harder, since we save other stuff in there. 29 | require('./lib/registry.js').kill() 30 | rimraf.sync(workshopper.dataDir) 31 | mkdirp.sync(workshopper.dataDir) 32 | console.log(workshopper.i18n.__('reset')) 33 | } 34 | }] 35 | }) 36 | 37 | var fs = require('fs') 38 | var path = require('path') 39 | var rimraf = require('rimraf') 40 | var mkdirp = require('mkdirp') 41 | 42 | var problems = require('./menu.json') 43 | problems.forEach(function (problem) { 44 | var p = problem.toLowerCase().replace(/\s/g, '-') 45 | var dir = path.join(__dirname, 'problems', p) 46 | shop.add(problem, function () { return require(dir) }) 47 | }) 48 | 49 | shop.execute = function (args) { 50 | return shop.constructor.prototype.execute.apply(this, arguments) 51 | } 52 | 53 | // Copy the registry-assets if they're not already there. 54 | 55 | var fromFolder = path.join(__dirname, 'assets') 56 | var toFolder = path.join(shop.dataDir) 57 | 58 | function cpclean (item) { 59 | var from = path.join(fromFolder, item) 60 | var to = path.join(toFolder, item) 61 | try { 62 | var assetsStat = fs.statSync(to) 63 | if (!assetsStat.isDirectory()) throw Error('enotdir') 64 | } catch (er) { 65 | rimraf.sync(to) 66 | cpr(from, to) 67 | } 68 | 69 | try { 70 | var versionStat = fs.readFileSync(shop.datadir + '/version', 'utf8') 71 | if (versionStat !== shop.options.version) throw Error('eold') 72 | } catch (e) { 73 | fs.writeFileSync(shop.datadir + '/version', shop.options.version) 74 | } 75 | } 76 | 77 | cpclean('registry') 78 | 79 | shop.cpr = cpr 80 | function cpr (from, to) { 81 | var st = fs.statSync(from) 82 | if (st.isDirectory()) { 83 | mkdirp.sync(to) 84 | fs.readdirSync(from).forEach(function (file) { 85 | cpr(path.resolve(from, file), path.resolve(to, file)) 86 | }) 87 | } else { 88 | fs.writeFileSync(to, fs.readFileSync(from)) 89 | } 90 | } 91 | 92 | shop.cwd = function () { 93 | var dataDir = shop.dataDir 94 | // verify we're in the right folder 95 | try { 96 | var cwd = fs.readFileSync(path.resolve(dataDir, 'cwd'), 'utf8').trim() 97 | } catch (er) { 98 | console.log(shop.i18n.__('error.not_setup')) 99 | return false 100 | } 101 | 102 | if (cwd === process.cwd()) return cwd 103 | 104 | console.log(shop.i18n.__('error.wrong_folder', {cwd: cwd})) 105 | return false 106 | } 107 | 108 | if (require.main === module) shop.execute(process.argv.slice(2)) 109 | -------------------------------------------------------------------------------- /lib/_config.yaml: -------------------------------------------------------------------------------- 1 | web: 2 | title: Verdaccio 3 | 4 | auth: 5 | htpasswd: 6 | file: ./htpasswd 7 | 8 | uplinks: 9 | npmjs: 10 | url: https://registry.npmjs.org/ 11 | 12 | packages: 13 | '@*/*': 14 | access: $all 15 | publish: $authenticated 16 | unpublish: $authenticated 17 | 18 | '**': 19 | access: $all 20 | publish: $authenticated 21 | unpublish: $authenticated 22 | 23 | middlewares: 24 | audit: 25 | enabled: true 26 | 27 | logs: 28 | - { type: stdout, format: pretty, level: trace } 29 | 30 | -------------------------------------------------------------------------------- /lib/registry.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var fs = require('fs') 3 | var node = process.execPath 4 | var spawn = require('child_process').spawn 5 | var shop = require('../index.js') 6 | var util = require('util') 7 | var verdaccio = require('verdaccio').default 8 | var yalm = require('js-yaml') 9 | 10 | var pidfile = path.resolve(shop.datadir, 'registry.pid') 11 | var assetdir = path.resolve(shop.datadir, 'registry') 12 | 13 | var logStream = fs.createWriteStream(path.resolve(shop.datadir, 'registry.log'), {flags: 'a'}) 14 | function log () { 15 | logStream.write(util.format.apply(util, arguments) + '\n') 16 | } 17 | 18 | if (require.main === module) { 19 | switch (process.argv[2]) { 20 | case 'daemon': 21 | daemon(process.argv.slice(3)) 22 | break 23 | case 'kill': 24 | kill() 25 | break 26 | } 27 | } 28 | 29 | exports.kill = kill 30 | function kill () { 31 | try { 32 | var pid = +fs.readFileSync(pidfile, 'ascii').trim() 33 | process.kill(pid, 'SIGKILL') 34 | } catch (er) {} 35 | try { 36 | fs.unlinkSync(pidfile) 37 | } catch (er) {} 38 | } 39 | 40 | exports.run = run 41 | function run (args) { 42 | kill() 43 | var child = spawn(node, [__filename, 'daemon'].concat(args || []), { 44 | stdio: 'ignore', 45 | detached: true, 46 | cwd: path.resolve(__dirname, '..') 47 | }) 48 | 49 | child.unref() 50 | } 51 | 52 | exports.daemon = daemon 53 | function daemon (args) { 54 | kill() 55 | var fd = fs.openSync(pidfile, 'wx') 56 | fs.writeSync(fd, process.pid + '\n') 57 | fs.closeSync(fd) 58 | var yamlConfigPath = path.join(__dirname, './_config.yaml') 59 | var yamlConfig = fs.readFileSync(yamlConfigPath, 'utf8') 60 | var configJsonFormat = yalm.safeLoad(yamlConfig) 61 | var lesson = args[0] 62 | configJsonFormat.storage = path.resolve(assetdir, 'store') 63 | configJsonFormat.self_path = path.resolve(assetdir) 64 | verdaccio(configJsonFormat, 15443, yamlConfigPath, '1.0.0', 'verdaccio', 65 | function (webServer, addrs, pkgName, pkgVersion) { 66 | webServer.listen(addrs.port || addrs.path, addrs.host, function () { 67 | log('%s Listening', lesson) 68 | }) 69 | }) 70 | } 71 | -------------------------------------------------------------------------------- /menu.json: -------------------------------------------------------------------------------- 1 | [ 2 | "00 Install npm", 3 | "01 Dev Environment", 4 | "02 Login", 5 | "03 Start A Project", 6 | "04 Install A Module", 7 | "05 Listing Dependencies", 8 | "06 npm Test", 9 | "07 Package Niceties", 10 | "08 Publish", 11 | "09 Version", 12 | "10 Publish Again", 13 | "11 Dist Tag", 14 | "12 Dist Tag Removal", 15 | "13 Outdated", 16 | "14 Update", 17 | "15 Rm", 18 | "16 Finale" 19 | ] 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "how-to-npm", 3 | "version": "2.5.1", 4 | "description": "A module to teach you how to module.", 5 | "bin": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/workshopper/how-to-npm" 9 | }, 10 | "scripts": { 11 | "test": "standard" 12 | }, 13 | "keywords": [ 14 | "workshop", 15 | "adventure", 16 | "tutorial", 17 | "tutor", 18 | "npm" 19 | ], 20 | "author": "Isaac Z. Schlueter (http://blog.izs.me/)", 21 | "license": "ISC", 22 | "bugs": { 23 | "url": "https://github.com/workshopper/how-to-npm/issues" 24 | }, 25 | "bundleDependencies": [ 26 | "workshopper-adventure", 27 | "mkdirp", 28 | "rimraf", 29 | "semver", 30 | "which" 31 | ], 32 | "dependencies": { 33 | "js-yaml": "^3.13.1", 34 | "mkdirp": "^0.5.0", 35 | "rimraf": "^2.2.8", 36 | "semver": "^4.2.0", 37 | "update-notifier": "^1.0.3", 38 | "verdaccio": "^4.6.2", 39 | "which": "^1.0.8", 40 | "workshopper-adventure": "^5.0.3" 41 | }, 42 | "preferGlobal": true, 43 | "devDependencies": { 44 | "standard": "^7.1.2" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /problems/00-install-npm/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var exec = require('child_process').exec 3 | var which = require('which') 4 | var semver = require('semver') 5 | 6 | exports.problem = { 7 | file: path.join(__dirname, 'problem.{lang}.txt') 8 | } 9 | 10 | exports.init = function (workshopper) { 11 | this.__ = workshopper.i18n.__ 12 | } 13 | 14 | exports.verify = function (args, cb) { 15 | if (args.join('').toLowerCase() === 'skip') { 16 | return cb(null, true, { 17 | file: path.join(__dirname, 'skip.{lang}.txt') 18 | }) 19 | } 20 | 21 | var __ = this.__ 22 | 23 | console.log(__('install-npm.verifying')) 24 | var npm 25 | 26 | try { 27 | npm = '"' + which.sync('npm') + '"' 28 | } catch (er) { 29 | console.log(__('install-npm.missing')) 30 | return cb(false) 31 | } 32 | 33 | // figure out what version we have 34 | exec(npm + ' --version', function (code, stdout, stderr) { 35 | var v = ('' + stdout).trim() 36 | if (code) { 37 | process.stderr.write(stderr) 38 | console.log(__('install-npm.npm-problem'), code) 39 | return cb(false) 40 | } 41 | 42 | console.log(__('install-npm.version-verified', {version: v})) 43 | 44 | exec(npm + ' view npm version --registry=https://registry.npmjs.org', function (code, stdout, stderr) { 45 | var latest = ('' + stdout).trim() 46 | if (code) { 47 | console.log(__('install-npm.npm-problem'), code) 48 | process.stderr.write(stderr) 49 | return cb(false) 50 | } 51 | 52 | console.log(__('install-npm.latest-version', {version: latest})) 53 | if (semver.gt(latest, v)) { 54 | console.log(__('install-npm.upgrade', {version: v, latest: latest})) 55 | return cb(false) 56 | } 57 | 58 | console.log(__('install-npm.success')) 59 | return cb(true) 60 | }) 61 | }) 62 | } 63 | -------------------------------------------------------------------------------- /problems/00-install-npm/problem.en.txt: -------------------------------------------------------------------------------- 1 | Hello, and welcome to the npm adventure workshop! I am going to be 2 | asking you to do various things with npm so that you can get started 3 | with it easily. 4 | 5 | Some helpful commands: 6 | 7 | npm help ............ Get help with npm 8 | how-to-npm print .... Re-display the current exercise 9 | how-to-npm verify ... Verify that you have finished an exercise 10 | how-to-npm solution . Show the solution for the current exercise 11 | 12 | The first thing we're going to do is make sure that your npm 13 | version is up to date. 14 | 15 | Run `$ADVENTURE_COMMAND verify` once that is done. 16 | 17 | (This is the only part of the workshop that requires network access. 18 | If the network is busted, and you want to skip this one, you can run 19 | `$ADVENTURE_COMMAND verify skip` to skip it.) 20 | -------------------------------------------------------------------------------- /problems/00-install-npm/problem.es.txt: -------------------------------------------------------------------------------- 1 | Hola, y bienvenidx a este workshop de aventura de npm! Voy a pedirte que hagas 2 | varias cosas con npm para que puedas empezar con él fácil y rápidamente. 3 | 4 | Algunos comandos útiles: 5 | 6 | npm help ............ Ayuda de npm (en inglés) 7 | how-to-npm print .... Vuelve a mostrar el ejercicio corriente. 8 | how-to-npm verify ... Verifica que has completado el ejercicio. 9 | how-to-npm solution . Muestra la solución para este ejercicio. 10 | 11 | Lo primero que vamos a hacer es asegurarnos que tu versión de 12 | npm está al día. 13 | 14 | Ejecuta `$ADVENTURE_COMMAND verify` una vez acabes con eso. 15 | 16 | (Esta es la única parte del workshop que requiere acceso al internet. 17 | Si no tienes acceso a ello y quieres saltar este problema, puedes 18 | ejecutar `$ADVENTURE_COMMAND verify skip` para saltarlo.) 19 | -------------------------------------------------------------------------------- /problems/00-install-npm/problem.fr.txt: -------------------------------------------------------------------------------- 1 | Bonjour, et bienvenue à l'atelier d'aventure npm! Je vais 2 | vous demander de faire des choses diverses avec npm afin 3 | que vous puissiez commencer à l'utiliser facilement. 4 | 5 | Quelques commandes utiles: 6 | 7 | npm help ............ Obtenir de l'aide avec npm 8 | how-to-npm print .... Rafficher l'exercice en cours 9 | how-to-npm verify ... Vérifier que vous avez terminé un exercice 10 | how-to-npm solution . Montrer la solution pour l'exercice en cours 11 | 12 | La première chose que nous allons faire est de s'assurer que 13 | votre version de npm est à jour. 14 | 15 | Exécutez `$ADVENTURE_COMMAND verify` une fois que c'est fait. 16 | 17 | (C'est la seule partie de l'atelier qui nécessite un accès internet. 18 | Si la connection est interrompu, et que vous souhaitez sauter celui-ci, 19 | vous pouvez exécuter `$ADVENTURE_COMMAND verify skip` pour passer cela.) 20 | -------------------------------------------------------------------------------- /problems/00-install-npm/problem.ja.txt: -------------------------------------------------------------------------------- 1 | こんにちは、ようこそ npm のワークショップへ!これから皆さんに npm に関連した 2 | 様々な課題に挑戦して頂きます。このワークショップを通じてあなたのパッケージを公開する 3 | 方法を学ぶことができます。 4 | 5 | 役立つコマンド一覧: 6 | 7 | npm help ............ npm の使い方を表示する 8 | how-to-npm print .... 課題を再表示する 9 | how-to-npm verify ... 課題の答え合わせを行う 10 | how-to-npm solution . 課題の正解を表示する 11 | 12 | まずはじめに、みなさんが最新の npm をインストールしているかを確認してください。 13 | 14 | 確認ができましたら `$ADVENTURE_COMMAND verify` を実行してください。 15 | 16 | (このワークショップを通じて、インターネットの接続を必要とするのはこの課題だけです。 17 | もしネットワークに通じない状況におり、この課題をスキップしたいときは 18 | `$ADVENTURE_COMMAND verify skip` を実行してください。) 19 | -------------------------------------------------------------------------------- /problems/00-install-npm/problem.ko.txt: -------------------------------------------------------------------------------- 1 | 어서오세요. npm 워크숍에 오신 걸 환영합니다! 이제부터 npm에 관련된 2 | 여러 가지 과제에 도전하게 됩니다. 이 워크숍을 통해서 여러분들은 3 | 직접 패키지를 만들고 배포하는 것을 배울 수 있습니다. 4 | 5 | 도움되는 명령어들: 6 | 7 | npm help ............ npm 사용법 8 | how-to-npm print .... 현재 과제 9 | how-to-npm verify ... 현재 과제의 채점 10 | how-to-npm solution . 현재 과제의 정답 11 | 12 | 먼저 최신 버전의 npm이 설치되어있는지 확인해주세요. 13 | 14 | 확인이 되었다면 `$ADVENTURE_COMMAND verify`를 실행해주세요. 15 | 16 | (이 워크숍에서 인터넷접속을 요구하는 과제는 이 과제뿐입니다. 17 | 만약 인터넷을 사용할 수 없는 환경에 있어서 이 과제를 건너뛰고 싶으시다면, 18 | `$ADVENTURE_COMMAND verify skip`을 실행해주세요.) 19 | -------------------------------------------------------------------------------- /problems/00-install-npm/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 您好,欢迎来到 npm 训练营!我将要求您做各种与 npm 相关的事情,这样您就可以很容 2 | 易的开始用它了。 3 | 4 | 一些有用命令列表: 5 | 6 | npm help ............ 可获得 npm 方面的帮助 7 | how-to-npm print .... 重新显示当前的练习 8 | how-to-npm verify ... 验证您是否完成了一项练习 9 | how-to npm solution . 展示当前练习的答案 10 | 11 | 首先,请确认您是否安装了最新版的 npm。 12 | 13 | 如果确认成功,请运行 "$ADVENTURE_COMMAND verify" 。 14 | 15 | (这是此训练营中唯一需要访问互联网的部分。如果您处于一个网络不通的状态,您可以运 16 | 行 "$ADVENTURE_COMMAND verify skip" 跳过。) -------------------------------------------------------------------------------- /problems/00-install-npm/skip.en.txt: -------------------------------------------------------------------------------- 1 | Ok, if you say so... 2 | You can always install the latest and greatest npm using 3 | `npm install npm -g`. You may need to run that with `sudo` 4 | or as an Administrator. 5 | -------------------------------------------------------------------------------- /problems/00-install-npm/skip.es.txt: -------------------------------------------------------------------------------- 1 | Vale, si eso es lo que quieres... 2 | Puedes instalar la mejor y más reciente versión de npm 3 | usando `npm install npm -g`. Puede ser que tengas que usar 4 | `sudo` o modo de Administrador para que funcione. 5 | -------------------------------------------------------------------------------- /problems/00-install-npm/skip.fr.txt: -------------------------------------------------------------------------------- 1 | Ok, si vous le dites... 2 | Vous pouvez toujours installer la dernière version ou une 3 | plus version supérieur de npm en utilisant 4 | `npm install npm -g`. Vous devrez peut-être exécuter cela 5 | avec `sudo` ou en tant que administrateur. 6 | -------------------------------------------------------------------------------- /problems/00-install-npm/skip.ja.txt: -------------------------------------------------------------------------------- 1 | 飛ばすのですね。わかりました... 2 | 次のコマンドで、いつでも最新の npm をインストールすることができます。 3 | `npm install npm -g` 4 | 5 | あなたの環境次第では、 `sudo` を付けるか、 6 | 管理者として実行する必要があるかもしれません。 7 | -------------------------------------------------------------------------------- /problems/00-install-npm/skip.ko.txt: -------------------------------------------------------------------------------- 1 | 그냥 건너뛰시려고요? 알겠습니다. 2 | 다음 명령어로 언제든지 최신 버전의 npm을 설치할 수 있습니다. 3 | `npm install npm -g` 4 | 5 | 현재 사용하고 있는 환경에 따라서, `sudo` 혹은 관리자로 실행해야 할 수도 있습니다. 6 | -------------------------------------------------------------------------------- /problems/00-install-npm/skip.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 好吧,如果这就是您想要的...... 2 | 3 | 使用 "npm install npm -g",您随时可以安装最新最好的 npm 版本。 4 | 5 | 您可能需要用 "sudo" 或管理员模式来运行。 -------------------------------------------------------------------------------- /problems/01-dev-environment/index.js: -------------------------------------------------------------------------------- 1 | var shop = require('../../') 2 | var fs = require('fs') 3 | var path = require('path') 4 | 5 | exports.problem = { 6 | file: path.join(__dirname, 'problem.{lang}.txt') 7 | } 8 | 9 | exports.init = function (workshopper) { 10 | this.__ = workshopper.i18n.__ 11 | } 12 | 13 | exports.verify = function (args, cb) { 14 | var datadir = shop.datadir 15 | var cwd = process.cwd() 16 | var __ = this.__ 17 | if (path.resolve(cwd, 'problems', 'dev-environment', path.basename(__filename)) === path.resolve(__filename)) { 18 | console.log(__('dev-environment.err_workshopper')) 19 | console.log(__('dev-environment.hint')) 20 | return cb(false) 21 | } 22 | 23 | if (cwd === process.env.HOME || cwd === process.env.USERPROFILE) { 24 | console.log(__('dev-environment.err_home')) 25 | console.log(__('dev-environment.hint')) 26 | return cb(false) 27 | } 28 | 29 | try { 30 | require(path.resolve(cwd, 'package.json')) 31 | } catch (e) { 32 | console.log(__('dev-environment.no_package', {error: e.stack})) 33 | return cb(false) 34 | } 35 | 36 | // Save the cwd so that we can ensure we're in the right place from now on 37 | fs.writeFileSync(path.resolve(datadir, 'cwd'), cwd) 38 | 39 | // Write the .npmrc file telling it to always use our local registry. 40 | var conf = fs.readFileSync(path.resolve(__dirname, '..', '..', 'workshop-npmrc'), 'utf8') 41 | conf = conf.replace(/%USERCONFIG%/g, path.resolve(datadir, 'npmrc')) 42 | 43 | fs.writeFileSync(path.resolve(cwd, '.npmrc'), conf) 44 | 45 | return cb(null, true, { 46 | file: path.join(__dirname, 'success.{lang}.txt') 47 | }) 48 | } 49 | -------------------------------------------------------------------------------- /problems/01-dev-environment/problem.en.txt: -------------------------------------------------------------------------------- 1 | One of the most important things that npm does is install packages. 2 | 3 | However, in order to be a good workshop program, we don't want to litter 4 | files all over your computer, so before going any further, let's set up a 5 | development environment. 6 | 7 | First, make a new directory and `cd` into it. 8 | 9 | Then, run `npm init` to create a package.json file. You will be prompted 10 | to answer a number of questions. You can just press enter to accept the 11 | default for each question. 12 | 13 | Run `$ADVENTURE_COMMAND verify` once you're done. All the other commands 14 | you run in this tutorial should be done in that folder. 15 | -------------------------------------------------------------------------------- /problems/01-dev-environment/problem.es.txt: -------------------------------------------------------------------------------- 1 | Una de las cosas más importantes que npm hace es instalar paquetes. 2 | 3 | Del otro lado, para poder tener un programa de workshop bueno, no queremos 4 | llenar nuestro ordenador de varias ficheros. Así que antes de seguir con esto, 5 | vamos a preparar nuestro ambiente de desarrollo para mantener todo nítido. 6 | 7 | Primero, crea un directorio nuevo y usa `cd` para entrar en él. 8 | 9 | Entonces, haz `npm init` para crear un fichero llamado package.json. npm te 10 | preguntará varias preguntas. Puedes simplemente puedes presionar `Enter` para 11 | aceptar los valores predeterminados. 12 | 13 | Ejecuta `$ADVENTURE_COMMAND verify` cuando termines. Todos los otros comandos 14 | que uses en este tutorial deberían ser ejecutados en ese directorio. 15 | -------------------------------------------------------------------------------- /problems/01-dev-environment/problem.fr.txt: -------------------------------------------------------------------------------- 1 | L'une des choses les plus importantes que npm fait est d'installer des 2 | paquets. 3 | 4 | Ensuite, lancez `npm init` pour créer un fichier package.json. Vous serez 5 | invité à répondre à un certain nombre de questions. Vous pouvez simplement 6 | appuyer sur la touche entrée pour accepter la valeur par défaut pour chaque 7 | question. 8 | 9 | Lancez `$ADVENTURE_COMMAND verify` une fois que vous avez terminé. Toutes 10 | les autres commandes que vous exécuterez dans ce tutoriel devrait être 11 | fait dans ce dossier. 12 | -------------------------------------------------------------------------------- /problems/01-dev-environment/problem.ja.txt: -------------------------------------------------------------------------------- 1 | 何はともあれ、最も重要な npm 機能といえば依存パッケージのインストールです。 2 | 3 | しかし、お行儀の良いワークショップであるためにも、みなさんのコンピューターのそこかしこに 4 | ファイルを散らばらせることは避けたいところです。なので、先に進む前に開発環境を準備してみましょう。 5 | 6 | 最初に、新しいディレクトリを作成してその中に `cd` で移動してみましょう。 7 | 8 | 完了したら `npm init` を実行して package.json というファイルを作成します。このコマンドを 9 | 実行すると、いくつかの質問が表示されます。自分でカスタマイズした入力をする他に、デフォルトの 10 | 設定を使うこともできます。その場合は、エンターキーを押して各質問の回答をスキップしてください。 11 | 12 | 準備が完了したら `$ADVENTURE_COMMAND verify` を実行します。以降の課題も、このフォルダ内で 13 | 作業するようにしてください。 14 | -------------------------------------------------------------------------------- /problems/01-dev-environment/problem.ko.txt: -------------------------------------------------------------------------------- 1 | npm이 하는 가장 중요한 일 중 하나는 패키지를 설치하는 것입니다. 2 | 3 | 하지만 깔끔한 워크숍을 진행하기 위해서 여러분의 컴퓨터에 파일을 어지럽히고 싶진 않습니다. 4 | 그래서 먼저 워크숍 전용의 개발환경을 구축해 봅시다. 5 | 6 | 먼저 새로운 디렉터리를 만들고 cd로 이동해 봅시다. 7 | 8 | 완료했다면 `npm init`을 실행해서 package.json이라는 파일을 만듭니다. 이 명령어를 실행하면 몇 개의 질문에 응해야 합니다. 디폴트로 설정하려면 엔터를 계속 누르세요. 9 | 10 | 준비가 완료됐다면 `$ADVENTURE_COMMAND verify`를 실행해봅시다. 이후의 과제들은 이 폴더에서 작업해야 합니다. 11 | -------------------------------------------------------------------------------- /problems/01-dev-environment/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | npm 做的最重要的事情之一就是安装软件包。 2 | 3 | 然而,为了成为一个好的学习教程,我们不希望在您的电脑中制造垃圾文件,所以在继续之前, 4 | 让我们设置一个开发环境。 5 | 6 | 首先,创建一个新目录,并 `cd` 到其中。 7 | 8 | 然后,运行 "npm init" 创建 package.json 文件。您按照提示回答一些问题。 9 | 您可以按 Enter 将每个问题的答案设置为默认值。 10 | 11 | 完成上述工作后,运行 "$ADVENTURE_COMMAND verify" 进行验证。以后的所有练习,您都 12 | 应该在这个文件夹中完成。 -------------------------------------------------------------------------------- /problems/01-dev-environment/success.en.txt: -------------------------------------------------------------------------------- 1 | Congratulations! 2 | You have a development environment. 3 | 4 | From here on out, make sure to run the workshop in this dir 5 | 6 | You might notice that a `.npmrc` file will show up in there. 7 | That normally would not be required, but the workshop uses it 8 | to mock out the parts that would normally talk to the internet. 9 | -------------------------------------------------------------------------------- /problems/01-dev-environment/success.es.txt: -------------------------------------------------------------------------------- 1 | ¡Muy bien! 2 | Ahora tienes un ambiente de desarrollo. 3 | 4 | De aquí en adelante asegúrate que ejecutas el workshop en este directorio. 5 | 6 | Tal vez has notado que hay un fichero `.npmrc` se ha aparecido ahí. 7 | Normalmente, este no sería requerido, pero el workshop lo usa para simular 8 | las partes que normalmente se conectarían al internet. 9 | -------------------------------------------------------------------------------- /problems/01-dev-environment/success.fr.txt: -------------------------------------------------------------------------------- 1 | Félicitation! 2 | Vous avez un environnement de développement. 3 | 4 | À partir de là, assurez-vous d'exécuter l'atelier dans ce répertoire 5 | 6 | Vous remarquerez peut-être qu'un fichier `.npmrc` apparaîtra. 7 | cela ne serait normalement pas nécessaire, mais l'atelier l'utilise 8 | pour se passer des parties qui normalement utilisent internet. 9 | -------------------------------------------------------------------------------- /problems/01-dev-environment/success.ja.txt: -------------------------------------------------------------------------------- 1 | おめでとうございます! 2 | 開発環境の準備が完了しました。 3 | 4 | これ以降の課題は、このディレクトリ内で作業を行うようにしてください。 5 | 6 | ところで `.npmrc` というファイルがあることに気付きましたでしょうか。 7 | このファイルは、普段は必須ではありませんが、このワークショップでは 8 | `.npmrc` を使って、インターネットと繋っているように見せかけています。 9 | -------------------------------------------------------------------------------- /problems/01-dev-environment/success.ko.txt: -------------------------------------------------------------------------------- 1 | 축하합니다! 2 | 개발환경이 준비되었습니다. 3 | 4 | 이후의 과제들은 현재 디렉터리에서 작업해주세요. 5 | 6 | `.npmrc`라는 파일이 생기신 걸 눈치채셨나요? 7 | 이 파일은 필수는 아니지만 이번 워크숍에서는 이 파일을 사용해서 8 | 마치 인터넷을 사용하고 있는 것처럼 보여줍니다. 9 | -------------------------------------------------------------------------------- /problems/01-dev-environment/success.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 恭喜!开发环境已就绪。 2 | 3 | 在此目录中执行其他任务。 4 | 5 | 顺便问一下,您是否注意到 `.npmrc` 文件?此文件通常不是必需的,但在此练习中,使 6 | 用 `.npmrc`,模拟互联网连接。 -------------------------------------------------------------------------------- /problems/02-login/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var reg = require('../../lib/registry.js') 3 | var shop = require('../../') 4 | 5 | exports.problem = { 6 | file: path.join(__dirname, 'problem.{lang}.txt') 7 | } 8 | 9 | exports.init = function (workshopper) { 10 | this.__ = workshopper.i18n.__ 11 | reg.run('login') 12 | } 13 | 14 | exports.verify = function (args, cb) { 15 | if (!shop.cwd()) return cb(false) 16 | var __ = this.__ 17 | 18 | // test who we are with whoami 19 | var exec = require('child_process').exec 20 | var npm = '"' + require('which').sync('npm') + '"' 21 | exec(npm + ' whoami', function (er, stdout, stderr) { 22 | var text = (stdout + '').trim() + '\n' + ((stderr || '') + '').trim() 23 | 24 | if (text.match(/Not authed. {2}Run 'npm adduser'/) || text.match(/ENEEDAUTH/)) { 25 | console.log(__('login.logged_out')) 26 | return cb(false) 27 | } 28 | 29 | if (er) { 30 | process.stdout.write(stdout) 31 | process.stderr.write(stderr) 32 | 33 | console.log(__('login.whoami_err')) 34 | return cb(false) 35 | } 36 | 37 | console.log(__('login.success', {user: (stdout + '').trim()})) 38 | reg.kill() 39 | return cb(true) 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /problems/02-login/problem.en.txt: -------------------------------------------------------------------------------- 1 | npm is best when you can be a part of it. That starts with 2 | creating an account. 3 | 4 | Because this is just a tutorial adventure, remember, we're not 5 | *actually* creating an account anywhere. However, when you run 6 | this in the Real World, it'll create a real account, with a page 7 | on npmjs.com and the ability to publish packages that real live 8 | humans can install and enjoy. 9 | 10 | To see who you're logged in as, run `npm whoami` 11 | 12 | To create your account, run `npm adduser` 13 | 14 | Try it now, and open the door to ever-greater module fun times! 15 | Then run `$ADVENTURE_COMMAND verify` 16 | -------------------------------------------------------------------------------- /problems/02-login/problem.es.txt: -------------------------------------------------------------------------------- 1 | npm no es sólo una utilidad, si no que también es una comunidad. Así 2 | que es mejor cuando puedes ser parte de él. Eso comienza con la 3 | creación de una cuenta. 4 | 5 | Como esto es sólamente un tutorial, recuerda que no estamos *verdaderamente* 6 | creando una cuenta en ningún sitio. De la misma manera, cuando ejecutes esto 7 | en el Mundo Real™, creará la cuenta de verdad, con una página web en npmjs.com 8 | y la abilidad de publicar tus propios paquetes que otras personas verdaderas 9 | podrán instalar y disfrutar. 10 | 11 | Para ver el nombre del usuario que estás usando, usa `npm whoami`. 12 | 13 | Para crear tu cuenta nueva, usa `npm adduser`. 14 | 15 | ¡Dale! Trátalo ahora y abre las puertas hacia la gloria y fama que viene con 16 | participar en la comunidad. 17 | 18 | Cuando termines, ejecuta `$ADVENTURE_COMMAND verify`. 19 | -------------------------------------------------------------------------------- /problems/02-login/problem.fr.txt: -------------------------------------------------------------------------------- 1 | npm est meilleur quand vous en faites partie. 2 | Cela commence par créer un compte. 3 | 4 | Parce que c'est juste un tutoriel, rappelez-vous, nous n'allons pas 5 | *réellement* créer un compte quelque part. Toutefois, lorsque vous 6 | faites cela dans le monde réel, il va créer un compte réel, 7 | avec une page sur npmjs.com et la possibilité de publier des 8 | packages réels dont les humains peuvent installer et profiter 9 | 10 | Pour voir en tant que qui vous êtes connecté, exécutez `npm whoami` 11 | 12 | Pour créer un compte, lancez `npm adduser` 13 | 14 | Essayez-le maintenant et ouvrez la porte à de plus en plus 15 | de module fun ! Ensuite, exécutez `$ADVENTURE_COMMAND verify` 16 | -------------------------------------------------------------------------------- /problems/02-login/problem.ja.txt: -------------------------------------------------------------------------------- 1 | npm をフルに楽しむために、そのエコシステムに参加してみましょう。参加するためには、 2 | アカウントの作成が必要になります。 3 | 4 | これはチュートリアルですので、擬似的に npm のサーバーを再現していることを思い出してください。 5 | *実際には* アカウントは作られません。しかし、実際の世界で同じコマンドを実行すれば、本物の 6 | アカウントを作成することができます。実際にアカウントを作成すると npmjs.com のページに 7 | アカウントのページが作成され、あなたのパッケージを公開することができ、そのパッケージを 8 | 他の人がインストールして楽しむことが可能となります。 9 | 10 | ログインしているアカウントを確認するには、`npm whoami` を実行してください。 11 | 12 | アカウントを作成するためには `npm adduser` を実行してください。 13 | 14 | それでは、実際に試してみましょう!そしてモジュールの世界への扉を開けてみましょう。 15 | 完了したら `$ADVENTURE_COMMAND verify` を実行してください。 16 | -------------------------------------------------------------------------------- /problems/02-login/problem.ko.txt: -------------------------------------------------------------------------------- 1 | npm을 최대한 즐기기 위해 직접 생태계에 참가해 봅시다. 2 | 먼저, 계정을 만들어 봅시다. 3 | 4 | 이것은 튜토리얼이기 때문에 유사 npm 서버를 재현하고 있다는 것을 기억해주세요. 5 | *실제* 계정은 만들어지지 않습니다. 단, 실제 세계에서 같은 명령어를 실행하면 6 | 실제 계정을 만들 수 있습니다. 실제 계정을 작성하면 npmjs.com 페이지에 계정 전용 페이지가 7 | 만들어지고 당신이 만든 패키지를 배포할 수 있으며 그 패키지를 다른 사람이 받을 수도 있습니다. 8 | 9 | 현재 로그인 중인 계정을 확인하려면, `npm whoami`을 실행해주세요. 10 | 11 | 계정을 작성하려면 `npm adduser`를 실행해주세요. 12 | 13 | 그럼, 실제로 해봅시다. 모듈의 세계로 들어가 봅시다! 14 | 완료했다면 `$ADVENTURE_COMMAND verify`를 실행해주세요. 15 | -------------------------------------------------------------------------------- /problems/02-login/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 正是因为有您的加入,npm 才会变得更美好。从创建一个帐户开始吧。 2 | 3 | 因为这只是一个教程,所以我们不会*实际*在某个地方创建帐户。但是,当您在现实世界 4 | 中这样做,它将创建一个真实的帐户。npmjs.com 上有一个页面,可以发布供人们安装和 5 | 使用的真正软件包。 6 | 7 | 要查看您登录的账户,请运行 "npm whoami" 8 | 9 | 要创建帐户,请运行 "npm adduser" 10 | 11 | 那么,让我们实际尝试一下吧!打开更大的模块世界的大门。完成后,请运 12 | 行 "$ADVENTURE_COMMAND verify"。 -------------------------------------------------------------------------------- /problems/03-start-a-project/continue.en.txt: -------------------------------------------------------------------------------- 1 | For extra credit, try also setting up this dir as a git repository. 2 | 3 | The convention is to have a single git repo for each module or project. 4 | Use the `git init` command to set up your working dir as a git project. 5 | 6 | Then, run `how-to-npm verify extra credit` 7 | -------------------------------------------------------------------------------- /problems/03-start-a-project/continue.es.txt: -------------------------------------------------------------------------------- 1 | Como bono, trata también de preparar este directorio con git. 2 | 3 | La práctica común es tener un solo repositorio de git para cada paquete. 4 | Usa `git init` para preparar tu directorio de desarrollo como un 5 | proyecto de git. 6 | 7 | Entonces, haz `how-to-npm verify extra credit`. 8 | -------------------------------------------------------------------------------- /problems/03-start-a-project/continue.fr.txt: -------------------------------------------------------------------------------- 1 | Pour bonus, essayez également de configurer ce répertoire comme dépôt git. 2 | 3 | La convention est d'avoir un seul git repo pour chaque module ou projet. 4 | Utilisez la commande `git init` pour configurer votre répertoire de 5 | travail comme un projet git. 6 | 7 | Ensuite, exécutez how-to-npm verify extra credit` vérifier le bonus. 8 | -------------------------------------------------------------------------------- /problems/03-start-a-project/continue.ja.txt: -------------------------------------------------------------------------------- 1 | 追加の課題として、このプロジェクトを git リポジトリとしてセットアップしてみましょう。 2 | 3 | npm では、慣例で各モジュールやプロジェクトが git リポジトリを一つ持つことになっています。 4 | `git init` を実行し、現在いるディレクトリを git プロジェクトとしてセットアップしましょう。 5 | 6 | 完了したら `how-to-npm verify extra credit` を実行してください。 7 | -------------------------------------------------------------------------------- /problems/03-start-a-project/continue.ko.txt: -------------------------------------------------------------------------------- 1 | 추가 과제로 이 프로젝트를 git 저장소로 만들어봅시다. 2 | 3 | npm은 관례로써 각 모듈과 프로젝트가 git 저장소를 하나씩 가지고 있습니다. 4 | `git init`을 실행해서 현재 디렉터리를 git 프로젝트로 만들어 봅시다. 5 | 6 | 완료했다면 `how-to-npm verify extra credit`을 실행해주세요. 7 | -------------------------------------------------------------------------------- /problems/03-start-a-project/continue.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 额外的挑战,尝试将此目录设置为 Git 仓库。 2 | 3 | 按照惯例,为每个模块或项目单独设置一个 Git 仓库。使用 "git init" 命令将您的工作 4 | 目录设置为一个 Git 仓库。 5 | 6 | 然后,运行 "how-to-npm verify extra credit" 进行验证。 -------------------------------------------------------------------------------- /problems/03-start-a-project/index.js: -------------------------------------------------------------------------------- 1 | var shop = require('../../') 2 | var reg = require('../../lib/registry.js') 3 | var fs = require('fs') 4 | var path = require('path') 5 | 6 | exports.init = function (workshopper) { 7 | this.__ = workshopper.i18n.__ 8 | this.lang = workshopper.i18n.lang 9 | reg.run('start-a-project') 10 | } 11 | 12 | exports.problem = { 13 | file: path.join(__dirname, 'problem.{lang}.txt') 14 | } 15 | 16 | exports.verify = function (args, cb) { 17 | var cwd = shop.cwd() 18 | var __ = this.__ 19 | 20 | try { 21 | require(cwd + '/package.json') 22 | } catch (er) { 23 | console.log(__('start-a-project.no_package')) 24 | return cb(false) 25 | } 26 | 27 | if (/^extracredit$/i.test(args[0] + args[1])) { 28 | try { 29 | fs.readFileSync(path.resolve(cwd, '.git', 'config')) 30 | console.log(__('start-a-project.extra_credit')) 31 | } catch (er) { 32 | console.log(fs.readFileSync(path.join(__dirname, 'suggestion.' + this.lang() + '.txt'), 'utf8') + cwd) 33 | return cb(false) 34 | } 35 | } else { 36 | console.log(fs.readFileSync(path.join(__dirname, 'continue.' + this.lang() + '.txt'), 'utf8')) 37 | } 38 | 39 | console.log(__('start-a-project.success')) 40 | 41 | return cb(true) 42 | } 43 | -------------------------------------------------------------------------------- /problems/03-start-a-project/problem.en.txt: -------------------------------------------------------------------------------- 1 | npm helps you build projects, but for npm to be able to do that, you need 2 | to tell npm a little bit about your project. You can tell npm about your 3 | project in a file called package.json. 4 | 5 | Run `npm init --scope=`, and replace with the user 6 | you created in the last lesson. This will create a package.json file. 7 | (For extra credit, set the project up with a git repo as well.) 8 | 9 | Run `$ADVENTURE_COMMAND verify` once you're done. 10 | -------------------------------------------------------------------------------- /problems/03-start-a-project/problem.es.txt: -------------------------------------------------------------------------------- 1 | npm te ayuda a crear proyectos, pero para que npm pueda 2 | hacerlo, necesitas decirle algunas cosas sobre to proyecto. 3 | Esta información se contiene en un fichero llamado package.json. 4 | 5 | Haz `npm init --scope=`, y reemplaza con el nombre del 6 | usuario que creaste en la última lección (usa `npm whoami` si se te olvidó). 7 | Esto creará un package.json. 8 | (Opcionalmente, como bono, prepara el directorio como repositorio de git). 9 | 10 | Haz `$ADVENTURE_COMMAND verify` cuando termines. 11 | -------------------------------------------------------------------------------- /problems/03-start-a-project/problem.fr.txt: -------------------------------------------------------------------------------- 1 | npm vous aide à créer des projets, mais pour que npm puisse le faire, 2 | vous avez besoin de donner des détails à propos de votre projet à npm. 3 | Vous pouvez indiquer ces détails à npm votre projet dans un fichier 4 | appelé package.json. 5 | 6 | Lancez `npm init --scope=`, et remplacez avec 7 | l'utilisateur que vous avez créé dans la dernière leçon. Cela va 8 | créer un fichier package.json. 9 | (Pour le bonus, définissez également le projet avec un dépôt git.) 10 | 11 | lancez `$ADVENTURE_COMMAND verify` quand vous aurez fini. 12 | -------------------------------------------------------------------------------- /problems/03-start-a-project/problem.ja.txt: -------------------------------------------------------------------------------- 1 | npm は、あなたのプロジェクトの構築を手助けしますが、そのためには npm にあなたのプロジェクトに 2 | 関して詳細を少しだけ教えてあげる必要があります。npm へは package.json という 3 | ファイルを通じて情報を伝えることができます。 4 | 5 | `npm init --scope=<ユーザー名>` から <ユーザー名> の部分を、先のレッスンで作成したあなたの 6 | アカウント名に置き換えて、実行してください。実行すると package.json が作成されます。 7 | 8 | (追加の課題として、このプロジェクトを git リポジトリとしてセットアップしてみましょう。) 9 | 10 | 完了したら `$ADVENTURE_COMMAND verify` を実行してください。 11 | -------------------------------------------------------------------------------- /problems/03-start-a-project/problem.ko.txt: -------------------------------------------------------------------------------- 1 | npm이 현재 프로젝트의 구축을 돕게 하려면, 현재 프로젝트에 관한 정보를 조금 알려 줄 필요가 있습니다. package.json이라는 파일을 통해서 npm에게 정보를 전달해 줄 수 있습니다. 2 | 3 | `npm init --scope=<유저명>`에서 <유저명> 부분에 이전 과제에서 작성한 계정을 입력한 뒤, 실행해주세요. package.json이 만들어질 것입니다. 4 | (추가 과제로서 이 프로젝트를 git 저장소로 만들어봅시다) 5 | 6 | 완료했다면 `$ADVENTURE_COMMAND verify`를 실행해주세요. 7 | -------------------------------------------------------------------------------- /problems/03-start-a-project/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | npm 可以帮助您构建项目,但为了使 npm 做到这一点,您需要告诉 npm 关于项目的一点 2 | 信息。您可以在 package.json 文件中,告诉 npm 您的项目信息。 3 | 4 | 运行 "npm init --scope=",并且将 替换成您在上一节课创建的 5 | 用户名。这将创建一个 package.json 文件。(额外的挑战,将此项目设为 Git 仓库。) 6 | 7 | 当您完成上述工作后,运行 "$ADVENTURE_COMMAND verify" -------------------------------------------------------------------------------- /problems/03-start-a-project/suggestion.en.txt: -------------------------------------------------------------------------------- 1 | Well, you got everything except the git part. 2 | The convention is one git repo per module, so you usually ought 3 | to run `git init` at the root of your project. 4 | 5 | Remove the .git folder from wherever you were, and run `git init` in 6 | -------------------------------------------------------------------------------- /problems/03-start-a-project/suggestion.es.txt: -------------------------------------------------------------------------------- 1 | Bueno, hiciste todo excepto la parte de git. 2 | La práctica común es un repositorio de git por paquete, 3 | así que en verdad deberías de hacer `git init` en la raíz 4 | de tu proyecto. 5 | 6 | Si iniciaste a git donde no era, remueve el directorio `.git` 7 | de ahí y usa `git init` de nuevo. 8 | -------------------------------------------------------------------------------- /problems/03-start-a-project/suggestion.fr.txt: -------------------------------------------------------------------------------- 1 | Eh bien, vous avez tout sauf la partie git. 2 | La convention est un dépôt git par module, donc vous devez 3 | habituellement lancer `git init` à la base du projet. 4 | 5 | Supprimer le dossier .git de n'importe où où vous êtes, 6 | et lancez-y `git init`. 7 | -------------------------------------------------------------------------------- /problems/03-start-a-project/suggestion.ja.txt: -------------------------------------------------------------------------------- 1 | git のパートを除いて、回答が完了しているようですね。 2 | 3 | npm では、慣例で一つのモジュールには一つの git リポジトリが対になる存在として設置することと 4 | なっています。`git init` をプロジェクトのルートディレクトリで実行してみてください。 5 | 6 | 再構築には、 .git フォルダを削除し `git init` を実行すれば可能です。 7 | プロジェクトのディレクトリ: 8 | -------------------------------------------------------------------------------- /problems/03-start-a-project/suggestion.ko.txt: -------------------------------------------------------------------------------- 1 | git 부분을 제외하고 완료하신 것 같군요. 2 | npm에서는 하나의 모듈에는 하나의 git 저장소가 존재하게 되어있습니다. 3 | `git init`를 프로젝트 루트 디렉터리에서 실행해주세요. 4 | 5 | 재구축하려면 .git 폴더를 삭제하고 `git init`을 실행해 주세요. 6 | -------------------------------------------------------------------------------- /problems/03-start-a-project/suggestion.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 好吧,除了 git 部分其他的您均已拥有。 2 | 3 | 按照惯例,一个模块要设置一个 Git 仓库,因此您需要在您项目的根目录下运行 "git init" 命令。 4 | 5 | 删除您当前的 .git 文件夹,然后再运行 "git init" 重建项目。 -------------------------------------------------------------------------------- /problems/04-install-a-module/index.js: -------------------------------------------------------------------------------- 1 | var reg = require('../../lib/registry.js') 2 | var shop = require('../../') 3 | var path = require('path') 4 | 5 | exports.problem = { 6 | file: path.join(__dirname, 'problem.{lang}.txt') 7 | } 8 | 9 | exports.init = function (workshopper) { 10 | this.__ = workshopper.i18n.__ 11 | reg.run('install-a-module') 12 | } 13 | 14 | exports.verify = function (args, cb) { 15 | var cwd = shop.cwd() 16 | if (!cwd) return cb(false) 17 | 18 | var __ = this.__ 19 | 20 | try { 21 | require(cwd + '/node_modules/@linclark/pkg') 22 | } catch (er) { 23 | console.log(__('install-a-module.error', {error: er})) 24 | return cb(false) 25 | } 26 | 27 | console.log(__('install-a-module.success')) 28 | reg.kill() 29 | 30 | return cb(true) 31 | } 32 | -------------------------------------------------------------------------------- /problems/04-install-a-module/problem.en.txt: -------------------------------------------------------------------------------- 1 | The first thing that most people do with npm is install a dependency. 2 | 3 | Dependencies are fetched from the registry, and unpacked in the `node_modules` 4 | folder. 5 | 6 | To install a module, use the `npm install ` command. 7 | 8 | The registry that we're using for this tutorial is a tiny version of 9 | the one at https://registry.npmjs.org. So you might find that it only has 10 | a small number of things. 11 | 12 | Let's start out by installing the "@linclark/pkg" module. 13 | 14 | Run `$ADVENTURE_COMMAND verify` once you're done. 15 | -------------------------------------------------------------------------------- /problems/04-install-a-module/problem.es.txt: -------------------------------------------------------------------------------- 1 | La primera cosa que la mayoría de las personas hacen con npm es 2 | instalar lo que se llama una "dependencia". 3 | 4 | Las dependencias se adquieren del registro de npm en el internet, 5 | y se desempacan a un directorio llamado `node_modules` en tu proyecto. 6 | 7 | Para instalar un paquete, usa `npm install `. 8 | 9 | El registro principal de npm se encuentra en https://registry.npmjs.org pero 10 | la version que usaremos para este tutorial es un registro pequeñísimo y 11 | local que estamos usando para que no necesites el internet durante el 12 | workshop. Todo lo que haremos funcionará igual cuando esté usando el 13 | registro principal. 😉 14 | 15 | Vamos a tratar de instalar algo: El paquete `@linclark/pkg`. 16 | 17 | Haz `$ADVENTURE_COMMAND verify` cuando lo hayas instalado. 18 | -------------------------------------------------------------------------------- /problems/04-install-a-module/problem.fr.txt: -------------------------------------------------------------------------------- 1 | La première chose que la plupart des gens font avec npm est installer une 2 | dépendance. 3 | 4 | Les dépendances sont récupérés depuis le registre, et dépaquetés dans le 5 | dossier `node_modules`. 6 | 7 | Pour installer une dépendance, utilisez la commande 8 | `npm install `. 9 | 10 | Le registre que nous sommes en train d'utiliser pour ce didactitiel est 11 | une version réduite de celui à l'adresse https://registry.npmjs.org. 12 | Donc vous devriez penser qu'il y a seulement un petit nombre de choses. 13 | 14 | Commençons par installer le module "@linclark/pkg". 15 | 16 | Lancez `$ADVENTURE_COMMAND verify` une fois que vous avez fini. 17 | -------------------------------------------------------------------------------- /problems/04-install-a-module/problem.ja.txt: -------------------------------------------------------------------------------- 1 | ほとんどの人が npm を使って最初にやることは、依存パッケージのインストールです。 2 | 3 | 依存パッケージはレジストリから取得され、`node_modules` フォルダに展開されます。 4 | 5 | モジュールをインストールするには `npm install <モジュール名>` を実行してください。 6 | 7 | このチュートリアルで使用されているレジストリは https://registry.npmjs.org の簡易版です。 8 | もしかしたら、あなたはレジストリに少ししかパッケージがないことにお気づきかもしれません。 9 | 10 | まずは @linclark/pkg" モジュールのインストールをしてみましょう。 11 | 12 | 完了したら `$ADVENTURE_COMMAND verify` を実行してください。 13 | -------------------------------------------------------------------------------- /problems/04-install-a-module/problem.ko.txt: -------------------------------------------------------------------------------- 1 | 대부분의 사람이 npm를 사용해서 맨 처음 하는 일은 의존 패키지를 설치하는 것입니다. 2 | 3 | 의존 패키지들은 레지스트리로부터 받아와 `node_modules` 폴더에 저장됩니다. 4 | 5 | 모듈을 설치하려면 `npm install <모듈 명>`을 실행해주세요. 6 | 7 | 이 워크숍에서 사용되는 레지스트리는 https://registry.npmjs.org의 간이 버전입니다. 레지스토리에 패키지가 몇 개 없다는 것을 눈치채실지도 모르겠습니다. 8 | 9 | 먼저 @linclark/pkg 모듈을 설치해봅시다. 10 | 11 | 완료했다면 `$ADVENTURE_COMMAND verify`를 실행해주세요. 12 | -------------------------------------------------------------------------------- /problems/04-install-a-module/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 对于大多数人而言,使用 npm 做的第一件事是安装依赖的软件包。 2 | 3 | 所有的依赖都从 registry 中获取,然后解压到 "node_modules" 文件夹中。 4 | 5 | 安装一个模块,使用 "npm install " 命令。 6 | 7 | 我们使用的 registry 是 https://registry.npmjs.org 的一个很小的版本。因此您也许 8 | 发现了,它只有一些少量的东西。 9 | 10 | 请安装 "@linclark/pkg" 模块。 11 | 12 | 完成所有工作后,运行 "$ADVENTURE_COMMAND verify"。 -------------------------------------------------------------------------------- /problems/05-listing-dependencies/continue.en.txt: -------------------------------------------------------------------------------- 1 | Indeed, not all is well here in dep-land. 2 | 3 | Your dependencies should be listed in the package.json file in an 4 | object called 'dependencies'. However, when we installed '@linclark/pkg', 5 | we didn't update the package.json file to list out this dependency. 6 | 7 | So, it shows up as 'extraneous', warning us that we have something 8 | there that we haven't listed as a dependency. 9 | 10 | The easiest way to avoid this situation is to use the `--save` flag 11 | when installing dependencies. You might not want to do this with 12 | things that you're just trying out, but when you decide on something, 13 | you can use this flag to update your package.json file easily. 14 | 15 | Try running `npm install @linclark/pkg --save` to install the module, and also 16 | update your package.json file at the same time. 17 | 18 | (Another option is to just edit package.json yourself in a text editor) 19 | 20 | Then run `how-to-npm verify OK` once you've fixed the problem. 21 | -------------------------------------------------------------------------------- /problems/05-listing-dependencies/continue.es.txt: -------------------------------------------------------------------------------- 1 | Pues claro, no todo está bien en el mundo de las dependencias. 2 | 3 | Tus dependencias deberían estar en el package.json, dentro de un "objecto" 4 | llamado `dependencies`. Pero, cuando instalamos `@linclark/pkg`, no lo 5 | añadimos al package.json para guardar esta dependencia. 6 | 7 | Así que puedes ver que aparece como `extraneous` en el listado, alertándonos 8 | que tenemos algo en nuestro `node_modules` que no hemos todavía guardado como 9 | dependencia oficial de nuestro paquete. 10 | 11 | La forma más fácil de arreglar este problema es usando la opción `--save` 12 | cuando instalemos dependencias. Tal vez no lo querrás hacer si sólo las 13 | estás tratando, pero cuando decidas que tu paquete las requerirá, puedes 14 | usar esta opción para fácilmente ponerlas en tu package.json. 15 | 16 | Trata de hacer `npm install @linclark/pkg --save` para instalar el paquete, 17 | y para añadirlo a tu package.json a la misma vez. 18 | 19 | (Otra opcion, claramente, es simplemente editar to package.json) 20 | 21 | Cuando termines, haz `how-to-npm verify OK`. 22 | -------------------------------------------------------------------------------- /problems/05-listing-dependencies/continue.fr.txt: -------------------------------------------------------------------------------- 1 | En effet, tout n'est pas bien ici dans le monde des dépendances. 2 | 3 | Vos dépendances doivent être répertoriées dans le fichier package.json 4 | dans un objet appelé «dependencies». Cependant, lorsque nous avons 5 | installé '@linclark/pkg', nous n'avons pas mis à jour le fichier package.json 6 | pour répertorier cette dépendance. 7 | 8 | Donc, il apparaît comme «extraneous», nous avertissant ainsi que nous avons 9 | quelque chose n'est pas répertorié comme une dépendance. 10 | 11 | La meilleure façon d'éviter cette situation est d'utiliser l'indicateur `--save` 12 | lors de l'installation des dépendances. Vous ne voudrez peut-être pas faire ça 13 | lorsque vous essayez seulement une dépendance, mais quand vous 14 | décidez d'en garder une, vous pouvez utiliser ce drapeau pour mettre à jour votre 15 | fichier package.json facilement. 16 | 17 | Essayez d'installer `npm install @linclark/pkg --save` pour installer le module, 18 | et dans le même temps mettez à jour votre fichier package.json. 19 | 20 | (Une autre option est de simplement éditer le package.json vous-même dans un 21 | éditeur de texte) 22 | 23 | Ensuite, exécutez `how-to-npm verify OK` une fois que vous avez réglé le 24 | problème. 25 | -------------------------------------------------------------------------------- /problems/05-listing-dependencies/continue.ja.txt: -------------------------------------------------------------------------------- 1 | お察しの通り、いまの段階では依存パッケージの管理を完全には行えていません。 2 | 3 | みなさんの依存パッケージは package.json の中の 'dependencies' と呼ばれるフィールド 4 | に追加されているべきです。しかし、今しがた '@linclark/pkg' モジュールをインストールした 5 | 際には、package.json を更新して依存パッケージの追加を行いませんでした。 6 | 7 | これが原因で npm は 'extraneous' という警告を表示し、依存パッケージの管理を可能とする 8 | 'dependencies' フィールドに追加されていないことを知らせています。 9 | 10 | この状況を解決する最も簡単な方法は、モジュールをインストールする際に `--save` フラグを追加する 11 | ことです。モジュールをお試しで使う際には、この機能を使う必要はあまりないかもしれません。しかし、 12 | 覚悟を決めてあなたのプロジェクトに導入する際は、このフラグを使って package.json を簡単に 13 | 更新することができます。 14 | 15 | `npm install @linclark/pkg --save` を実行して、モジュールのインストールと 16 | package.json の更新を試してみましょう。 17 | 18 | (他のやり方としては、直接 package.json をテキストエディタで編集しても構いません。) 19 | 20 | 問題を解決したら `how-to-npm verify OK` を実行してください。 21 | -------------------------------------------------------------------------------- /problems/05-listing-dependencies/continue.ko.txt: -------------------------------------------------------------------------------- 1 | 사실 지금 단계에서의 의존 패키지 관리는 완벽하지 않습니다. 2 | 3 | 의존 패키지들은 package.json내의 'dependencies' 필드에 추가돼있어야 합니다. 그러나 4 | '@linclark/pkg' 모듈을 설치했을 때 package.json 이 이 모듈을 의존하도록 갱신하지 않았습니다. 5 | 6 | 이 경우 npm은 'extraneous'라는 경고를 표시해서, 의존 패키지를 관리하는 7 | 'dependencies' 필드가 추가되지 않았음을 알려줍니다. 8 | 9 | 이 상황을 해결하는 가장 좋은 방법은 모듈 설치 시에 `--save` 플래그를 추가하는 것입니다. 10 | 모듈을 시험 삼아 써볼 때는 이 기능은 별로 필요가 없습니다. 하지만, 모듈을 현재 프로젝트에 11 | 도입하기로 했다면 이 플래그를 사용해서 package.json을 간단히 갱신할 수 있습니다. 12 | 13 | `npm install @linclark/pkg --save`를 실행해서 모듈의 설치와 14 | package.json의 갱신을 확인해보세요. 15 | 16 | (다른 방법으로, package.json을 직접 텍스트 에디터로 편집할 수 있습니다) 17 | 18 | 문제가 해결됐다면 `how-to-npm verify OK`를 실행해주세요. 19 | -------------------------------------------------------------------------------- /problems/05-listing-dependencies/continue.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 如您所见,目前对依赖包的管理并不算好。 2 | 3 | 依赖包必须添加到 package.json 内的 "dependencies" 字段中。 4 | 然而,当我们安装 "@linclark/pkg" 模块时,我们并没有更新 package.json 文件中的依赖列表。 5 | 6 | 所以,npm 会发出一个 'extraneous' 警告,告诉我们没有添加 'dependencies' 字段来管理依赖包。 7 | 8 | 避免发生此情况的最简单的办法是,在安装依赖时追加 "--save" 标识。虽然在试用模块时,可能您并 9 | 不希望这么做,但如果您决定将模块引入到当前项目中,则可以使用该标识更新 package.json。 10 | 11 | 尝试运行 "npm install @linclark/pkg --save" 来安装模块,并更新 package.json 文件。 12 | 13 | (另一个方法是可以在文本编辑器中自己编辑 package.json 文件) 14 | 15 | 如果解决了该问题,则运行 "how-to-npm verify OK"。 -------------------------------------------------------------------------------- /problems/05-listing-dependencies/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var reg = require('../../lib/registry.js') 3 | var shop = require('../../') 4 | var fs = require('fs') 5 | 6 | exports.problem = { 7 | file: path.join(__dirname, 'problem.{lang}.txt') 8 | } 9 | 10 | exports.init = function (workshopper) { 11 | this.__ = workshopper.i18n.__ 12 | this.lang = workshopper.i18n.lang 13 | reg.run('install-a-module') 14 | } 15 | 16 | exports.verify = function (args, cb) { 17 | // verify we're in the right folder 18 | var cwd = shop.cwd() 19 | var __ = this.__ 20 | if (!cwd) return false 21 | 22 | // see if there was a problem or not 23 | var deps = require(cwd + '/package.json').dependencies 24 | try { 25 | var pkg = require(cwd + '/node_modules/@linclark/pkg/package.json') 26 | } catch (er) {} 27 | var semver = require('semver') 28 | var ok 29 | if (!pkg || !deps || !deps['@linclark/pkg'] || !semver.satisfies(pkg.version, deps['@linclark/pkg'])) { 30 | ok = false 31 | } else { 32 | ok = true 33 | } 34 | 35 | var claim = args.join('').toUpperCase().trim() 36 | 37 | if (claim !== 'OK' && claim !== 'NOTOK') { 38 | console.log(__('listing-dependencies.usage')) 39 | return cb(false) 40 | } 41 | 42 | if (claim === 'OK' && !ok) { 43 | console.log(__('listing-dependencies.ok_not')) 44 | return cb(false) 45 | } else if (claim === 'NOTOK' && ok) { 46 | console.log(__('listing-dependencies.not_ok_not')) 47 | return cb(false) 48 | } else if (ok) { 49 | console.log(__('listing-dependencies.success')) 50 | reg.kill() 51 | return cb(true) 52 | } else { 53 | console.log(fs.readFileSync(path.join(__dirname, 'continue.' + this.lang() + '.txt'), 'utf8')) 54 | // skip calling the cb, so we can keep working on it. 55 | return 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /problems/05-listing-dependencies/problem.en.txt: -------------------------------------------------------------------------------- 1 | npm isn't just for installing stuff. It also shows you what you 2 | have installed (your dependencies). 3 | 4 | You can do this using the `npm ls` command. 5 | 6 | Run this command in your working dir. If there are 7 | any problems npm will alert you by returning an "!ERR" message. 8 | 9 | If everything looks ok, then run `$ADVENTURE_COMMAND verify OK`, or 10 | `$ADVENTURE_COMMAND verify NOT OK` if npm does report a problem". 11 | -------------------------------------------------------------------------------- /problems/05-listing-dependencies/problem.es.txt: -------------------------------------------------------------------------------- 1 | npm no es sólamente para instalar cosillas. Entre otras cosas, 2 | te enseña lo que ya tienes instalado localmente (es decir, 3 | tus dependencias). 4 | 5 | Puedes ver esta lista con el comando `npm ls`. 6 | 7 | Úsalo en tu directorio de desarrollo. Si hay algún problema, 8 | npm te alertará con un mensaje que empezará con `!ERR`. 9 | 10 | Si todo se ve bien, entonces haz `$ADVENTURE_COMMAND verify OK`, 11 | o si no, `$ADVENTURE_COMMAND verify NOT OK`. 12 | -------------------------------------------------------------------------------- /problems/05-listing-dependencies/problem.fr.txt: -------------------------------------------------------------------------------- 1 | npm n'est pas seulement fait pour l'installation. Il vous montre 2 | également ce que vous avez installé (vos dépendances). 3 | 4 | Vous pouvez le faire en utilisant la commande `npm ls`. 5 | 6 | Exécutez cette commande dans votre répertoire de travail. S'il y a 7 | un problème npm vous alertera en retournant un message "! ERR". 8 | 9 | Si tout semble correct, exécutez `$ADVENTURE_COMMAND verify OK`, ou 10 | `$ADVENTURE_COMMAND verify NOT OK` si npm signale un problème". 11 | -------------------------------------------------------------------------------- /problems/05-listing-dependencies/problem.ja.txt: -------------------------------------------------------------------------------- 1 | npm は、インストールのためだけにあるわけではありません。インストール済みの依存パッケージを 2 | 確認することもできます。 3 | 4 | `npm ls` を実行してみてください。 5 | 6 | もし何かしら問題がある状態でこのコマンドを実行すると npm は "!ERR" からはじまる 7 | エラーメッセージを表示します。 8 | 9 | 問題がなさそうでしたら `$ADVENTURE_COMMAND verify OK` を実行してください。 10 | また、何か問題があった場合は `$ADVENTURE_COMMAND verify NOT OK` を実行してください。 11 | -------------------------------------------------------------------------------- /problems/05-listing-dependencies/problem.ko.txt: -------------------------------------------------------------------------------- 1 | npm이 단지 설치만을 위해 있는 건 아닙니다. 2 | 설치 완료된 의존 패키지를 확인하는 것도 가능합니다. 3 | 4 | `npm ls`를 실행해보세요. 5 | 6 | 만약 문제가 있다면 이 명령어 실행 시에 npm은 "!ERR"로 시작되는 7 | 에러 메시지를 표시할 것입니다. 8 | 9 | 문제없다면 `$ADVENTURE_COMMAND verify OK`를 실행해주세요. 10 | 만약 문제가 있다면 `$ADVENTURE_COMMAND verify NOT OK`를 실행해주세요. 11 | -------------------------------------------------------------------------------- /problems/05-listing-dependencies/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | npm 不仅是用来安装的。它还能显示您已经安装的软件包(您的依赖项)。 2 | 3 | 您可以使用 "npm ls" 命令来实现。 4 | 5 | 在您的工作目录中运行该命令。如果出现任何问题,npm 将返回一条以 "!ERR" 开头的错误信息。 6 | 7 | 如果您发现一切 OK,则运行 "$ADVENTURE_COMMAND verify OK", 8 | 如果遇到任何问题,则运行 "$ADVENTURE_COMMAND verify NOT OK"。 -------------------------------------------------------------------------------- /problems/06-npm-test/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var shop = require('../../') 3 | 4 | exports.problem = { 5 | file: path.join(__dirname, 'problem.{lang}.txt') 6 | } 7 | 8 | exports.init = function (workshopper) { 9 | this.__ = workshopper.i18n.__ 10 | } 11 | 12 | exports.verify = function (args, cb) { 13 | var cwd = shop.cwd() 14 | if (!cwd) return cb(false) 15 | 16 | var __ = this.__ 17 | 18 | var pj = require(cwd + '/package.json') 19 | 20 | if (!pj.scripts || !pj.scripts.test) { 21 | console.log(__('npm-test.section_missing')) 22 | return cb(false) 23 | } 24 | 25 | // try running the test! 26 | var exec = require('child_process').exec 27 | 28 | console.log(__('npm-test.running') + '\n\n') 29 | exec('npm test --color=always', function (er, stdout, stderr) { 30 | process.stdout.write(stdout) 31 | process.stderr.write(stderr) 32 | 33 | console.log('\n\n' + __('npm-test.running_done')) 34 | 35 | if (er) { 36 | console.log(__('npm-test.error')) 37 | return cb(false) 38 | } 39 | 40 | console.log(__('npm-test.success')) 41 | return cb(true) 42 | }) 43 | } 44 | -------------------------------------------------------------------------------- /problems/06-npm-test/problem.en.txt: -------------------------------------------------------------------------------- 1 | Now you've installed something, and used `npm ls` to show what's going on. 2 | 3 | If you look at the package.json file, it has this rather odd bit in it: 4 | 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | 9 | npm can be used as a task runner with its "scripts" property. Almost 10 | every module and project will have a test script that runs to make 11 | sure everything is good. In order to help remind you to do this, npm 12 | puts an "always failing" test in there by default. 13 | 14 | First, create a file called `test.js`. For the purposes of this workshop 15 | you can leave it blank, but this would be where you'd write your 16 | tests (this is npm class, not testing class). The test has to exit 17 | without throwing an error, or else the test fails. 18 | 19 | Then, edit your `package.json` file to make your scripts section look like 20 | this instead: 21 | 22 | "scripts": { 23 | "test": "node test.js" 24 | }, 25 | 26 | Once that's done, run `$ADVENTURE_COMMAND verify` to check your work. 27 | 28 | Additional info: If you wanted to actually run any tests you'd written in 29 | `test.js` with the "test" script, you'd run `npm test`. 30 | 31 | The docs for npm's scripts property can be found here: 32 | https://docs.npmjs.com/misc/scripts 33 | -------------------------------------------------------------------------------- /problems/06-npm-test/problem.es.txt: -------------------------------------------------------------------------------- 1 | Así que ya has instalado algo, y usado `npm ls` para ver 2 | qué es lo que hizo. 3 | 4 | Si miras dentro del package.json, tiene esta parte medio extaña: 5 | 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | 10 | npm se puede usar como algo que se llama "task runner", o sea, 11 | un gestor de tareas. Esto se hace con la propiedas llamada "scripts". 12 | Casi todos los paquetes y proyectos tendrán una tarea de prueba 13 | que ejecuta para verificar que todo está funcionando bien. Para 14 | recordarte hacer esto, npm pone una prueba que "siempre falla" ahí 15 | cuando creas tu package.json. 16 | 17 | Para crear tu propia prueba, primero crea un fichero llamado `test.js`. 18 | Para los propósitos de este taller, puedes dejarlo en blanco, pero aquí 19 | es donde escribirías tus pruebas (esta es una clase de npm -- no de pruebas 🤓) 20 | La prueba tiene que terminar sin error, o si no npm entenderá que la prueba 21 | en sí falló. 22 | 23 | Entonces, edita tu `package.json` para que tu sección se vea así: 24 | 25 | "scripts": { 26 | "test": "node test.js" 27 | }, 28 | 29 | Cuando termines, y guardes el fichero, haz `$ADVENTURE_COMMAND verify` 30 | para verificar que lo hiciste bien. 31 | 32 | Adicionalmente: Si quieres ejecutar cualquier prueba que hayas escrito en 33 | `test.js`, simplemente puedes haces `npm test`, y npm hará lo que esperas. 34 | 35 | La documentación para `scripts` se encuentra en `npm help scripts`. 36 | -------------------------------------------------------------------------------- /problems/06-npm-test/problem.fr.txt: -------------------------------------------------------------------------------- 1 | Maintenant vous avez installé quelque chose et utilisé `npm ls` pour 2 | montrer ce qui se passe. 3 | 4 | Si vous regardez le fichier package.json, il a cette chose plutôt 5 | bizarre à l'intérieur: 6 | 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | 11 | npm peut être utilisé comme un gestionnaire de tâches avec sa propriété "scripts". 12 | Presque chaque module et projet aura un script de test qui fonctionne pour être 13 | sûr que tout est bon. Afin de vous rappeler de le faire, npm met un test 14 | "qui ne marchera jamais" par défaut. 15 | 16 | Tout d'abord, créez un fichier appelé `test.js`. Dans le but de cet 17 | atelier vous pouvez le laisser vide, mais ce serait là où vous écririez 18 | vos tests (c'est la classe npm, pas la classe de test). Le test doit 19 | se terminer sans lancer d'erreur, sinon le test échoue. 20 | 21 | Ensuite, modifiez votre fichier `package.json` pour modifier votre section scripts 22 | ressemblant à cela par exemple: 23 | 24 | "scripts": { 25 | "test": "node test.js" 26 | }, 27 | 28 | Une fois que c'est fait, exécutez `$ADVENTURE_COMMAND verify` pour vérifier votre 29 | travail. 30 | 31 | Informations supplémentaires: Si vous voulez exécuter des tests que vous avez 32 | écrits dans `test.js` avec le script de "test" script, vous devez lancer 33 | `npm test`. 34 | 35 | La documentation pour les scripts npm peut être trouvée ici: 36 | https://docs.npmjs.com/misc/scripts 37 | -------------------------------------------------------------------------------- /problems/06-npm-test/problem.ja.txt: -------------------------------------------------------------------------------- 1 | これまで、モジュールをインストールをし、`npm ls` を実行すると何が起きるかを確認しました。 2 | 3 | ところで、package.json を見てみると、次のような奇妙な記述があるかと思います: 4 | 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | 9 | npm は、この "scripts" プロパティを利用することでタスクランナーとしても利用できます。 10 | ほとんどのモジュールやプロジェクトは、動作を保証するためのテストスクリプトを備えています。 11 | テストを忘れないために、npm はデフォルトで常に失敗するテストスクリプトが設定されています。 12 | 13 | まずは `test.js` という名前のファイルを作成しましょう。このワークショップの課題においては、 14 | 空のファイルで大丈夫です。これで、どこにテストを書けば良いのかを理解できたかと思います(これは、 15 | ただの npm のクラスであり、テスト用の特別なクラスではありません)。また、テストは終了時に 16 | エラーがあってはいけません。さもなければ、テストは失敗となります。 17 | 18 | それでは、みなさんの `package.json` を編集し、下記のようにしてみましょう: 19 | 20 | "scripts": { 21 | "test": "node test.js" 22 | }, 23 | 24 | これが完了したら、`$ADVENTURE_COMMAND verify` を実行してください。 25 | 26 | 追加のヒント:あなたが "test" プロパティに設置した `test.js` を実行したい場合は、 27 | `npm test` で実行することができます。 28 | 29 | package.json の "scripts" に関する詳細な情報は、こちらで確認することができます: 30 | https://docs.npmjs.com/misc/scripts 31 | -------------------------------------------------------------------------------- /problems/06-npm-test/problem.ko.txt: -------------------------------------------------------------------------------- 1 | 지금까지 모듈을 설치하고 `npm ls`를 실행하면 무슨 일이 일어나는지 확인했습니다. 2 | 3 | 그런데 package.json 을 확인해보면 다음과 같은 기묘한 코드가 있는걸 확인할 수 있습니다. 4 | 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | 9 | npm은 이 "scripts" 속성을 이용해서 태스크 러너로도 활용할 수 있습니다. 10 | 대부분 모듈이나 프로젝트는 동작 확인을 위한 테스트 스크립트가 있습니다. 11 | 테스트를 잊어버리지 않도록 npm은 디폴트로 항상 실패하는 테스트 스크립트를 설정합니다. 12 | 13 | 먼저 `test.js` 파일을 작성해봅시다. 이 워크숍의 과제로는 빈 파일이어도 괜찮습니다. 14 | 이제 어디에 테스트를 작성하면 되는지 알게 되셨을 겁니다. 15 | (이 파일은 npm 클래스이며, 테스트용의 특별한 클래스가 아닙니다) 16 | 테스트는 에러 없이 종료되어야 합니다. 그렇지 않으면 실패로 간주합니다. 17 | 18 | 이제 직접 `package.json`을 다음과 같이 편집해봅시다. 19 | 20 | "scripts": { 21 | "test": "node test.js" 22 | }, 23 | 24 | 완료했다면 `$ADVENTURE_COMMAND verify`를 실행해주세요. 25 | 26 | 추가 정보: `package.json` 내의 "test" 속성의 `test.js`를 직접 실행하고 싶다면, 27 | `npm test`를 실행하세요. 28 | 29 | package.json의 "scripts"에 관한 상세한 정보는 다음 링크에서 확인할 수 있습니다. 30 | https://docs.npmjs.com/misc/scripts 31 | -------------------------------------------------------------------------------- /problems/06-npm-test/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 现在您已经安装了一些东西,使用 "npm ls" 可以显示正在发生的事情。 2 | 3 | 如果您查看 package.json 文件,会发现在其中有如下奇怪的表述: 4 | 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | 9 | npm 可以使用 "scripts" 属性,来用作任务执行者。 10 | 几乎每个模块和项目都会有一个测试脚本,以确保其正常运行。 11 | 为避免忘记测试,默认情况下 npm 设置测试脚本为"始终失败"。 12 | 13 | 首先,创建一个名叫 "test.js" 的文件。用于训练营的挑战,可以将其置为空, 14 | 它将用来编写您的测试(这是 npm 类型,而不是测试类型)。 15 | 此外,测试结束时不应出现错误,否则,测试将失败。 16 | 17 | 然后,编写您的 "package.json" 文件,使您的脚本部分看起来像这样: 18 | 19 | "scripts": { 20 | "test": "node test.js" 21 | }, 22 | 23 | 一旦完成,运行 "$ADVENTURE_COMMAND verify" 来验证您的工作。 24 | 25 | 其他提示:如果您确实想运行您在 "test.js" 中写的 "test" 脚本,请运行 "npm test"。 26 | 27 | npm 脚本属性的有关文档,可以在这里找到:https://docs.npmjs.com/misc/scripts 28 | -------------------------------------------------------------------------------- /problems/07-package-niceties/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var shop = require('../../') 3 | 4 | exports.problem = { 5 | file: path.join(__dirname, 'problem.{lang}.txt') 6 | } 7 | 8 | exports.init = function (workshopper) { 9 | this.__ = workshopper.i18n.__ 10 | } 11 | 12 | exports.verify = function (args, cb) { 13 | // verify we're in the right folder 14 | var cwd = shop.cwd() 15 | if (!cwd) return cb(false) 16 | var __ = this.__ 17 | 18 | // make sure we get no warnings 19 | var exec = require('child_process').exec 20 | var npm = '"' + require('which').sync('npm') + '"' 21 | exec(npm + ' i', function (er, stdout, stderr) { 22 | if (er) { 23 | process.stdout.write(stdout) 24 | process.stderr.write(stderr) 25 | 26 | console.log('\n' + __('package-niceties.error')) 27 | return cb(false) 28 | } 29 | 30 | var pj = require(cwd + '/package.json') 31 | 32 | stderr = (stderr + '').trim() 33 | var reg = new RegExp('npm WARN (package.json|' + pj.name + ')') 34 | if (reg.test(stderr)) { 35 | console.log('\n' + __('package-niceties.problem') + '\n\n' + 36 | stderr + '\n') 37 | return cb(false) 38 | } 39 | 40 | console.log(__('package-niceties.success')) 41 | return cb(true) 42 | }) 43 | } 44 | -------------------------------------------------------------------------------- /problems/07-package-niceties/problem.en.txt: -------------------------------------------------------------------------------- 1 | So, we've created a package.json file, but it's missing a few things 2 | that people usually expect. If you type `npm install`, you'll see 3 | something like this: 4 | 5 | npm WARN package.json %ID% No description 6 | npm WARN package.json %ID% No repository field. 7 | npm WARN package.json %ID% No README data 8 | 9 | Before we can share this work of art with the world, we need to make 10 | it a bit more polished so that people know how to use it. 11 | 12 | First, create a README.md file, with a few words in it. 13 | 14 | Then, add a "repository" field in your package.json file, with a url 15 | where people can access the code. 16 | 17 | You can edit your package.json file by hand, or run `npm init` again. 18 | 19 | Run `$ADVENTURE_COMMAND verify` when you're done. 20 | -------------------------------------------------------------------------------- /problems/07-package-niceties/problem.es.txt: -------------------------------------------------------------------------------- 1 | Así que hemos creado un package.json, pero todavía faltan un 2 | par de cosas que la gente normalmente espera. Si escribes `npm install`, 3 | verás algo así: 4 | 5 | npm WARN package.json %ID% No description 6 | npm WARN package.json %ID% No repository field. 7 | npm WARN package.json %ID% No README data 8 | 9 | Antes de que podamos compartir nuestra maravilla de paquete, 10 | debemos pulirlo un poquito para que la gente sepa lo que hace 11 | y cómo usarlo. 12 | 13 | Primero, crea un fichero llamado `README.md`, con algunas 14 | palabras adentro. Lo que sea, que describa tu paquete. 15 | 16 | Entonces, añade una propiedad llamada "repository" dentro de 17 | tu package.json, con un enlace que vaya a donde existe tu 18 | repositorio. En nuestro caso, puedes poner lo que quieras, 19 | como `https://github.com/worskshopper/how-to-npm`. Este 20 | campo se usará para encontrar donde has guardado tu código. 21 | 22 | Puedes editar to package.json a mano, o ejecutar `npm init` 23 | de nuevo y llenar los campos de esa manera. 24 | 25 | Haz `$ADVENTURE_COMMAND verify` cuando termines. 26 | -------------------------------------------------------------------------------- /problems/07-package-niceties/problem.fr.txt: -------------------------------------------------------------------------------- 1 | Nous avons donc créé un fichier package.json, mais il manque quelques 2 | éléments que les gens attendent habituellement. Si vous tapez 3 | `npm install`, vous verrez quelque chose comme ça: 4 | 5 | npm WARN package.json %ID% No description 6 | npm WARN package.json %ID% No repository field. 7 | npm WARN package.json %ID% No README data 8 | 9 | Avant de pouvoir partager cette œuvre d'art avec le monde, nous devons 10 | rendre cela un peu plus propre afin que les utilisateurs sachent comment 11 | l'utiliser. 12 | 13 | Premièrement, créez un fichier README.md, avec quelques mots à l'intérieur. 14 | 15 | Alors, ajouter un champ "repository" dans votre fichier package.json, avec 16 | une url où l'on peut accéder au code. 17 | 18 | Vous pouvez modifier votre fichier package.json à la main ou exécuter 19 | `npm init` à nouveau. 20 | 21 | Lancez `$ADVENTURE_COMMAND verify` quand vous aurez fini. 22 | -------------------------------------------------------------------------------- /problems/07-package-niceties/problem.ja.txt: -------------------------------------------------------------------------------- 1 | さて、私たちは package.json を作成しましたが、そのファイルはユーザーが必要とする 2 | 一般的な項目がいくつかかけています。例えば `npm install` と実行すると、以下のような 3 | メッセージが表示されるでしょう。 4 | 5 | npm WARN package.json %ID% No description 6 | npm WARN package.json %ID% No repository field. 7 | npm WARN package.json %ID% No README data 8 | 9 | あなたの芸術的な作品を世界に向けて共有する前に、作品を少しだけ整えて見ましょう。そうすることで、 10 | ユーザーはあなたの作品の使い方を知ることができます。 11 | 12 | 最初に簡単な説明を README.md というファイルを作って書いてみましょう。 13 | 14 | 次に `repository` というフィールドを package.json に追加し、ユーザーがコードに 15 | アクセスできる URL を指定してみましょう。 16 | 17 | 手元のエディタで package.json を編集しても良いですし、`npm init` を再度実行してフィールド 18 | の情報を更新することもできます。 19 | 20 | 完了したら `$ADVENTURE_COMMAND verify` を実行してください。 21 | -------------------------------------------------------------------------------- /problems/07-package-niceties/problem.ko.txt: -------------------------------------------------------------------------------- 1 | 자 이제 우리는 package.json을 만들었습니다. 하지만 그 파일은 2 | 사용자가 요구하는 일반적인 항목들이 빠져 있습니다. 3 | `npm install`을 실행해보면, 다음과 같은 메시지가 표시될 것입니다. 4 | 5 | npm WARN package.json %ID% No description 6 | npm WARN package.json %ID% No repository field. 7 | npm WARN package.json %ID% No README data 8 | 9 | 당신이 만든 예술적인 작품을 세상에 내놓기 전에 조금 다듬어봅시다. 10 | 사용자들이 어떻게 사용하는지 알 수 있게 말이죠. 11 | 12 | 먼저 간단한 설명을 README.md라는 파일을 만들고 추가해봅시다. 13 | 14 | 다음으로 `repository` 라는 필드를 package.json에 추가하고 사용자가 15 | 코드를 확인할 수 있도록 URL을 지정해줍시다. 16 | 17 | 수중에 있는 에디터로 package.json을 편집해도 좋고, `npm init`을 재실행해서 18 | 필드의 정보를 갱신할 수 있습니다. 19 | 20 | 완료했다면 `$ADVENTURE_COMMAND verify`를 실행해주세요. 21 | -------------------------------------------------------------------------------- /problems/07-package-niceties/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 虽然您创建了一个 package.json 文件,但是它还缺少一些人们通常期望的内容。 2 | 如果您输入 "npm install",您会看见大致如下的内容: 3 | 4 | npm WARN package.json %ID% No description 5 | npm WARN package.json %ID% No repository field 6 | npm WARN package.json %ID% No README data 7 | 8 | 在向世界分享您的工作成果之前,我们需要将其再完善一下,以便人们知道如何使用它。 9 | 10 | 首先,创建一个 README.md 文件,里面只有少量的文字。 11 | 12 | 然后,在 package.json 文件中添加名为 "repository" 的字段,并制定一个人们可以访问代码的网址。 13 | 14 | 您能手动编辑您的 package.json 文件,或再次运行 "npm init"。 15 | 16 | 当您完成后,运行 "$ADVENTURE_COMMAND verify"。 17 | -------------------------------------------------------------------------------- /problems/08-publish/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var reg = require('../../lib/registry.js') 3 | var shop = require('../../') 4 | var fs = require('fs') 5 | 6 | exports.problem = { 7 | file: path.join(__dirname, 'problem.{lang}.txt') 8 | } 9 | 10 | exports.init = function (workshopper) { 11 | this.__ = workshopper.i18n.__ 12 | this.lang = workshopper.i18n.lang 13 | reg.run('publish') 14 | } 15 | 16 | exports.verify = function (args, cb) { 17 | if (!shop.cwd()) return cb(false) 18 | 19 | var pkg = require(process.cwd() + '/package.json') 20 | var name = pkg.name 21 | var exec = require('child_process').exec 22 | var npm = '"' + require('which').sync('npm') + '"' 23 | var __ = this.__ 24 | exec(npm + ' --color=always view ' + name, function (er, stdout, stderr) { 25 | if (er) { 26 | process.stderr.write(stderr) 27 | 28 | console.log('\n\n' + __('publish.error', {name: name}) + '\n') 29 | return cb(false) 30 | } 31 | 32 | console.log('\n' + fs.readFileSync(path.join(__dirname, 'success.' + this.lang() + '.txt'), 'utf8').replace(/%NAME%/g, name)) 33 | reg.kill() 34 | 35 | return cb(true) 36 | }.bind(this)) 37 | } 38 | -------------------------------------------------------------------------------- /problems/08-publish/problem.en.txt: -------------------------------------------------------------------------------- 1 | What good is a package manager without packages? 2 | 3 | Not very good. 4 | 5 | Luckily, that is not a problem for npm, because it's very easy for all 6 | npm users to publish their modules and share them with the world. 7 | 8 | Packages get into the registry by using the `npm publish` command. 9 | 10 | Try it now. There's not much to it. 11 | 12 | (Make sure you're still in the right project directory, though. If you 13 | publish something by mistake, you can remove it, but there's no guarantee 14 | that no one saw it in the meantime.) 15 | 16 | Then run `$ADVENTURE_COMMAND verify` when you're done. 17 | -------------------------------------------------------------------------------- /problems/08-publish/problem.es.txt: -------------------------------------------------------------------------------- 1 | Y para qué sirve un gestionador de paquetes sin paquetes? 2 | 3 | Pues te digo: para nada. 4 | 5 | Lo bueno es que eso no es un problema para npm, porque es muy 6 | fácil para todos los usuarios de npm publicar sus paquetes y 7 | compartirlos con el mundo entero.🌍🌎🌏 8 | 9 | Los paquetes se envían al registro con el comando `npm publish`. 10 | 11 | Pruébalo! No es nada complicado.💚 12 | 13 | (¡Asegúrate que todavía estás en el directorio de tu proyecto! So publicas algo por accidente, lo puedes quitar, 14 | pero no hay garantía que nadie lo haya visto en el proceso.) 15 | 16 | Entonces, haz `$ADVENTURE_COMMAND verify` y ya! 17 | -------------------------------------------------------------------------------- /problems/08-publish/problem.fr.txt: -------------------------------------------------------------------------------- 1 | À quoi bon un gestionnaire de paquets sans paquets? 2 | 3 | Pas grand chose. 4 | 5 | Heureusement, ce n'est pas un problème pour npm, parce que c'est 6 | très facile pour tous les utilisateurs de npm de publier leurs 7 | modules et les partager avec le monde entier. 8 | 9 | Les packages sont publiés dans le registre à l'aide de la commande `npm publish`. 10 | 11 | Essayez-le maintenant. Il n'y a pas grand-chose. 12 | 13 | (Assurez-vous que vous êtes toujours dans le bon répertoire de projets. 14 | Si vous publiez quelque chose par erreur, vous pouvez le supprimer, 15 | mais il n'y a aucune garantie que personne ne l'a vu dans l'intervalle.) 16 | 17 | Ensuite, lancez `$ ADVENTURE_COMMAND verify` lorsque vous avez terminé. 18 | -------------------------------------------------------------------------------- /problems/08-publish/problem.ja.txt: -------------------------------------------------------------------------------- 1 | みなさんはパッケージが何もないパッケージマネージャーをどう思いますか。 2 | 3 | あまり良いとは言えませんよね。 4 | 5 | 世界に向けてパッケージを公開し、恩恵をシェアするのは npm では非常に簡単なので、 6 | 幸運にも、この問題は npm では起こっていません。 7 | 8 | パッケージは、`npm publish` コマンドを通じてレジストリに登録することができます。 9 | 10 | 試しに実行してみましょう。難しいことは何もありません。 11 | 12 | (正しいディレクトリにいるか、改めて確認してください。あなたが誤って何かを公開してしまった 13 | 場合は削除することはできます。しかし、その間に誰もダウンロードしていないという保証はありません。) 14 | 15 | 完了したら `$ADVENTURE_COMMAND verify` を実行してください。 16 | -------------------------------------------------------------------------------- /problems/08-publish/problem.ko.txt: -------------------------------------------------------------------------------- 1 | 패키지가 없는 패키지 매니저는 무슨 소용이 있을까요? 2 | 3 | 별로 쓸모가 없겠죠? 4 | 5 | 다행히도 npm은 모든 npm 사용자들에게 있어서 세계의 사용자들과 6 | 패키지를 배포하고 공유하는 것이 아주 간단합니다. 7 | 8 | 패키지는 `npm publish` 명령어를 통해서 레지스트리에 등록할 수 있습니다. 9 | 10 | 시험 삼아 실행해보세요. 간단합니다! 11 | 12 | (현재 올바른 디렉터리에 있는지 다시 한번 확인해주세요. 실수로 배포하게 되었다면, 13 | 삭제할 수 있습니다만, 그동안에 누가 보거나 다운로드를 할 수 있습니다.) 14 | 15 | 완료했다면 `$ADVENTURE_COMMAND verify`를 실행해주세요. 16 | -------------------------------------------------------------------------------- /problems/08-publish/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 您如何看待一个没有任何软件包的包管理器? 2 | 3 | 这确实不太好。 4 | 5 | 幸运的是,对于 npm 来说这不是问题,因为所有的 npm 用户都可以很容易地发布他们的模块并与世界分享。 6 | 7 | 软件包通过使用 "npm publish" 命令来加入到 npm registry 中。 8 | 9 | 现在就试试,这没什么难的。 10 | 11 | (请再次确认您在正确的目录中。如果您错误地发布了什么,可以删除。但是,不能保证在此期间没有人下载。) 12 | 13 | 当完成以后,运行 "$ADVENTURE_COMMAND verify"。 -------------------------------------------------------------------------------- /problems/08-publish/success.en.txt: -------------------------------------------------------------------------------- 1 | In order to view your package content, I just ran this command: 2 | 3 | npm view %NAME% 4 | 5 | Run that command yourself to see what it prints out. 6 | 7 | The `npm view` command is a great way to view package details, 8 | to see what you just published, and to check if a name is already taken. 9 | 10 | Now that you've published your first package here in make-believe npm 11 | workshop land, go out and write a real thing to share with real humans! 12 | 13 | You don't have to just share code for other people, though. There are 14 | also benefits to breaking up your code into small manageable pieces, even 15 | if you are only using them all yourself. 16 | 17 | You can imagine that your future self and your past self are the two 18 | other developers on your team. (Scheduling meetings is pretty tricky.) 19 | 20 | Run `how-to-npm` to go on to the next adventure! 21 | -------------------------------------------------------------------------------- /problems/08-publish/success.es.txt: -------------------------------------------------------------------------------- 1 | Para poder ver los contenidos de tu paquete, acabo de hacer: 2 | 3 | npm view %NAME% 4 | 5 | ¡Hazlo tú y ve los resultados por tu cuenta! 6 | 7 | El comando `npm view` es una excelente manera de ver detalles, 8 | de ver lo que ya has publicado, y para ver si un nombre de 9 | paquete ya está siendo usado (porque en el registro de npm, 10 | sólo puede haber un paquete con cierto nombre). 11 | 12 | Ya que has publicado tu primer paquete en el registro simulado, 13 | ¡ve y escribe algo de verdad para compartir con seres humanos! 14 | 15 | ¡Pero no te preocupes! No tienes que usar el registro para compartir 16 | tu código con otras personas. Hay ventajas cuando divides tu propio 17 | código en varios paquetes pequeños con propósito dedicado, 18 | aunque seas tú la única persona que los usa. 19 | 20 | Puedes imaginarte, entonces, que una versión futura de ti y tu ser 21 | pasado son dos desarroladores en el mismo equipo (aunque manejar 22 | reuniones se pone un poco complicado...) 23 | 24 | ¡Ahora haz `how-to-npm` para ir a la próxima aventura! 25 | -------------------------------------------------------------------------------- /problems/08-publish/success.fr.txt: -------------------------------------------------------------------------------- 1 | Pour afficher le contenu de votre package, je viens de lancer cette commande: 2 | 3 | npm view %NAME% 4 | 5 | Exécutez cette commande vous-même pour voir ce que cela affiche. 6 | 7 | La commande `npm view` est une excellente façon de voir les détails 8 | sur le package, pour voir ce que vous venez de publier, et pour 9 | vérifier si un nom est déjà pris. 10 | 11 | Maintenant que vous avez publié votre premier package ici dans le npm 12 | crée par l'atelier, sortez et écrivez une vraie chose à partager avec 13 | de vrais humains! 14 | 15 | Vous n'avez pas à partager le code pour d'autres personnes, cependant. Il y 16 | a un avantage à décomposer votre code en petites pièces gérables, même 17 | si vous ne les utilisez que vous-même. 18 | 19 | Vous pouvez imaginer que votre vous du futur et votre vous du passé sont deux 20 | autres développeurs de votre équipe. (Planifier des réunions est assez délicat.) 21 | 22 | Lancez `how-to-npm` pour aller à la prochaine aventure ! 23 | -------------------------------------------------------------------------------- /problems/08-publish/success.ja.txt: -------------------------------------------------------------------------------- 1 | あなたのパッケージの詳細を確認するために、内部でこのコマンドを実行しました。 2 | 3 | npm view %NAME% 4 | 5 | 自分自身で実行して、なにが表示されるか確認してみてください。 6 | 7 | この `npm view` コマンドはパッケージの詳細を確認するのに最も優れた方法です。自分が公開した 8 | パッケージの情報を閲覧したり、同じ名前がすでに使われていないかを確認するのに使えます。 9 | 10 | これで、この how-to-npm のワークショップ内で、あなたはパッケージを内部的に公開することが 11 | できました。このディレクトリの外に出て同じことをすれば、世界の人々に向けて 12 | 実際にあなたのコードを公開することができます! 13 | 14 | npm はコードを共有するためではなく、コードを管理しやすい単位で細かく分割する利点もあります。 15 | 自分自身のアプリケーションのためだけに使っている場合でも、このメリットを享受するこができます。 16 | 17 | 未来の自分と過去の自分が、それぞれ別の開発者としてチーム内に存在している状態を 18 | 想像してみてください。(二人をミーティングに連れてくるのは極めて困難ですよね) 19 | 20 | 次の問題に行くには `how-to-npm` を実行してください。 21 | -------------------------------------------------------------------------------- /problems/08-publish/success.ko.txt: -------------------------------------------------------------------------------- 1 | 패키지의 상세정보를 확인하려면, 다음 명령어를 실행하세요. 2 | 3 | npm view %NAME% 4 | 5 | 직접 실행해서 무엇이 표시되는지 확인해보세요. 6 | 7 | 이 `npm view` 명령어는 패키지의 상세정보를 확인하는 가장 좋은 방법입니다. 8 | 방금 자신이 배포한 패키지의 정보를 확인하거나, 같은 이름의 패키지가 존재하는지도 확인할 수 있습니다. 9 | 10 | 이걸로 hwo-to-npm 내의 가상 npm에 패키지를 배포하였습니다. 11 | 현재 디렉터리를 나와서 똑같은 방법으로 진행하면, 실제 전 세계 사람들에게 12 | 당신의 코드가 배포됩니다! 13 | 14 | npm은 코드 공유뿐만 아니라 코드를 관리하기 쉬운 작은 단위로 나눌 수 있습니다. 15 | 혼자 사용하는 애플리케이션이라도 이 장점을 활용할 수 있습니다. 16 | 17 | 미래의 자신과 과거의 자신이 각각의 개발자로서 팀에 존재하는 걸 상상해보세요. 18 | (미팅 스케줄을 잡는 건 어렵겠군요.) 19 | 20 | `how-to-npm`을 실행해서 다음 과제를 진행하세요. 21 | -------------------------------------------------------------------------------- /problems/08-publish/success.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 为了查看您的包内容,我们刚才运行了这个命令: 2 | 3 | npm view %NAME% 4 | 5 | 您自已运行一下那个命令,看看它打印出了什么。 6 | 7 | "npm view" 命令是查看包详情的最佳方法,用于查看您发布的软件包的信息,并检查是否已使用了相同的名称。 8 | 9 | 现在,在此 how-to-npm 训练营,您可以在内部发布软件包。只要离开这个目录做同样的事,就能向全世界的人们公开您的代码! 10 | 11 | npm 不是只为了共享代码,她还能将代码分解为小的可管理的部分,即使您仅为自己的应用程序而使用,也能享受到这一好处。 12 | 13 | 想象一下,未来的自己和过去的自己,分别作为不同的两个开发人员存在于团队中。(安排先后次序会变得棘手) 14 | 15 | 运行 "how-to-npm" 继续下一个挑战! -------------------------------------------------------------------------------- /problems/09-version/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var semver = require('semver') 3 | var shop = require('../../') 4 | var fs = require('fs') 5 | 6 | exports.problem = { 7 | file: path.join(__dirname, 'problem.{lang}.txt') 8 | } 9 | 10 | exports.init = function (workshopper) { 11 | this.__ = workshopper.i18n.__ 12 | } 13 | 14 | exports.verify = function (args, cb) { 15 | if (!shop.cwd()) return cb(false) 16 | 17 | var verfile = path.join(shop.datadir, '/version') 18 | var __ = this.__ 19 | var pkg = require(shop.cwd() + '/package.json') 20 | var ver = semver.clean(pkg.version) 21 | var oldVer 22 | try { 23 | oldVer = fs.readFileSync(verfile, 'utf8') 24 | } catch (er) { 25 | oldVer = ver 26 | fs.writeFileSync(verfile, oldVer, 'utf8') 27 | } 28 | if (!ver) { 29 | console.log(__('version.invalid_semver', {version: pkg.version})) 30 | return cb(false) 31 | } 32 | 33 | if (ver === oldVer) { 34 | console.log(__('version.old_version', {version: ver})) 35 | return cb(false) 36 | } 37 | 38 | console.log(__('version.success')) 39 | 40 | return cb(true) 41 | } 42 | -------------------------------------------------------------------------------- /problems/09-version/problem.en.txt: -------------------------------------------------------------------------------- 1 | Every package in npm has a version number associated with it. As 2 | you release updates to your package, these updates get an updated 3 | version number. 4 | 5 | Version numbers in npm follow a standard called "SemVer". This stands 6 | for "Semantic Version". The specification for this standard can be 7 | found at http://semver.org. 8 | 9 | The tl;dr version is that for a version like this: 10 | 11 | 1.2.3 12 | ^ ^ ^ 13 | | | `-- Patch version. Update for every change. 14 | | `---- Minor version. Update for API additions. 15 | `------ Major version. Update for breaking API changes. 16 | 17 | npm has a special command called `npm version` which will update your 18 | package.json file for you, and also commit the change to git if your 19 | project is a git repository. You can learn more at `npm help version`. 20 | 21 | Or, if you don't trust the machines, you can open up your package.json 22 | file by hand, and put some new numbers in the "version" field. 23 | 24 | The npm registry won't let you publish a new release of your package 25 | without updating the version number! Ever! So, get used to the idea of 26 | bumping the version whenever you want to publish, even if the change is 27 | really minor. 28 | 29 | Don't worry, there's a lot of integers, we probably won't run out. 30 | 31 | Update your version number now, and then `$ADVENTURE_COMMAND verify` to check it. 32 | -------------------------------------------------------------------------------- /problems/09-version/problem.es.txt: -------------------------------------------------------------------------------- 1 | Cada paquete en npm tiene un número de versión asociado. Mientras 2 | vas publicando versiones nuevas, estas versiones reciben un 3 | número de versión nuevo y único. 4 | 5 | Las versiones de npm siguen un estándar llamado "SemVer". En inglés 6 | eso es "Semantic Versioning", o sea "versionamiento semántico". 7 | El texto del estándar se encuentra en http://semver.org. 8 | 9 | La explicación corta es así: 10 | 11 | 1.2.3 12 | ^ ^ ^ 13 | | | `-- versión "patch" (parche). Cambia con cada versión nueva. 14 | | `---- versión menor. Incrementa con cada rasgo nuevo. 15 | `------ versión mayor. Incrementa cuando hay cambios de API incompatibles. 16 | 17 | npm tiene un comando especial llamado `npm version`, que puede manejar 18 | la versión en package.json por tii, y además acometer el cambio 19 | a git si lo estás usando. Para leer más sobre el tema, 20 | haz `npm help version` 21 | 22 | O, si no confías mucho de semejantes programas, puedes abrir 23 | tu package.json y editar el número en el campo llamado "version". 24 | 25 | ¡El registro de npm no te dejará publicar una versión que haya 26 | sido publicada antes! ¡Nunca! Así que acostúmbrate a la idea de 27 | que incrementar la versión cada vez que vayas a publicar, aunque 28 | los cambios sean mínimos. 29 | 30 | No te preocupes. Resultan que exísten muchos números, así que probablemente 31 | no se te van a acabar.😉 32 | 33 | Incrementa tu número de versión ahora, y entonces haz `$ADVENTURE_COMMAND verify`. 34 | -------------------------------------------------------------------------------- /problems/09-version/problem.fr.txt: -------------------------------------------------------------------------------- 1 | Chaque package dans npm a un numéro de version qui lui est associé. 2 | À mesure que vous publiez des mises à jour de votre package, ces 3 | mises à jour obtiennent un numéro de version mis à jour. 4 | 5 | Les numéros de version en npm suivent une norme appelée "SemVer". 6 | Cela signifie "Semantic Version". La spécification de cette norme 7 | peut être trouver sur http://semver.org. 8 | 9 | La version tl;dr est celle d'une version comme celle-ci: 10 | 11 | 1.2.3 12 | ^ ^ ^ 13 | | | `-- Version patch. Mise à jour pour chaque changement. 14 | | `---- Version mineur. Mise à jour pour les ajouts d'API. 15 | `------ Version majeur. Mise à jour pour modifications API. 16 | 17 | npm a une commande spéciale appelée `npm version` qui mettra à jour votre 18 | fichier package.json pour vous, et également commit la modification à git 19 | si votre projet a un dépôt git. Vous pouvez en savoir plus sur 20 | `npm help version`. 21 | 22 | Ou, si vous ne faites pas confiance aux machines, vous pouvez ouvrir votre 23 | fichier package.json à la main, et mettre quelques nouveaux numéros dans le 24 | champ "version". 25 | 26 | Le registre npm ne vous permettra pas de publier une nouvelle version 27 | de votre package sans mettre à jour le numéro de version! Jamais! Alors, 28 | habituez-vous à l'idée de modifier la version à chaque fois que vous voulez 29 | publier, même si le changement est vraiment mineur. 30 | 31 | Ne vous inquiétez pas, il y a beaucoup d'entiers, nous n'en manquerons 32 | probablement pas. 33 | 34 | Mettez à jour votre numéro de version, puis lancez `$ADVENTURE_COMMAND verify` 35 | pour vérifier cela. 36 | -------------------------------------------------------------------------------- /problems/09-version/problem.ja.txt: -------------------------------------------------------------------------------- 1 | どの npm のパッケージにも、それに関連付けられたバージョン番号がありま 2 | す。みなさんがパッケージの更新をリリースするときには、バージョン 3 | 番号もいっしょに更新します。 4 | 5 | npm におけるバージョン番号は、"SemVer" と呼ばれる標準に従います。 6 | "SemVer" は、"Semantic Version" の略です。この標準の仕様は、 7 | http://semver.org に記載されています。 8 | 9 | この仕様をかいつまんで説明すると、次のようなバージョン番号のことです: 10 | 11 | 1.2.3 12 | ^ ^ ^ 13 | | | `-- パッチバージョン。細かい修正をする際に更新する。 14 | | `---- マイナーバージョン。APIを追加したときに更新する。 15 | `------ メジャーバージョン。APIの互換性がなくなったときに更新する。 16 | 17 | npm には、`npm version` という package.json を更新するためのコマンドがあります。また、 18 | あなたのプロジェクトが git リポジトリであるときは、更新内容を同時にコミットします。詳細に 19 | ついては、`npm help version` を見てみてください。 20 | 21 | このコマンドを使うのが不安な場合は、package.json を開き、"version" フィールドを 22 | 新しいバージョンに手動で更新しても大丈夫です。 23 | 24 | npm レジストリは、バージョンの更新なしでのパッケージ更新のリリースはさせてくれません。 25 | 何があってもです。なので、更新を公開するときには、どんなに些細な変更でも常にバージョンの番号を 26 | 上げるという考え方に慣れてください。 27 | 28 | ご心配なく、整数は非常に多くあるので使い切ることはないでしょう。 29 | 30 | それでは、バージョン番号を更新してみてください。完了したら `$ADVENTURE_COMMAND verify` を 31 | 実行してください。 32 | -------------------------------------------------------------------------------- /problems/09-version/problem.ko.txt: -------------------------------------------------------------------------------- 1 | npm에 배포된 모든 패키지는 버전 번호를 가지고 있습니다. 2 | 패키지를 갱신하여 재배포하면, 버전 번호도 같이 갱신됩니다. 3 | 4 | npm의 버전 번호는 "SemVer"라는 표준을 따릅니다. 5 | "SemVer"는 "Semantic Version"의 줄임말입니다. 이 표준의 사양은 6 | http://semver.org에 기재되어있습니다. 7 | 8 | 간단하게 설명하면 다음과 같습니다: 9 | 10 | 1.2.3 11 | ^ ^ ^ 12 | | | `-- 패치 버전. 작은 수정을 포함한 모든 업데이트. 13 | | `---- 마이너 버전. API를 추가하는 업데이트. 14 | `------ 메이저 버전. API 호환성이 없어지는 업데이트. 15 | 16 | npm에는 `npm version`이라는 package.json을 갱신하는 명령어가 있습니다. 17 | 만약 사용하고 있는 프로젝트가 git이라면 변경내용을 커밋합니다. 18 | 자세한 내용은 `npm help version`을 참고하세요. 19 | 20 | 이 명령어를 사용하는 게 불안하다면 package.json 파일을 열어서 version 필드에 21 | 새로운 버전을 입력하셔도 괜찮습니다. 22 | 23 | npm 레지스트리는 버전 번호를 갱신하지 않으면 패키지를 재배포 할 수 없게 합니다. 24 | 무슨 일이 있더라도 말이죠. 그렇기 때문에, 배포를 할 때는 사소한 변경이라도 25 | 버전 번호를 갱신 하는 것에 익숙해지는 것이 좋습니다. 26 | 27 | 걱정하지 마세요. 정수는 아주 많으므로 전부 다 써버릴 일은 없을 거예요. 28 | 29 | 그럼 버전 번호를 갱신해주세요. 30 | 완료했다면 `$ADVENTURE_COMMAND verify`를 실행해주세요. 31 | -------------------------------------------------------------------------------- /problems/09-version/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | npm 的每个软件包都有一个与之相关联的版本号。当您发布新的软件包时,其版本号也会随之更新。 2 | 3 | 版本号在 npm 中遵循一个名为 "SemVer" 的标准。它是 "Semantic Version" 的缩写。这个标准的详细说明可以在 http://semver.org 找到。 4 | 5 | 具体说明如下: 6 | 7 | 1.2.3 8 | ^ ^ ^ 9 | | | `-- 补丁版本。每一次小的修改后的更新。 10 | | `---- 小版本。当添加 API 时的更新。 11 | `------ 主要版本。当 API 不再具有兼容性时的更新。 12 | 13 | npm有关于项目版本的命令: 14 | npm version ................ 查看当前版本号 15 | npm version ... 更新项目版本号 16 | 17 | 您可以通过 "npm help version" 了解更多相关信息。 18 | 19 | 如果您不放心运行命令,可以打开 package.json 手动将 "version" 字段修改为新版本。 20 | 如果您的项目是一个 Git 仓库,则该修改也将提交给 Git。 21 | 22 | 不管怎样,在不更新版本号的情况下,npm 不会允许您发布新版本! 23 | 因此,在发布更新时,请记住,无论多么细微的更改,都要及时更新版本号。 24 | 25 | 别担心,整数非常多,用不完的。 26 | 27 | 现在更新您的版本号,然后使用 "$ADVENTURE_COMMAND verify" 来检验。 -------------------------------------------------------------------------------- /problems/10-publish-again/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var semver = require('semver') 3 | var reg = require('../../lib/registry.js') 4 | var shop = require('../../') 5 | 6 | exports.problem = { 7 | file: path.join(__dirname, 'problem.{lang}.txt') 8 | } 9 | 10 | exports.init = function (workshopper) { 11 | this.__ = workshopper.i18n.__ 12 | this.lang = workshopper.i18n.lang 13 | reg.run('publish') 14 | } 15 | 16 | exports.verify = function (args, cb) { 17 | if (!shop.cwd()) return cb(false) 18 | 19 | var __ = this.__ 20 | var pkg = require(path.join(shop.cwd(), 'package.json')) 21 | var data = require(path.join(shop.datadir, 'registry', 'store', pkg.name, 'package.json')) 22 | var ver = semver.clean(pkg.version) 23 | 24 | // should be more than one entry in the time obj, and the current 25 | // version should be in there. 26 | var releases = Object.keys(data.time).filter(function (v) { 27 | return v !== 'created' && v !== 'modified' 28 | }) 29 | 30 | if (releases.length <= 1) { 31 | console.log(__('publish-again.not_republished')) 32 | return cb(false) 33 | } 34 | 35 | if (releases.indexOf(ver) === -1) { 36 | console.log(__('publish-again.current_missing', { 37 | version: ver, 38 | found: JSON.stringify(releases, null, 2) 39 | })) 40 | return cb(false) 41 | } 42 | 43 | console.log(__('publish-again.success')) 44 | reg.kill() 45 | return cb(true) 46 | } 47 | -------------------------------------------------------------------------------- /problems/10-publish-again/problem.en.txt: -------------------------------------------------------------------------------- 1 | Publishing something once is fine. But healthy packages get 2 | published again and again with new and exciting bug fixes. 3 | 4 | You can't re-use the same version number again, because that's hella 5 | confusing for all the robots running the treadmills that power the npm 6 | registry. But, now that we changed the version number in the last 7 | exercise, you can publish the package again. 8 | 9 | Go for it! Then get your prize with `$ADVENTURE_COMMAND verify` 10 | -------------------------------------------------------------------------------- /problems/10-publish-again/problem.es.txt: -------------------------------------------------------------------------------- 1 | Publicando una vez está bien. Pero paquetes saludables se publican 2 | una y otra y otra vez, con cada mejora o cada arreglo. 3 | 4 | Como dije antes, no puedes reusar el mismo número de versión 5 | porque se confundirían demasiado los usuarios, y los programas 6 | que esperan que cada versión identifique algo único. 7 | 8 | Pero cambiamos el número en el ejercicio previo, así que puedes 9 | publicar el paquete de nuevo.🕺 10 | 11 | ¡Dale! A ver si puedes. Para tu premio, haz `$ADVENTURE_COMMAND verify`. 12 | -------------------------------------------------------------------------------- /problems/10-publish-again/problem.fr.txt: -------------------------------------------------------------------------------- 1 | Publier quelque chose une fois est très bien. Mais les packages sains 2 | sont publiées encore et encore avec de nouvelles et passionnantes 3 | corrections de bugs. 4 | 5 | Vous ne pouvez pas réutiliser le même numéro de version à nouveau, 6 | parce que c'est embêtant pour tous les robots qui font tourner 7 | les tapis roulants qui alimentent le registre npm. Mais, 8 | maintenant que nous avons changé le numéro de version dans le dernier 9 | exercice, vous pouvez publier le paquet à nouveau. 10 | 11 | Compris ! Alors, obtenez votre prix avec `$ADVENTURE_COMMAND verify` 12 | -------------------------------------------------------------------------------- /problems/10-publish-again/problem.ja.txt: -------------------------------------------------------------------------------- 1 | 手始めに何かを公開するのは良いことです。しかし、健全なパッケージというのは、 2 | 新しくて刺激的なバグフィックスと共に、何度も何度も更新されるものです。 3 | 4 | npm レジストリを動かす動力源としてベルトコンベアの上を走るすべてのロボットを 5 | とんでもなく混乱させてしまうので、同じバージョンを使いまわすことはできません。 6 | しかし、私たちは前回の課題でバージョンを更新したので、パッケージを改めて更新 7 | することができます。 8 | 9 | やってみましょう!完了したら `$ADVENTURE_COMMAND verify` を実行してください。 10 | -------------------------------------------------------------------------------- /problems/10-publish-again/problem.ko.txt: -------------------------------------------------------------------------------- 1 | 패키지 배포는 좋은 일입니다. 단 정상적인 패키지라면 2 | 여러 가지 버그들로 끊임없이 재배포를 하게 됩니다. 3 | 4 | 재배포 시에는 같은 버전 번호를 사용할 수 없습니다. 5 | 그건 npm 레지스트리를 움직이기 위해 러닝머신 위에서 달리는 모든 로봇을 6 | 교란하기 때문입니다. 7 | 하지만 우리는 이전 과제에서 버전 번호를 갱신했기 때문에 재배포할 수 있습니다. 8 | 9 | 패키지를 재배포해보세요. 완료했다면 `$ADVENTURE_COMMAND verify`를 실행해주세요. 10 | -------------------------------------------------------------------------------- /problems/10-publish-again/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 有一次发布是好事。可是健壮的软件包往往是在一次又一次的 bug 修复中诞生的。 2 | 3 | 您不能重复使用同一个版本号,这不仅会使用户感到困惑,还会使通过版本号进行 4 | 内容识别的程序发生混乱。 5 | 6 | 但是,由于我们在上一个练习中更改了版本号,所以您可以再次发布。 7 | 8 | 继续努力! 9 | 完成后运行 "$ADVENTURE_COMMAND verify"。 -------------------------------------------------------------------------------- /problems/11-dist-tag/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var reg = require('../../lib/registry.js') 3 | var shop = require('../../') 4 | 5 | exports.problem = { 6 | file: path.join(__dirname, 'problem.{lang}.txt') 7 | } 8 | 9 | exports.init = function (workshopper) { 10 | this.__ = workshopper.i18n.__ 11 | reg.run('dist-tag') 12 | } 13 | 14 | exports.verify = function (args, cb) { 15 | var cwd = shop.cwd() 16 | if (!cwd) return cb(false) 17 | 18 | var __ = this.__ 19 | var pkg = require(path.join(cwd, '/package.json')) 20 | var name = pkg.name 21 | 22 | var body = require(path.join(shop.datadir, 'registry', 'store', name, 'package.json')) 23 | var dt = body['dist-tags'] 24 | var tags = Object.keys(dt) 25 | if (tags.length === 1) { 26 | console.log(__('dist-tag.success')) 27 | return cb(false) 28 | } 29 | 30 | reg.kill() 31 | return cb(null, true, { 32 | file: path.join(__dirname, 'success.{lang}.txt') 33 | }) 34 | } 35 | -------------------------------------------------------------------------------- /problems/11-dist-tag/problem.en.txt: -------------------------------------------------------------------------------- 1 | Every published package on npm has a `dist-tags` entry on it which 2 | maps strings like "latest" to version numbers like "1.2.48". 3 | 4 | By default, the "latest" version is what gets installed. When you 5 | publish, the version that you publish gets tagged as "latest". This 6 | is generally great, because most of the time you publish things when 7 | you're ready for users to use them. 8 | 9 | However, if you need to publish something, and *not* make it the 10 | default version of a package (for example, if it's a security release 11 | for a legacy version, or something), then you can manually manage 12 | these distribution tags with the `dist-tag` function. 13 | 14 | `npm dist-tag add @ []` will add a new tag. 15 | To find out the name of your current package/version type `npm ls`. 16 | The first line of the output will be the package and version; e.g. pkg@1.0.1. 17 | To add a tag type in the name of the tag. 18 | 19 | npm dist-tag add pkg@1.0.1 beta 20 | 21 | Run `npm help dist-tag` to learn more about it. 22 | 23 | Let's add a dist-tag on your package, 24 | and then `$ADVENTURE_COMMAND verify` to check it. 25 | -------------------------------------------------------------------------------- /problems/11-dist-tag/problem.es.txt: -------------------------------------------------------------------------------- 1 | Cada paquete publicado en npm tiene algo llamado `dist-tags` ("etiquetas de distribución") 2 | que se usa para convertir palabras regulares a versiones específicas. 3 | Por ejemplo, "latest" ("mas-reciente") puede convertirse a "1.2.48". 4 | 5 | En general, la versión "latest" es la que se instalará cuando 6 | haces `npm install paquete`. Cuando publicas, lo mismo pasa: 7 | el "dist-tag" con el que publicarás si no haces nada más será "latest". 8 | En general, esto es genial, porque la mayoría de las veces publicas 9 | cuando ya tu código está listo para tus usuarios. 10 | 11 | Pero resulta que si quieres publicar algo, y que *no* sea la versión 12 | que la mayoría de los usuarios van a instalar (por ejemplo, si 13 | es un lanzamiento de seguridad o una versión preliminar), puedes 14 | manejar tus etiquetas manualmente con el comando llamado "npm dist-tag". 15 | 16 | `npm dist-tag add @ []` añadirá una 17 | etiqueta nueva. Para averiguar el nombre de tu paquete/versión corriente, 18 | usa `npm ls .` La primera línea dirá el nombre y versión; 19 | por ejemplo, `mipaquete@1.0.1`. 20 | 21 | Para añadir la etiqueta, esribe el nombre que quieres usar: 22 | 23 | npm dist-tag add pkg@1.0.1 beta 24 | 25 | Haz `npm help dist-tag` para aprender más. 26 | 27 | Añade ahora un dist-tag nuevo a tu paquete, y entonces haz 28 | `$ADVENTURE_COMMAND verify` para terminar el ejercicio. 29 | -------------------------------------------------------------------------------- /problems/11-dist-tag/problem.fr.txt: -------------------------------------------------------------------------------- 1 | Chaque package publié sur npm possède une entrée `dist-tags` qui 2 | attribue des chaînes comme "latest" vers des numéros de version 3 | comme "1.2.48". 4 | 5 | Par défaut, la version "latest" est installée. Lorsque vous 6 | publiez, la version que vous publiez est marquée comme "latest". 7 | C'est génial, parce que la plupart du temps vous publiez des choses 8 | quand vous êtes prêt à ce que les utilisateurs les utilise. 9 | 10 | Cependant, si vous avez besoin de publier quelque chose, et *ne pas* 11 | en faire la version par défaut d'un package (par exemple, si c'est une version 12 | de sécurité pour une version héritée, ou quelque chose comme cela), vous pouvez 13 | gérer manuellement ces balises de distribution avec la fonction `dist-tag`. 14 | 15 | `npm dist-tag add @ []` ajoutera un nouveau tag. 16 | Pour connaître le nom de votre package/version actue,l tapez `npm ls`. 17 | La première ligne de la sortie sera le paquet et la version; 18 | par exemple pkg@1.0.1. 19 | Pour ajouter un tag replacez "tag" par le nom du tag. 20 | 21 | npm dist-tag add pkg@1.0.1 beta 22 | 23 | Lancez `npm help dist-tag` pour en savoir plus. 24 | 25 | Ajoutons une dist-tag sur votre package, et en suite 26 | lancez `$ADVENTURE_COMMAND verify` pour vérifier cela. 27 | -------------------------------------------------------------------------------- /problems/11-dist-tag/problem.ja.txt: -------------------------------------------------------------------------------- 1 | npm に公開されたパッケージは、いずれも `dist-tags` (配布タグ) 2 | エントリーを持っていて、それらは、 "latest" のような文字列を "1.2.48" 3 | のようなバージョン番号にマッピングします。 4 | 5 | デフォルトでは、"latest" タグの付いたバージョンがインストールされます。 6 | パッケージを公開すると、公開したバージョンに "latest" というタグが付け 7 | られます。これは概ね良好に機能します、なぜなら、ほとんどの場合、みなさ 8 | んがなにかを公開するときには、ユーザーがそれを使える用意は整っているは 9 | ずだからです。 10 | 11 | しかしながら、もしなにかを公開する必要があって、しかも、それを 12 | デフォルトバージョンのパッケージにしたくないなら(例えば、レガシーな 13 | バージョンに対するセキュリティーリリースなど)、`dist-tag` 機能を 14 | 使うことで、手動でそれらの配布物のタグを管理できます。 15 | 16 | `npm dist-tag add@ []` で新しいタグを追加することができます。 17 | 現在のパッケージ・バージョンの名前を調べるには `npm ls` を入力してください。 18 | 出力の最初の行はパッケージとバージョンです(例えば pkg@1.0.1)。 19 | タグ名を追加するのは、このようになります。 20 | 21 | npm dist-tag add pkg@1.0.1 beta 22 | 23 | `npm help dist-tag` を実行すれば、もっと詳しく学べます。 24 | 25 | それでは、あなたのパッケージに配布タグを付与して、 26 | 完了したら `$ADVENTURE_COMMAND verify` を実行してください。 27 | -------------------------------------------------------------------------------- /problems/11-dist-tag/problem.ko.txt: -------------------------------------------------------------------------------- 1 | npm에 배포된 패키지는 `dist-tags` 항목이 있습니다. 2 | 그것은 "latest"와 같은 문자열을 "1.2.48"과 같이 버전 번호로 매핑해줍니다. 3 | 4 | 디폴트로는 "latest" 태그가 붙은 버전이 설치됩니다. 5 | 패키지를 배포하면, 배포한 버전에 "latest" 라는 태그가 붙습니다. 6 | 이 기능은 대체로 괜찮게 작용합니다. 왜냐하면, 대부분의 경우 패키지를 배포할 때 7 | 사용자들이 그 패키지들을 정상적으로 사용할 수 있게끔 만들어 놓기 때문입니다. 8 | 9 | 만약 패키지를 배포할 때 그것을 디폴트 버전으로 하고 싶지 않다면 10 | (예를 들면 전 버전의 보안패치라든지) 11 | `dist-tag` 기능을 사용해서 수동으로 배포물의 태그를 관리할 수 있습니다. 12 | 13 | `npm dist-tag add@ []`를 실행해서 새로운 태그를 추가할 수 있습니다. 14 | 현재 패키지・버전의 이름을 알고싶다면 `npm ls`를 실행하세요. 15 | 출력되는 첫 번째 줄은 패키지와 버전입니다. (패키지@버전 pkg@1.0.1) 16 | 태그를 추가하려면 이렇게 하세요. 17 | 18 | npm dist-tag add pkg@1.0.1 beta 19 | 20 | `npm help dist-tag`를 실행하면 더 자세한 내용을 확인할 수 있습니다. 21 | 22 | 이제 지금까지 만든 패키지에 태그를 붙여보세요. 23 | 그리고 `$ADVENTURE_COMMAND verify`를 실행해서 결과를 확인해주세요. 24 | -------------------------------------------------------------------------------- /problems/11-dist-tag/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 在 npm 中发布的每个软件包都有一个 "dist-tags"(分发标签)条目, 2 | 这些条目将 "latest" 之类的字符串映射到 "1.2.48" 这样的版本号上。 3 | 4 | 默认情况下,当您发布软件包时,您发布的版本将被标记为 "latest" ,也就是程序的安装版。 5 | 这通常是没有问题的,因为大多数时候,只有当您准备好让用户使用时,才会将它们发布出去。 6 | 7 | 但是,如果您需要发布某些内容,但又不想将其作为软件包的默认版本(例如,针对旧版本的 8 | 安全补丁),则可以使用 "dist-tag" 功能手动管理这些标签。 9 | 10 | "npm dist-tag add @ []" 用于添加一个标签。 11 | 12 | 输入 "npm ls" 以确定当前软件包版本的名称。 13 | 输出的第一行是软件包和版本号(例如pkg@1.0.1)。添加标签的方式为: 14 | 15 | npm dist-tag add pkg@1.0.1 beta 16 | 17 | 运行 "npm help dist-tag" 可以学习更多的相关知识。 18 | 19 | 在您的软件包上添加一个标签,然后输入 "$ADVENTURE_COMMAND verify" 来检验。 -------------------------------------------------------------------------------- /problems/11-dist-tag/success.en.txt: -------------------------------------------------------------------------------- 1 | Congratulations! You've added a dist-tag! 2 | 3 | This is a handy way to manage releases. For example, the npm project 4 | itself publishes each new version as 'next' (instead of 'latest') so 5 | that beta users can test it out before it becomes the default. 6 | 7 | Run `how-to-npm` to move on to the next exercise. 8 | -------------------------------------------------------------------------------- /problems/11-dist-tag/success.es.txt: -------------------------------------------------------------------------------- 1 | ¡Muy bien! Has añadido una etiqueta nueva, o "dist-tag". 2 | 3 | Esta es una manera muy útil de manejar diferentes líneas de lanzamiento. 4 | Por ejemplo, el proyecto npm en sí siempre publica versiones nuevas 5 | a un dist-tag llamado `next`, así que usuarios beta pueden tratarlo 6 | por algunas semanas antes de que el resto de los usuarios de npm 7 | lo instalen. Esto ayuda mucho a encontrar problemas críticos temprano. 8 | 9 | Ahora haz `how-to-npm` para continuar. 10 | -------------------------------------------------------------------------------- /problems/11-dist-tag/success.fr.txt: -------------------------------------------------------------------------------- 1 | Félicitation ! Vous avez ajouté un dist-tag ! 2 | 3 | Il s'agit d'une façon pratique de gérer les versions. Par exemple, 4 | le projet npm lui-même publie chaque nouvelle version en tant que 'next' 5 | (au lieu de 'latest') comme cela les utilisateurs beta peuvent tester 6 | cela avant que cela devienne la valeur par défaut. 7 | 8 | Lancez `how-to-npm` pour passer à l'exercice suivant. 9 | -------------------------------------------------------------------------------- /problems/11-dist-tag/success.ja.txt: -------------------------------------------------------------------------------- 1 | おめでとうございます。配布タグを追加できました。 2 | 3 | この機能は、リリースを管理するのに便利です。たとえば、npm 自体の 4 | プロジェクトでは、それぞれ新しいバージョンを ('latest' の替わりに) 'next' 5 | として公開して、ベータユーザーが、デフォルトになる前のものをテストできる 6 | ようにしています。 7 | 8 | `$ADVENTURE_COMMAND` を実行して、次の課題に進んでください。 9 | -------------------------------------------------------------------------------- /problems/11-dist-tag/success.ko.txt: -------------------------------------------------------------------------------- 1 | 축하합니다. 태그를 추가했습니다! 2 | 3 | 이 기능은 릴리스를 관리하는데 편리합니다. 4 | 예를 들면, npm 프로젝트에서는 새로운 버전이 배포될 때 5 | 'next'로 배포해서 ('latest' 대신에) 베타 사용자가 그 버전이 6 | 디폴트로 설정되기 전에 테스트를 하는 것이 가능하게 합니다. 7 | 8 | `$ADVENTURE_COMMAND`를 실행해서 다음 과제에 도전하세요. 9 | -------------------------------------------------------------------------------- /problems/11-dist-tag/success.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 恭喜您!您已经添加了一个标签! 2 | 3 | 这是管理版本的一种好方法。例如,npm 自己的项目中将每个新版本发布为 "Next" 4 | (而不是 "latest"),以便 beta 用户可以在它成为正式版本之前测试它。 5 | 6 | 请运行 "how-to-npm" 继续下一个练习。 -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var reg = require('../../lib/registry.js') 3 | var shop = require('../../') 4 | 5 | exports.problem = { 6 | file: path.join(__dirname, 'problem.{lang}.txt') 7 | } 8 | 9 | exports.init = function (workshopper) { 10 | this.__ = workshopper.i18n.__ 11 | reg.run('dist-tag') 12 | } 13 | 14 | exports.verify = function (args, cb) { 15 | var cwd = shop.cwd() 16 | if (!cwd) return cb(false) 17 | 18 | var __ = this.__ 19 | var pkg = require(path.join(cwd, 'package.json')) 20 | var name = pkg.name 21 | 22 | var body = require(path.join(shop.datadir, 'registry', 'store', name, 'package.json')) 23 | var dt = body['dist-tags'] 24 | var tags = Object.keys(dt) 25 | if (tags.length > 1) { 26 | console.log(__('dist-tag-removal.too_many')) 27 | return cb(false) 28 | } 29 | 30 | var time = body.time 31 | var mostRecentTime = '' 32 | var mostRecentVersion 33 | for (var v in time) { 34 | if (!body.versions[v]) continue 35 | if (time[v] > mostRecentTime) { 36 | mostRecentTime = time[v] 37 | mostRecentVersion = v 38 | } 39 | } 40 | 41 | if (dt.latest === mostRecentVersion) { 42 | console.log(__('dist-tag-removal.version_mismatch', {version: mostRecentVersion})) 43 | return cb(false) 44 | } 45 | 46 | reg.kill() 47 | return cb(null, true, { 48 | file: path.join(__dirname, 'success.{lang}.txt') 49 | }) 50 | } 51 | -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/problem.en.txt: -------------------------------------------------------------------------------- 1 | Now that you've added a dist-tag or two, let's clean things up. 2 | 3 | The only dist-tag you CAN'T ever remove is "latest". That's because 4 | every package installs its "latest" tag by default, so that tag has 5 | some special semantics. 6 | 7 | You CAN point "latest" to a different version, or delete other tags. 8 | 9 | Let's delete all the tags that we can, and also point "latest" at 10 | something other than the most recent release. 11 | 12 | Run `npm help dist-tag` to learn more about the command. 13 | -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/problem.es.txt: -------------------------------------------------------------------------------- 1 | Ahora que tienes uno o dos dist-tags adicionales, vamos a limpiar 2 | las cosas un poco: 3 | 4 | La única etiqueta que NUNCA puedes remover es "latest". Eso es porque 5 | cada paquete instala "latest" si no le das una versión más específica. 6 | 7 | Lo que sí puedes hacer es cambiar "latest" para que se refiera a 8 | una versión diferente, o borrar otras etiquetas que esa. 9 | 10 | Usa `npm dist-tag rm ` para borrar todas las etiquetas que podamos, y 11 | además cambiar la referencia de "latest" para que sea alguna versión que no sea 12 | la más reciente. 13 | 14 | Puedes usar `npm dist-tag ls` para ver la lista de todos los dist-tags 15 | existentes. 16 | 17 | Haz `npm help dist-tag` para aprender más sobre el comando. 18 | -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/problem.fr.txt: -------------------------------------------------------------------------------- 1 | Maintenant que vous avez ajouté un dist-tag ou deux, nettoyons les choses. 2 | 3 | Le seul dist-tag que vous ne pouvez jamais supprimer est "latest". 4 | C'est parce que chaque paquet installe son tag "latest" par défaut, 5 | de sorte que tag a quelques sémantiques spéciales. 6 | 7 | Vous POUVEZ pointer "latest" vers une autre version, ou supprimer d'autres balises. 8 | 9 | Supprions toutes les balises que nous pouvons, et pointons également "latest" 10 | vers une autre version que la version la plus récente. 11 | 12 | Exécutez `npm help dist-tag` pour en savoir plus sur la commande. 13 | -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/problem.ja.txt: -------------------------------------------------------------------------------- 1 | 前回の課題で、一つあるいはそれ以上の配布タグを追加しました。 2 | 今度はそれらを掃除しましょう。 3 | 4 | 削除することのできない配布タグがひとつだけあって、それは"latest" 5 | です。なぜなら、 各パッケージは、デフォルトで "latest" タグを追加 6 | して、そのタグが特殊な意味を持つようにするからです。 7 | 8 | "latest" が異なるバージョンを指したり、あるいは、それ以外のタグでし 9 | たら削除することができます。 10 | 11 | 消せるタグをすべて消してください、そして、"latest" が最新のリリース 12 | 以外を指すようにしてください。 13 | 14 | `npm help dist-tag` を実行して、このコマンドをさらに学んでください。 15 | -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/problem.ko.txt: -------------------------------------------------------------------------------- 1 | 지금까지 태그를 몇 개 추가해보았습니다. 2 | 이제 그것들을 없애봅시다. 3 | 4 | 단 "latest" 태그는 삭제할 수 없습니다. 5 | 각각의 패키지들은 기본설정으로 latest 태그를 추가하며 6 | 그것은 특별한 의미가 있기 때문입니다. 7 | 8 | 9 | "latest" 태그는 최신 버전 이외의 다른 버전을 가리킬 수 있으며, 10 | "latest" 이외의 태그들은 모두 삭제할 수 있습니다. 11 | 12 | 제거할 수 있는 태그는 모두 제거해주세요. 13 | 그리고 "latest" 태그를 최신 릴리스 이외의 버전에 지정해보세요. 14 | 15 | `npm help dist-tag`를 실행하면 이 명령어에 대해 더 배울 수 있습니다. 16 | -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 现在您已经添加了一两个标签,让我们来清理一下吧。 2 | 3 | 唯一不能删除的是 "latest" 标签。那是因为每个软件包都默认添加了 "latest" 标签, 4 | 以使该标签具有特殊含义。 5 | 6 | 您可以让 "latest" 标签指向不同的版本,或删除其他的标签。 7 | 8 | 关于 dist-tag 的有关命令: 9 | npm dist-tag add @ [] . 添加标签 10 | npm dist-tag rm .............. 删除指定标签 11 | npm dist-tag ls [] .................. 列出指定软件包上的所有标签 12 | 13 | 运行 "npm help dist-tag" 学习更过相关的命令。 14 | 15 | 请删除所有您能删除的标签,并让 "latest" 标签指向最新发布以外的其他版本。 16 | (译者注:添加 "latest" 标签让它指向最新版本以外的其他版本) 17 | 18 | 完成之后,运行 "$ADVENTURE_COMMAND verify" 进行验证。 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/success.en.txt: -------------------------------------------------------------------------------- 1 | Congratulations! You're a dist-tagging pro! 2 | 3 | Run `how-to-npm` to move on to the next exercise. 4 | -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/success.es.txt: -------------------------------------------------------------------------------- 1 | ¡Felicidades! Ahora sabes más sobre dist-tags que la mayoría de los 2 | usuarios de npm. 💪 3 | 4 | Vamos con `how-to-npm` a la próxima aventura. 5 | -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/success.fr.txt: -------------------------------------------------------------------------------- 1 | Félicitation ! Vous êtes un pro du dist-tagging ! 2 | 3 | Lancez `how-to-npm` pour passer à l'exercice suivant. 4 | -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/success.ja.txt: -------------------------------------------------------------------------------- 1 | おめでとうございます。もはや配布タグのプロですね。 2 | 3 | `$ADVENTURE_COMMAND` を実行して次の課題に進んでください。 4 | -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/success.ko.txt: -------------------------------------------------------------------------------- 1 | 축하합니다. 태그 붙이기의 달인이시군요! 2 | 3 | `$ADVENTURE_COMMAND`를 실행해서 다음 과제에 도전하세요. 4 | -------------------------------------------------------------------------------- /problems/12-dist-tag-removal/success.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 恭喜您! 您已经是操作标签的专家了! 2 | 3 | 运行 "how-to-npm" 继续下一个练习。 -------------------------------------------------------------------------------- /problems/13-outdated/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var reg = require('../../lib/registry.js') 3 | var shop = require('../../') 4 | 5 | exports.problem = { 6 | file: path.join(__dirname, 'problem.{lang}.txt') 7 | } 8 | 9 | exports.init = function (workshopper) { 10 | this.__ = workshopper.i18n.__ 11 | var pkg = require(shop.datadir + '/registry/store/@linclark/pkg/package.json') 12 | 13 | if (pkg['dist-tags'].latest === '1.0.2') { 14 | console.log(path.resolve(__dirname, '..', '..', 'assets', 'registry-update')) 15 | shop.cpr(path.resolve(__dirname, '..', '..', 'assets', 'registry-update'), 16 | path.resolve(shop.datadir, 'registry')) 17 | } 18 | reg.run('outdated') 19 | } 20 | 21 | exports.verify = function (args, cb) { 22 | if (!shop.cwd()) return cb(false) 23 | 24 | var __ = this.__ 25 | var arg = args.join('').toLowerCase() 26 | if (arg === '@linclark/pkg') { 27 | reg.kill() 28 | return cb(null, true, { 29 | file: path.join(__dirname, 'success.{lang}.txt') 30 | }) 31 | } 32 | 33 | if (!arg || arg === 'pkg') { 34 | console.log(__('outdated.no_package')) 35 | } else if (arg !== '@linclark/pkg') { 36 | console.log(__('outdated.wrong_package', {pkg: arg})) 37 | } 38 | 39 | return cb(false) 40 | } 41 | -------------------------------------------------------------------------------- /problems/13-outdated/problem.en.txt: -------------------------------------------------------------------------------- 1 | Now that we have some dependencies, and you've learned that your own 2 | packages can be updated repeatedly, the obvious question is: What do 3 | we do when someone *else* updates *their* package? 4 | 5 | The first step is to detect this. Because of the way that we define 6 | our dependencies with a version range, and each release is a unique 7 | combination of a name and a version, we can detect compatible releases 8 | programmatically with the `npm outdated` command. 9 | 10 | To pass this challenge, run `$ADVENTURE_COMMAND verify PKG` where `PKG` 11 | is the name of the package that is out of date. 12 | -------------------------------------------------------------------------------- /problems/13-outdated/problem.es.txt: -------------------------------------------------------------------------------- 1 | Ya que tenemos algunas dependencias, y has aprendido que tus propios 2 | paquetes pueden ser cambiados una y otra vez, la pregunta obvia es esta: 3 | Que hacemos cuando *alguien más* ha cambiado *su* paquete? 4 | 5 | El primer paso es detectar esto. Debido a la manera que definimos nuestras 6 | dependencias con rangos de números, y como cada lanzamiento es una combinación 7 | única de nombre y versión, podemos detectar versiones nuevas con 8 | el comando `npm outdated`. 9 | 10 | Para completar este ejercicio, haz `$ADVENTURE_COMMAND verify PAQ` 11 | donde `PAQ` es el nombre del paquete que dice que tiene versión nueva. 12 | -------------------------------------------------------------------------------- /problems/13-outdated/problem.fr.txt: -------------------------------------------------------------------------------- 1 | Maintenant que nous avons certaines dépendances, et vous avez appris que 2 | votre propre package peut être mis à jour à plusieurs reprises, la 3 | question évidente est: que faisons nous quand quelqu'un *d'autre* 4 | mets à jour *son* package ? 5 | 6 | La première étape consiste à détecter cela. En raison de la façon dont 7 | nous définissons nos dépendances avec une gamme de versions, et chaque 8 | version est une combinaison d'un nom et d'une version, nous pouvons 9 | détecter les versions compatibles automatiquement avec la commande 10 | `npm outdated`. 11 | 12 | Pour réussir ce défi, lancez `$ADVENTURE_COMMAND verify PKG` où `PKG` 13 | est le nom du package qui est obsolète. 14 | -------------------------------------------------------------------------------- /problems/13-outdated/problem.ja.txt: -------------------------------------------------------------------------------- 1 | 前回までに、依存パッケージがでてきて、それから、自分のパッケージを繰 2 | り返し更新する方法について学びました。ここでひとつの疑問が浮かびます。 3 | もし他の誰かが、依存パッケージを更新したときには、どうすればいいで 4 | しょう。 5 | 6 | 最初のステップは、更新を検知することです。幅を持ったバージョンでもって 7 | 依存性を定義しており、各々のリリースは、名前とバージョンの一意な組み 8 | 合わせで識別できることから、`npm outdated` コマンドで機械的に互換性 9 | のあるリリースを検出することができます。 10 | 11 | この課題をパスするために、`$ADVENTURE_COMMAND verify PKG` を実行してください。 12 | ただし、`PKG` は古くなってしまったパッケージの名前とします。 13 | -------------------------------------------------------------------------------- /problems/13-outdated/problem.ko.txt: -------------------------------------------------------------------------------- 1 | 지금까지의 우리는 의존 패키지를 추가하고 2 | 그것들을 반복해서 업데이트하는 방법을 배웠습니다. 3 | 여기서 한 가지 의문점이 생깁니다. 만약, 누군가가 4 | 현재 우리가 추가한 의존 패키지를 업데이트했다면 어떻게 해야 할까요? 5 | 6 | 제일 첫 번째 할 일은 패키지가 업데이트되었는지 확인하는 것입니다. 7 | 우리는 의존 패키지에 사용할 버전의 범위를 명시하였고, 8 | 각각의 릴리스는 이름과 버전으로 고유한 ID를 갖기 때문에 9 | `npm outdated` 명령어로 호환성이 있는 릴리스를 검출하는 것이 가능합니다. 10 | 11 | 이 과제를 해결하려면 `$ADVENTURE_COMMAND verify PKG`를 실행하세요. 12 | `PKG`는 오래된 패키지의 이름입니다. 13 | -------------------------------------------------------------------------------- /problems/13-outdated/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 现在我们已经有了一些依赖项,并且您也明白可以反复更新自己的软件包,这里存在一个问题: 2 | 如果您安装了别人的软件包,而作者后来将该软件包进行更新,那我们该怎么办? 3 | 4 | 第一步是要检测到这一点。因为我们用 "version range" (版本区间)来定义我们的依赖关系, 5 | 每一次发布都是名称和版本号的唯一组合,我们可以使用 "npm outdated" 命令,来检测出可兼容的版本。 6 | 7 | 要想打通此关,请运行 "$ADVENTURE_COMMAND verify PKG",并将 "PKG" 替换成已经过时的包的名称。 -------------------------------------------------------------------------------- /problems/13-outdated/success.en.txt: -------------------------------------------------------------------------------- 1 | That's absolutely right! The `@linclark/pkg` package has had an update while 2 | we weren't looking. 3 | 4 | In the next lesson, we'll learn how to update packages that are outdated. 5 | -------------------------------------------------------------------------------- /problems/13-outdated/success.es.txt: -------------------------------------------------------------------------------- 1 | ¡Correcto! El paquete `@linclark/pkg` lanzó una nueva version 2 | mientras no estábamos mirando. 3 | 4 | En la próxima lección, aprenderemos como traer esos paquetes al día. 5 | -------------------------------------------------------------------------------- /problems/13-outdated/success.fr.txt: -------------------------------------------------------------------------------- 1 | C'est absolument juste! Le package `@linclark/pkg` a eu une mise à jour 2 | alors que nous ne cherchions pas. 3 | 4 | Dans la leçon suivante, nous apprendrons comment mettre à jour les packages 5 | obselètes. 6 | -------------------------------------------------------------------------------- /problems/13-outdated/success.ja.txt: -------------------------------------------------------------------------------- 1 | 正解です。`@linclark/pkg` パッケージは、しばらく見ないうちに更新されていました。 2 | 3 | 次の講義では、古くなってしまったパッケージを更新する方法について学びます。 4 | -------------------------------------------------------------------------------- /problems/13-outdated/success.ko.txt: -------------------------------------------------------------------------------- 1 | 정답입니다. `@linclark/pkg` 패키지는 우리가 안 본 사이에 업데이트되었습니다. 2 | 3 | 다음 과제는 오래된 패키지를 업데이트하는 방법입니다. 4 | -------------------------------------------------------------------------------- /problems/13-outdated/success.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 这是绝对正确的! "@linclark/pkg" 包在经过一段时间后又进行了更新。 2 | 3 | 下一课,我们将学习如何更新已过时的软件包。 -------------------------------------------------------------------------------- /problems/14-update/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var reg = require('../../lib/registry.js') 3 | var shop = require('../../') 4 | 5 | exports.problem = { 6 | file: path.join(__dirname, 'problem.{lang}.txt') 7 | } 8 | 9 | exports.init = function (workshopper) { 10 | this.__ = workshopper.i18n.__ 11 | reg.run('outdated') 12 | } 13 | 14 | exports.verify = function (args, cb) { 15 | if (!shop.cwd()) return cb(false) 16 | 17 | var __ = this.__ 18 | var pkg = require(path.join(shop.cwd(), '/node_modules/@linclark/pkg/package.json')) 19 | if (pkg.version !== '1.0.3') { 20 | console.log(__('update.outdated')) 21 | return cb(false) 22 | } 23 | 24 | reg.kill() 25 | console.log(__('update.success')) 26 | return cb(true) 27 | } 28 | -------------------------------------------------------------------------------- /problems/14-update/problem.en.txt: -------------------------------------------------------------------------------- 1 | It's fine, of course, to explicitly check for outdated modules, 2 | and then run `npm install` to pull them in. 3 | 4 | However, if you want to be a bit more lazy about it, there's a special 5 | npm command that will UPDATE all of your deps to the max version you 6 | allow in your package.json. 7 | 8 | Can you guess what command that might be? (`npm help` might help you) 9 | 10 | Update all your deps to the latest version possible, and then 11 | run `$ADVENTURE_COMMAND verify` to pick up your delicious green banner. 12 | -------------------------------------------------------------------------------- /problems/14-update/problem.es.txt: -------------------------------------------------------------------------------- 1 | Está bien, claro, directamente verificar si hay paquetes anticuados, 2 | y entonces usar `npm install paquete@vers` para traerlos al día. 3 | 4 | Pero, podemos ser un poco más vagos con esto. Hay un comando 5 | especial de npm que actualizará todas tus dependencias al número 6 | de versión más alto *permitido por el rango en package.json*. 7 | 8 | El comando es `npm update`. Puedes leer `npm help update` para 9 | ver más detalles. 10 | 11 | Actualiza todas tus dependencias a las versiones más recientes posibles, 12 | y ejecuta `$ADVENTURE_COMMAND verify` para terminar aquí. 13 | -------------------------------------------------------------------------------- /problems/14-update/problem.fr.txt: -------------------------------------------------------------------------------- 1 | Il est bien, bien sûr, de vérifier explicitement si il y a des modules 2 | obsolètes, et ensuite lancez `npm install`. 3 | 4 | Cependant, si vous voulez être un peu plus paresseux à ce sujet, 5 | il y a une commande spécial npm qui mettra À JOUR tout les dépendances 6 | pour la version maximum que vous autorisez dans votre package.json. 7 | 8 | Pouvez-vous deviner quelle commande qui pourrait le faire ? 9 | (`npm help` pourrait vous aider) 10 | 11 | Mettez à jour tous vos dépendances à la dernière version possible, puis 12 | lancez `$ADVENTURE_COMMAND verify` pour obtenir votre magnifique bannière 13 | verte. 14 | -------------------------------------------------------------------------------- /problems/14-update/problem.ja.txt: -------------------------------------------------------------------------------- 1 | もちろん、古くなったパッケージを明示的にチェックしてから、 2 | `npm install` を実行して更新するやりかたでもうまくいきます。 3 | 4 | しかし、もうすこし楽をしたいのであれば、そのために用意された npm 5 | コマンドがあります。そのコマンドを実行すれば、すべての依存パッケージを 6 | package.json に記述されている許容可能な最大のバージョンまで引き上げら 7 | れます。 8 | 9 | どのコマンドだか当てられるでしょうか(`npm help` でコマンド一覧が見られます)。 10 | 11 | すべての依存パッケージを可能な限り新しいバージョンに更新してから、 12 | `$ADVENTURE_COMMAND verify` を実行して、緑色の素敵なバナーを表示させましょう。 13 | -------------------------------------------------------------------------------- /problems/14-update/problem.ko.txt: -------------------------------------------------------------------------------- 1 | 물론 오래된 패키지를 명시적으로 확인한 뒤에, 2 | `npm install`을 실행해서 갱신하는 방법도 있습니다. 3 | 4 | 하지만 이 방법이 귀찮으신 분들을 위해 준비된 npm 명령어가 있습니다. 5 | 이 명령어를 실행하면 package.json에 기재된 모든 의존 패키지들이 6 | 허용 가능한 최대 버전까지 업데이트됩니다. 7 | 8 | 어떤 명령어인지 아시겠나요? (`npm help`를 입력하면 명령어 일람을 볼 수 있습니다) 9 | 10 | 모든 의존 패키지를 가능한 최대 버전으로 업데이트 하고 나서, 11 | `$ADVENTURE_COMMAND verify`를 실행해서 멋진 녹색 배너를 표시해봅시다. 12 | -------------------------------------------------------------------------------- /problems/14-update/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 当然,在显式地检查旧软件包之后,也可以运行 "npm install" 命令把它们拉进来。 2 | 3 | 然而,如果您想懒惰一点,恰好有为此准备的 npm 命令。 4 | 该命令会将所有相关软件包,提升到 package.json 文件中可接受的最新版本。 5 | 6 | 您能猜到那是什么命令吗?("npm help" 可以帮助您) 7 | 8 | 更新所有相关的软件包到最新版本,然后运行 "$ADVENTURE_COMMAND verify" 来显示有趣的绿色横幅。 -------------------------------------------------------------------------------- /problems/15-rm/index.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs') 2 | var path = require('path') 3 | var shop = require('../../') 4 | 5 | exports.problem = { 6 | file: path.join(__dirname, 'problem.{lang}.txt') 7 | } 8 | 9 | exports.init = function (workshopper) { 10 | this.__ = workshopper.i18n.__ 11 | } 12 | 13 | exports.verify = function (args, cb) { 14 | var cwd = shop.cwd() 15 | if (!cwd) return cb(false) 16 | 17 | var __ = this.__ 18 | var pkg = require(cwd + '/package.json') 19 | var deps = Object.keys(pkg.dependencies || {}) 20 | var nm 21 | try { 22 | nm = fs.readdirSync(path.resolve(cwd, 'node_modules')) 23 | nm = nm.filter(function (n) { 24 | return !/^\./.test(n) 25 | }) 26 | } catch (er) { 27 | nm = [] 28 | } 29 | 30 | if (nm.length) { 31 | console.log(__('rm.dependencies_left')) 32 | return cb(false) 33 | } 34 | 35 | if (deps.length) { 36 | console.log(__('rm.package_json_left')) 37 | return cb(false) 38 | } 39 | 40 | return cb(null, true, { 41 | file: path.join(__dirname, 'success.{lang}.txt') 42 | }) 43 | } 44 | -------------------------------------------------------------------------------- /problems/15-rm/problem.en.txt: -------------------------------------------------------------------------------- 1 | If you have a way to put stuff there, then naturally, you'll one 2 | day need a way to delete them. 3 | 4 | Enter the `npm rm` command (aka `npm uninstall` if you prefer to 5 | type things out long-hand). 6 | 7 | Remove all the deps! But, make sure that you don't keep depending on them. 8 | 9 | Just like you can use `--save` on installing packages, you can also 10 | use `--save` when removing packages, to also remove them from your 11 | package.json file. 12 | 13 | When you've removed your dependencies, type `$ADVENTURE_COMMAND verify` to move on. 14 | -------------------------------------------------------------------------------- /problems/15-rm/problem.es.txt: -------------------------------------------------------------------------------- 1 | Si tienes que meterle cosas, pues naturalmente, algún día tendrás que sacarlas. 2 | 3 | Para eso está el comando `npm rm` (que también se conoce como `npm uninstall`). 4 | 5 | Borra todas las dependencias! 6 | 7 | Pero espera -- igual que puedes usar `--save` cuando instalas paquetes, 8 | igual puedes usar `--save` cuando los borras, que los borrará 9 | también de tu package.json. 10 | 11 | Cuando hayas borrado todas tus dependencias, dale a `$ADVENTURE_COMMAND verify` y seguimos. 12 | -------------------------------------------------------------------------------- /problems/15-rm/problem.fr.txt: -------------------------------------------------------------------------------- 1 | Si vous avez un moyen de mettre des choses à un endroit, 2 | alors naturellement, vous aurez un jour besoin d'un moyen 3 | de les supprimer. 4 | 5 | Entrer la commande `npm rm` (aussi appelé `npm uninstall` 6 | si vous préférez tapez des choses longues). 7 | 8 | Supprimer tous les dépendance ! Mais, assurez-vous que vous 9 | ne dependez pas d'eux. 10 | 11 | Tout comme vous pouvez utiliser `--save` lors de l'installation de paquets, 12 | vous pouvez utiliser `--save` lors de la suppréssion des packages, de les retirer 13 | du fichier package.json. 14 | 15 | Lorsque vous avez supprimé vos dépendances, tapez `$ADVENTURE_COMMAND verify` pour 16 | continuer. 17 | -------------------------------------------------------------------------------- /problems/15-rm/problem.ja.txt: -------------------------------------------------------------------------------- 1 | なにかを追加することができる以上、当然、それを取り除く方法が必要 2 | になることもあるでしょう。 3 | 4 | その場合、`npm rm` コマンドを入力してください(別名 `npm uninstall` 5 | もし長いコマンドを入力するのが好きならこちらでもかまいません)。 6 | 7 | 依存パッケージをすべて削除しましょう。ただし、それらのパッケージを 8 | 実際に使用していないことは確認しておいてください。 9 | 10 | インストール時に、`--save` を使ったように、パッケージを取り除くとき 11 | にも、`--save` を使うことで package.json ファイルからそれに関する 12 | 記述を除去できます。 13 | 14 | 依存パッケージを除去できたなら、`$ADVENTURE_COMMAND verify` とタイプして 15 | 進んでください。 16 | -------------------------------------------------------------------------------- /problems/15-rm/problem.ko.txt: -------------------------------------------------------------------------------- 1 | 무엇을 추가하는 것이 가능하다면, 언젠가 그것을 없애버려야 할 날이 왔을 때 제거하는 것도 가능해야겠죠? 2 | 3 | `npm rm`을 입력해주세요(`npm uninstall`을 입력하셔도 됩니다, 4 | 긴 명령어를 입력하시는 걸 좋아하신다면요). 5 | 6 | 의존 패키지를 전부 제거해봅시다. 단, 그것들을 전부 사용하고 있지 않은 상태여야 합니다. 7 | 8 | 패키지 설치 시에 `--save`를 사용하였듯이, 패키지 제거 시에도 `--save`를 사용함으로 package.json 파일에서 패키지 정보를 제거할 수 있습니다. 9 | 10 | 의존 패키지를 제거가 완료되었다면 `$ADVENTURE_COMMAND verify`를 입력해서 진행해주세요. 11 | -------------------------------------------------------------------------------- /problems/15-rm/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 既然您能加入一些东西,那么自然您也能将它们删除。 2 | 3 | 输入 "npm rm" 命令(如果您喜欢使用长命令,可以输入 "npm uninstall") 4 | 5 | 删除所有的依赖包!但要确保您不再需要它们。 6 | 7 | 就像您可以使用 "--save" 来安装软件包,您也可使用 "--save" 从 package.json 8 | 文件中删除对软件包的描述。 9 | 10 | 当删除了您所有的依赖项后,输入 "$ADVENTURE_COMMAND verify" 继续下一关。 -------------------------------------------------------------------------------- /problems/15-rm/success.en.txt: -------------------------------------------------------------------------------- 1 | Awesome! You have removed the packages from your node_modules folder, 2 | and also updated your package.json file to reflect that you're no longer 3 | depending on them. 4 | 5 | Well done. 6 | -------------------------------------------------------------------------------- /problems/15-rm/success.es.txt: -------------------------------------------------------------------------------- 1 | ¡Guay! Has borrado todos los paquetes de tu node_modules, y además 2 | has borrado referencias a ellos de tu package.json. 3 | 4 | Muy bien.👏 5 | -------------------------------------------------------------------------------- /problems/15-rm/success.fr.txt: -------------------------------------------------------------------------------- 1 | Impressionnant ! Vous avez supprimé les packages de votre dossier node_modules, 2 | et également mis à jour votre fichier package.json pour refléter le fait 3 | que vous n'êtes plus dépendant d'eux. 4 | 5 | Bien joué. 6 | -------------------------------------------------------------------------------- /problems/15-rm/success.ja.txt: -------------------------------------------------------------------------------- 1 | すばらしい。node_modules フォルダーからパッケージを取り除けました。 2 | また、package.json ファイルを更新して、もはやそれらに依存していない 3 | ということを反映させることができました。 4 | 5 | これで完了です。 6 | -------------------------------------------------------------------------------- /problems/15-rm/success.ko.txt: -------------------------------------------------------------------------------- 1 | 멋져요. node_modules 폴더에서 패키지를 제거하였습니다. 2 | 또한, package.json을 갱신해서 제거된 패키지에 더는 의존하고 있지 않다는 것을 반영하였습니다. 3 | 4 | 잘하셨습니다. 5 | -------------------------------------------------------------------------------- /problems/15-rm/success.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 好极了! 您成功的删除了 node_modules 文件夹中的软件包, 2 | 而且更新了 package.json 文件,以反映您不再依赖它们。 3 | 4 | 干得漂亮! -------------------------------------------------------------------------------- /problems/16-finale/index.js: -------------------------------------------------------------------------------- 1 | var shop = require('../../') 2 | var path = require('path') 3 | 4 | exports.problem = { 5 | file: path.join(__dirname, 'problem.{lang}.txt') 6 | } 7 | 8 | exports.init = function (workshopper) { 9 | this.__ = workshopper.i18n.__ 10 | } 11 | 12 | exports.verify = function (args, cb) { 13 | if (!shop.cwd()) return cb(false) 14 | 15 | var __ = this.__ 16 | var completed = shop.appStorage.get('completed') 17 | var leftOver = shop.exercises.filter(function (specifier) { 18 | return completed.indexOf(specifier) === -1 && specifier !== '16 Finale' 19 | }) 20 | 21 | // the 1 remaining would be this one, of course 22 | if (leftOver.length > 0) { 23 | console.log(__('finale.todo') + '\n') 24 | leftOver.forEach(function (id) { 25 | console.log(' - ' + __('exercise.' + id)) 26 | }) 27 | console.log('') 28 | return cb(false) 29 | } 30 | 31 | return cb(null, true, { 32 | file: path.join(__dirname, 'success.{lang}.txt') 33 | }) 34 | } 35 | -------------------------------------------------------------------------------- /problems/16-finale/problem.en.txt: -------------------------------------------------------------------------------- 1 | 2 | It's almost time to say goodbye. But don't worry! This is just an 3 | introduction. If you've finished all the other exercises, then run 4 | `$ADVENTURE_COMMAND verify` to learn about the next steps beyond this little 5 | workshop. 6 | -------------------------------------------------------------------------------- /problems/16-finale/problem.es.txt: -------------------------------------------------------------------------------- 1 | Ya es casi hora de decir adiós. Pero no te preocupes! Esto es sólo 2 | una introducción. Si ya acabaste todos los otros ejercicios, escribe 3 | `$ADVENTURE_COMMAND verify` para ver los próximos pasos para tomar. 4 | -------------------------------------------------------------------------------- /problems/16-finale/problem.fr.txt: -------------------------------------------------------------------------------- 1 | 2 | Il est presque temps de dire au revoir. Mais ne vous inquiétez pas! 3 | C'est juste une introduction. Si vous avez terminé tous les autres exercices, 4 | `$ADVENTURE_COMMAND verify` pour connaître les prochaines étapes au-delà 5 | de ce petit atelier. 6 | -------------------------------------------------------------------------------- /problems/16-finale/problem.ja.txt: -------------------------------------------------------------------------------- 1 | 2 | お別れの挨拶を言うときが近付いてきました。けれど心配はいりません。この 3 | ワークショッパーはあくまで入門編なのですから。これまでの課題がすべて 4 | 終わったら、`$ADVENTURE_COMMAND verify` を実行して、この小さなアドベンチャー 5 | を越えたあとに待っている、さらなるステップについて学んでください。 6 | -------------------------------------------------------------------------------- /problems/16-finale/problem.ko.txt: -------------------------------------------------------------------------------- 1 | 2 | 이제 곧 헤어질 시간이군요. 하지만 걱정하지 마세요! 이 워크숍은 시작일 뿐이니까요. 지금까지의 모든 과제를 완료하셨다면, `$ADVENTURE_COMMAND verify`를 실행해서 다음 단계에 도전해보세요! 3 | -------------------------------------------------------------------------------- /problems/16-finale/problem.zh-cn.txt: -------------------------------------------------------------------------------- 1 | 道别的时候快到了。不用担心!这仅仅是一个入门。 2 | 3 | 如果您已经完成了其他所有的挑战,可以运行 "$ADVENTURE_COMMAND verify", 4 | 去了解本训练营之后接下来的学习步骤。 -------------------------------------------------------------------------------- /problems/16-finale/success.en.txt: -------------------------------------------------------------------------------- 1 | There is SO MUCH MORE that npm can do. Some of the things that we didn't 2 | have time to cover in this modest little workshop include: 3 | 4 | 1. Splitting your app up into multiple modules 5 | 2. Sharing private code with teammates using scoped modules 6 | 3. Other fun npm commands, like `edit` and `bugs` and `explore`! 7 | 8 | You can still learn more about all the fun you and npm can have together. 9 | It all starts with the thought: "There should be a module that does this..." 10 | 11 | Your adventure is awaiting you at https://www.npmjs.com/ 12 | 13 | See you on the internet! 14 | -------------------------------------------------------------------------------- /problems/16-finale/success.es.txt: -------------------------------------------------------------------------------- 1 | Hay TANTO MÁS que puede hacer npm. Algunas de las cosas que no pudimos 2 | cubrir en este simple tutorial incluyen: 3 | 4 | 1. Dividiendo tu aplicación en múltiples paquetes. 5 | 2. Compartiendo código privado con tu equipo usando "scopes" 6 | 3. ¡Otros comandos divertidos, como `edit` y `bugs` y `explore`! 7 | 8 | Todavía puedes aprender más sobre todo lo que puede hacer npm. 9 | 10 | Tu aventura te espera en https://www.npmjs.com/ 11 | 12 | ¡Nos vemos en el internet! 13 | -------------------------------------------------------------------------------- /problems/16-finale/success.fr.txt: -------------------------------------------------------------------------------- 1 | Il y a TELLEMENT PLUS de choses que npm peut faire. Certaines des choses 2 | que nous n'avons pas eu le temps de couvrir dans ce modeste petit atelier 3 | comprennent: 4 | 5 | 1. Diviser votre application en plusieurs modules 6 | 2. Partage de code privé avec des coéquipiers en utilisant des modules "scoped" 7 | 3. Autre fun avec des commandes npm, comme `edit` et `bugs` et `explore`! 8 | 9 | Vous pouvez toujours en savoir plus sur tout le plaisir que vous et npm 10 | pouvez avoir ensemble. Tout commence par la pensée: "Il devrait y avoir 11 | un module qui fait cela ..." 12 | 13 | Votre aventure vous attend sur https://www.npmjs.com/ 14 | 15 | À plus tard sur l'internet ! 16 | -------------------------------------------------------------------------------- /problems/16-finale/success.ja.txt: -------------------------------------------------------------------------------- 1 | npm ができることは、まだまだ他にもあります。時間がなかったため、この小さな 2 | ワークショップでカバーできなかったのは、例えばこんなことです: 3 | 4 | 1. アプリを複数のモジュールに分割する 5 | 2. プライベートなコードをチームメイトと共有するために、スコープ付き 6 | モジュールを使う 7 | 3. 他のおもしろい npm コマンド、たとえば、`edit` や `bugs` や `explore` 8 | 9 | まだ他にも、npm でできる興味深いことをたくさん学べます。 10 | 「こんなことをするモジュールがあるはずだ」と考えることから、すべては始るの 11 | です。 12 | 13 | https://www.npmjs.com/ で冒険がみなさんを待っています。 14 | 15 | ではまた、インターネットでお会いしましょう。 16 | -------------------------------------------------------------------------------- /problems/16-finale/success.ko.txt: -------------------------------------------------------------------------------- 1 | npm으로 가능한 것은 아직 더 많이 있습니다. 이 워크숍에서 다루지 못한 것들은 예를 들면 이런 것들이 있습니다. 2 | 3 | 1. 애플리케이션을 복수의 모듈로 나누기 4 | 2. 모듈에 범위를 지정하여, 비공개 코드를 팀원과 공유하기 5 | 3. 여러 가지 재미있는 npm 명령어들, `edit`, `bugs`, `explore` 등등. 6 | 7 | 이외에도 npm에 관한 흥미롭고 더 재밌는 것들을 배울 수 있습니다. 음. 이러이러한 모듈 없으려나? 라고 생각하는 순간으로부터 npm의 여행은 시작됩니다! 8 | 9 | https://www.npmjs.com/에서 모험이 여러분들을 기다리고 있습니다. 10 | 11 | 그럼, 인터넷에서 다시 만나요! 12 | -------------------------------------------------------------------------------- /problems/16-finale/success.zh-cn.txt: -------------------------------------------------------------------------------- 1 | npm 还可以做很多其他的事。在这个小小的训练营里,我们没来得及讨论的还有: 2 | 3 | 1. 将应用程序拆分为多个模块 4 | 2. 为模块指定范围,以便与队友们共享私有代码 5 | 3. 其他好玩儿的 npm 命令,比如 `edit` 、 `bugs` 和 `explore`! 6 | 7 | 另外,还可以学到很多在 npm 下能做的有趣的事。 8 | 这一切都从一个想法开始:"应该有一个能做这些事情的模块..." 9 | 10 | https://www.npmjs.com/ 上的冒险之旅正等待着您。 11 | 12 | 那么,我们在网上再见吧。 13 | -------------------------------------------------------------------------------- /workshop-npmrc: -------------------------------------------------------------------------------- 1 | registry = http://localhost:15443/ 2 | userconfig = %USERCONFIG% 3 | --------------------------------------------------------------------------------