Skip to content

Commit

Permalink
🐛 Fix alfy bundle bug
Browse files Browse the repository at this point in the history
  • Loading branch information
顾一峰 committed Aug 29, 2023
1 parent 6d91ab6 commit 5bc1600
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 23 deletions.
21 changes: 0 additions & 21 deletions index.js

This file was deleted.

19 changes: 19 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {lstatSync, readdirSync} from 'fs-extra';
import {join} from 'node:path';

const WORKSPACE_DIR = process.env.WORKSPACE;
const filterArg = process.argv[2];

const directoryFilter = (filename) => {
return lstatSync(join(WORKSPACE_DIR, filename)).isDirectory();
};

const dirs = readdirSync(join(WORKSPACE_DIR)).filter(directoryFilter);
const items = dirs.filter(item => item.includes(filterArg)).map(item => ({
title: `工程:${item}`,
subtitle: item,
arg: join(WORKSPACE_DIR, item),
}));


console.log(JSON.stringify({items}, null, '\t'));
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "NODE_ENV=development rollup -c rollup.config.mjs -w",
"build": "NODE_ENV=production rollup -c rollup.config.mjs && ditto -ck './dist/' './dist/code.alfredworkflow'",
"prebuild": "rm -rf dist"
},
Expand Down
3 changes: 1 addition & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import resolve from '@rollup/plugin-node-resolve';
import json from '@rollup/plugin-json';
import copy from 'rollup-plugin-copy';


export default {
input: 'index.js',
input: 'index.mjs',
plugins: [
resolve(),
commonjs(),
Expand Down

0 comments on commit 5bc1600

Please sign in to comment.