# Upgrade Guide

# 0.13.0

This release greatly simplifies the specific inclusion of files in the app and wood folders. Instead of prefixing your includes with @wood-config/file or @app-ui/file, you will instead prefix them with @wood/config/file or @app/ui/file. This may seem superficial, but it means that we only have special cases for the wood and app folders, instead of special cases for every folder under each of them. This greatly simplifies the require logic behind the scenes, and means that you can now specifically require any file in the wood and app folders, not just ones with specifically-defined aliases.

Upgrade steps:

  1. Update _moduleAliases in package.json:
  "_moduleAliases": {
    "@app": "./app",
    "@wood": "./wood"
  },
  1. Update moduleNameMapper in jest.config.js:
  moduleNameMapper: {
    '^@app(.*)$': '<rootDir>/app/$1',
    '^@wood(.*)$': '<rootDir>/wood/$1',
  },
  1. Update settings.import/resolver.alias-array.map in .eslintrc.js:
        map: [
          ['#api', [
            resolve(__dirname, 'app/api'),
            resolve(__dirname, 'wood/api'),
          ]],

          ['#config', [
            resolve(__dirname, 'app/config'),
            resolve(__dirname, 'wood/config'),
          ]],
          ['#features', [
            resolve(__dirname, 'app/features'),
            resolve(__dirname, 'wood/features'),
          ]],
          ['#lib', [
            resolve(__dirname, 'app/lib'),
            resolve(__dirname, 'wood/lib'),
          ]],
          ['#ui', [
            resolve(__dirname, 'app/ui'),
            resolve(__dirname, 'wood/ui'),
          ]],
          ['@app', resolve(__dirname, 'app')],
          ['@wood', resolve(__dirname, 'wood')],
        ],
  1. Update _moduleAliases in app/package.json:
  "_moduleAliases": {
    "@app": ".",
    "@wood": "../wood/"
  },
  1. Replace all instances of @wood-root with @wood.
  2. Replace all instances of @app-root with @app.
  3. Replace all instances of @wood- with @wood/.
  4. Replace all instances of @app- with @app/.

# 0.12.0

This release is a significant change in the file layout of Nodewood. If you are upgrading from < 0.12.0 and do not perform these changes, your app will not work.

This release moves all files in api/src to api, lib/src to lib, and ui/src to ui to better match how the rest of the framework is structured. These files were originally in separate root folders, but were all moved under the wood folder a while back and should properly have had their src folder removed at that time.

But as they say, the best time to plant a tree is twenty years ago, and the second-best time is now.

Upgrade steps:

  1. Move all code from your app/api/src folder to the app/api folder.
  2. Move all code from your app/lib/src folder to the app/lib folder.
  3. Move all code from your app/ui/src folder to the app/ui folder.
  4. Update .eslintrc.js to remove the /src suffix for all entries.
  5. Update jest.config.js to change all instances of src/$1 to $1.
  6. Update package.json to remove the src suffix for all entries in _moduleAliases.
  7. Update package.json to change main to "app/api/api.js".
  8. Update package.json to change scripts.dev-api-only to "cd app/api && NODE_ENV=development nodemon --watch . --watch ../config --watch ../features --watch ../../wood -L ./api.js | npx pino-pretty"
  9. Update app/package.json to remove the src suffix for all entries in _moduleAliases.
  10. Update app/api/api.js and change the startServer line to const { startServer } = require('../../wood/api/api.js');.
  11. Update `app/
  12. Update any other custom code you have added that refers to api/src, lib/src, or ui/src.
  13. Update any other custom code you have added to the api, lib, or ui folders that access files from other folders using relative paths (i.e. if you have a sequence of ../../../, etc).

If you experience into any issues, please contact support at hello@nodewood.com.