mirror of
https://github.com/simple-icons/simple-icons.git
synced 2025-01-05 01:20:39 +02:00
Restructure the scripts/
directory (#5546)
* Restructure scripts/ directory And update references to this scripts everywhere. * Update names of file-level constants in bump-version.js * Normalize quotes between all scripts * Move "create-release.yml" scripts to scripts/release * Move slugs table script to scripts/release * Update relative path logic in update-slugs-table.js
This commit is contained in:
parent
a254c8ae5d
commit
153a029c25
6
.github/workflows/create-release.yml
vendored
6
.github/workflows/create-release.yml
vendored
@ -26,11 +26,11 @@ jobs:
|
||||
# Ensure we are checked out on the develop branch
|
||||
ref: develop
|
||||
- name: Bump version
|
||||
run: node ./scripts/bump-version.js "${{ needs.release-pr.outputs.new-version }}"
|
||||
run: node ./scripts/release/bump-version.js "${{ needs.release-pr.outputs.new-version }}"
|
||||
- name: Update major version in CDN URLs
|
||||
run: node ./scripts/update-cdn-urls.js
|
||||
run: node ./scripts/release/update-cdn-urls.js
|
||||
- name: Update slugs table
|
||||
run: node ./scripts/build-slugs-table.js
|
||||
run: node ./scripts/release/update-slugs-table.js
|
||||
- name: Commit version bump
|
||||
uses: stefanzweifel/git-auto-commit-action@v4.11.0
|
||||
with:
|
||||
|
@ -31,11 +31,11 @@
|
||||
"uglify-js": "3.13.5"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build-package.js",
|
||||
"build": "node scripts/build/package.js",
|
||||
"clean": "rm -f icons/*.js index.js",
|
||||
"lint": "run-s our-lint jsonlint svglint wslint",
|
||||
"our-lint": "node scripts/lint.js",
|
||||
"jsonlint": "node scripts/jsonlint.js",
|
||||
"our-lint": "node scripts/lint/ourlint.js",
|
||||
"jsonlint": "node scripts/lint/jsonlint.js",
|
||||
"svglint": "svglint icons/*.svg --ci",
|
||||
"wslint": "editorconfig-checker -exclude \\.svg$",
|
||||
"prepublishOnly": "npm run build",
|
||||
|
@ -14,18 +14,20 @@ const minify = require("uglify-js").minify;
|
||||
|
||||
const UTF8 = "utf8";
|
||||
|
||||
const dataFile = path.resolve(__dirname, "..", "_data", "simple-icons.json");
|
||||
const indexFile = path.resolve(__dirname, "..", "index.js");
|
||||
const iconsDir = path.resolve(__dirname, "..", "icons");
|
||||
const rootDir = path.resolve(__dirname, "..", "..");
|
||||
const dataFile = path.resolve(rootDir, "_data", "simple-icons.json");
|
||||
const indexFile = path.resolve(rootDir, "index.js");
|
||||
const iconsDir = path.resolve(rootDir, "icons");
|
||||
|
||||
const indexTemplateFile = path.resolve(__dirname, "templates", "index.js");
|
||||
const iconObjectTemplateFile = path.resolve(__dirname, "templates", "icon-object.js");
|
||||
const templatesDir = path.resolve(__dirname, "templates");
|
||||
const indexTemplateFile = path.resolve(templatesDir, "index.js");
|
||||
const iconObjectTemplateFile = path.resolve(templatesDir, "icon-object.js");
|
||||
|
||||
const indexTemplate = fs.readFileSync(indexTemplateFile, UTF8);
|
||||
const iconObjectTemplate = fs.readFileSync(iconObjectTemplateFile, UTF8);
|
||||
|
||||
const data = require(dataFile);
|
||||
const { getIconSlug, titleToSlug } = require("./utils.js");
|
||||
const { getIconSlug, titleToSlug } = require("../utils.js");
|
||||
|
||||
// Local helper functions
|
||||
function escape(value) {
|
@ -1,8 +1,9 @@
|
||||
const path = require("path");
|
||||
const Validator = require("jsonschema").Validator;
|
||||
|
||||
const schemaFile = path.resolve(__dirname, "..", ".jsonschema.json");
|
||||
const dataFile = path.resolve(__dirname, "..", "_data", "simple-icons.json");
|
||||
const rootDir = path.resolve(__dirname, "..", "..");
|
||||
const schemaFile = path.resolve(rootDir, ".jsonschema.json");
|
||||
const dataFile = path.resolve(rootDir, "_data", "simple-icons.json");
|
||||
|
||||
const schema = require(schemaFile);
|
||||
const data = require(dataFile);
|
@ -12,7 +12,8 @@ const { diffLinesUnified } = require("jest-diff");
|
||||
|
||||
const UTF8 = "utf8";
|
||||
|
||||
const dataFile = path.resolve( __dirname, "..", "_data", "simple-icons.json");
|
||||
const rootDir = path.resolve(__dirname, "..", "..");
|
||||
const dataFile = path.resolve(rootDir, "_data", "simple-icons.json");
|
||||
const data = require(dataFile);
|
||||
|
||||
/**
|
@ -4,12 +4,12 @@
|
||||
* Updates the version of this package to the CLI specified version.
|
||||
*/
|
||||
|
||||
const { execSync } = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const PACKAGE_JSON_FILE = path.resolve(__dirname, '..', 'package.json');
|
||||
const PACKAGE_LOCK_FILE = path.resolve(__dirname, '..', 'package-lock.json');
|
||||
const rootDir = path.resolve(__dirname, "..", "..");
|
||||
const packageJsonFile = path.resolve(rootDir, "package.json");
|
||||
const packageLockFile = path.resolve(rootDir, "package-lock.json");
|
||||
|
||||
function readManifest(file) {
|
||||
const manifestRaw = fs.readFileSync(file).toString();
|
||||
@ -18,20 +18,20 @@ function readManifest(file) {
|
||||
}
|
||||
|
||||
function writeManifest(file, json) {
|
||||
const manifestRaw = JSON.stringify(json, null, 2) + '\n';
|
||||
const manifestRaw = JSON.stringify(json, null, 2) + "\n";
|
||||
fs.writeFileSync(file, manifestRaw);
|
||||
}
|
||||
|
||||
function main(newVersion) {
|
||||
try {
|
||||
const manifest = readManifest(PACKAGE_JSON_FILE);
|
||||
const manifestLock = readManifest(PACKAGE_LOCK_FILE);
|
||||
const manifest = readManifest(packageJsonFile);
|
||||
const manifestLock = readManifest(packageLockFile);
|
||||
|
||||
manifest.version = newVersion
|
||||
manifestLock.version = newVersion
|
||||
|
||||
writeManifest(PACKAGE_JSON_FILE, manifest);
|
||||
writeManifest(PACKAGE_LOCK_FILE, manifestLock);
|
||||
writeManifest(packageJsonFile, manifest);
|
||||
writeManifest(packageLockFile, manifestLock);
|
||||
} catch (error) {
|
||||
console.error(`Failed to bump package version to ${newVersion}:`, error);
|
||||
process.exit(1);
|
@ -8,7 +8,7 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const rootDir = path.resolve(__dirname, "..");
|
||||
const rootDir = path.resolve(__dirname, "..", "..");
|
||||
const packageJsonFile = path.resolve(rootDir, "package.json");
|
||||
const readmeFile = path.resolve(rootDir, "README.md");
|
||||
|
@ -7,15 +7,16 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const dataFile = path.resolve(__dirname, "..", "_data", "simple-icons.json");
|
||||
const slugsFile = path.resolve(__dirname, "..", "slugs.md");
|
||||
const rootDir = path.resolve(__dirname, "..", "..");
|
||||
const dataFile = path.resolve(rootDir, "_data", "simple-icons.json");
|
||||
const slugsFile = path.resolve(rootDir, "slugs.md");
|
||||
|
||||
const data = require(dataFile);
|
||||
const { getIconSlug } = require("./utils.js");
|
||||
const { getIconSlug } = require("../utils.js");
|
||||
|
||||
let content = `<!--
|
||||
This file is automatically generated. If you want to change something, please
|
||||
update the script at '${__filename.replace(__dirname, "scripts")}'.
|
||||
update the script at '${path.relative(rootDir, __filename)}'.
|
||||
-->
|
||||
|
||||
# Simple Icons slugs
|
Loading…
Reference in New Issue
Block a user