ci: fix command

This commit is contained in:
Acid Chicken (硫酸鶏)
2023-04-06 22:58:59 +09:00
parent 36c207646e
commit fc118b5081
5 changed files with 64 additions and 90 deletions

View File

@@ -1,9 +1,6 @@
# (cd path/to/frontend; pnpm tsc -p .storybook)
# (cd path/to/frontend; node .storybook/generate.js)
/changes.js
/generate.js
# (cd path/to/frontend; node .storybook/preload-locale.js)
/preload-locale.js
/locale.ts
# (cd path/to/frontend; node .storybook/preload-theme.js)
/preload-theme.js
/themes.ts

View File

@@ -1,24 +1,41 @@
import fs from 'node:fs/promises';
import path from 'node:path';
import fs from "node:fs/promises";
import path from "node:path";
import micromatch from "micromatch";
fs.readFile(path.resolve(__dirname, '../storybook-static/preview-stats.json'))
.then((buffer) => {
const stats = JSON.parse(buffer.toString());
const modules = new Set(process.argv.slice(2).map((arg) => path.resolve(__dirname, '..', arg)));
for (;;) {
const oldSize = modules.size;
for (const module of Array.from(modules)) {
if (stats.modules[module]) {
for (const reason of stats.modules[module].reasons) {
modules.add(reason.moduleName);
}
fs.readFile(
path.resolve(__dirname, "../storybook-static/preview-stats.json")
).then((buffer) => {
const stats = JSON.parse(buffer.toString());
const modules = new Set(
process.argv.slice(2).map((arg) => path.relative(path.resolve(__dirname, ".."), path.resolve(__dirname, "../../..", arg)))
);
if (
micromatch(Array.from(modules), [
"../../assets/**",
"../../fluent-emojis/**",
"../../locales/**",
"../../misskey-assets/**",
"assets/**",
"public/**",
"../../pnpm-lock.yaml",
]).length
) {
return;
}
for (;;) {
const oldSize = modules.size;
for (const module of Array.from(modules)) {
if (stats.modules[module]) {
for (const reason of stats.modules[module].reasons) {
modules.add(reason.moduleName);
}
}
if (modules.size === oldSize) {
break;
}
}
for (const file of Array.from(modules)) {
process.stdout.write(` --only-story-files ${file}`);
if (modules.size === oldSize) {
break;
}
})
}
for (const file of Array.from(modules)) {
process.stdout.write(` --only-story-files ${path.resolve(__dirname, "..", file)}`);
}
});

View File

@@ -98,6 +98,7 @@
"@types/gulp": "4.0.10",
"@types/gulp-rename": "2.0.1",
"@types/matter-js": "0.18.2",
"@types/micromatch": "^4.0.2",
"@types/node": "18.15.11",
"@types/punycode": "2.1.0",
"@types/sanitize-html": "2.9.0",
@@ -122,6 +123,7 @@
"eslint-plugin-vue": "9.10.0",
"fast-glob": "3.2.12",
"happy-dom": "8.9.0",
"micromatch": "^4.0.5",
"msw": "1.2.1",
"msw-storybook-addon": "1.8.0",
"prettier": "2.8.7",