Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(scripts): Cleaning up scripts #2092

Merged
merged 28 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a6a4b0e
cleanup scripts
ericfennis Dec 31, 2023
98228f0
Move helpers to package
ericfennis Apr 19, 2024
cfc1e10
Merge branch 'main' of https://github.com/lucide-icons/lucide into cl…
ericfennis Apr 19, 2024
0cec7a0
Fixes scripts
ericfennis Apr 19, 2024
53d56c5
Fix scripts
ericfennis Apr 19, 2024
aa333bf
Formatting
ericfennis Apr 19, 2024
d235651
Fix helpers import paths
ericfennis Apr 19, 2024
d65b7e5
Remove lucide-figma
ericfennis Apr 19, 2024
5489dff
Rename helpers package
ericfennis Apr 19, 2024
6968f6d
Fix build
ericfennis Apr 19, 2024
65b2549
formatting
ericfennis Apr 19, 2024
b10bb7d
Adjust main build-icons file
ericfennis Apr 19, 2024
86a3a65
Add export casing
ericfennis Apr 20, 2024
37e3acf
Adds `exportModuleNameCasing` fro lab project
ericfennis Apr 20, 2024
4273afa
Merge branch 'main' of https://github.com/lucide-icons/lucide into cl…
ericfennis Apr 26, 2024
daf07cf
Merge branch 'main' into cleanup
ericfennis May 3, 2024
3a93e5d
Merge branch 'main' of https://github.com/lucide-icons/lucide into cl…
ericfennis May 3, 2024
200fbd6
format files
ericfennis May 3, 2024
997f636
Bump package version @lucide/build-icons
ericfennis May 7, 2024
881221c
Merge branch 'main' of https://github.com/lucide-icons/lucide into cl…
ericfennis Jun 21, 2024
c4e576d
Revert changes in icons
ericfennis Jun 21, 2024
05762a4
Revert changes in PR yml
ericfennis Jun 21, 2024
1c6262b
Fix lint issues
ericfennis Jun 21, 2024
117b098
Fix site build
ericfennis Jun 21, 2024
15281b1
fix lint errors
ericfennis Jun 21, 2024
1c7b31a
Merge branch 'main' into cleanup
ericfennis Jun 28, 2024
b722fb8
Attempt fix linting
ericfennis Jun 28, 2024
a6a6ab7
Fix lint errors
ericfennis Jun 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const DEFAULT_ATTRS = require('./scripts/render/default-attrs.json');
const DEFAULT_ATTRS = require('@lucide/build-icons/render/default-attrs.json');

module.exports = {
root: true,
Expand All @@ -15,7 +15,9 @@ module.exports = {
'no-use-before-define': 'off',
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: ['**/*.test.js', '**/*.spec.js', './scripts/**'] },
{
devDependencies: ['**/*.test.js', '**/*.spec.js', '**/scripts/**'],
},
],
'import/extensions': [
'error',
Expand Down
11 changes: 0 additions & 11 deletions docs/.vitepress/data/packageData.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,5 @@
"href": "https://www.npmjs.com/package/lucide-static"
}
]
},
"lucide-flutter": {
"order": 9,
"icon": "flutter",
"shields": [
{
"alt": "flutter",
"src": "https://img.shields.io/pub/v/lucide_icons",
"href": "https://img.shields.io/pub/v/lucide_icons"
}
]
}
}
6 changes: 0 additions & 6 deletions docs/.vitepress/lib/fetchPackages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { promises as fs, constants } from 'fs';
import path from 'path';
import yaml from 'js-yaml';
import { PackageItem } from '../theme/types';

const fileExist = (filePath) =>
Expand All @@ -27,11 +26,6 @@ const fetchPackages = async (): Promise<PackageItem[]> => {
return JSON.parse(await fs.readFile(jsonFilePath, 'utf-8'));
}

const ymlFilePath = path.resolve(filePath, 'pubspec.yaml');
if (await fileExist(ymlFilePath)) {
return yaml.load(await fs.readFile(ymlFilePath, 'utf-8'));
}

return null;
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import fetchPackages from '../../../lib/fetchPackages';
export default {
async load() {
const packages = await fetchPackages();

return {
packages: packages
.filter((p) => p.name in packageData)
.filter((p) => p?.name != null && p.name in packageData)
.map((pData) => ({
...pData,
...packageData[pData.name],
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/theme/components/packages/PackageList.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script setup lang="ts">
import { data } from './PackageList.data'
import GridSection from '../base/GridSection.vue'
import PackageListItem from "./PackageListItem.vue";</script>
import PackageListItem from "./PackageListItem.vue";
</script>

<template>
<GridSection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const props = defineProps<{
<img v-if="packageData.iconDark" :src="packageData.iconDark" alt="" class="package-icon dark" :class="packageData.iconClass" />
</div>
<div class="package-title">
<h2 class="title">{{ props.packageData.name }}</h2>
<h2 class="title">{{ props.packageData?.name }}</h2>
<a v-for="shield in props.packageData.shields" :href="shield.href" class="package-shield" rel="noreferrer noopener">
<img :src="shield.src" :alt="shield.href" />
</a>
Expand Down
16 changes: 9 additions & 7 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"docs:build": "pnpm run /^prebuild:.*/ && vitepress build",
"docs:preview": "vitepress preview",
"build:docs": "vitepress build",
"prebuild:iconNodes": "node ../scripts/writeIconNodes.mjs",
"prebuild:metaJson": "node ../scripts/writeIconMetaIndex.mjs",
"prebuild:releaseJson": "node ../scripts/writeReleaseMetadata.mjs",
"prebuild:iconNodes": "node ./scripts/writeIconNodes.mjs",
"prebuild:metaJson": "node ./scripts/writeIconMetaIndex.mjs",
"prebuild:releaseJson": "node ./scripts/writeReleaseMetadata.mjs",
"prebuild:categoriesJson": "node ./scripts/writeCategoriesMetadata.mjs",
"prebuild:relatedIcons": "node ../scripts/writeIconRelatedIcons.mjs",
"prebuild:iconDetails": "node ../scripts/writeIconDetails.mjs",
"postbuild:vercelJson": "node ../scripts/writeVercelOutput.mjs",
"prebuild:relatedIcons": "node ./scripts/writeIconRelatedIcons.mjs",
"prebuild:iconDetails": "node ./scripts/writeIconDetails.mjs",
"postbuild:vercelJson": "node ./scripts/writeVercelOutput.mjs",
"dev": "npx nitropack dev",
"prebuild:api": "npx nitropack prepare",
"build:api": "npx nitropack build",
Expand All @@ -25,6 +25,9 @@
"author": "Eric Fennis",
"license": "ISC",
"devDependencies": {
"@lucide/build-icons": "workspace:*",
"@lucide/helpers": "workspace:*",
"@lucide/shared": "workspace:*",
"@rollup/plugin-replace": "^5.0.2",
"@types/semver": "^7.5.3",
"h3": "^1.8.0",
Expand All @@ -41,7 +44,6 @@
"@vueuse/core": "^10.7.2",
"element-to-path": "^1.2.1",
"fuse.js": "^6.5.3",
"js-yaml": "^4.1.0",
"jszip": "^3.7.0",
"lodash": "^4.17.20",
"lodash-es": "^4.17.21",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import fs from 'fs';
import path from 'path';
import renderIconsObject from './render/renderIconsObject.mjs';
import { readSvgDirectory, toCamelCase } from './helpers.mjs';
import { readSvgDirectory, toCamelCase } from '@lucide/helpers';

const currentDir = process.cwd();
const ICONS_DIR = path.resolve(currentDir, '../icons');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import { readSvgDirectory, toCamelCase } from './helpers.mjs';
import { readSvgDirectory, toCamelCase } from '@lucide/helpers';

const currentDir = process.cwd();
const ICONS_DIR = path.resolve(currentDir, '../icons');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
import renderIconsObject from './render/renderIconsObject.mjs';
import { readSvgDirectory, toCamelCase } from './helpers.mjs';
import { renderIconsObject } from '@lucide/build-icons';
import { readSvgDirectory, toCamelCase } from '@lucide/helpers';

const currentDir = process.cwd();
const ICONS_DIR = path.resolve(currentDir, '../icons');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import { readSvgDirectory } from './helpers.mjs';
import { readSvgDirectory } from '@lucide/helpers';

const currentDir = process.cwd();
const ICONS_DIR = path.resolve(currentDir, '../icons');
Expand All @@ -19,13 +19,6 @@ const categoryWeight = 3;
const MAX_RELATED_ICONS = 4 * 17; // grid of 4x17 icons, = 68 icons

const arrayMatches = (a, b) => {
// let matches = 0;
// for (let i = 0; i < a.length; ++i) {
// if (b.indexOf(a[i]) != -1) {
// matches++;
// }
// }
// return matches;
return a.filter((item) => b.includes(item)).length;
};

Expand Down Expand Up @@ -53,7 +46,6 @@ const getRelatedIcons = (currentIcon, icons) => {
};

const iconsMetaDataPromises = svgFiles.map(async (iconName) => {
// eslint-disable-next-line import/no-dynamic-require, global-require
const metaData = JSON.parse(fs.readFileSync(`../icons/${iconName}`));

const name = iconName.replace('.json', '');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from 'fs';
import path from 'path';
import { simpleGit } from 'simple-git';
import semver from 'semver';
import { readSvgDirectory } from './helpers.mjs';
import { readSvgDirectory } from '@lucide/helpers';

const DATE_OF_FORK = '2020-06-08T16:39:52+0100';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import path from 'path';
import fs from 'fs';
// eslint-disable-next-line import/no-named-as-default, import/no-named-as-default-member
import getIconMetaData from '../tools/build-icons/utils/getIconMetaData.mjs';
import { getCurrentDirPath } from './helpers.mjs';
import { getIconMetaData } from '@lucide/build-icons';
import { getCurrentDirPath } from '@lucide/helpers';

const currentDir = process.cwd();
const scriptDir = getCurrentDirPath(import.meta.url);
Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@
"lucide-vue-next": "pnpm --filter lucide-vue-next",
"lucide-svelte": "pnpm --filter lucide-svelte",
"lucide-static": "pnpm --filter lucide-static",
"build:icons": "node ./scripts/buildIcons.mjs --templateSrc ./packages/lucide/scripts/exportTemplate.mjs",
"build:outline-icons": "pnpm --filter outline-svg start",
"build:font": "pnpm --filter docs prebuild:releaseJson && pnpm --filter build-font start",
"generate:supersprite": "node ./scripts/generateSuperSVG.mjs",
"optimize": "node ./scripts/optimizeSvgs.mjs",
"addjsons": "node scripts/addMissingIconJsonFiles.mjs",
"checkIcons": "node scripts/checkIconsAndCategories.mjs --presets @babel/env",
"tags2icons": "node scripts/migrateTagsToIcons.mjs --presets @babel/env",
"icons2tags": "node scripts/migrateIconsToTags.mjs --presets @babel/env",
"icons2categories": "node scripts/migrateIconsToCategories.mjs --presets @babel/env",
"categories2icons": "node scripts/migrateCategoriesToIcons.mjs --presets @babel/env",
"checkIcons": "node scripts/checkIconsAndCategories.mjs",
"tags2icons": "node scripts/migrateTagsToIcons.mjs",
"icons2tags": "node scripts/migrateIconsToTags.mjs",
"icons2categories": "node scripts/migrateIconsToCategories.mjs",
"categories2icons": "node scripts/migrateCategoriesToIcons.mjs",
"generate:changelog": "node ./scripts/generateChangelog.mjs",
"generate:contributors": "node ./scripts/updateContributors.mjs icons/*.svg",
"generate:nextJSAliases": "node ./scripts/generateNextJSAliases.mjs",
Expand All @@ -42,6 +40,8 @@
"renamePattern": "node scripts/rename/renamePattern.mjs"
},
"devDependencies": {
"@lucide/build-icons": "workspace:*",
"@lucide/helpers": "workspace:*",
"@html-eslint/eslint-plugin": "^0.19.1",
"@html-eslint/parser": "^0.19.1",
"@octokit/rest": "^19.0.13",
Expand All @@ -60,7 +60,6 @@
"husky": "^8.0.3",
"lint-staged": "^13.3.0",
"minimist": "^1.2.8",
"node-fetch": "^3.3.2",
"p-memoize": "^7.1.1",
"prettier": "3.2.4",
"semver": "^7.5.4",
Expand Down
25 changes: 0 additions & 25 deletions packages/lucide-figma/README.md

This file was deleted.

Binary file removed packages/lucide-figma/cover.png
Binary file not shown.
Binary file removed packages/lucide-figma/icon.png
Binary file not shown.
26 changes: 0 additions & 26 deletions packages/lucide-figma/manifest.json

This file was deleted.

30 changes: 0 additions & 30 deletions packages/lucide-figma/package.json

This file was deleted.

Loading
Loading