mirror of
https://github.com/Mibew/simple-icons.git
synced 2025-01-29 21:40:35 +03: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
|
# Ensure we are checked out on the develop branch
|
||||||
ref: develop
|
ref: develop
|
||||||
- name: Bump version
|
- 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
|
- 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
|
- name: Update slugs table
|
||||||
run: node ./scripts/build-slugs-table.js
|
run: node ./scripts/release/update-slugs-table.js
|
||||||
- name: Commit version bump
|
- name: Commit version bump
|
||||||
uses: stefanzweifel/git-auto-commit-action@v4.11.0
|
uses: stefanzweifel/git-auto-commit-action@v4.11.0
|
||||||
with:
|
with:
|
||||||
|
@ -31,11 +31,11 @@
|
|||||||
"uglify-js": "3.13.5"
|
"uglify-js": "3.13.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node scripts/build-package.js",
|
"build": "node scripts/build/package.js",
|
||||||
"clean": "rm -f icons/*.js index.js",
|
"clean": "rm -f icons/*.js index.js",
|
||||||
"lint": "run-s our-lint jsonlint svglint wslint",
|
"lint": "run-s our-lint jsonlint svglint wslint",
|
||||||
"our-lint": "node scripts/lint.js",
|
"our-lint": "node scripts/lint/ourlint.js",
|
||||||
"jsonlint": "node scripts/jsonlint.js",
|
"jsonlint": "node scripts/lint/jsonlint.js",
|
||||||
"svglint": "svglint icons/*.svg --ci",
|
"svglint": "svglint icons/*.svg --ci",
|
||||||
"wslint": "editorconfig-checker -exclude \\.svg$",
|
"wslint": "editorconfig-checker -exclude \\.svg$",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
|
@ -14,18 +14,20 @@ const minify = require("uglify-js").minify;
|
|||||||
|
|
||||||
const UTF8 = "utf8";
|
const UTF8 = "utf8";
|
||||||
|
|
||||||
const dataFile = path.resolve(__dirname, "..", "_data", "simple-icons.json");
|
const rootDir = path.resolve(__dirname, "..", "..");
|
||||||
const indexFile = path.resolve(__dirname, "..", "index.js");
|
const dataFile = path.resolve(rootDir, "_data", "simple-icons.json");
|
||||||
const iconsDir = path.resolve(__dirname, "..", "icons");
|
const indexFile = path.resolve(rootDir, "index.js");
|
||||||
|
const iconsDir = path.resolve(rootDir, "icons");
|
||||||
|
|
||||||
const indexTemplateFile = path.resolve(__dirname, "templates", "index.js");
|
const templatesDir = path.resolve(__dirname, "templates");
|
||||||
const iconObjectTemplateFile = path.resolve(__dirname, "templates", "icon-object.js");
|
const indexTemplateFile = path.resolve(templatesDir, "index.js");
|
||||||
|
const iconObjectTemplateFile = path.resolve(templatesDir, "icon-object.js");
|
||||||
|
|
||||||
const indexTemplate = fs.readFileSync(indexTemplateFile, UTF8);
|
const indexTemplate = fs.readFileSync(indexTemplateFile, UTF8);
|
||||||
const iconObjectTemplate = fs.readFileSync(iconObjectTemplateFile, UTF8);
|
const iconObjectTemplate = fs.readFileSync(iconObjectTemplateFile, UTF8);
|
||||||
|
|
||||||
const data = require(dataFile);
|
const data = require(dataFile);
|
||||||
const { getIconSlug, titleToSlug } = require("./utils.js");
|
const { getIconSlug, titleToSlug } = require("../utils.js");
|
||||||
|
|
||||||
// Local helper functions
|
// Local helper functions
|
||||||
function escape(value) {
|
function escape(value) {
|
@ -1,8 +1,9 @@
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
const Validator = require("jsonschema").Validator;
|
const Validator = require("jsonschema").Validator;
|
||||||
|
|
||||||
const schemaFile = path.resolve(__dirname, "..", ".jsonschema.json");
|
const rootDir = path.resolve(__dirname, "..", "..");
|
||||||
const dataFile = path.resolve(__dirname, "..", "_data", "simple-icons.json");
|
const schemaFile = path.resolve(rootDir, ".jsonschema.json");
|
||||||
|
const dataFile = path.resolve(rootDir, "_data", "simple-icons.json");
|
||||||
|
|
||||||
const schema = require(schemaFile);
|
const schema = require(schemaFile);
|
||||||
const data = require(dataFile);
|
const data = require(dataFile);
|
@ -12,7 +12,8 @@ const { diffLinesUnified } = require("jest-diff");
|
|||||||
|
|
||||||
const UTF8 = "utf8";
|
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);
|
const data = require(dataFile);
|
||||||
|
|
||||||
/**
|
/**
|
@ -4,12 +4,12 @@
|
|||||||
* Updates the version of this package to the CLI specified version.
|
* Updates the version of this package to the CLI specified version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { execSync } = require('child_process');
|
const fs = require("fs");
|
||||||
const fs = require('fs');
|
const path = require("path");
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
const PACKAGE_JSON_FILE = path.resolve(__dirname, '..', 'package.json');
|
const rootDir = path.resolve(__dirname, "..", "..");
|
||||||
const PACKAGE_LOCK_FILE = path.resolve(__dirname, '..', 'package-lock.json');
|
const packageJsonFile = path.resolve(rootDir, "package.json");
|
||||||
|
const packageLockFile = path.resolve(rootDir, "package-lock.json");
|
||||||
|
|
||||||
function readManifest(file) {
|
function readManifest(file) {
|
||||||
const manifestRaw = fs.readFileSync(file).toString();
|
const manifestRaw = fs.readFileSync(file).toString();
|
||||||
@ -18,20 +18,20 @@ function readManifest(file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function writeManifest(file, json) {
|
function writeManifest(file, json) {
|
||||||
const manifestRaw = JSON.stringify(json, null, 2) + '\n';
|
const manifestRaw = JSON.stringify(json, null, 2) + "\n";
|
||||||
fs.writeFileSync(file, manifestRaw);
|
fs.writeFileSync(file, manifestRaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
function main(newVersion) {
|
function main(newVersion) {
|
||||||
try {
|
try {
|
||||||
const manifest = readManifest(PACKAGE_JSON_FILE);
|
const manifest = readManifest(packageJsonFile);
|
||||||
const manifestLock = readManifest(PACKAGE_LOCK_FILE);
|
const manifestLock = readManifest(packageLockFile);
|
||||||
|
|
||||||
manifest.version = newVersion
|
manifest.version = newVersion
|
||||||
manifestLock.version = newVersion
|
manifestLock.version = newVersion
|
||||||
|
|
||||||
writeManifest(PACKAGE_JSON_FILE, manifest);
|
writeManifest(packageJsonFile, manifest);
|
||||||
writeManifest(PACKAGE_LOCK_FILE, manifestLock);
|
writeManifest(packageLockFile, manifestLock);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Failed to bump package version to ${newVersion}:`, error);
|
console.error(`Failed to bump package version to ${newVersion}:`, error);
|
||||||
process.exit(1);
|
process.exit(1);
|
@ -8,7 +8,7 @@
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const rootDir = path.resolve(__dirname, "..");
|
const rootDir = path.resolve(__dirname, "..", "..");
|
||||||
const packageJsonFile = path.resolve(rootDir, "package.json");
|
const packageJsonFile = path.resolve(rootDir, "package.json");
|
||||||
const readmeFile = path.resolve(rootDir, "README.md");
|
const readmeFile = path.resolve(rootDir, "README.md");
|
||||||
|
|
@ -7,15 +7,16 @@
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const dataFile = path.resolve(__dirname, "..", "_data", "simple-icons.json");
|
const rootDir = path.resolve(__dirname, "..", "..");
|
||||||
const slugsFile = path.resolve(__dirname, "..", "slugs.md");
|
const dataFile = path.resolve(rootDir, "_data", "simple-icons.json");
|
||||||
|
const slugsFile = path.resolve(rootDir, "slugs.md");
|
||||||
|
|
||||||
const data = require(dataFile);
|
const data = require(dataFile);
|
||||||
const { getIconSlug } = require("./utils.js");
|
const { getIconSlug } = require("../utils.js");
|
||||||
|
|
||||||
let content = `<!--
|
let content = `<!--
|
||||||
This file is automatically generated. If you want to change something, please
|
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
|
# Simple Icons slugs
|
Loading…
Reference in New Issue
Block a user