Skip to content

Instantly share code, notes, and snippets.

@joshwiens
Last active February 22, 2017 09:36
Show Gist options
  • Save joshwiens/21f09152933f6d0ee13775e7bf738b59 to your computer and use it in GitHub Desktop.
Save joshwiens/21f09152933f6d0ee13775e7bf738b59 to your computer and use it in GitHub Desktop.
Notes on using webpack-defualts for an upgrade

1.) npm i -D webpack-defaults

2.) Add webpack-defualts to scripts

3.) Execute npm run webpack-defaults

Initial update checkpoint

  • Babel outputs to ./dist the files field for an existing repo is all but guaranteed to be wrong and require updating. This should be documented unless there is a way to migrate existing files settings to incorporate the dist output ( more trouble than it's worth imo)
  • Uses yarn, yarn-debug.log* needs to be ingored on update as well.
  • travis.yml before_script & script are duplicating commands for npm & yarn. In Travis we should only use yarn.
  • Are we outputing a README.md from the approved template on an empty repo? Should we spit out a README_TMPL.md to assist people in upgrading their existing readme to the contrib standard?
  • We should be outputing an empty? src folder if it doesn't exist, perhaps with the migration.md documentation inside ( and ignored by git ) Babel requires all the javascript to reside under ./src

travis.yml

sudo: false
language: node_js
branches:
  only:
    - master
matrix:
  fast_finish: true
  include:
    - os: linux
      node_js: '6'
      env: WEBPACK_VERSION="2.2.0" JOB_PART=test
    - os: linux
      node_js: '4.3'
      env: WEBPACK_VERSION="2.2.0" JOB_PART=test
    - os: linux
      node_js: '7'
      env: WEBPACK_VERSION="2.2.0" JOB_PART=test
    - os: linux
      node_js: '7'
      env: WEBPACK_VERSION="2.2.0" BITHOUND_CHECK=true JOB_PART=lint
    - os: linux
      node_js: '7'
      env: WEBPACK_VERSION="2.2.0" JOB_PART=coverage
before_install:
  - nvm --version
  - node --version
before_script:
  - 'if [ "$WEBPACK_VERSION" ]; then yarn add webpack@^$WEBPACK_VERSION; fi'
  - >-
    if [ "$BITHOUND_CHECK" ]; then npm install -g bithound; bithound check
    [email protected]:$TRAVIS_REPO_SLUG.git; fi
script:
  - 'npm run travis:$JOB_PART'
  - 'yarn run travis:$JOB_PART'
after_success:
  - 'bash <(curl -s https://codecov.io/bash)'

There are some formating issues in the bash if statements in before_script Everything else looks good as it relates to initial command execution.

4.) create ./src directory

Initial refactoring checkpoint

  • Move all .js files into ./src. Document the importance of moving and not creating new files to retain git history?
  • Document how jest looks for test files
  • Document standard ./src layout. i.e ...
Single-File Lib
├── src
    ├── some-lib.test.js
    ├── index.js
Multi-File Lib
├── src
    ├── lib/
    |   ├── some-lib.js
    |   ├── some-lib.test.js
    ├── index.js
  • Add note about disabling the pre-commit hook during initial refactoring? Not being able to commit incrementally is a recipe for disaster with this level of change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment