From 65dbae91c36767c6adc4680265ebf15ca9f30650 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Thu, 22 Aug 2024 15:39:55 -0300 Subject: [PATCH] Add /etc --- Rules | 5 +++-- eslint.config.mjs => etc/eslint.config.mjs | 0 .rubocop.yml => etc/rubocop.yml | 0 tsconfig.json => etc/tsconfig.json | 4 +++- webpack.common.js => etc/webpack.common.js | 8 ++++---- webpack.development.js => etc/webpack.development.js | 0 webpack.production.js => etc/webpack.production.js | 0 package.json | 5 +++-- rake/tasks/ci.rake | 2 +- rake/tasks/format.rake | 12 +++++++++++- share/al-quran.reflectslight.io/CHANGELOG.org | 6 ++++++ 11 files changed, 31 insertions(+), 11 deletions(-) rename eslint.config.mjs => etc/eslint.config.mjs (100%) rename .rubocop.yml => etc/rubocop.yml (100%) rename tsconfig.json => etc/tsconfig.json (74%) rename webpack.common.js => etc/webpack.common.js (70%) rename webpack.development.js => etc/webpack.development.js (100%) rename webpack.production.js => etc/webpack.production.js (100%) diff --git a/Rules b/Rules index 6894b8d..34f943b 100644 --- a/Rules +++ b/Rules @@ -24,12 +24,13 @@ tdata = Ryo.from_json(path: File.join(dirs.content, "json", "t.json")) surahs = Ryo.from_json(path: File.join(dirs.content, "json", "surahs.json")) tidy = `which tidy || which tidy5`.chomp buildenv = ENV["buildenv"] || "development" +etcdir = File.join(__dir__, "etc") ## -# Plugins +# Filters Nanoc::Webpack .default_argv - .replace([*Nanoc::Webpack.default_argv, "--config", "webpack.#{buildenv}.js"].uniq) + .replace([*Nanoc::Webpack.default_argv, "--config", File.join(etcdir, "webpack.#{buildenv}.js")].uniq) Nanoc::Tidy .default_argv .replace([*Nanoc::Tidy.default_argv, "-upper"].uniq) diff --git a/eslint.config.mjs b/etc/eslint.config.mjs similarity index 100% rename from eslint.config.mjs rename to etc/eslint.config.mjs diff --git a/.rubocop.yml b/etc/rubocop.yml similarity index 100% rename from .rubocop.yml rename to etc/rubocop.yml diff --git a/tsconfig.json b/etc/tsconfig.json similarity index 74% rename from tsconfig.json rename to etc/tsconfig.json index 525bd23..9705588 100644 --- a/tsconfig.json +++ b/etc/tsconfig.json @@ -1,4 +1,6 @@ { + "include": ["../src/**/*.ts", "../src/**/*.tsx"], + "exclude": ["../node_modules"], "compilerOptions": { "strict": true, "module": "commonjs", @@ -9,7 +11,7 @@ "jsx": "react", "lib": [ "ES2020", "DOM" ], - "baseUrl": "src/", + "baseUrl": "../src/", "paths": { "~/*": ["./js/*"], "@json/*": ["./json/*"] diff --git a/webpack.common.js b/etc/webpack.common.js similarity index 70% rename from webpack.common.js rename to etc/webpack.common.js index bbd215a..45451d8 100644 --- a/webpack.common.js +++ b/etc/webpack.common.js @@ -2,11 +2,11 @@ const path = require("path"); module.exports = { resolve: { - modules: [path.resolve(__dirname, "node_modules")], + modules: [path.resolve(__dirname, "..", "node_modules")], alias: { - "@css": path.resolve(__dirname, "src/css"), - "@json": path.resolve(__dirname, "src/json"), - "~": path.resolve(__dirname, "src/js"), + "@css": path.resolve(__dirname, "..", "src", "css"), + "@json": path.resolve(__dirname, "..", "src", "json"), + "~": path.resolve(__dirname, "..", "src", "js"), }, extensions: [".js", ".ts", ".tsx", ".json", ".css", ".scss"], }, diff --git a/webpack.development.js b/etc/webpack.development.js similarity index 100% rename from webpack.development.js rename to etc/webpack.development.js diff --git a/webpack.production.js b/etc/webpack.production.js similarity index 100% rename from webpack.production.js rename to etc/webpack.production.js diff --git a/package.json b/package.json index a83b878..0af167d 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,9 @@ "./packages/typescript/*" ], "scripts": { - "tsc": "tsc --noEmit", - "eslint": "npm exec eslint -- --fix src/js/" + "tsc": "npx tsc --noEmit -p etc/tsconfig.json", + "eslint": "npx eslint --config etc/eslint.config.mjs src/js/", + "eslint:apply": "npx eslint --config etc/eslint.config.mjs --fix src/js/" }, "dependencies": { "classnames": "^2.3", diff --git a/rake/tasks/ci.rake b/rake/tasks/ci.rake index 731f66f..3fe2f0d 100644 --- a/rake/tasks/ci.rake +++ b/rake/tasks/ci.rake @@ -6,7 +6,7 @@ namespace :ci do end task :eslint do - sh "npx eslint src/js" + sh "npm run eslint" end task :tsc do diff --git a/rake/tasks/format.rake b/rake/tasks/format.rake index 224f75a..21ebf50 100644 --- a/rake/tasks/format.rake +++ b/rake/tasks/format.rake @@ -3,13 +3,23 @@ namespace :format do desc "Run rubocop (Ruby)" task :rubocop do - sh "bundle exec rubocop -A" + sh "bundle exec rubocop --config etc/rubocop.yml" + end + + desc "Apply rubocop (Ruby)" + task :"rubocop:apply" do + sh "bundle exec rubocop -A --config etc/rubocop.yml" end desc "Run eslint (TypeScript)" task :eslint do sh "npm run eslint" end + + desc "Run eslint (TypeScript)" + task :"eslint:apply" do + sh "npm run eslint:apply" + end end desc "Run all formats" diff --git a/share/al-quran.reflectslight.io/CHANGELOG.org b/share/al-quran.reflectslight.io/CHANGELOG.org index 2dc7aa1..765394d 100644 --- a/share/al-quran.reflectslight.io/CHANGELOG.org +++ b/share/al-quran.reflectslight.io/CHANGELOG.org @@ -1,3 +1,9 @@ +* vNEXT + +**** Add ~etc/~ +This change moves a large portion of the website's configuration +files to the ~/etc~ directory + * v0.9.0 **** Add ~share/al-quran.reflectslight.io/documentation/~