Skip to content

Instantly share code, notes, and snippets.

@DamonOehlman
Last active June 13, 2021 20:22
Show Gist options
  • Select an option

  • Save DamonOehlman/19b4025d08c93d0c890c2c33339ae262 to your computer and use it in GitHub Desktop.

Select an option

Save DamonOehlman/19b4025d08c93d0c890c2c33339ae262 to your computer and use it in GitHub Desktop.

Revisions

  1. DamonOehlman revised this gist Aug 1, 2017. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -47,6 +47,12 @@ Once the script is available, simply change directory to where your offline clon
    npm-all-the-things
    ```

    Alternatively, you can also use [`yarn`](https://github.com/yarnpkg/yarn):

    ```
    yarn-all-the-things
    ```

    What will happen now is the `npm-all-the-things` script will iterate through all the child directories of the directory you are in, and if it located a `package.json` file in that directory it will remove the `node_modules` directory, and will then do an `npm install --min-cache 99999` in that directory. I had previously been using `local-npm` for going offline, but [according to this deprecation notice](https://github.com/nolanlawson/local-npm/pull/122#issue-154909382) the npm `--min-cache` option is just as good.

    If you cloned a few repos, then this will generate a lot of output. Some of it useful, some of less so. It will, however, ensure that whatever remote dependencies are pulled down and cached. There will be some of your packages that will likely fail though (perhaps because you initially built it on a different platform, or it's just unloved). In these cases, the project folders will contain a `.npm-resync-fail` file (see the list below), which can give you a good idea of what projects you might need to fix before tweaking offline.
  2. DamonOehlman revised this gist May 30, 2016. 1 changed file with 20 additions and 0 deletions.
    20 changes: 20 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -72,3 +72,23 @@ If you cloned a few repos, then this will generate a lot of output. Some of it
    Some good alternative options, are listed in this post also:

    <https://addyosmani.com/blog/using-npm-offline/>

    ## Contributing to another project

    If you decide that you'd like to help out with another open source project over the weekend, then probably the simplest way to do this is to fork the project on github that you have been thinking about working with, and then running `multirepo` again.

    Here's some output after I ran multirepo again after fixing a few of my old repos and also cloning [`choo`](https://github.com/yoshuawuyts/choo):

    ```
    [damo@djomac me]$ multirepo pull
    Checking for repos with new pushes since 2016-05-27T10:10:08.385Z
    Loading repo metadata from GitHub API (page 1)...
    4 repo(s) with new pushes have been found
    Pulling repo DamonOehlman/beandat...
    Pulling repo DamonOehlman/jsonite...
    Pulling repo DamonOehlman/djo-shell...
    Cloning repo DamonOehlman/choo...
    Cloned 1 new repos, skipped 0 existing repos, pulled 3 existing repos.
    ```

    Then, just run `npm-all-the-things` again to pick up any new package installs.
  3. DamonOehlman revised this gist May 30, 2016. 1 changed file with 20 additions and 1 deletion.
    21 changes: 20 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -49,7 +49,26 @@ npm-all-the-things

    What will happen now is the `npm-all-the-things` script will iterate through all the child directories of the directory you are in, and if it located a `package.json` file in that directory it will remove the `node_modules` directory, and will then do an `npm install --min-cache 99999` in that directory. I had previously been using `local-npm` for going offline, but [according to this deprecation notice](https://github.com/nolanlawson/local-npm/pull/122#issue-154909382) the npm `--min-cache` option is just as good.

    If you cloned a few repos, then this will generate a lot of output. Some of it useful, some of less so. It will, however, ensure that whatever remote dependencies are pulled down and cached. There will be some of your packages that will likely fail though (perhaps because you initially built it on a different platform, or it's just unloved). In these cases, the project folders will contain a `.npm-resync-fail` file:
    If you cloned a few repos, then this will generate a lot of output. Some of it useful, some of less so. It will, however, ensure that whatever remote dependencies are pulled down and cached. There will be some of your packages that will likely fail though (perhaps because you initially built it on a different platform, or it's just unloved). In these cases, the project folders will contain a `.npm-resync-fail` file (see the list below), which can give you a good idea of what projects you might need to fix before tweaking offline.

    ```
    [damo@djomac me]$ find . -name .npm-resync-fail
    ./beandat/.npm-resync-fail
    ./deckem/.npm-resync-fail
    ./dilemma-server/.npm-resync-fail
    ./easyusb/.npm-resync-fail
    ./guidebook/.npm-resync-fail
    ./jsonite/.npm-resync-fail
    ./localo/.npm-resync-fail
    ./node-dilemma/.npm-resync-fail
    ./node-gh-controller/.npm-resync-fail
    ./nokku/.npm-resync-fail
    ./pull-portal/.npm-resync-fail
    ./rtc.io-guidebook/.npm-resync-fail
    ./skelesense/.npm-resync-fail
    ./talk-bedazzle-intro/.npm-resync-fail
    ```

    Some good alternative options, are listed in this post also:

    <https://addyosmani.com/blog/using-npm-offline/>
  4. DamonOehlman revised this gist May 29, 2016. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -47,4 +47,9 @@ Once the script is available, simply change directory to where your offline clon
    npm-all-the-things
    ```

    What will happen now is the `npm-all-the-things` script will iterate through all the child directories of the directory you are in, and if it located a `package.json` file in that directory it will remove the `node_modules` directory, and request a fresh `npm install` using the `--min-cache` directive.
    What will happen now is the `npm-all-the-things` script will iterate through all the child directories of the directory you are in, and if it located a `package.json` file in that directory it will remove the `node_modules` directory, and will then do an `npm install --min-cache 99999` in that directory. I had previously been using `local-npm` for going offline, but [according to this deprecation notice](https://github.com/nolanlawson/local-npm/pull/122#issue-154909382) the npm `--min-cache` option is just as good.

    If you cloned a few repos, then this will generate a lot of output. Some of it useful, some of less so. It will, however, ensure that whatever remote dependencies are pulled down and cached. There will be some of your packages that will likely fail though (perhaps because you initially built it on a different platform, or it's just unloved). In these cases, the project folders will contain a `.npm-resync-fail` file:

    ```
    ```
  5. DamonOehlman revised this gist May 27, 2016. 1 changed file with 19 additions and 1 deletion.
    20 changes: 19 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -29,4 +29,22 @@ If you've used `multirepo` before you probably have your own process for this, b

    If you hit an error during the github authentication it could be because you have used `multirepo` before and you have a [personal access token](https://github.com/settings/tokens) that needs to be removed so you can reauthenticate.

    Using `multirepo pull` is a nice one-shot command that ensures you bring both clone and pull the repos from GitHub down to your local machine.
    Using `multirepo pull` is a nice one-shot command that ensures you bring both clone and pull the repos from GitHub down to your local machine.

    ## Step 2. Prefetch your dependencies

    Assuming you are using [npm](https://npmjs.org/) for managing packages, this is something I've written a script for before for myself (and recently tweaked). To get this script (and some of it's friends) you can install using npm:

    ```
    npm install -g djo-shell
    ```

    This is simply a collection of bash scripts that I find useful from time to time. If you'd rather not install the package, then feel free to curl down the [script itself](https://raw.githubusercontent.com/DamonOehlman/djo-shell/master/npmd-all-the-things.sh).

    Once the script is available, simply change directory to where your offline cloned repos exist `~/code/offline/me` is where I put mine in this exercise, and run the following command:

    ```
    npm-all-the-things
    ```

    What will happen now is the `npm-all-the-things` script will iterate through all the child directories of the directory you are in, and if it located a `package.json` file in that directory it will remove the `node_modules` directory, and request a fresh `npm install` using the `--min-cache` directive.
  6. DamonOehlman revised this gist May 27, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -27,6 +27,6 @@ If you've used `multirepo` before you probably have your own process for this, b
    Your GitHub OTP/2FA Code (optional): ******
    ```

    If you hit an error during the github authentication it could be because you have used `multirepo` before and you have a [personal access token](https://github.com/settings/tokens) than needs to be removed so you can reauthenticate.
    If you hit an error during the github authentication it could be because you have used `multirepo` before and you have a [personal access token](https://github.com/settings/tokens) that needs to be removed so you can reauthenticate.

    Using `multirepo pull` is a nice one-shot command that ensures you bring both clone and pull files from your repositories.
    Using `multirepo pull` is a nice one-shot command that ensures you bring both clone and pull the repos from GitHub down to your local machine.
  7. DamonOehlman revised this gist May 27, 2016. 1 changed file with 28 additions and 5 deletions.
    33 changes: 28 additions & 5 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,32 @@
    The following is guide to preparing for CampJS VII.
    The following is an "oh noes, where's my Internet" guide to surviving as a coder with no or limited Internet. Primarily the guide is focused on those who will be doing JS development (and using npm as a package manager) but some of the advice is useful for other environments also.

    ## Step 1: Complete the dietary requirements + travel survey
    ## Step 1. Clone all things

    ## Step 2: Ready yourself for an offline experience
    _Tooling in this steps require that you have git installed, and use github for your repositories._

    ## Step 3: Pack your things
    One thing I really like to do when I get a bit of time offline, is clean up an old repository that I once thought was useful. I rarely know about what project this might be in advance. As a result, I like to __clone all the things__ from my personal github account.

    ## Step 4: Go to CampJS VII
    To do this I recommend using [`multirepo`](https://github.com/maxogden/multirepo), which is best installed (at the moment) like so:

    ```
    npm install -g https://github.com/maxogden/multirepo
    ```

    If you've used `multirepo` before you probably have your own process for this, but if not here's what I'd recommend:

    - create a new directory where you are going to clone everything too, say something like `~/code/offline/me`
    - next, in that directory run `multirepo pull`

    You should see output similar to the following, prompting you for username, password and MFA token:

    ```
    [damo@djomac me]$ multirepo pull
    Your GitHub username: DamonOehlman
    Your GitHub password: ✔✔✔✔✔✔✔✔✔✔✔
    Your GitHub OTP/2FA Code (optional): ******
    ```

    If you hit an error during the github authentication it could be because you have used `multirepo` before and you have a [personal access token](https://github.com/settings/tokens) than needs to be removed so you can reauthenticate.

    Using `multirepo pull` is a nice one-shot command that ensures you bring both clone and pull files from your repositories.
  8. DamonOehlman created this gist May 24, 2016.
    9 changes: 9 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    The following is guide to preparing for CampJS VII.

    ## Step 1: Complete the dietary requirements + travel survey

    ## Step 2: Ready yourself for an offline experience

    ## Step 3: Pack your things

    ## Step 4: Go to CampJS VII