From fdd716846aadb3c8c015640835da9c4a697379c2 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 12 May 2022 23:10:42 +0300 Subject: [PATCH] Update directory structure in packages and readme --- README.md | 62 ++++++++++++++++------- components/ember/build.js | 6 +-- components/ember/package.json | 2 +- components/react/build.js | 10 ++-- components/react/package.json | 2 +- components/svelte/build.js | 6 +-- components/svelte/package.json | 2 +- components/svg-framework/build.js | 10 ++-- components/svg-framework/package.json | 2 +- components/vue/build.js | 10 ++-- components/vue/package.json | 2 +- components/vue2/build.js | 10 ++-- components/vue2/package.json | 2 +- iconify-icon/icon/package.json | 2 +- packages/api-redundancy/package-lock.json | 2 +- 15 files changed, 77 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index 28cee01..2f938a1 100644 --- a/README.md +++ b/README.md @@ -38,32 +38,56 @@ This makes it possible to have an unlimited choice of icons! ## Available packages -There are several Iconify components included in this repository: +There are several types of packages, split in their own directories. -| Implementation | Usage | -| -------------------------------------- | ------------------------- | -| [SVG Framework](./packages/iconify/) | HTML | -| [React component](./packages/react/) | React, Next.js | -| [Vue 3 component](./packages/vue/) | Vue 3 | -| [Vue 2 component](./packages/vue2/) | Vue 2 | -| [Svelte component](./packages/svelte/) | Svelte, SvelteKit, Sapper | -| [Ember component](./packages/ember/) | Ember | +### Main packages -Other packages: +Directory `packages` contains main packages that are reusable by all other packages in this repository as well as third party components. + +Main packages: - [Iconify types](./packages/types/) - TypeScript types. - [Iconify utils](./packages/utils/) - common files used by various Iconify projects (including tools, API, etc...). - [Iconify core](./packages/core/) - common files used by various components. - [API redundancy](./packages/api-redundancy/) - library for managing redundancies for loading data from API: handling timeouts, rotating hosts. -- [React demo](./demo/react-demo/) - demo for React component. Run `npm start` to start demo. -- [Next.js demo](./demo/nextjs-demo/) - demo for React component with Next.js. Run `npm run build` to build it and `npm start` to start demo. -- [Vue 3 demo](./demo/vue-demo/) - demo for Vue component. Run `npm run dev` to start demo. -- [Vue 2 demo](./demo/vue2-demo/) - demo for Vue component. Run `npm run dev` to start demo. -- [Svelte demo](./demo/svelte-demo/) - demo for Svelte component. Run `npm run dev` to start demo. -- [Svelte demo with Vite](./demo/svelte-demo-vite/) - demo for Svelte component using Vite. Run `npm run dev` to start demo. -- [Sapper demo](./demo/sapper-demo/) - demo for Sapper, using Svelte component on the server and in the browser. Run `npm run dev` to start the demo (deprecated, use SvelteKit instead of Sapper). -- [SvelteKit demo](./demo/sveltekit-demo/) - demo for SvelteKit, using Svelte component on the server and in the browser. Run `npm run dev` to start the demo. -- [Ember demo](./demo/ember-demo/) - demo for Ember component. Run `npm run start` to start demo. + +### Iconify icon components + +Directory `component` contains Iconify icon components and SVG framework. + +| Icon component | Usage | +| ---------------------------------------- | ------ | +| [SVG Framework](./components/iconify/) | HTML | +| [React component](./components/react/) | React | +| [Vue 3 component](./components/vue/) | Vue 3 | +| [Vue 2 component](./components/vue2/) | Vue 2 | +| [Svelte component](./components/svelte/) | Svelte | +| [Ember component](./components/ember/) | Ember | + +#### Demo + +Directory `components-demo` contains demo packages that show usage of icon components. + +- [React demo](./components-demo/react-demo/) - demo for React component. Run `npm run dev` to start demo. +- [Next.js demo](./components-demo/nextjs-demo/) - demo for React component with Next.js. Run `npm run dev` to start demo. +- [Vue 3 demo](./components-demo/vue-demo/) - demo for Vue 3 component. Run `npm run dev` to start demo. +- [Nuxt 3 demo](./components-demo/nuxt3-demo/) - demo for Vue 3 component with Nuxt. Run `npm run dev` to start demo. +- [Vue 2 demo](./components-demo/vue2-demo/) - demo for Vue 2 component. Run `npm run build` to build demo and `npm run serve` to start it. +- [Svelte demo](./components-demo/svelte-demo/) - demo for Svelte component. Run `npm run dev` to start demo. +- [Svelte demo with Vite](./components-demo/svelte-demo-vite/) - demo for Svelte component using Vite. Run `npm run dev` to start demo. +- [Sapper demo](./components-demo/sapper-demo/) - demo for Sapper, using Svelte component on the server and in the browser. Run `npm run dev` to start the demo (deprecated, use SvelteKit instead of Sapper). +- [SvelteKit demo](./components-demo/sveltekit-demo/) - demo for SvelteKit, using Svelte component on the server and in the browser. Run `npm run dev` to start the demo. +- [Ember demo](./components-demo/ember-demo/) - demo for Ember component. Run `npm run build` to build demo and `npm run start` to start it. + +### IconifyIcon + +Directory `iconify-icon` contains `iconify-icon` web component and wrappers for various frameworks. + +- [IconifyIcon web component](./iconify-icon/icon/) - `iconify-icon` web component. + +#### Demo + +Directory `iconify-icon-demo` will contain demo packages that show usage of `iconify-icon` web component. ## Installation diff --git a/components/ember/build.js b/components/ember/build.js index f0fb4f6..301a4cf 100644 --- a/components/ember/build.js +++ b/components/ember/build.js @@ -3,7 +3,7 @@ const fs = require('fs'); const path = require('path'); const child_process = require('child_process'); -const packagesDir = path.dirname(__dirname); +const coreDir = path.dirname(require.resolve('@iconify/core/package.json')); // List of commands to run const commands = []; @@ -58,7 +58,7 @@ const fileExists = (file) => { return true; }; -if (compile.lib && !fileExists(packagesDir + '/core/lib/cache.mjs')) { +if (compile.lib && !fileExists(coreDir + '/lib/cache.mjs')) { compile.core = true; } @@ -67,7 +67,7 @@ if (compile.core) { commands.push({ cmd: 'npm', args: ['run', 'build'], - cwd: packagesDir + '/core', + cwd: coreDir, }); } diff --git a/components/ember/package.json b/components/ember/package.json index 4eb4694..ee6241b 100644 --- a/components/ember/package.json +++ b/components/ember/package.json @@ -10,7 +10,7 @@ "repository": { "type": "git", "url": "https://github.com/iconify/iconify.git", - "directory": "packages/ember" + "directory": "components/ember" }, "keywords": [ "ember-addon" diff --git a/components/react/build.js b/components/react/build.js index 3f34b8e..23b2647 100644 --- a/components/react/build.js +++ b/components/react/build.js @@ -3,7 +3,7 @@ const fs = require('fs'); const path = require('path'); const child_process = require('child_process'); -const packagesDir = path.dirname(__dirname); +const coreDir = path.dirname(require.resolve('@iconify/core/package.json')); // List of commands to run const commands = []; @@ -64,15 +64,15 @@ const fileExists = (file) => { return true; }; -if (compile.dist && !fileExists(packagesDir + '/react/lib/icon.js')) { +if (compile.dist && !fileExists('./lib/icon.js')) { compile.lib = true; } -if (compile.api && !fileExists(packagesDir + '/react/lib/icon.d.ts')) { +if (compile.api && !fileExists('./lib/icon.d.ts')) { compile.lib = true; } -if (compile.lib && !fileExists(packagesDir + '/core/lib/cache.mjs')) { +if (compile.lib && !fileExists(coreDir + '/lib/cache.mjs')) { compile.core = true; } @@ -81,7 +81,7 @@ if (compile.core) { commands.push({ cmd: 'npm', args: ['run', 'build'], - cwd: packagesDir + '/core', + cwd: coreDir, }); } diff --git a/components/react/package.json b/components/react/package.json index f778796..2ee14ee 100644 --- a/components/react/package.json +++ b/components/react/package.json @@ -10,7 +10,7 @@ "repository": { "type": "git", "url": "https://github.com/iconify/iconify.git", - "directory": "packages/react" + "directory": "components/react" }, "scripts": { "clean": "rimraf lib dist tsconfig.tsbuildinfo", diff --git a/components/svelte/build.js b/components/svelte/build.js index 6133198..4d1240e 100644 --- a/components/svelte/build.js +++ b/components/svelte/build.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const child_process = require('child_process'); -const packagesDir = path.dirname(__dirname); +const coreDir = path.dirname(require.resolve('@iconify/core/package.json')); // List of commands to run const commands = []; @@ -61,7 +61,7 @@ const fileExists = (file) => { return true; }; -if (compile.dist && !fileExists(packagesDir + '/core/lib/modules.mjs')) { +if (compile.dist && !fileExists(coreDir + '/lib/modules.mjs')) { compile.core = true; } @@ -70,7 +70,7 @@ if (compile.core) { commands.push({ cmd: 'npm', args: ['run', 'build'], - cwd: packagesDir + '/core', + cwd: coreDir, }); } diff --git a/components/svelte/package.json b/components/svelte/package.json index 67d7282..1cc8616 100644 --- a/components/svelte/package.json +++ b/components/svelte/package.json @@ -10,7 +10,7 @@ "repository": { "type": "git", "url": "https://github.com/iconify/iconify.git", - "directory": "packages/svelte" + "directory": "components/svelte" }, "svelte": "dist/Icon.svelte", "module": "dist/index.mjs", diff --git a/components/svg-framework/build.js b/components/svg-framework/build.js index e527062..db6a885 100644 --- a/components/svg-framework/build.js +++ b/components/svg-framework/build.js @@ -3,7 +3,7 @@ const fs = require('fs'); const path = require('path'); const child_process = require('child_process'); -const packagesDir = path.dirname(__dirname); +const coreDir = path.dirname(require.resolve('@iconify/core/package.json')); // List of commands to run const commands = []; @@ -57,15 +57,15 @@ const fileExists = (file) => { return true; }; -if (compile.dist && !fileExists(packagesDir + '/iconify/lib/iconify.js')) { +if (compile.dist && !fileExists('./lib/iconify.js')) { compile.lib = true; } -if (compile.api && !fileExists(packagesDir + '/iconify/lib/iconify.d.ts')) { +if (compile.api && !fileExists('./lib/iconify.d.ts')) { compile.lib = true; } -if (compile.lib && !fileExists(packagesDir + '/core/lib/cache.mjs')) { +if (compile.lib && !fileExists(coreDir + '/lib/cache.mjs')) { compile.core = true; } @@ -74,7 +74,7 @@ if (compile.core) { commands.push({ cmd: 'npm', args: ['run', 'build'], - cwd: packagesDir + '/core', + cwd: coreDir, }); } diff --git a/components/svg-framework/package.json b/components/svg-framework/package.json index 6159b37..65fd6bd 100644 --- a/components/svg-framework/package.json +++ b/components/svg-framework/package.json @@ -14,7 +14,7 @@ "repository": { "type": "git", "url": "https://github.com/iconify/iconify.git", - "directory": "packages/iconify" + "directory": "components/svg-framework" }, "scripts": { "clean": "rimraf lib dist tests-compiled tsconfig.tsbuildinfo", diff --git a/components/vue/build.js b/components/vue/build.js index afdca4d..5a2500e 100644 --- a/components/vue/build.js +++ b/components/vue/build.js @@ -3,7 +3,7 @@ const fs = require('fs'); const path = require('path'); const child_process = require('child_process'); -const packagesDir = path.dirname(__dirname); +const coreDir = path.dirname(require.resolve('@iconify/core/package.json')); // List of commands to run const commands = []; @@ -57,15 +57,15 @@ const fileExists = (file) => { return true; }; -if (compile.dist && !fileExists(packagesDir + '/vue/lib/IconifyIcon.js')) { +if (compile.dist && !fileExists('./lib/IconifyIcon.js')) { compile.lib = true; } -if (compile.api && !fileExists(packagesDir + '/vue/lib/IconifyIcon.d.ts')) { +if (compile.api && !fileExists('./lib/IconifyIcon.d.ts')) { compile.lib = true; } -if (compile.lib && !fileExists(packagesDir + '/core/lib/cache.mjs')) { +if (compile.lib && !fileExists(coreDir + '/lib/cache.mjs')) { compile.core = true; } @@ -74,7 +74,7 @@ if (compile.core) { commands.push({ cmd: 'npm', args: ['run', 'build'], - cwd: packagesDir + '/core', + cwd: coreDir, }); } diff --git a/components/vue/package.json b/components/vue/package.json index a222895..55b3876 100644 --- a/components/vue/package.json +++ b/components/vue/package.json @@ -10,7 +10,7 @@ "repository": { "type": "git", "url": "https://github.com/iconify/iconify.git", - "directory": "packages/vue" + "directory": "components/vue" }, "scripts": { "build": "node build", diff --git a/components/vue2/build.js b/components/vue2/build.js index 4dc940a..b3c48a1 100644 --- a/components/vue2/build.js +++ b/components/vue2/build.js @@ -3,7 +3,7 @@ const fs = require('fs'); const path = require('path'); const child_process = require('child_process'); -const packagesDir = path.dirname(__dirname); +const coreDir = path.dirname(require.resolve('@iconify/core/package.json')); // List of commands to run const commands = []; @@ -57,15 +57,15 @@ const fileExists = file => { return true; }; -if (compile.dist && !fileExists(packagesDir + '/vue/lib/IconifyIcon.js')) { +if (compile.dist && !fileExists('./lib/IconifyIcon.js')) { compile.lib = true; } -if (compile.api && !fileExists(packagesDir + '/vue/lib/IconifyIcon.d.ts')) { +if (compile.api && !fileExists('./lib/IconifyIcon.d.ts')) { compile.lib = true; } -if (compile.lib && !fileExists(packagesDir + '/core/lib/cache.mjs')) { +if (compile.lib && !fileExists(coreDir + '/lib/cache.mjs')) { compile.core = true; } @@ -74,7 +74,7 @@ if (compile.core) { commands.push({ cmd: 'npm', args: ['run', 'build'], - cwd: packagesDir + '/core', + cwd: coreDir, }); } diff --git a/components/vue2/package.json b/components/vue2/package.json index 4472387..08a61ff 100644 --- a/components/vue2/package.json +++ b/components/vue2/package.json @@ -10,7 +10,7 @@ "repository": { "type": "git", "url": "https://github.com/iconify/iconify.git", - "directory": "packages/vue2" + "directory": "components/vue2" }, "scripts": { "build": "node build", diff --git a/iconify-icon/icon/package.json b/iconify-icon/icon/package.json index 036ab8e..a80d00f 100644 --- a/iconify-icon/icon/package.json +++ b/iconify-icon/icon/package.json @@ -14,7 +14,7 @@ "repository": { "type": "git", "url": "https://github.com/iconify/iconify.git", - "directory": "packages/icon" + "directory": "iconify-icon/icon" }, "scripts": { "clean": "rimraf lib dist tsconfig.tsbuildinfo", diff --git a/packages/api-redundancy/package-lock.json b/packages/api-redundancy/package-lock.json index 8cefdc4..f60b8ad 100644 --- a/packages/api-redundancy/package-lock.json +++ b/packages/api-redundancy/package-lock.json @@ -7,7 +7,7 @@ "": { "name": "@iconify/api-redundancy", "version": "1.1.0", - "license": "(Apache-2.0 OR GPL-2.0)", + "license": "MIT", "devDependencies": { "@types/jest": "^27.4.1", "@types/node": "^17.0.22",