mirror of
https://github.com/tabler/tabler.git
synced 2025-12-21 09:24:24 +04:00
feat: implement zip-package script for packaging dashboard assets
This commit is contained in:
30
.build/zip-package.mjs
Normal file
30
.build/zip-package.mjs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
import AdmZip from 'adm-zip';
|
||||||
|
import path from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import { readFileSync } from 'fs';
|
||||||
|
|
||||||
|
// Get __dirname in ESM
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
|
||||||
|
const pkg = JSON.parse(
|
||||||
|
readFileSync(path.join(__dirname, '../core', 'package.json'), 'utf8')
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create zip instance and add folder
|
||||||
|
const zip = new AdmZip();
|
||||||
|
zip.addLocalFolder(path.join(__dirname, '../preview/dist'), 'dashboard');
|
||||||
|
|
||||||
|
zip.addLocalFile(path.join(__dirname, '../preview/static', 'og.png'), '.', 'preview.png');
|
||||||
|
|
||||||
|
zip.addFile("documentation.url", Buffer.from("[InternetShortcut]\nURL = https://tabler.io/docs"));
|
||||||
|
|
||||||
|
|
||||||
|
// Folder to zip and output path
|
||||||
|
const outputZipPath = path.join(__dirname, '../packages-zip', `tabler-${pkg.version}.zip`);
|
||||||
|
|
||||||
|
// Write the zip file
|
||||||
|
zip.writeZip(outputZipPath);
|
||||||
|
|
||||||
|
console.log(`Zipped folder to ${outputZipPath}`);
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"description": "Premium and Open Source dashboard template with responsive and high quality UI.",
|
"description": "Premium and Open Source dashboard template with responsive and high quality UI.",
|
||||||
"homepage": "https://tabler.io",
|
"homepage": "https://tabler.io",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "turbo build && pnpm run zip",
|
"build": "turbo build && pnpm run zip-package",
|
||||||
"dev": "turbo dev",
|
"dev": "turbo dev",
|
||||||
"clean": "turbo clean",
|
"clean": "turbo clean",
|
||||||
"bundlewatch": "turbo bundlewatch",
|
"bundlewatch": "turbo bundlewatch",
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
"publish": "changeset publish",
|
"publish": "changeset publish",
|
||||||
"playwright": "pnpm run build && pnpm run vt",
|
"playwright": "pnpm run build && pnpm run vt",
|
||||||
"reformat-md": "node .build/reformat-md.mjs",
|
"reformat-md": "node .build/reformat-md.mjs",
|
||||||
"start": "pnpm dev",
|
"zip-package": "node .build/zip-package.mjs",
|
||||||
"zip": "mkdir -p packages-zip && zip -r packages-zip/tabler-$(node -p \"require('./core/package.json').version\").zip preview/dist/*"
|
"start": "pnpm dev"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.6.5",
|
"packageManager": "pnpm@10.6.5",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
"@rollup/plugin-commonjs": "^28.0.3",
|
"@rollup/plugin-commonjs": "^28.0.3",
|
||||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||||
"@rollup/plugin-replace": "^6.0.2",
|
"@rollup/plugin-replace": "^6.0.2",
|
||||||
|
"adm-zip": "^0.5.16",
|
||||||
"autoprefixer": "^10.4.21",
|
"autoprefixer": "^10.4.21",
|
||||||
"bundlewatch": "^0.4.0",
|
"bundlewatch": "^0.4.0",
|
||||||
"clean-css-cli": "^5.6.3",
|
"clean-css-cli": "^5.6.3",
|
||||||
|
|||||||
9
pnpm-lock.yaml
generated
9
pnpm-lock.yaml
generated
@@ -32,6 +32,9 @@ importers:
|
|||||||
'@rollup/plugin-replace':
|
'@rollup/plugin-replace':
|
||||||
specifier: ^6.0.2
|
specifier: ^6.0.2
|
||||||
version: 6.0.2(rollup@4.37.0)
|
version: 6.0.2(rollup@4.37.0)
|
||||||
|
adm-zip:
|
||||||
|
specifier: ^0.5.16
|
||||||
|
version: 0.5.16
|
||||||
autoprefixer:
|
autoprefixer:
|
||||||
specifier: ^10.4.21
|
specifier: ^10.4.21
|
||||||
version: 10.4.21(postcss@8.5.3)
|
version: 10.4.21(postcss@8.5.3)
|
||||||
@@ -999,6 +1002,10 @@ packages:
|
|||||||
engines: {node: '>=0.4.0'}
|
engines: {node: '>=0.4.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
adm-zip@0.5.16:
|
||||||
|
resolution: {integrity: sha512-TGw5yVi4saajsSEgz25grObGHEUaDrniwvA2qwSC060KfqGPdglhvPMA2lPIoxs3PQIItj2iag35fONcQqgUaQ==}
|
||||||
|
engines: {node: '>=12.0'}
|
||||||
|
|
||||||
ajv@6.12.6:
|
ajv@6.12.6:
|
||||||
resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
|
resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
|
||||||
|
|
||||||
@@ -3971,6 +3978,8 @@ snapshots:
|
|||||||
|
|
||||||
acorn@8.14.0: {}
|
acorn@8.14.0: {}
|
||||||
|
|
||||||
|
adm-zip@0.5.16: {}
|
||||||
|
|
||||||
ajv@6.12.6:
|
ajv@6.12.6:
|
||||||
dependencies:
|
dependencies:
|
||||||
fast-deep-equal: 3.1.3
|
fast-deep-equal: 3.1.3
|
||||||
|
|||||||
Reference in New Issue
Block a user