diff --git a/.releaseconfig.json b/.releaseconfig.json index cac25b49b..1186e8d17 100644 --- a/.releaseconfig.json +++ b/.releaseconfig.json @@ -1,7 +1,7 @@ { - "plugins": ["iobroker", "license", "lerna"], + "plugins": ["iobroker", "license"], "ioPackage": "packages/admin", "exec": { - "before_commit": "npm run build" + "before_commit": "npm run build && npm run bump-versions" } } diff --git a/package.json b/package.json index 2930fe18d..6541adf26 100644 --- a/package.json +++ b/package.json @@ -12,12 +12,12 @@ "devDependencies": { "@alcalzone/release-script": "^3.8.0", "@alcalzone/release-script-plugin-iobroker": "^3.7.2", - "@alcalzone/release-script-plugin-lerna": "^3.7.0", "@alcalzone/release-script-plugin-license": "^3.7.0", "@iobroker/build-tools": "^2.0.6" }, "scripts": { - "build": "node tasks", + "build": "node tasks --build", + "bump-versions": "node tasks --bump-versions", "install-monorepo": "npm i && npm i -w packages/dm-gui-components && npm i -w packages/jsonConfig && npm i -w packages/admin cd packages/admin/src-admin && npm i -f", "npm": "npm run install-monorepo", "start": "npm run start -w packages/admin", diff --git a/packages/dm-gui-components/package.json b/packages/dm-gui-components/package.json index bdda2a017..b0161f056 100644 --- a/packages/dm-gui-components/package.json +++ b/packages/dm-gui-components/package.json @@ -48,11 +48,13 @@ }, "homepage": "https://github.com/ioBroker/dm-gui-components#readme", "dependencies": { + "@iobroker/json-config": "file:../jsonConfig" + }, + "devDependencies": { "@craco/craco": "^7.1.0", "@iobroker/adapter-react-v5": "^7.2.4", "@iobroker/dm-utils": "^0.5.0", "@iobroker/eslint-config": "^0.1.6", - "@iobroker/json-config": "file:../jsonConfig", "@iobroker/types": "^7.0.0", "@types/react": "^18.3.11", "@types/react-dom": "^18.3.0", diff --git a/packages/jsonConfig/package.json b/packages/jsonConfig/package.json index 1bfef29c6..06c959023 100644 --- a/packages/jsonConfig/package.json +++ b/packages/jsonConfig/package.json @@ -16,6 +16,12 @@ "access": "public" }, "dependencies": { + "react-qr-code": "^2.0.15", + "crypto-js": "^4.2.0", + "react-color": "^2.19.3", + "react-ace": "^12.0.0" + }, + "devDependencies": { "@craco/craco": "^7.1.0", "@iobroker/adapter-react-v5": "^7.2.4", "@iobroker/eslint-config": "^0.1.6", @@ -24,12 +30,8 @@ "@types/react": "^18.3.11", "@types/react-color": "^3.0.12", "@types/react-dom": "^18.3.0", - "crypto-js": "^4.2.0", "react": "^18.3.1", - "react-ace": "^12.0.0", - "react-color": "^2.19.3", "react-dom": "^18.3.1", - "react-qr-code": "^2.0.15", "tsc-alias": "^1.8.10", "typescript": "^5.6.2" }, diff --git a/tasks.js b/tasks.js index 5ffbc6958..c49cf4b33 100644 --- a/tasks.js +++ b/tasks.js @@ -1,5 +1,5 @@ const { exec } = require('node:child_process'); -const { existsSync } = require('node:fs'); +const { existsSync, readFileSync, writeFileSync } = require('node:fs'); const COLORS = { RED: '\x1b[31m', @@ -82,7 +82,37 @@ async function build() { } log('-------------- END --------------', COLORS.RED); } -build().catch(e => { - console.error(e); - process.exit(1); -}); +if (process.argv.includes('--build')) { + build().catch(e => { + console.error(e); + process.exit(1); + }); +} else if (process.argv.includes('--bump-versions')) { + // read the version in package/admin + const packAdmin = JSON.parse(readFileSync(`${__dirname}/packages/admin/package.json`).toString()); + const version = packAdmin.version; + // replace in JsonConfig the version + const packJsonConfig = JSON.parse(readFileSync(`${__dirname}/packages/jsonConfig/package.json`).toString()); + packJsonConfig.version = version; + log(`Set the version in jsonConfig/package.json to ${packJsonConfig.version}`, COLORS.CYAN); + writeFileSync(`${__dirname}/packages/jsonConfig/package.json`, JSON.stringify(packJsonConfig, null, 4)); + + // replace in JsonConfig the version + const packDmComponents = JSON.parse(readFileSync(`${__dirname}/packages/dm-gui-components/package.json`).toString()); + packDmComponents.version = version; + packDmComponents.dependencies['@iobroker/json-config'] = version; + packAdmin.devDependencies['@iobroker/dm-gui-components'] = version; + packAdmin.devDependencies['@iobroker/json-config'] = version; + log(`Set the version in dm-gui-components/package.json to ${packDmComponents.version}`, COLORS.GREEN); + writeFileSync(`${__dirname}/packages/dm-gui-components/package.json`, JSON.stringify(packDmComponents, null, 4)); + + // const packAdminGuiComponents = JSON.parse(readFileSync(`${__dirname}/packages/admin/src-admin/package.json`).toString()); + // packAdminGuiComponents.version = version; + // packAdminGuiComponents.dependencies['@iobroker/dm-gui-components'] = version; + // packAdminGuiComponents.dependencies['@iobroker/json-config'] = version; + // log(`Set the version in admin/src-admin/package.json to ${packAdminGuiComponents.version}`, COLORS.YELLOW); + // writeFileSync(`${__dirname}/packages/admin/src-admin/package.json`, JSON.stringify(packAdminGuiComponents, null, 4)); + + log(`Set the version in admin/package.json to ${packAdmin.version}`, COLORS.MAGENTA); + writeFileSync(`${__dirname}/packages/admin/package.json`, JSON.stringify(packAdmin, null, 4)); +}