2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-09 23:00:56 +00:00

Sync local dependencies, script to automatically update version numbers

This commit is contained in:
Vjacheslav Trushkin 2022-03-31 15:59:42 +03:00
parent fb537ef559
commit 4c85bcd9f3
23 changed files with 194 additions and 100 deletions

View File

@ -1,72 +1,72 @@
{
"name": "ember-demo",
"version": "0.0.0",
"private": true,
"description": "Small description for ember-demo goes here",
"repository": "",
"license": "MIT",
"author": "",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "ember build --environment=production",
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
"lint:hbs": "ember-template-lint .",
"lint:hbs:fix": "ember-template-lint . --fix",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"start": "ember serve",
"test": "npm-run-all lint test:*",
"test:ember": "ember test"
},
"devDependencies": {
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.6.0",
"@glimmer/component": "^1.0.4",
"@glimmer/tracking": "^1.0.4",
"@iconify-icons/mdi-light": "^1.1.1",
"@iconify/ember": "^1.0.3",
"babel-eslint": "^10.1.0",
"broccoli-asset-rev": "^3.0.0",
"ember-auto-import": "^2.2.4",
"ember-cli": "~4.1.0",
"ember-cli-app-version": "^5.0.0",
"ember-cli-babel": "^7.26.11",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^6.0.1",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-cli-sri": "^2.1.1",
"ember-cli-terser": "^4.0.2",
"ember-data": "~4.1.0",
"ember-export-application-global": "^2.0.1",
"ember-fetch": "^8.1.1",
"ember-load-initializers": "^2.1.2",
"ember-page-title": "^7.0.0",
"ember-qunit": "^5.1.5",
"ember-resolver": "^8.0.3",
"ember-source": "~4.1.0",
"ember-template-lint": "^3.15.0",
"ember-welcome-page": "^6.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-ember": "^10.5.8",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-qunit": "^7.2.0",
"loader.js": "^4.7.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"qunit": "^2.17.2",
"qunit-dom": "^2.0.0",
"webpack": "^5.65.0"
},
"engines": {
"node": "12.* || 14.* || >= 16"
},
"ember": {
"edition": "octane"
}
"name": "ember-demo",
"version": "0.0.0",
"private": true,
"description": "Small description for ember-demo goes here",
"repository": "",
"license": "MIT",
"author": "",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "ember build --environment=production",
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
"lint:hbs": "ember-template-lint .",
"lint:hbs:fix": "ember-template-lint . --fix",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"start": "ember serve",
"test": "npm-run-all lint test:*",
"test:ember": "ember test"
},
"devDependencies": {
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.6.0",
"@glimmer/component": "^1.0.4",
"@glimmer/tracking": "^1.0.4",
"@iconify-icons/mdi-light": "^1.1.1",
"@iconify/ember": "^1.1.0",
"babel-eslint": "^10.1.0",
"broccoli-asset-rev": "^3.0.0",
"ember-auto-import": "^2.2.4",
"ember-cli": "~4.1.0",
"ember-cli-app-version": "^5.0.0",
"ember-cli-babel": "^7.26.11",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^6.0.1",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-cli-sri": "^2.1.1",
"ember-cli-terser": "^4.0.2",
"ember-data": "~4.1.0",
"ember-export-application-global": "^2.0.1",
"ember-fetch": "^8.1.1",
"ember-load-initializers": "^2.1.2",
"ember-page-title": "^7.0.0",
"ember-qunit": "^5.1.5",
"ember-resolver": "^8.0.3",
"ember-source": "~4.1.0",
"ember-template-lint": "^3.15.0",
"ember-welcome-page": "^6.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-ember": "^10.5.8",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-qunit": "^7.2.0",
"loader.js": "^4.7.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"qunit": "^2.17.2",
"qunit-dom": "^2.0.0",
"webpack": "^5.65.0"
},
"engines": {
"node": "12.* || 14.* || >= 16"
},
"ember": {
"edition": "octane"
}
}

View File

