Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
feat: support theme
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Dec 10, 2022
1 parent 2854b8a commit 1157175
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions scripts/after-build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const packageJSON = fs.readJsonSync('package.json');

const repoDir = path.join(__dirname, '..');
const distDir = path.join(__dirname, '..', 'dist');
const nodejsPluginOutDir = path.join(distDir, 'plugins', author, name);
const nodejsPluginOutDir = path.join(distDir, `${pluginInfo["plugin-type"]}s`, author, name);
// cross platform cp -r ${repoDir}/src/ ${nodejsPluginOutDir}/
const ignoredExtensions = packageJSON.ignoredExtensionsWhenBuildPlugin;
const copyOptions = {
Expand Down Expand Up @@ -65,7 +65,7 @@ function zipDirectory(source, out) {
}

if (process.env.CI) {
const outPath = path.join(__dirname, '..', 'plugins.zip');
const outPath = path.join(__dirname, '..', `${pluginInfo["plugin-type"]}s.zip`);
await zipDirectory(path.join(__dirname, '..', 'dist'), outPath);
await fs.move(outPath, path.join(distDir, 'out', 'plugins.zip'));
await fs.move(outPath, path.join(distDir, 'out', `${pluginInfo["plugin-type"]}s.zip`));
}
2 changes: 1 addition & 1 deletion scripts/build-demo-html.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const pluginTitle = `${author}/${name}`;

const repoDirectory = path.resolve(__dirname, '..');
const distDirectory = path.resolve(repoDirectory, 'dist');
const jsonPluginFileName = `$__plugins_${pluginTitle.replace('/', '_')}.json`;
const jsonPluginFileName = `$__${pluginInfo["plugin-type"]}s_${pluginTitle.replace('/', '_')}.json`;
// copy demo
await fs.copy(path.join(repoDirectory, 'demo'), distDirectory);
// copy json plugin
Expand Down
4 changes: 2 additions & 2 deletions scripts/dev/packup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const ENTRANCE_EXT_LIST = new Set(['.ts', '.tsx', '.jsx', '.mjs']);
const pluginInfo = fs.readJsonSync('src/plugin.info');
const [_, __, author, name] = pluginInfo.title.split('/');
const pluginTitle = `${author}/${name}`;
const DIST_PLUGIN_DIRECTORY = path.join(DISTNATION_DIRECTORY, 'plugins', pluginTitle);
const SRC_PLUGIN_DIRECTORY = path.join(SOURCE_DIRECTORY, 'plugins', pluginTitle);
const DIST_PLUGIN_DIRECTORY = path.join(DISTNATION_DIRECTORY, `${pluginInfo["plugin-type"]}s`, pluginTitle);

export const cleanDist = async () => {
const distJsTiddler = /^.*\.js\.dist\.tid$/;
Expand Down Expand Up @@ -106,7 +106,7 @@ const ignoredExtString =
? `|${packageJSON.ignoredExtensionsWhenBuildPlugin.map((ext) => ext.replace('.', '')).join('|')}`
: '';
// eslint-disable-next-line security/detect-non-literal-regexp, security-node/non-literal-reg-expr
const excludeFiles = new RegExp(`^.*.(tsx?|jsx|meta|swp|mjs${ignoredExtString})$|^.(git|hg|lock-wscript|svn|DS_Store|(wafpickle-|_).*)$|^CVS$|^npm-debug.log$`);
const excludeFiles = /^.*\.(tsx?|jsx|meta|swp|mjs)$|^\.(git|hg|lock-wscript|svn|DS_Store|(wafpickle-|_).*)$|^CVS$|^npm-debug\.log$/;

export const exportPlugins = ($tw, minify, exportToDistribution, exportToWiki) => {
// Ignore ts, tsx, jsm and jsx
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const target = RunTarget.mainJs(path.resolve('node_modules/tw5-plugin-packer/act
const options = RunOptions.create()
.setInputs({
minify: process.env.CI !== undefined,
source: [`dist/plugins/${pluginTitle}`],
source: [`dist/${pluginInfo["plugin-type"]}s/${pluginTitle}`],
output: 'dist/out',
'uglifyjs-options': '{ "warnings": false, "ie8": false, "safari10": false }',
'cleancss-options': '{ "compatibility": "*", "level": 2 }',
Expand Down

0 comments on commit 1157175

Please sign in to comment.