mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
Chore: Seperate allPossibleCategories to @joplin/lib (#6754)
This commit is contained in:
parent
a7cdcaf25f
commit
6efe8c171a
@ -25,6 +25,7 @@
|
||||
"typescript": "^3.9.3",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11",
|
||||
"yargs": "^16.2.0"
|
||||
"yargs": "^16.2.0",
|
||||
"@joplin/lib": "~2.9"
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ const WebpackOnBuildPlugin = require('on-build-webpack');
|
||||
const tar = require('tar');
|
||||
const glob = require('glob');
|
||||
const execSync = require('child_process').execSync;
|
||||
const allPossibleCategories = require('@joplin/lib/pluginCategories.json');
|
||||
|
||||
const rootDir = path.resolve(__dirname);
|
||||
const userConfigFilename = './plugin.config.json';
|
||||
@ -29,7 +30,6 @@ const userConfig = Object.assign({}, {
|
||||
|
||||
const manifestPath = `${srcDir}/manifest.json`;
|
||||
const packageJsonPath = `${rootDir}/package.json`;
|
||||
const allPossibleCategories = ['appearance', 'developer tools', 'productivity', 'themes', 'integrations', 'viewer', 'search', 'tags', 'editor', 'files', 'personal knowledge management'];
|
||||
const allPossibleScreenshotsType = ['jpg', 'jpeg', 'png', 'gif', 'webp'];
|
||||
const manifest = readManifest(manifestPath);
|
||||
const pluginArchiveFilePath = path.resolve(publishDir, `${manifest.id}.jpl`);
|
||||
@ -73,7 +73,7 @@ function validateCategories(categories) {
|
||||
if (!categories) return null;
|
||||
if ((categories.length !== new Set(categories).size)) throw new Error('Repeated categories are not allowed');
|
||||
categories.forEach(category => {
|
||||
if (!allPossibleCategories.includes(category)) throw new Error(`${category} is not a valid category. Please make sure that the category name is lowercase. Valid Categories are: \n${allPossibleCategories}\n`);
|
||||
if (!allPossibleCategories.map(category => { return category.name; }).includes(category)) throw new Error(`${category} is not a valid category. Please make sure that the category name is lowercase. Valid categories are: \n${allPossibleCategories.map(category => { return category.name; })}\n`);
|
||||
});
|
||||
}
|
||||
|
||||
|
35
packages/lib/pluginCategories.json
Normal file
35
packages/lib/pluginCategories.json
Normal file
@ -0,0 +1,35 @@
|
||||
[
|
||||
{
|
||||
"name": "appearance"
|
||||
},
|
||||
{
|
||||
"name": "developer tools"
|
||||
},
|
||||
{
|
||||
"name": "productivity"
|
||||
},
|
||||
{
|
||||
"name": "themes"
|
||||
},
|
||||
{
|
||||
"name": "integrations"
|
||||
},
|
||||
{
|
||||
"name": "viewer"
|
||||
},
|
||||
{
|
||||
"name": "search"
|
||||
},
|
||||
{
|
||||
"name": "tags"
|
||||
},
|
||||
{
|
||||
"name": "editor"
|
||||
},
|
||||
{
|
||||
"name": "files"
|
||||
},
|
||||
{
|
||||
"name": "personal knowledge management"
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue
Block a user