-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from modos189/feature/list
Added generation of meta.json file with list of plugins
- Loading branch information
Showing
12 changed files
with
200 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,44 @@ | ||
import * as helpers from './helpers.js'; | ||
import nunjucks from 'nunjucks'; | ||
import fs from 'fs'; | ||
import {get_dist_plugins, get_stat_counters} from './helpers.js'; | ||
import {get_dist_plugins, get_plugins_in_categories, get_stat_counters} from './helpers.js'; | ||
|
||
export const run_update = async (metadata_files, force = false) => { | ||
export const run_update = async (metadata_files) => { | ||
let is_updated = false; | ||
for (const [filepath, author, filename] of metadata_files) { | ||
console.log(`Checking ${author}/${filename}`); | ||
const metadata = helpers.read_metadata_file(filepath); | ||
|
||
if (force || await helpers.is_plugin_update_available(metadata, author, filename)) { | ||
if (metadata === null) continue; | ||
if (await helpers.is_plugin_update_available(metadata, author, filename)) { | ||
console.log(`Updating ${author}/${filename}`); | ||
await helpers.update_plugin(metadata, author, filename); | ||
is_updated = true; | ||
} else { | ||
console.log(`${author}/${filename} is up to date`); | ||
} | ||
} | ||
return is_updated; | ||
}; | ||
|
||
export const make_plugins_list = () => { | ||
export const render_readme = async () => { | ||
const template = fs.readFileSync('templates/README.njk', 'utf8'); | ||
const plugins = get_dist_plugins(); | ||
const plugins = await get_dist_plugins(); | ||
const markers = get_stat_counters(plugins); | ||
markers.collection = plugins; | ||
markers.collection = get_plugins_in_categories(plugins); | ||
|
||
nunjucks.configure({ autoescape: true }); | ||
const readme = nunjucks.renderString(template, markers); | ||
|
||
fs.writeFileSync('../README.md', readme); | ||
console.log('README.md updated'); | ||
}; | ||
|
||
export const make_plugins_json = async () => { | ||
const plugins = await get_dist_plugins(); | ||
const meta_data = { | ||
plugins, | ||
version: 2 | ||
}; | ||
fs.writeFileSync('../dist/meta.json', JSON.stringify(meta_data, null, 2)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import globals from "globals"; | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import js from "@eslint/js"; | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all | ||
}); | ||
|
||
export default [...compat.extends("eslint:recommended"), { | ||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
}, | ||
|
||
ecmaVersion: 13, | ||
sourceType: "module", | ||
}, | ||
|
||
rules: { | ||
eqeqeq: "error", | ||
indent: ["warn", 4], | ||
|
||
"brace-style": ["error", "1tbs", { | ||
allowSingleLine: true, | ||
}], | ||
|
||
curly: ["error", "multi-line"], | ||
"keyword-spacing": "error", | ||
"spaced-comment": "error", | ||
|
||
quotes: ["error", "single", { | ||
avoidEscape: true, | ||
}], | ||
|
||
"no-trailing-spaces": "error", | ||
|
||
"max-len": ["warn", { | ||
code: 160, | ||
}], | ||
|
||
semi: "error", | ||
"eol-last": "error", | ||
"quote-props": ["error", "consistent-as-needed"], | ||
"no-unused-expressions": "error", | ||
}, | ||
}, { | ||
files: ["**/*.test.js", "**/*.spec.js"], | ||
|
||
rules: { | ||
"no-unused-expressions": "off", | ||
}, | ||
}]; |
Oops, something went wrong.