@koobiq/components 18.6.0 → 18.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/core/version.mjs +2 -2
- package/fesm2022/koobiq-components-core.mjs +1 -1
- package/fesm2022/koobiq-components-core.mjs.map +1 -1
- package/package.json +4 -4
- package/schematics/collection.json +7 -2
- package/schematics/migrations/css-selectors/index.js +3 -3
- package/schematics/migrations/deprecated-icons/data.js +1580 -0
- package/schematics/migrations/deprecated-icons/index.js +96 -0
- package/schematics/{new-icons-pack → migrations/new-icons-pack}/index.js +13 -29
- package/schematics/migrations/new-icons-pack/schema.json +25 -0
- package/schematics/ng-add/index.js +3 -3
- package/schematics/utils/package-config.js +6 -60
- /package/schematics/{new-icons-pack → migrations/deprecated-icons}/schema.json +0 -0
- /package/schematics/{new-icons-pack → migrations/new-icons-pack}/data.js +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var path = require('path');
|
|
6
|
+
var utils_packageConfig = require('../../package-config-D0ROjo4J.js');
|
|
7
|
+
var migrations_deprecatedIcons_data = require('./data.js');
|
|
8
|
+
require('@angular-devkit/schematics');
|
|
9
|
+
require('@schematics/angular/utility');
|
|
10
|
+
|
|
11
|
+
function _interopNamespaceDefault(e) {
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
29
|
+
|
|
30
|
+
const iconsFontImportRule = "@use '@koobiq/icons/fonts/kbq-icons';";
|
|
31
|
+
function deprecatedIcons(options) {
|
|
32
|
+
let targetDir;
|
|
33
|
+
return async (tree, context) => {
|
|
34
|
+
const { project, fix, stylesExt } = options;
|
|
35
|
+
try {
|
|
36
|
+
const projectDefinition = await utils_packageConfig.setupOptions(project, tree);
|
|
37
|
+
targetDir = projectDefinition ? tree.getDir(projectDefinition.root) : tree;
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
targetDir = tree;
|
|
41
|
+
}
|
|
42
|
+
const { logger } = context;
|
|
43
|
+
const handleDeprecatedIcons = (newContent, filePath) => {
|
|
44
|
+
if (fix) {
|
|
45
|
+
migrations_deprecatedIcons_data.iconsMapping.forEach(({ replace, replaceWith }) => {
|
|
46
|
+
newContent = newContent.replace(new RegExp(`kbq-${replace}`, 'g'), `kbq-${replaceWith}`);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const foundIcons = migrations_deprecatedIcons_data.iconsMapping.filter(({ replace }) => newContent.indexOf(replace) !== -1);
|
|
51
|
+
if (foundIcons.length) {
|
|
52
|
+
const parsedFilePath = path__namespace.relative(__dirname, `.${filePath}`).replace(/\\/g, '/');
|
|
53
|
+
utils_packageConfig.logMessage(logger, [
|
|
54
|
+
`Please pay attention! Found deprecated icons in file: `,
|
|
55
|
+
parsedFilePath,
|
|
56
|
+
foundIcons.map(({ replace, replaceWith }) => `\t${replace} -> \t${replaceWith}`).join('\n')
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return newContent;
|
|
61
|
+
};
|
|
62
|
+
// Update styles, templates & components
|
|
63
|
+
targetDir.visit((filePath, entry) => {
|
|
64
|
+
let initialContent;
|
|
65
|
+
// if project property not provided, skip files in node_modules & dist
|
|
66
|
+
if (filePath.includes('node_modules') || filePath.includes('dist')) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (filePath.endsWith('.html') || filePath.endsWith('.ts') || filePath.endsWith(stylesExt)) {
|
|
70
|
+
initialContent = entry?.content.toString();
|
|
71
|
+
let newContent = initialContent;
|
|
72
|
+
if (newContent) {
|
|
73
|
+
migrations_deprecatedIcons_data.iconClassReplacements.forEach(({ replace, replaceWith }) => {
|
|
74
|
+
newContent = newContent.replace(new RegExp(replace, 'g'), replaceWith);
|
|
75
|
+
});
|
|
76
|
+
newContent = handleDeprecatedIcons(newContent, filePath);
|
|
77
|
+
if (initialContent !== newContent) {
|
|
78
|
+
tree.overwrite(filePath, newContent || '');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
// check if icon styles from new scope should be included in styles file
|
|
84
|
+
targetDir.visit((filePath, entry) => {
|
|
85
|
+
if (filePath.endsWith(stylesExt) && !entry?.content.toString()?.includes(iconsFontImportRule)) {
|
|
86
|
+
const parsedFilePath = path__namespace.relative(__dirname, `.${filePath}`).replace(/\\/g, '/');
|
|
87
|
+
utils_packageConfig.logMessage(logger, [
|
|
88
|
+
parsedFilePath,
|
|
89
|
+
`Provide \`${iconsFontImportRule}\` to support icon styles from new scope`
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
exports.default = deprecatedIcons;
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var chalk = require('chalk');
|
|
6
5
|
var path = require('path');
|
|
7
|
-
var utils_packageConfig = require('
|
|
8
|
-
var
|
|
6
|
+
var utils_packageConfig = require('../../package-config-D0ROjo4J.js');
|
|
7
|
+
var migrations_newIconsPack_data = require('./data.js');
|
|
9
8
|
require('@angular-devkit/schematics');
|
|
10
9
|
require('@schematics/angular/utility');
|
|
11
10
|
|
|
@@ -28,12 +27,9 @@ function _interopNamespaceDefault(e) {
|
|
|
28
27
|
|
|
29
28
|
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
30
29
|
|
|
31
|
-
const
|
|
32
|
-
const data = newIconsPack_data.newIconsPackData;
|
|
30
|
+
const data = migrations_newIconsPack_data.newIconsPackData;
|
|
33
31
|
function newIconsPack(options) {
|
|
34
32
|
let targetDir;
|
|
35
|
-
const breakingIconsVersionRegExp = /^\^|\~?9\.1\.0/;
|
|
36
|
-
const pkg = '@koobiq/icons';
|
|
37
33
|
return async (tree, context) => {
|
|
38
34
|
const { project, fix, stylesExt } = options;
|
|
39
35
|
try {
|
|
@@ -44,7 +40,7 @@ function newIconsPack(options) {
|
|
|
44
40
|
targetDir = tree;
|
|
45
41
|
}
|
|
46
42
|
const { logger } = context;
|
|
47
|
-
const handleDeprecatedIcons = (newContent,
|
|
43
|
+
const handleDeprecatedIcons = (newContent, filePath) => {
|
|
48
44
|
if (fix) {
|
|
49
45
|
data.forEach(({ replace, replaceWith }) => {
|
|
50
46
|
newContent = newContent.replace(new RegExp(`kbq-${replace}`, 'g'), `kbq-${replaceWith}`);
|
|
@@ -53,32 +49,27 @@ function newIconsPack(options) {
|
|
|
53
49
|
else {
|
|
54
50
|
const foundIcons = data.filter(({ replace }) => newContent.indexOf(replace) !== -1);
|
|
55
51
|
if (foundIcons.length) {
|
|
56
|
-
|
|
52
|
+
const parsedFilePath = path__namespace.relative(__dirname, `.${filePath}`).replace(/\\/g, '/');
|
|
53
|
+
utils_packageConfig.logMessage(logger, [
|
|
54
|
+
`Please pay attention! Found deprecated icons in file: `,
|
|
55
|
+
parsedFilePath,
|
|
56
|
+
foundIcons.map(({ replace, replaceWith }) => `\t${replace} -> \t${replaceWith}`).join('\n')
|
|
57
|
+
]);
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
return newContent;
|
|
60
61
|
};
|
|
61
|
-
// Check if breaking version is used indeed
|
|
62
|
-
if (tree.exists('package.json')) {
|
|
63
|
-
const sourceText = tree.read('package.json').toString('utf-8');
|
|
64
|
-
const json = JSON.parse(sourceText);
|
|
65
|
-
const isIconsBreakingVersionUsed = ['devDependencies', 'dependencies', 'peerDependencies'].some((type) => json[type] && json[type][pkg] && breakingIconsVersionRegExp.test(json[type][pkg]));
|
|
66
|
-
if (!isIconsBreakingVersionUsed) {
|
|
67
|
-
logger.warn('Breaking version of icons is not used. Everything is OK.');
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
62
|
// Update templates & components
|
|
72
63
|
targetDir.visit((path, entry) => {
|
|
73
|
-
// if project property not provided,
|
|
74
|
-
if (path.includes('node_modules')) {
|
|
64
|
+
// if project property not provided, skip files in node_modules & dist
|
|
65
|
+
if (path.includes('node_modules') || path.includes('dist')) {
|
|
75
66
|
return;
|
|
76
67
|
}
|
|
77
68
|
if (path.endsWith('.html') || path.endsWith('.ts') || path.endsWith('.md')) {
|
|
78
69
|
const initialContent = entry?.content.toString();
|
|
79
70
|
let newContent = initialContent;
|
|
80
71
|
if (newContent) {
|
|
81
|
-
|
|
72
|
+
migrations_newIconsPack_data.iconReplacements.forEach(({ replace, replaceWith }) => {
|
|
82
73
|
newContent = newContent.replace(new RegExp(replace, 'g'), replaceWith);
|
|
83
74
|
});
|
|
84
75
|
newContent = handleDeprecatedIcons(newContent, path);
|
|
@@ -109,12 +100,5 @@ function newIconsPack(options) {
|
|
|
109
100
|
});
|
|
110
101
|
};
|
|
111
102
|
}
|
|
112
|
-
function showWarning(filePath, foundIcons, logger) {
|
|
113
|
-
logger.warn('-------------------------');
|
|
114
|
-
logger.warn(`Please pay attention! Found deprecated icons in file: `);
|
|
115
|
-
logger.info(`${bold(italic(blue(path__namespace.resolve(`.${filePath}`))))}`);
|
|
116
|
-
logger.warn(foundIcons.map(({ replace, replaceWith }) => `\t${replace} -> \t${replaceWith}`).join('\n'));
|
|
117
|
-
logger.warn('-------------------------');
|
|
118
|
-
}
|
|
119
103
|
|
|
120
104
|
exports.default = newIconsPack;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "koobiq-components-new-icons-pack",
|
|
4
|
+
"title": "koobiq-components new-icons-pack schematic",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Name of the project",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "projectName"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"fix": {
|
|
15
|
+
"type": "boolean",
|
|
16
|
+
"description": "Whether overwrite icons prefixes or simply inform in console",
|
|
17
|
+
"default": false
|
|
18
|
+
},
|
|
19
|
+
"stylesExt": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Use this option to specify styles extension preferred in your project",
|
|
22
|
+
"default": "scss"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var schematics = require('@angular-devkit/schematics');
|
|
6
6
|
var utility = require('@schematics/angular/utility');
|
|
7
|
-
var utils_packageConfig = require('../
|
|
7
|
+
var utils_packageConfig = require('../package-config-D0ROjo4J.js');
|
|
8
8
|
|
|
9
9
|
function noProject(project) {
|
|
10
10
|
return `Unable to find project '${project}' in the workspace`;
|
|
@@ -41,8 +41,8 @@ function ngAdd(options) {
|
|
|
41
41
|
}
|
|
42
42
|
// Installing dependencies
|
|
43
43
|
utils_packageConfig.addPackageToPackageJson(tree, '@angular/cdk', "^18.2.6");
|
|
44
|
-
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/cdk', "^18.
|
|
45
|
-
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/angular-luxon-adapter', "^18.
|
|
44
|
+
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/cdk', "^18.7.0");
|
|
45
|
+
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/angular-luxon-adapter', "^18.7.0");
|
|
46
46
|
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/date-formatter', "^3.1.3");
|
|
47
47
|
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/date-adapter', "^3.1.3");
|
|
48
48
|
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/icons', "^9.1.0");
|
|
@@ -1,65 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
require('@angular-devkit/schematics');
|
|
4
|
+
require('@schematics/angular/utility');
|
|
5
|
+
var utils_packageConfig = require('../package-config-D0ROjo4J.js');
|
|
5
6
|
|
|
6
|
-
function noProject(project) {
|
|
7
|
-
return `Unable to find project '${project}' in the workspace`;
|
|
8
|
-
}
|
|
9
7
|
|
|
10
|
-
/**
|
|
11
|
-
* Sorts the keys of the given object.
|
|
12
|
-
* @returns A new object instance with sorted keys
|
|
13
|
-
*/
|
|
14
|
-
function sortObjectByKeys(obj) {
|
|
15
|
-
return Object.keys(obj)
|
|
16
|
-
.sort()
|
|
17
|
-
.reduce((result, key) => (result[key] = obj[key]) && result, {});
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Adds a package to the package.json in the given tree
|
|
21
|
-
*/
|
|
22
|
-
function addPackageToPackageJson(tree, pkg, version, devDependency = false) {
|
|
23
|
-
if (tree.exists('package.json')) {
|
|
24
|
-
const sourceText = tree.read('package.json').toString('utf-8');
|
|
25
|
-
const json = JSON.parse(sourceText);
|
|
26
|
-
const dependenciesType = devDependency ? 'devDependencies' : 'dependencies';
|
|
27
|
-
const dependencies = json[dependenciesType] || {};
|
|
28
|
-
if (!dependencies[pkg]) {
|
|
29
|
-
dependencies[pkg] = version;
|
|
30
|
-
json[dependenciesType] = sortObjectByKeys(dependencies);
|
|
31
|
-
}
|
|
32
|
-
tree.overwrite('package.json', JSON.stringify(json, null, 2));
|
|
33
|
-
}
|
|
34
|
-
return tree;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Gets the version of the specified package by looking at the package.json in the given tree
|
|
38
|
-
*/
|
|
39
|
-
function getPackageVersionFromPackageJson(tree, name, includeDevDependencies = false) {
|
|
40
|
-
if (!tree.exists('package.json')) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
const packageJson = JSON.parse(tree.read('package.json').toString('utf8'));
|
|
44
|
-
if (packageJson.dependencies && packageJson.dependencies[name]) {
|
|
45
|
-
return packageJson.dependencies[name];
|
|
46
|
-
}
|
|
47
|
-
if (includeDevDependencies && packageJson.devDependencies && packageJson.devDependencies[name]) {
|
|
48
|
-
return packageJson.devDependencies[name];
|
|
49
|
-
}
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
async function setupOptions(project, tree) {
|
|
53
|
-
if (project) {
|
|
54
|
-
const workspace = await utility.readWorkspace(tree);
|
|
55
|
-
const projectWorkspace = workspace.projects.get(project);
|
|
56
|
-
if (!projectWorkspace) {
|
|
57
|
-
throw new schematics.SchematicsException(noProject(project));
|
|
58
|
-
}
|
|
59
|
-
return projectWorkspace;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
8
|
|
|
63
|
-
exports.addPackageToPackageJson = addPackageToPackageJson;
|
|
64
|
-
exports.getPackageVersionFromPackageJson = getPackageVersionFromPackageJson;
|
|
65
|
-
exports.setupOptions = setupOptions;
|
|
9
|
+
exports.addPackageToPackageJson = utils_packageConfig.addPackageToPackageJson;
|
|
10
|
+
exports.getPackageVersionFromPackageJson = utils_packageConfig.getPackageVersionFromPackageJson;
|
|
11
|
+
exports.setupOptions = utils_packageConfig.setupOptions;
|
|
File without changes
|
|
File without changes
|