strapi/packages/utils/upgrade/resources/examples/upgrade-strapi-version.json.ts
Ben Irvin 7d13a12c99
feat: Upgrade Tool
* feat: upgrade tool refactor for updated specs (v5)
* chore: format code (prettier)
* chore: remove debug comments
* feat: upgrade the strapi dependencies in project's package.json
* feat: install dependencies during the upgrade process
* chore: fix lint issue
* chore: rephrase requirement sentence's sentiment
* feat: add a --yes option for the upgrade CLI
* enh: make properties readonly to avoid mutations
* chore: adding better logs to the upgrade CLI
* chore: remove unused import
* feat: add minor and patch commands
* fix: use major and minor instead of premajor and preminor
* fix: re-add type casting
* fix: make major requirements required
* chore: revert sentiment update on GIT_CLEAN requirement
* fix: make promisify working by mocking the entire file-system
* fix: yarn.lock update
* feat: Select and run codemods only (#19083)
* chore: add unit tests for upgrader tasks
* fix: rename tests
* chore: Update packages/utils/upgrade/src/tasks/__tests__/upgrade.test.ts
* chore: Add unit tests for upgrade tool (#19056)
* chore: move example codemods (#19156)
* chore: fix yarn.lock
* fix: sync glob versions
* chore: add comment
* chore: update docs

---------

Co-authored-by: Convly <jean-sebastien.herbaux@epitech.eu>
Co-authored-by: Bassel Kanso <basselkanso82@gmail.com>
Co-authored-by: Christian <christian.capeans.perez@strapi.io>
Co-authored-by: Christian Capeans <christiancp100@gmail.com>
2024-01-08 11:26:27 +01:00

30 lines
793 B
TypeScript

import path from 'node:path';
import type { modules } from '../../dist';
/**
* Note: This transform file is only for development purposes and should be deleted before releasing
*/
const transform: modules.runner.json.JSONTransform = (file, params) => {
const { cwd, json } = params;
// Ignore files that are not the root package.json
// Note: We could also find every file named package.json and update the dependencies for all of them
const rootPackageJsonPath = path.join(cwd, 'package.json');
if (file.path !== rootPackageJsonPath) {
return file.json;
}
const j = json(file.json);
const strapiDepAddress = 'dependencies.@strapi/strapi';
if (j.has(strapiDepAddress)) {
j.set(strapiDepAddress, '5.0.0');
}
return j.root();
};
export default transform;