From ce39190abe491ca270145c8f0bfc9b3f5305fd5b Mon Sep 17 00:00:00 2001 From: Bahadir Sofuoglu Date: Wed, 14 Sep 2022 17:49:38 +0300 Subject: [PATCH] Changes for package build --- LICENSE.md | 21 +++++++++++++++++++++ build-meta.js | 17 +++++++++++++++++ package-build.json | 32 ++++++++++++++++++++++++++++++++ package.json | 6 +++++- rollup.config.js | 1 + 5 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 LICENSE.md create mode 100644 build-meta.js create mode 100644 package-build.json diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..56fb43e7e --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018-2021 PrimeTek + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/build-meta.js b/build-meta.js new file mode 100644 index 000000000..bf5527d00 --- /dev/null +++ b/build-meta.js @@ -0,0 +1,17 @@ +const fs = require('fs-extra'); +const path = require('path'); + +fs.readdirSync(path.resolve(__dirname, './components/'), { withFileTypes: true }) + .filter((dir) => dir.isDirectory()) + .forEach(({ name: folderName }) => { + fs.readdirSync(path.resolve(__dirname, './components/' + folderName)).forEach((file) => { + if (file === 'package.json' || file.endsWith('d.ts') || file.endsWith('vue')) { + fs.copySync(path.resolve(__dirname, './components/' + folderName) + '/' + file, 'dist/' + folderName + '/' + file); + } + }); + }); + +fs.copySync(path.resolve(__dirname, './components/ts-helpers.d.ts'), 'dist/ts-helpers.d.ts'); +fs.copySync(path.resolve(__dirname, './package-build.json'), 'dist/package.json'); +fs.copySync(path.resolve(__dirname, './README.md'), 'dist/README.md'); +fs.copySync(path.resolve(__dirname, './LICENSE.md'), 'dist/LICENSE.md'); diff --git a/package-build.json b/package-build.json new file mode 100644 index 000000000..40d594361 --- /dev/null +++ b/package-build.json @@ -0,0 +1,32 @@ +{ + "name": "primevue", + "version": "3.17.0", + "homepage": "https://www.primefaces.org/primevue", + "repository": { + "type": "git", + "url": "https://github.com/primefaces/primevue.git" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/primefaces/primevue/issues" + }, + "keywords": [ + "primevue", + "vue", + "ui framework", + "component framework", + "ui library", + "component library", + "material", + "bootstrap" + ], + "web-types": "./web-types.json", + "vetur": { + "tags": "./vetur-tags.json", + "attributes": "./vetur-attributes.json" + }, + "peerDependencies": { + "vue": "^3.0.0", + "primeicons": "^5.0.0" + } + } diff --git a/package.json b/package.json index 7bd593425..db160928b 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,13 @@ "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare", + "build:package": "NODE_ENV=production rollup -c && node build-meta && node api-generator/build-api && gulp build-styles", + "build:check": "npm run lint && npm run format:check && npm run security:check && npm run test:unit", + "security:check": "npm audit --production --audit-level high", "format": "prettier --write \"**/*.{js,vue,d.ts}\"", "format:check": "prettier --check \"**/*.{js,vue,d.ts}\"", - "test:unit": "vitest" + "test:unit": "vitest", + "test:build": "NODE_ENV=production rollup -c" }, "devDependencies": { "@fullcalendar/core": "^5.11.0", diff --git a/rollup.config.js b/rollup.config.js index 78c564530..215ce6294 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -118,6 +118,7 @@ function addCore() { Object.entries(core).forEach(([filePath, value]) => { const code = Object.keys(coreDependencies).reduce((val, d) => { const name = d.replace('primevue/', ''); + val += value[name] + '\n'; return val;