@ -8,7 +8,7 @@
"name": "@iconify-demo/nextjs",
"version": "0.1.0",
"dependencies": {
"@iconify/react": "^3.1.3",
"@iconify/react": "^3.2.0",
"next": "^12.0.8",
"react": "^17.0.2",
"react-dom": "^17.0.2"

View File

@ -8,7 +8,7 @@
"start": "next start"
},
"dependencies": {
"@iconify/react": "^3.1.3",
"@iconify/react": "^3.2.0",
"next": "^12.0.8",
"react": "^17.0.2",
"react-dom": "^17.0.2"

View File

@ -6,7 +6,7 @@
"": {
"name": "@iconify-demo/nuxt3",
"dependencies": {
"@iconify/vue": "^3.1.3"
"@iconify/vue": "^3.2.0"
},
"devDependencies": {
"nuxt3": "latest"

View File

@ -10,6 +10,6 @@
"nuxt3": "latest"
},
"dependencies": {
"@iconify/vue": "^3.1.3"
"@iconify/vue": "^3.2.0"
}
}

View File

@ -14,8 +14,8 @@
"devDependencies": {
"@iconify-icons/mdi-light": "^1.1.1",
"@iconify-icons/uil": "^1.1.2",
"@iconify/core": "^1.2.3",
"@iconify/react": "^3.1.3",
"@iconify/core": "^1.3.1",
"@iconify/react": "^3.2.0",
"@types/react": "^17.0.33",
"@types/react-dom": "^17.0.10",
"@vitejs/plugin-react": "^1.0.7",

View File

@ -14,8 +14,8 @@
"devDependencies": {
"@iconify-icons/mdi-light": "^1.1.1",
"@iconify-icons/uil": "^1.1.2",
"@iconify/core": "^1.2.3",
"@iconify/react": "^3.1.3",
"@iconify/core": "^1.3.1",
"@iconify/react": "^3.2.0",
"@types/react": "^17.0.33",
"@types/react-dom": "^17.0.10",
"@vitejs/plugin-react": "^1.0.7",

View File

@ -19,7 +19,7 @@
"@babel/preset-env": "^7.16.11",
"@babel/runtime": "^7.16.7",
"@iconify-icons/openmoji": "^1.1.20",
"@iconify/svelte": "^2.1.2",
"@iconify/svelte": "^2.2.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.1.3",

View File

@ -24,7 +24,7 @@
"@babel/preset-env": "^7.16.11",
"@babel/runtime": "^7.16.7",
"@iconify-icons/openmoji": "^1.1.20",
"@iconify/svelte": "^2.1.2",
"@iconify/svelte": "^2.2.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.1.3",

View File

@ -9,7 +9,7 @@
"version": "0.0.0",
"devDependencies": {
"@iconify-icons/mdi-light": "^1.1.1",
"@iconify/svelte": "^2.1.2",
"@iconify/svelte": "^2.2.0",
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.35",
"@tsconfig/svelte": "^3.0.0",
"svelte": "^3.46.2",

View File

@ -11,7 +11,7 @@
},
"devDependencies": {
"@iconify-icons/mdi-light": "^1.1.1",
"@iconify/svelte": "^2.1.2",
"@iconify/svelte": "^2.2.0",
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.35",
"@tsconfig/svelte": "^3.0.0",
"svelte": "^3.46.2",

View File

@ -13,7 +13,7 @@
"devDependencies": {
"@iconify-icons/mdi-light": "^1.1.1",
"@iconify-icons/uil": "^1.1.2",
"@iconify/svelte": "^2.1.2",
"@iconify/svelte": "^2.2.0",
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"rollup": "^2.33.3",

View File

@ -10,7 +10,7 @@
"devDependencies": {
"@iconify-icons/mdi-light": "^1.1.1",
"@iconify-icons/uil": "^1.1.2",
"@iconify/svelte": "^2.1.2",
"@iconify/svelte": "^2.2.0",
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"rollup": "^2.33.3",

View File

@ -14,7 +14,7 @@
},
"devDependencies": {
"@iconify-icons/mdi-light": "^1.1.1",
"@iconify/svelte": "^2.1.2",
"@iconify/svelte": "^2.2.0",
"@sveltejs/kit": "next",
"@types/cookie": "^0.4.1",
"svelte": "^3.46.2",

View File

@ -11,7 +11,7 @@
},
"devDependencies": {
"@iconify-icons/mdi-light": "^1.1.1",
"@iconify/svelte": "^2.1.2",
"@iconify/svelte": "^2.2.0",
"@sveltejs/kit": "next",
"@types/cookie": "^0.4.1",
"svelte": "^3.46.2",

View File

@ -13,8 +13,8 @@
"devDependencies": {
"@iconify-icons/bx": "^1.1.5",
"@iconify-icons/dashicons": "^1.1.1",
"@iconify/types": "^1.0.12",
"@iconify/vue": "^3.1.3",
"@iconify/types": "^1.1.0",
"@iconify/vue": "^3.2.0",
"@vitejs/plugin-vue": "^2.1.0",
"typescript": "^4.6.3",
"vite": "^2.7.13"

View File

@ -12,8 +12,8 @@
"devDependencies": {
"@iconify-icons/bx": "^1.1.5",
"@iconify-icons/dashicons": "^1.1.1",
"@iconify/types": "^1.0.12",
"@iconify/vue": "^3.1.3",
"@iconify/types": "^1.1.0",
"@iconify/vue": "^3.2.0",
"@vitejs/plugin-vue": "^2.1.0",
"typescript": "^4.6.3",
"vite": "^2.7.13"

View File

@ -14,7 +14,7 @@ export function cleanWorkspace(workspace: PackageInfo) {
if (!stat.isDirectory()) {
return;
}
} catch (err) {
} catch {
return;
}

View File

@ -0,0 +1,89 @@
import fs from 'fs';
import { addLinksToWorkspace } from './add-links';
import { addToPath, pathToString, relativePath } from './dirs';
import { runNPMCommand } from './exec';
import { consoleLog } from './log';
import { PackageInfo } from './types';
import { findWorkspaces } from './workspaces';
const props: string[] = [
'dependencies',
'devDependencies',
'optionalDependencies',
];
/**
* Change versions of local package
*/
export function updateVersions(workspace: PackageInfo) {
// Find all workspaces
const workspaces = findWorkspaces();
// Get package.json
const packageFilename = pathToString(
addToPath(workspace.path, 'package.json')
);
let data: Record<string, unknown>;
try {
data = JSON.parse(fs.readFileSync(packageFilename, 'utf8'));
} catch {
return;
}
const updated: Set<string> = new Set();
props.forEach((prop) => {
const dependencies = data[prop];
if (typeof dependencies !== 'object') {
return;
}
// Find local packages
workspaces.forEach((item) => {
if (
item.name === workspace.name ||
item.private ||
typeof dependencies[item.name] !== 'string'
) {
return;
}
const newVersion = item.version;
const oldValue = dependencies[item.name] as string;
// ^*
if (oldValue.slice(0, 1) === '^') {
const oldVersion = oldValue.slice(1);
if (oldVersion !== newVersion) {
// Change version
dependencies[item.name] = '^' + newVersion;
updated.add(item.name);
}
return;
}
// exact version
if (oldValue.match(/^[0-9]/) && oldValue !== newVersion) {
dependencies[item.name] = newVersion;
updated.add(item.name);
}
});
});
if (!updated.size) {
return;
}
// Update package.json
const newContent = JSON.stringify(data, null, '\t') + '\n';
fs.writeFileSync(packageFilename, newContent, 'utf8');
consoleLog(
`Updated dependencies in ${relativePath(packageFilename)}: ${Array.from(
updated
).join(', ')}`
);
// Reinstall dependencies to update package-lock.json
runNPMCommand(workspace, ['install']);
addLinksToWorkspace(workspace);
}

View File

@ -4,6 +4,7 @@ import { cleanWorkspace } from './helpers/clean';
import { runNPMCommand } from './helpers/exec';
import { actionOptions, enablePrivateFilter } from './helpers/options';
import { removeLinksFromWorkspace } from './helpers/remove-links';
import { updateVersions } from './helpers/versions';
/**
* All actions
@ -24,6 +25,9 @@ const actionFunctions: Record<string, () => void> = {
addLinksToWorkspace(workspace);
});
},
versions: () => {
runAction('Updating versions of local packages', updateVersions);
},
};
/**

View File

@ -18,7 +18,8 @@
"unlink": "node monorepo unlink",
"reinstall": "node monorepo clean install",
"build": "node monorepo run build --if-present --public",
"test": "node monorepo run build --if-present --public"
"test": "node monorepo run build --if-present --public",
"versions": "node monorepo versions"
},
"devDependencies": {}
}

View File

@ -11,7 +11,7 @@
"dependencies": {
"@iconify/api-redundancy": "^1.1.0",
"@iconify/types": "^1.1.0",
"@iconify/utils": "^1.0.29"
"@iconify/utils": "^1.0.31"
},
"devDependencies": {
"@types/jest": "^27.4.1",
@ -796,9 +796,9 @@
"integrity": "sha512-Jh0llaK2LRXQoYsorIH8maClebsnzTcve+7U3rQUSnC11X4jtPnFuyatqFLvMxZ8MLG8dB4zfHsbPfuvxluONw=="
},
"node_modules/@iconify/utils": {
"version": "1.0.29",
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.29.tgz",
"integrity": "sha512-ReARQUYRAzuj0fvzUhHZlw38bMYq8u+oKsecMalk2Lp98b54uHtOcpEKTAdXwTwYV7MMxEGCa4pRmYofZtXdOw==",
"version": "1.0.31",
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.31.tgz",
"integrity": "sha512-sBksCt6kI4WaMHwXo1c/MQVuQfWwwd87qHiAPASN8neoQvMCdYTLn+2khc3/OmYPbmg6kYisCxVLkAv0pcy9Ig==",
"dependencies": {
"@antfu/install-pkg": "^0.1.0",
"@antfu/utils": "^0.5.0",
@ -7671,9 +7671,9 @@
"integrity": "sha512-Jh0llaK2LRXQoYsorIH8maClebsnzTcve+7U3rQUSnC11X4jtPnFuyatqFLvMxZ8MLG8dB4zfHsbPfuvxluONw=="
},
"@iconify/utils": {
"version": "1.0.29",
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.29.tgz",
"integrity": "sha512-ReARQUYRAzuj0fvzUhHZlw38bMYq8u+oKsecMalk2Lp98b54uHtOcpEKTAdXwTwYV7MMxEGCa4pRmYofZtXdOw==",
"version": "1.0.31",
"resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-1.0.31.tgz",
"integrity": "sha512-sBksCt6kI4WaMHwXo1c/MQVuQfWwwd87qHiAPASN8neoQvMCdYTLn+2khc3/OmYPbmg6kYisCxVLkAv0pcy9Ig==",
"requires": {
"@antfu/install-pkg": "^0.1.0",
"@antfu/utils": "^0.5.0",

View File

@ -109,7 +109,7 @@
"dependencies": {
"@iconify/api-redundancy": "^1.1.0",
"@iconify/types": "^1.1.0",
"@iconify/utils": "^1.0.29"
"@iconify/utils": "^1.0.31"
},
"devDependencies": {
"@types/jest": "^27.4.1",