mirror of
https://github.com/iconoir-icons/iconoir
synced 2024-05-10 10:26:39 +02:00
chore: update all conflict-free dependencies (#354)
This commit is contained in:
parent
523a25b664
commit
d5a40498ee
145
bin/build.js
145
bin/build.js
|
@ -1,11 +1,11 @@
|
|||
import execa from 'execa';
|
||||
import { promises as fs, readFileSync, existsSync } from 'fs';
|
||||
import { execa } from 'execa';
|
||||
import { generateTemplateFilesBatch } from 'generate-template-files';
|
||||
import { Listr } from 'listr2';
|
||||
import os from 'os';
|
||||
import path, { basename, dirname } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { incompatibleNames, flutterIncompatibleNames } from '../constants.js';
|
||||
import { existsSync, promises as fs, readFileSync } from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path, { basename, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { flutterIncompatibleNames, incompatibleNames } from '../constants.js';
|
||||
import { buildVueIcons } from './buildVue.js';
|
||||
|
||||
// Paths
|
||||
|
@ -53,7 +53,9 @@ const tasks = new Listr(
|
|||
title: 'Fetching icons',
|
||||
task: async (ctx) => {
|
||||
const iconFiles = await fs.readdir(iconoirIconsDir);
|
||||
ctx.iconoirIconsFiles = iconFiles.filter(file => file.endsWith('.svg'));
|
||||
ctx.iconoirIconsFiles = iconFiles.filter((file) =>
|
||||
file.endsWith('.svg'),
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -69,7 +71,7 @@ const tasks = new Listr(
|
|||
task: async (ctx) => {
|
||||
await fs.writeFile(
|
||||
path.join(rootDir, targets['meta-data'].path),
|
||||
JSON.stringify({ icons: ctx.iconoirIconsFiles })
|
||||
JSON.stringify({ icons: ctx.iconoirIconsFiles }),
|
||||
);
|
||||
},
|
||||
},
|
||||
|
@ -82,13 +84,13 @@ const tasks = new Listr(
|
|||
(
|
||||
await fs.readFile(
|
||||
path.join(__dirname, 'header.css'),
|
||||
'utf8'
|
||||
'utf8',
|
||||
)
|
||||
).replace('[YEAR]', new Date().getFullYear()),
|
||||
];
|
||||
ctx.iconoirIconsFiles.forEach((file) => {
|
||||
const fileContents = readFileSync(
|
||||
path.join(__dirname, '../icons/', file)
|
||||
path.join(__dirname, '../icons/', file),
|
||||
)
|
||||
.toString()
|
||||
.replace(/\n/g, '')
|
||||
|
@ -97,12 +99,12 @@ const tasks = new Listr(
|
|||
content.push(
|
||||
`.iconoir-${
|
||||
path.parse(file).name
|
||||
}::before{mask-image:url('data:image/svg+xml;charset=utf-8,${fileContents}');-webkit-mask-image:url('data:image/svg+xml;charset=utf-8,${fileContents}');}`
|
||||
}::before{mask-image:url('data:image/svg+xml;charset=utf-8,${fileContents}');-webkit-mask-image:url('data:image/svg+xml;charset=utf-8,${fileContents}');}`,
|
||||
);
|
||||
});
|
||||
await fs.writeFile(
|
||||
path.join(rootDir, targets.css.path),
|
||||
content
|
||||
content,
|
||||
);
|
||||
},
|
||||
},
|
||||
|
@ -120,7 +122,7 @@ const tasks = new Listr(
|
|||
task: async (ctx) => {
|
||||
try {
|
||||
ctx.tmpDir = await fs.mkdtemp(
|
||||
path.join(os.tmpdir(), 'iconoir-')
|
||||
path.join(os.tmpdir(), 'iconoir-'),
|
||||
);
|
||||
} catch (err) {
|
||||
ctx.skip = true;
|
||||
|
@ -137,7 +139,7 @@ const tasks = new Listr(
|
|||
const promises = ctx.iconoirIconsFiles.map((file) => {
|
||||
const srcFilePath = path.join(
|
||||
iconoirIconsDir,
|
||||
file
|
||||
file,
|
||||
);
|
||||
const iconName = file.split('.')[0];
|
||||
const dstFileName =
|
||||
|
@ -146,7 +148,7 @@ const tasks = new Listr(
|
|||
: iconName;
|
||||
const dstFilePath = path.join(
|
||||
ctx.tmpDir,
|
||||
`${dstFileName}.svg`
|
||||
`${dstFileName}.svg`,
|
||||
);
|
||||
|
||||
return fs.copyFile(srcFilePath, dstFilePath);
|
||||
|
@ -167,16 +169,16 @@ const tasks = new Listr(
|
|||
const targetsToBuild =
|
||||
cliTargets.length > 0
|
||||
? cliTargets.filter(
|
||||
(cliTarget) => targets[cliTarget]?.react
|
||||
(cliTarget) => targets[cliTarget]?.react,
|
||||
)
|
||||
: Object.keys(targets).filter(
|
||||
(target) => targets[target].react
|
||||
(target) => targets[target].react,
|
||||
);
|
||||
const tasks = targetsToBuild.map((target) => {
|
||||
const builtIconsDir = path.join(
|
||||
rootDir,
|
||||
targets[target].path,
|
||||
'src'
|
||||
'src',
|
||||
);
|
||||
return {
|
||||
title: `Building ${target}`,
|
||||
|
@ -187,18 +189,17 @@ const tasks = new Listr(
|
|||
title: 'Cleaning target directory',
|
||||
task: async (ctx) => {
|
||||
try {
|
||||
const files = await fs.readdir(
|
||||
builtIconsDir
|
||||
);
|
||||
const files =
|
||||
await fs.readdir(builtIconsDir);
|
||||
const serverFiles = existsSync(
|
||||
path.join(builtIconsDir, 'server')
|
||||
path.join(builtIconsDir, 'server'),
|
||||
)
|
||||
? (
|
||||
await fs.readdir(
|
||||
path.join(
|
||||
builtIconsDir,
|
||||
'server'
|
||||
)
|
||||
'server',
|
||||
),
|
||||
)
|
||||
).map((file) => `server/${file}`)
|
||||
: [];
|
||||
|
@ -209,19 +210,19 @@ const tasks = new Listr(
|
|||
.filter(
|
||||
(file) =>
|
||||
!ignoreCleanFilenames.includes(
|
||||
path.basename(file)
|
||||
)
|
||||
path.basename(file),
|
||||
),
|
||||
)
|
||||
.map((file) => {
|
||||
return fs.unlink(
|
||||
path.join(builtIconsDir, file)
|
||||
path.join(builtIconsDir, file),
|
||||
);
|
||||
});
|
||||
return Promise.all(promises).catch(
|
||||
(err) => {
|
||||
ctx[target] = { skip: true };
|
||||
throw new Error(err.message);
|
||||
}
|
||||
},
|
||||
);
|
||||
} catch (err) {
|
||||
ctx[target] = { skip: true };
|
||||
|
@ -240,7 +241,7 @@ const tasks = new Listr(
|
|||
'--config-file',
|
||||
path.join(
|
||||
targets[target].path,
|
||||
'.svgrrc.json'
|
||||
'.svgrrc.json',
|
||||
),
|
||||
'--out-dir',
|
||||
builtIconsDir,
|
||||
|
@ -250,7 +251,7 @@ const tasks = new Listr(
|
|||
'bin/templates/index-template.cjs',
|
||||
ctx.tmpDir,
|
||||
],
|
||||
{ preferLocal: true }
|
||||
{ preferLocal: true },
|
||||
);
|
||||
} catch (err) {
|
||||
throw new Error(err.message);
|
||||
|
@ -271,12 +272,12 @@ const tasks = new Listr(
|
|||
'--config-file',
|
||||
path.join(
|
||||
targets[target].path,
|
||||
'.svgrrc.json'
|
||||
'.svgrrc.json',
|
||||
),
|
||||
'--out-dir',
|
||||
path.join(
|
||||
builtIconsDir,
|
||||
'server'
|
||||
'server',
|
||||
),
|
||||
'--template',
|
||||
'bin/templates/icon-template-server-component.cjs',
|
||||
|
@ -284,7 +285,7 @@ const tasks = new Listr(
|
|||
'bin/templates/index-template.cjs',
|
||||
ctx.tmpDir,
|
||||
],
|
||||
{ preferLocal: true }
|
||||
{ preferLocal: true },
|
||||
);
|
||||
} catch (err) {
|
||||
throw new Error(err.message);
|
||||
|
@ -294,7 +295,7 @@ const tasks = new Listr(
|
|||
]
|
||||
: []),
|
||||
],
|
||||
{ concurrent: false, exitOnError: false }
|
||||
{ concurrent: false, exitOnError: false },
|
||||
),
|
||||
};
|
||||
});
|
||||
|
@ -305,7 +306,7 @@ const tasks = new Listr(
|
|||
},
|
||||
},
|
||||
],
|
||||
{ concurrent: false }
|
||||
{ concurrent: false },
|
||||
),
|
||||
},
|
||||
{
|
||||
|
@ -322,7 +323,7 @@ const tasks = new Listr(
|
|||
task: async (ctx) => {
|
||||
try {
|
||||
ctx.tmpDir = await fs.mkdtemp(
|
||||
path.join(os.tmpdir(), 'iconoir-')
|
||||
path.join(os.tmpdir(), 'iconoir-'),
|
||||
);
|
||||
} catch (err) {
|
||||
ctx.skip = true;
|
||||
|
@ -339,7 +340,7 @@ const tasks = new Listr(
|
|||
const promises = ctx.iconoirIconsFiles.map((file) => {
|
||||
const srcFilePath = path.join(
|
||||
iconoirIconsDir,
|
||||
file
|
||||
file,
|
||||
);
|
||||
const iconName = file.split('.')[0];
|
||||
const dstFileName =
|
||||
|
@ -348,7 +349,7 @@ const tasks = new Listr(
|
|||
: iconName;
|
||||
const dstFilePath = path.join(
|
||||
ctx.tmpDir,
|
||||
`${dstFileName}.svg`
|
||||
`${dstFileName}.svg`,
|
||||
);
|
||||
|
||||
return fs.copyFile(srcFilePath, dstFilePath);
|
||||
|
@ -369,16 +370,16 @@ const tasks = new Listr(
|
|||
const targetsToBuild =
|
||||
cliTargets.length > 0
|
||||
? cliTargets.filter(
|
||||
(cliTarget) => targets[cliTarget]?.vue
|
||||
(cliTarget) => targets[cliTarget]?.vue,
|
||||
)
|
||||
: Object.keys(targets).filter(
|
||||
(target) => targets[target].vue
|
||||
(target) => targets[target].vue,
|
||||
);
|
||||
const tasks = targetsToBuild.map((target) => {
|
||||
const builtIconsDir = path.join(
|
||||
rootDir,
|
||||
targets[target].path,
|
||||
'src'
|
||||
'src',
|
||||
);
|
||||
return {
|
||||
title: `Building ${target}`,
|
||||
|
@ -389,26 +390,25 @@ const tasks = new Listr(
|
|||
title: 'Cleaning target directory',
|
||||
task: async (ctx) => {
|
||||
try {
|
||||
const files = await fs.readdir(
|
||||
builtIconsDir
|
||||
);
|
||||
const files =
|
||||
await fs.readdir(builtIconsDir);
|
||||
files
|
||||
.filter(
|
||||
(file) =>
|
||||
!ignoreCleanFilenames.includes(
|
||||
path.basename(file)
|
||||
)
|
||||
path.basename(file),
|
||||
),
|
||||
)
|
||||
.map((file) => {
|
||||
return fs.unlink(
|
||||
path.join(builtIconsDir, file)
|
||||
path.join(builtIconsDir, file),
|
||||
);
|
||||
});
|
||||
return Promise.all(files).catch(
|
||||
(err) => {
|
||||
ctx[target] = { skip: true };
|
||||
throw new Error(err.message);
|
||||
}
|
||||
},
|
||||
);
|
||||
} catch (err) {
|
||||
ctx[target] = { skip: true };
|
||||
|
@ -430,7 +430,7 @@ const tasks = new Listr(
|
|||
},
|
||||
},
|
||||
],
|
||||
{ concurrent: false, exitOnError: false }
|
||||
{ concurrent: false, exitOnError: false },
|
||||
),
|
||||
};
|
||||
});
|
||||
|
@ -441,7 +441,7 @@ const tasks = new Listr(
|
|||
},
|
||||
},
|
||||
],
|
||||
{ concurrent: false }
|
||||
{ concurrent: false },
|
||||
),
|
||||
},
|
||||
{
|
||||
|
@ -458,7 +458,7 @@ const tasks = new Listr(
|
|||
task: async (ctx) => {
|
||||
try {
|
||||
ctx.flutterTmpDir = await fs.mkdtemp(
|
||||
path.join(os.tmpdir(), 'iconoir-')
|
||||
path.join(os.tmpdir(), 'iconoir-'),
|
||||
);
|
||||
} catch (err) {
|
||||
ctx.skip = true;
|
||||
|
@ -475,7 +475,7 @@ const tasks = new Listr(
|
|||
const promises = ctx.iconoirIconsFiles.map((file) => {
|
||||
const srcFilePath = path.join(
|
||||
iconoirIconsDir,
|
||||
file
|
||||
file,
|
||||
);
|
||||
const iconName = file.split('.')[0];
|
||||
const dstFileName =
|
||||
|
@ -484,7 +484,7 @@ const tasks = new Listr(
|
|||
: iconName;
|
||||
const dstFilePath = path.join(
|
||||
ctx.flutterTmpDir,
|
||||
`${dstFileName}.svg`
|
||||
`${dstFileName}.svg`,
|
||||
);
|
||||
|
||||
ctx.dstFilePaths = [
|
||||
|
@ -510,16 +510,16 @@ const tasks = new Listr(
|
|||
const targetsToBuild =
|
||||
cliTargets.length > 0
|
||||
? cliTargets.filter(
|
||||
(cliTarget) => targets[cliTarget]?.flutter
|
||||
(cliTarget) => targets[cliTarget]?.flutter,
|
||||
)
|
||||
: Object.keys(targets).filter(
|
||||
(target) => targets[target].flutter
|
||||
(target) => targets[target].flutter,
|
||||
);
|
||||
const tasks = targetsToBuild.map((target) => {
|
||||
const builtIconsDir = path.join(
|
||||
rootDir,
|
||||
targets[target].path,
|
||||
'lib'
|
||||
'lib',
|
||||
);
|
||||
return {
|
||||
title: `Building ${target}`,
|
||||
|
@ -530,19 +530,18 @@ const tasks = new Listr(
|
|||
title: 'Cleaning target directory',
|
||||
task: async (ctx) => {
|
||||
try {
|
||||
const files = await fs.readdir(
|
||||
builtIconsDir
|
||||
);
|
||||
const files =
|
||||
await fs.readdir(builtIconsDir);
|
||||
const promises = files.map((file) => {
|
||||
return fs.unlink(
|
||||
path.join(builtIconsDir, file)
|
||||
path.join(builtIconsDir, file),
|
||||
);
|
||||
});
|
||||
return Promise.all(promises).catch(
|
||||
(err) => {
|
||||
ctx[target] = { skip: true };
|
||||
throw new Error(err.message);
|
||||
}
|
||||
},
|
||||
);
|
||||
} catch (err) {
|
||||
ctx[target] = { skip: true };
|
||||
|
@ -556,9 +555,9 @@ const tasks = new Listr(
|
|||
await fs.writeFile(
|
||||
path.join(
|
||||
builtIconsDir,
|
||||
'iconoir_flutter.dart'
|
||||
'iconoir_flutter.dart',
|
||||
),
|
||||
'library iconoir_flutter;\n\n'
|
||||
'library iconoir_flutter;\n\n',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
@ -612,28 +611,28 @@ const tasks = new Listr(
|
|||
},
|
||||
async onComplete(results) {
|
||||
finalFileNames.push(
|
||||
results.output.path
|
||||
results.output.path,
|
||||
);
|
||||
},
|
||||
},
|
||||
]);
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
finalFileNames.sort();
|
||||
await fs.appendFile(
|
||||
path.join(
|
||||
builtIconsDir,
|
||||
'iconoir_flutter.dart'
|
||||
'iconoir_flutter.dart',
|
||||
),
|
||||
finalFileNames
|
||||
.map(
|
||||
(fileName) =>
|
||||
`export './${basename(
|
||||
fileName
|
||||
)}';`
|
||||
fileName,
|
||||
)}';`,
|
||||
)
|
||||
.join('\n')
|
||||
.join('\n'),
|
||||
);
|
||||
} catch (err) {
|
||||
throw new Error(err.message);
|
||||
|
@ -641,7 +640,7 @@ const tasks = new Listr(
|
|||
},
|
||||
},
|
||||
],
|
||||
{ concurrent: false, exitOnError: false }
|
||||
{ concurrent: false, exitOnError: false },
|
||||
),
|
||||
};
|
||||
});
|
||||
|
@ -652,11 +651,11 @@ const tasks = new Listr(
|
|||
},
|
||||
},
|
||||
],
|
||||
{ concurrent: false }
|
||||
{ concurrent: false },
|
||||
),
|
||||
},
|
||||
],
|
||||
{ concurrent: true }
|
||||
{ concurrent: true },
|
||||
),
|
||||
},
|
||||
{
|
||||
|
@ -678,7 +677,7 @@ const tasks = new Listr(
|
|||
concurrent: false,
|
||||
exitOnError: false,
|
||||
rendererOptions: { collapse: false, collapseErrors: false },
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
await tasks.run();
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
import fs from 'fs/promises';
|
||||
import { toHtml } from 'hast-util-to-html';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { parse } from 'svg-parser';
|
||||
import componentTemplate from './templates/vue/icon-template.cjs';
|
||||
import indexTemplate from './templates/vue/index-template.cjs';
|
||||
import providerTemplate from './templates/vue/provider-template.cjs';
|
||||
import providerKeyTemplate from './templates/vue/provider-key-template.cjs';
|
||||
import { toHtml } from 'hast-util-to-html';
|
||||
import path from 'path';
|
||||
import providerTemplate from './templates/vue/provider-template.cjs';
|
||||
|
||||
export async function buildVueIcons(srcDir, { outDir = './out/' }) {
|
||||
const files = await fs.readdir(srcDir, 'utf8');
|
||||
|
||||
const providerKeyFileName = 'providerKey';
|
||||
const providerKey = providerKeyTemplate();
|
||||
await fs.writeFile(path.join(outDir, providerKeyFileName + '.ts'), providerKey, 'utf8');
|
||||
await fs.writeFile(
|
||||
path.join(outDir, providerKeyFileName + '.ts'),
|
||||
providerKey,
|
||||
'utf8'
|
||||
);
|
||||
|
||||
const fileNames = [];
|
||||
for (const file of files) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { updateYamlKey } from '@atomist/yaml-updater';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import semver from 'semver';
|
||||
|
||||
const PACKAGE_BASE = '';
|
||||
|
|
14
package.json
14
package.json
|
@ -36,15 +36,15 @@
|
|||
"@atomist/yaml-updater": "^1.0.2",
|
||||
"@svgr/cli": "^5.5.0",
|
||||
"@types/svg-parser": "^2.0.3",
|
||||
"eslint": "^8.0.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"execa": "^5.1.1",
|
||||
"eslint": "^8.50.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"execa": "^8.0.1",
|
||||
"generate-template-files": "^3.2.0",
|
||||
"hast-util-to-html": "^8.0.4",
|
||||
"hast-util-to-html": "^9.0.0",
|
||||
"listr2": "^3.12.2",
|
||||
"prettier": "^2.4.1",
|
||||
"semver": "^7.3.5",
|
||||
"prettier": "^3.0.3",
|
||||
"semver": "^7.5.4",
|
||||
"svg-parser": "^2.0.4"
|
||||
},
|
||||
"pnpm": {
|
||||
|
|
|
@ -34,11 +34,10 @@
|
|||
"react-native-svg": "^12.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@types/react": "^17.0.29",
|
||||
"@types/react-native": "^0.50.0",
|
||||
"react": "^17.0.2",
|
||||
"react-native-svg": "^12.1.1",
|
||||
"typescript": "^4.4.4"
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
|
@ -46,8 +46,8 @@
|
|||
"react": "^16.8.6 || ^17 || ^18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^17.0.29",
|
||||
"react": "^17.0.2",
|
||||
"typescript": "^4.4.4"
|
||||
"@types/react": "^18.2.22",
|
||||
"react": "^18.2.0",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
|
@ -42,7 +42,7 @@
|
|||
"sideEffects": false,
|
||||
"homepage": "https://iconoir.com",
|
||||
"dependencies": {
|
||||
"vue-demi": "latest"
|
||||
"vue-demi": "^0.14.6"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vue/composition-api": ">=1.0.0-rc.1",
|
||||
|
@ -54,11 +54,10 @@
|
|||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^4.2.1",
|
||||
"esbuild": "^0.17.18",
|
||||
"terser": "^5.17.1",
|
||||
"vite": "^4.3.3",
|
||||
"vite-plugin-dts": "^2.3.0",
|
||||
"vue": "^3.2.47"
|
||||
"@vitejs/plugin-vue": "^4.3.4",
|
||||
"terser": "^5.20.0",
|
||||
"vite": "^4.4.9",
|
||||
"vite-plugin-dts": "^3.5.4",
|
||||
"vue": "^3.3.4"
|
||||
}
|
||||
}
|
2530
pnpm-lock.yaml
2530
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue