chore: 🎨 format
This commit is contained in:
parent
1fddd319c4
commit
2eea153ba1
|
@ -1,12 +1,12 @@
|
||||||
import { defineConfig } from 'cypress'
|
import { defineConfig } from "cypress";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
// We've imported your old cypress plugins here.
|
// We've imported your old cypress plugins here.
|
||||||
// You may want to clean this up later by importing these.
|
// You may want to clean this up later by importing these.
|
||||||
setupNodeEvents(on, config) {
|
setupNodeEvents(on, config) {
|
||||||
return require('./cypress/plugins/index.js')(on, config)
|
return require("./cypress/plugins/index.js")(on, config);
|
||||||
},
|
},
|
||||||
baseUrl: 'http://localhost:61812',
|
baseUrl: "http://localhost:61812",
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('Before setup instance', () => {
|
describe("Before setup instance", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.resetState();
|
cy.resetState();
|
||||||
});
|
});
|
||||||
|
@ -9,31 +9,31 @@ describe('Before setup instance', () => {
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('successfully loads', () => {
|
it("successfully loads", () => {
|
||||||
cy.visit('/');
|
cy.visit("/");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('setup instance', () => {
|
it("setup instance", () => {
|
||||||
cy.visit('/');
|
cy.visit("/");
|
||||||
|
|
||||||
cy.intercept('POST', '/api/admin/accounts/create').as('signup');
|
cy.intercept("POST", "/api/admin/accounts/create").as("signup");
|
||||||
|
|
||||||
cy.get('[data-cy-admin-username] input').type('admin');
|
cy.get("[data-cy-admin-username] input").type("admin");
|
||||||
cy.get('[data-cy-admin-password] input').type('admin1234');
|
cy.get("[data-cy-admin-password] input").type("admin1234");
|
||||||
cy.get('[data-cy-admin-ok]').click();
|
cy.get("[data-cy-admin-ok]").click();
|
||||||
|
|
||||||
// なぜか動かない
|
// なぜか動かない
|
||||||
//cy.wait('@signup').should('have.property', 'response.statusCode');
|
//cy.wait('@signup').should('have.property', 'response.statusCode');
|
||||||
cy.wait('@signup');
|
cy.wait("@signup");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('After setup instance', () => {
|
describe("After setup instance", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.resetState();
|
cy.resetState();
|
||||||
|
|
||||||
// インスタンス初期セットアップ
|
// インスタンス初期セットアップ
|
||||||
cy.registerUser('admin', 'pass', true);
|
cy.registerUser("admin", "pass", true);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
@ -42,34 +42,34 @@ describe('After setup instance', () => {
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('successfully loads', () => {
|
it("successfully loads", () => {
|
||||||
cy.visit('/');
|
cy.visit("/");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('signup', () => {
|
it("signup", () => {
|
||||||
cy.visit('/');
|
cy.visit("/");
|
||||||
|
|
||||||
cy.intercept('POST', '/api/signup').as('signup');
|
cy.intercept("POST", "/api/signup").as("signup");
|
||||||
|
|
||||||
cy.get('[data-cy-signup]').click();
|
cy.get("[data-cy-signup]").click();
|
||||||
cy.get('[data-cy-signup-username] input').type('alice');
|
cy.get("[data-cy-signup-username] input").type("alice");
|
||||||
cy.get('[data-cy-signup-password] input').type('alice1234');
|
cy.get("[data-cy-signup-password] input").type("alice1234");
|
||||||
cy.get('[data-cy-signup-password-retype] input').type('alice1234');
|
cy.get("[data-cy-signup-password-retype] input").type("alice1234");
|
||||||
cy.get('[data-cy-signup-submit]').click();
|
cy.get("[data-cy-signup-submit]").click();
|
||||||
|
|
||||||
cy.wait('@signup');
|
cy.wait("@signup");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('After user signup', () => {
|
describe("After user signup", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.resetState();
|
cy.resetState();
|
||||||
|
|
||||||
// インスタンス初期セットアップ
|
// インスタンス初期セットアップ
|
||||||
cy.registerUser('admin', 'pass', true);
|
cy.registerUser("admin", "pass", true);
|
||||||
|
|
||||||
// ユーザー作成
|
// ユーザー作成
|
||||||
cy.registerUser('alice', 'alice1234');
|
cy.registerUser("alice", "alice1234");
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
@ -78,51 +78,53 @@ describe('After user signup', () => {
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('successfully loads', () => {
|
it("successfully loads", () => {
|
||||||
cy.visit('/');
|
cy.visit("/");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('signin', () => {
|
it("signin", () => {
|
||||||
cy.visit('/');
|
cy.visit("/");
|
||||||
|
|
||||||
cy.intercept('POST', '/api/signin').as('signin');
|
cy.intercept("POST", "/api/signin").as("signin");
|
||||||
|
|
||||||
cy.get('[data-cy-signin]').click();
|
cy.get("[data-cy-signin]").click();
|
||||||
cy.get('[data-cy-signin-username] input').type('alice');
|
cy.get("[data-cy-signin-username] input").type("alice");
|
||||||
// Enterキーでサインインできるかの確認も兼ねる
|
// Enterキーでサインインできるかの確認も兼ねる
|
||||||
cy.get('[data-cy-signin-password] input').type('alice1234{enter}');
|
cy.get("[data-cy-signin-password] input").type("alice1234{enter}");
|
||||||
|
|
||||||
cy.wait('@signin');
|
cy.wait("@signin");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('suspend', function() {
|
it("suspend", function () {
|
||||||
cy.request('POST', '/api/admin/suspend-user', {
|
cy.request("POST", "/api/admin/suspend-user", {
|
||||||
i: this.admin.token,
|
i: this.admin.token,
|
||||||
userId: this.alice.id,
|
userId: this.alice.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.visit('/');
|
cy.visit("/");
|
||||||
|
|
||||||
cy.get('[data-cy-signin]').click();
|
cy.get("[data-cy-signin]").click();
|
||||||
cy.get('[data-cy-signin-username] input').type('alice');
|
cy.get("[data-cy-signin-username] input").type("alice");
|
||||||
cy.get('[data-cy-signin-password] input').type('alice1234{enter}');
|
cy.get("[data-cy-signin-password] input").type("alice1234{enter}");
|
||||||
|
|
||||||
// TODO: cypressにブラウザの言語指定できる機能が実装され次第英語のみテストするようにする
|
// TODO: cypressにブラウザの言語指定できる機能が実装され次第英語のみテストするようにする
|
||||||
cy.contains(/アカウントが凍結されています|This account has been suspended due to/gi);
|
cy.contains(
|
||||||
|
/アカウントが凍結されています|This account has been suspended due to/gi,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('After user singed in', () => {
|
describe("After user singed in", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.resetState();
|
cy.resetState();
|
||||||
|
|
||||||
// インスタンス初期セットアップ
|
// インスタンス初期セットアップ
|
||||||
cy.registerUser('admin', 'pass', true);
|
cy.registerUser("admin", "pass", true);
|
||||||
|
|
||||||
// ユーザー作成
|
// ユーザー作成
|
||||||
cy.registerUser('alice', 'alice1234');
|
cy.registerUser("alice", "alice1234");
|
||||||
|
|
||||||
cy.login('alice', 'alice1234');
|
cy.login("alice", "alice1234");
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
@ -131,16 +133,16 @@ describe('After user singed in', () => {
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('successfully loads', () => {
|
it("successfully loads", () => {
|
||||||
cy.get('[data-cy-open-post-form]').should('be.visible');
|
cy.get("[data-cy-open-post-form]").should("be.visible");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('note', () => {
|
it("note", () => {
|
||||||
cy.get('[data-cy-open-post-form]').click();
|
cy.get("[data-cy-open-post-form]").click();
|
||||||
cy.get('[data-cy-post-form-text]').type('Hello, Misskey!');
|
cy.get("[data-cy-post-form-text]").type("Hello, Misskey!");
|
||||||
cy.get('[data-cy-open-post-form-submit]').click();
|
cy.get("[data-cy-open-post-form-submit]").click();
|
||||||
|
|
||||||
cy.contains('Hello, Misskey!');
|
cy.contains("Hello, Misskey!");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
describe('After user signed in', () => {
|
describe("After user signed in", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.resetState();
|
cy.resetState();
|
||||||
cy.viewport('macbook-16');
|
cy.viewport("macbook-16");
|
||||||
// インスタンス初期セットアップ
|
// インスタンス初期セットアップ
|
||||||
cy.registerUser('admin', 'pass', true);
|
cy.registerUser("admin", "pass", true);
|
||||||
|
|
||||||
// ユーザー作成
|
// ユーザー作成
|
||||||
cy.registerUser('alice', 'alice1234');
|
cy.registerUser("alice", "alice1234");
|
||||||
|
|
||||||
cy.login('alice', 'alice1234');
|
cy.login("alice", "alice1234");
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
@ -17,47 +17,47 @@ describe('After user signed in', () => {
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('widget edit toggle is visible', () => {
|
it("widget edit toggle is visible", () => {
|
||||||
cy.get('.mk-widget-edit').should('be.visible');
|
cy.get(".mk-widget-edit").should("be.visible");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('widget select should be visible in edit mode', () => {
|
it("widget select should be visible in edit mode", () => {
|
||||||
cy.get('.mk-widget-edit').click();
|
cy.get(".mk-widget-edit").click();
|
||||||
cy.get('.mk-widget-select').should('be.visible');
|
cy.get(".mk-widget-select").should("be.visible");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('first widget should be removed', () => {
|
it("first widget should be removed", () => {
|
||||||
cy.get('.mk-widget-edit').click();
|
cy.get(".mk-widget-edit").click();
|
||||||
cy.get('.customize-container:first-child .remove._button').click();
|
cy.get(".customize-container:first-child .remove._button").click();
|
||||||
cy.get('.customize-container').should('have.length', 2);
|
cy.get(".customize-container").should("have.length", 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
function buildWidgetTest(widgetName) {
|
function buildWidgetTest(widgetName) {
|
||||||
it(`${widgetName} widget should get added`, () => {
|
it(`${widgetName} widget should get added`, () => {
|
||||||
cy.get('.mk-widget-edit').click();
|
cy.get(".mk-widget-edit").click();
|
||||||
cy.get('.mk-widget-select select').select(widgetName, { force: true });
|
cy.get(".mk-widget-select select").select(widgetName, { force: true });
|
||||||
cy.get('.bg._modalBg.transparent').click({ multiple: true, force: true });
|
cy.get(".bg._modalBg.transparent").click({ multiple: true, force: true });
|
||||||
cy.get('.mk-widget-add').click({ force: true });
|
cy.get(".mk-widget-add").click({ force: true });
|
||||||
cy.get(`.mkw-${widgetName}`).should('exist');
|
cy.get(`.mkw-${widgetName}`).should("exist");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
buildWidgetTest('memo');
|
buildWidgetTest("memo");
|
||||||
buildWidgetTest('notifications');
|
buildWidgetTest("notifications");
|
||||||
buildWidgetTest('timeline');
|
buildWidgetTest("timeline");
|
||||||
buildWidgetTest('calendar');
|
buildWidgetTest("calendar");
|
||||||
buildWidgetTest('rss');
|
buildWidgetTest("rss");
|
||||||
buildWidgetTest('trends');
|
buildWidgetTest("trends");
|
||||||
buildWidgetTest('clock');
|
buildWidgetTest("clock");
|
||||||
buildWidgetTest('activity');
|
buildWidgetTest("activity");
|
||||||
buildWidgetTest('photos');
|
buildWidgetTest("photos");
|
||||||
buildWidgetTest('digitalClock');
|
buildWidgetTest("digitalClock");
|
||||||
buildWidgetTest('federation');
|
buildWidgetTest("federation");
|
||||||
buildWidgetTest('postForm');
|
buildWidgetTest("postForm");
|
||||||
buildWidgetTest('slideshow');
|
buildWidgetTest("slideshow");
|
||||||
buildWidgetTest('serverMetric');
|
buildWidgetTest("serverMetric");
|
||||||
buildWidgetTest('onlineUsers');
|
buildWidgetTest("onlineUsers");
|
||||||
buildWidgetTest('jobQueue');
|
buildWidgetTest("jobQueue");
|
||||||
buildWidgetTest('button');
|
buildWidgetTest("button");
|
||||||
buildWidgetTest('aiscript');
|
buildWidgetTest("aiscript");
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,4 +18,4 @@
|
||||||
module.exports = (on, config) => {
|
module.exports = (on, config) => {
|
||||||
// `on` is used to hook into various events Cypress emits
|
// `on` is used to hook into various events Cypress emits
|
||||||
// `config` is the resolved Cypress config
|
// `config` is the resolved Cypress config
|
||||||
}
|
};
|
||||||
|
|
|
@ -24,32 +24,34 @@
|
||||||
// -- This will overwrite an existing command --
|
// -- This will overwrite an existing command --
|
||||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||||
|
|
||||||
Cypress.Commands.add('resetState', () => {
|
Cypress.Commands.add("resetState", () => {
|
||||||
cy.window(win => {
|
cy.window((win) => {
|
||||||
win.indexedDB.deleteDatabase('keyval-store');
|
win.indexedDB.deleteDatabase("keyval-store");
|
||||||
});
|
});
|
||||||
cy.request('POST', '/api/reset-db').as('reset');
|
cy.request("POST", "/api/reset-db").as("reset");
|
||||||
cy.get('@reset').its('status').should('equal', 204);
|
cy.get("@reset").its("status").should("equal", 204);
|
||||||
cy.reload(true);
|
cy.reload(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('registerUser', (username, password, isAdmin = false) => {
|
Cypress.Commands.add("registerUser", (username, password, isAdmin = false) => {
|
||||||
const route = isAdmin ? '/api/admin/accounts/create' : '/api/signup';
|
const route = isAdmin ? "/api/admin/accounts/create" : "/api/signup";
|
||||||
|
|
||||||
cy.request('POST', route, {
|
cy.request("POST", route, {
|
||||||
username: username,
|
username: username,
|
||||||
password: password,
|
password: password,
|
||||||
}).its('body').as(username);
|
})
|
||||||
|
.its("body")
|
||||||
|
.as(username);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('login', (username, password) => {
|
Cypress.Commands.add("login", (username, password) => {
|
||||||
cy.visit('/');
|
cy.visit("/");
|
||||||
|
|
||||||
cy.intercept('POST', '/api/signin').as('signin');
|
cy.intercept("POST", "/api/signin").as("signin");
|
||||||
|
|
||||||
cy.get('[data-cy-signin]').click();
|
cy.get("[data-cy-signin]").click();
|
||||||
cy.get('[data-cy-signin-username] input').type(username);
|
cy.get("[data-cy-signin-username] input").type(username);
|
||||||
cy.get('[data-cy-signin-password] input').type(`${password}{enter}`);
|
cy.get("[data-cy-signin-password] input").type(`${password}{enter}`);
|
||||||
|
|
||||||
cy.wait('@signin').as('signedIn');
|
cy.wait("@signin").as("signedIn");
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,19 +14,21 @@
|
||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
|
|
||||||
// Import commands.js using ES2015 syntax:
|
// Import commands.js using ES2015 syntax:
|
||||||
import './commands'
|
import "./commands";
|
||||||
|
|
||||||
// Alternatively you can use CommonJS syntax:
|
// Alternatively you can use CommonJS syntax:
|
||||||
// require('./commands')
|
// require('./commands')
|
||||||
|
|
||||||
Cypress.on('uncaught:exception', (err, runnable) => {
|
Cypress.on("uncaught:exception", (err, runnable) => {
|
||||||
if ([
|
if (
|
||||||
|
[
|
||||||
// Chrome
|
// Chrome
|
||||||
'ResizeObserver loop limit exceeded',
|
"ResizeObserver loop limit exceeded",
|
||||||
|
|
||||||
// Firefox
|
// Firefox
|
||||||
'ResizeObserver loop completed with undelivered notifications',
|
"ResizeObserver loop completed with undelivered notifications",
|
||||||
].some(msg => err.message.includes(msg))) {
|
].some((msg) => err.message.includes(msg))
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -530,7 +530,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
if (ps.cw !== note.cw || (ps.cw && !note.cw)) {
|
if (ps.cw !== note.cw || (ps.cw && !note.cw)) {
|
||||||
update.cw = ps.cw;
|
update.cw = ps.cw;
|
||||||
}
|
}
|
||||||
else if (!ps.cw && note.cw) {
|
if (!ps.cw && note.cw) {
|
||||||
update.cw = null;
|
update.cw = null;
|
||||||
}
|
}
|
||||||
if (ps.visibility !== note.visibility) {
|
if (ps.visibility !== note.visibility) {
|
||||||
|
|
|
@ -468,7 +468,9 @@ export default async (
|
||||||
} else if (boostedByRelay && data.renote?.uri) {
|
} else if (boostedByRelay && data.renote?.uri) {
|
||||||
// Use Redis transaction for atomicity
|
// Use Redis transaction for atomicity
|
||||||
await redisClient.watch(`publishedNote:${data.renote.uri}`);
|
await redisClient.watch(`publishedNote:${data.renote.uri}`);
|
||||||
const exists = await redisClient.exists(`publishedNote:${data.renote.uri}`);
|
const exists = await redisClient.exists(
|
||||||
|
`publishedNote:${data.renote.uri}`,
|
||||||
|
);
|
||||||
if (exists === 0) {
|
if (exists === 0) {
|
||||||
// Start the transaction
|
// Start the transaction
|
||||||
const transaction = redisClient.multi();
|
const transaction = redisClient.multi();
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"api": "pnpm api-extractor run --local --verbose",
|
"api": "pnpm api-extractor run --local --verbose",
|
||||||
"api-prod": "pnpm api-extractor run --verbose",
|
"api-prod": "pnpm api-extractor run --verbose",
|
||||||
"api-doc": "pnpm api-documenter markdown -i ./etc/",
|
"api-doc": "pnpm api-documenter markdown -i ./etc/",
|
||||||
"lint": "pnpm rome check --apply * && pnpm rome check --apply 'src/*.ts'",
|
"lint": "pnpm rome check --apply *.ts",
|
||||||
"format": "pnpm rome format --write '*' ; pnpm rome format --write '**/*.ts'",
|
"format": "pnpm rome format --write '*' ; pnpm rome format --write '**/*.ts'",
|
||||||
"jest": "jest --coverage --detectOpenHandles",
|
"jest": "jest --coverage --detectOpenHandles",
|
||||||
"test": "pnpm jest && pnpm tsd"
|
"test": "pnpm jest && pnpm tsd"
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { isTouchUsing } from "@/scripts/touch";
|
||||||
import { popup, alert } from "@/os";
|
import { popup, alert } from "@/os";
|
||||||
import { mainRouter } from "@/router";
|
import { mainRouter } from "@/router";
|
||||||
|
|
||||||
|
|
||||||
const start = isTouchUsing ? "touchstart" : "mouseover";
|
const start = isTouchUsing ? "touchstart" : "mouseover";
|
||||||
const end = isTouchUsing ? "touchend" : "mouseleave";
|
const end = isTouchUsing ? "touchend" : "mouseleave";
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ const apiClient = new Misskey.api.APIClient({
|
||||||
export const api = ((
|
export const api = ((
|
||||||
endpoint: string,
|
endpoint: string,
|
||||||
data: Record<string, any> = {},
|
data: Record<string, any> = {},
|
||||||
token?: string | null | undefined
|
token?: string | null | undefined,
|
||||||
) => {
|
) => {
|
||||||
pendingApiRequestsCount.value++;
|
pendingApiRequestsCount.value++;
|
||||||
|
|
||||||
|
@ -36,16 +36,13 @@ export const api = ((
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const promise = new Promise((resolve, reject) => {
|
const promise = new Promise((resolve, reject) => {
|
||||||
fetch(
|
fetch(endpoint.indexOf("://") > -1 ? endpoint : `${apiUrl}/${endpoint}`, {
|
||||||
endpoint.indexOf("://") > -1 ? endpoint : `${apiUrl}/${endpoint}`,
|
|
||||||
{
|
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
credentials: "omit",
|
credentials: "omit",
|
||||||
cache: "no-cache",
|
cache: "no-cache",
|
||||||
headers: authorization ? { authorization } : {},
|
headers: authorization ? { authorization } : {},
|
||||||
}
|
})
|
||||||
)
|
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const body = res.status === 204 ? null : await res.json();
|
const body = res.status === 204 ? null : await res.json();
|
||||||
|
|
||||||
|
@ -68,7 +65,7 @@ export const api = ((
|
||||||
export const apiGet = ((
|
export const apiGet = ((
|
||||||
endpoint: string,
|
endpoint: string,
|
||||||
data: Record<string, any> = {},
|
data: Record<string, any> = {},
|
||||||
token?: string | null | undefined
|
token?: string | null | undefined,
|
||||||
) => {
|
) => {
|
||||||
pendingApiRequestsCount.value++;
|
pendingApiRequestsCount.value++;
|
||||||
|
|
||||||
|
@ -113,7 +110,7 @@ export const apiGet = ((
|
||||||
export const apiWithDialog = ((
|
export const apiWithDialog = ((
|
||||||
endpoint: string,
|
endpoint: string,
|
||||||
data: Record<string, any> = {},
|
data: Record<string, any> = {},
|
||||||
token?: string | null | undefined
|
token?: string | null | undefined,
|
||||||
) => {
|
) => {
|
||||||
const promise = api(endpoint, data, token);
|
const promise = api(endpoint, data, token);
|
||||||
promiseDialog(promise, null, (err) => {
|
promiseDialog(promise, null, (err) => {
|
||||||
|
@ -130,7 +127,7 @@ export function promiseDialog<T extends Promise<any>>(
|
||||||
promise: T,
|
promise: T,
|
||||||
onSuccess?: ((res: any) => void) | null,
|
onSuccess?: ((res: any) => void) | null,
|
||||||
onFailure?: ((err: Error) => void) | null,
|
onFailure?: ((err: Error) => void) | null,
|
||||||
text?: string
|
text?: string,
|
||||||
): T {
|
): T {
|
||||||
const showing = ref(true);
|
const showing = ref(true);
|
||||||
const success = ref(false);
|
const success = ref(false);
|
||||||
|
@ -168,7 +165,7 @@ export function promiseDialog<T extends Promise<any>>(
|
||||||
text: text,
|
text: text,
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
|
@ -189,7 +186,7 @@ const zIndexes = {
|
||||||
high: 3000000,
|
high: 3000000,
|
||||||
};
|
};
|
||||||
export function claimZIndex(
|
export function claimZIndex(
|
||||||
priority: "low" | "middle" | "high" = "low"
|
priority: "low" | "middle" | "high" = "low",
|
||||||
): number {
|
): number {
|
||||||
zIndexes[priority] += 100;
|
zIndexes[priority] += 100;
|
||||||
return zIndexes[priority];
|
return zIndexes[priority];
|
||||||
|
@ -204,7 +201,7 @@ export async function popup(
|
||||||
component: Component,
|
component: Component,
|
||||||
props: Record<string, any>,
|
props: Record<string, any>,
|
||||||
events = {},
|
events = {},
|
||||||
disposeEvent?: string
|
disposeEvent?: string,
|
||||||
) {
|
) {
|
||||||
markRaw(component);
|
markRaw(component);
|
||||||
|
|
||||||
|
@ -245,7 +242,7 @@ export function pageWindow(path: string) {
|
||||||
initialPath: path,
|
initialPath: path,
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +257,7 @@ export function modalPageWindow(path: string) {
|
||||||
initialPath: path,
|
initialPath: path,
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +268,7 @@ export function toast(message: string) {
|
||||||
message,
|
message,
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +289,7 @@ export function alert(props: {
|
||||||
resolve();
|
resolve();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -316,7 +313,7 @@ export function confirm(props: {
|
||||||
resolve(result ? result : { canceled: true });
|
resolve(result ? result : { canceled: true });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -343,7 +340,7 @@ export function yesno(props: {
|
||||||
resolve(result ? result : { canceled: true });
|
resolve(result ? result : { canceled: true });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -384,7 +381,7 @@ export function inputText(props: {
|
||||||
resolve(result ? result : { canceled: true });
|
resolve(result ? result : { canceled: true });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -422,7 +419,7 @@ export function inputParagraph(props: {
|
||||||
resolve(result ? result : { canceled: true });
|
resolve(result ? result : { canceled: true });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -462,7 +459,7 @@ export function inputNumber(props: {
|
||||||
resolve(result ? result : { canceled: true });
|
resolve(result ? result : { canceled: true });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -499,11 +496,11 @@ export function inputDate(props: {
|
||||||
result: new Date(result.result),
|
result: new Date(result.result),
|
||||||
canceled: false,
|
canceled: false,
|
||||||
}
|
}
|
||||||
: { canceled: true }
|
: { canceled: true },
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -529,7 +526,7 @@ export function select<C = any>(
|
||||||
}[];
|
}[];
|
||||||
}[];
|
}[];
|
||||||
}
|
}
|
||||||
)
|
),
|
||||||
): Promise<
|
): Promise<
|
||||||
| { canceled: true; result: undefined }
|
| { canceled: true; result: undefined }
|
||||||
| {
|
| {
|
||||||
|
@ -554,7 +551,7 @@ export function select<C = any>(
|
||||||
resolve(result ? result : { canceled: true });
|
resolve(result ? result : { canceled: true });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -574,7 +571,7 @@ export function success(): Promise<void> {
|
||||||
{
|
{
|
||||||
done: () => resolve(),
|
done: () => resolve(),
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -591,7 +588,7 @@ export function waiting(): Promise<void> {
|
||||||
{
|
{
|
||||||
done: () => resolve(),
|
done: () => resolve(),
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -610,7 +607,7 @@ export function form(title, form) {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -629,7 +626,7 @@ export async function selectUser() {
|
||||||
resolve(user);
|
resolve(user);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -648,7 +645,7 @@ export async function selectInstance(): Promise<Misskey.entities.Instance> {
|
||||||
resolve(instance);
|
resolve(instance);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -672,7 +669,7 @@ export async function selectDriveFile(multiple: boolean) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -696,7 +693,7 @@ export async function selectDriveFolder(multiple: boolean) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -718,7 +715,7 @@ export async function pickEmoji(src: HTMLElement | null, opts) {
|
||||||
resolve(emoji);
|
resolve(emoji);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -727,7 +724,7 @@ export async function cropImage(
|
||||||
image: Misskey.entities.DriveFile,
|
image: Misskey.entities.DriveFile,
|
||||||
options: {
|
options: {
|
||||||
aspectRatio: number;
|
aspectRatio: number;
|
||||||
}
|
},
|
||||||
): Promise<Misskey.entities.DriveFile> {
|
): Promise<Misskey.entities.DriveFile> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
popup(
|
popup(
|
||||||
|
@ -745,7 +742,7 @@ export async function cropImage(
|
||||||
resolve(x);
|
resolve(x);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"closed"
|
"closed",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -760,7 +757,7 @@ let activeTextarea: HTMLTextAreaElement | HTMLInputElement | null = null;
|
||||||
export async function openEmojiPicker(
|
export async function openEmojiPicker(
|
||||||
src?: HTMLElement,
|
src?: HTMLElement,
|
||||||
opts,
|
opts,
|
||||||
initialTextarea: typeof activeTextarea
|
initialTextarea: typeof activeTextarea,
|
||||||
) {
|
) {
|
||||||
if (openingEmojiPicker) return;
|
if (openingEmojiPicker) return;
|
||||||
|
|
||||||
|
@ -776,14 +773,13 @@ export async function openEmojiPicker(
|
||||||
const observer = new MutationObserver((records) => {
|
const observer = new MutationObserver((records) => {
|
||||||
for (const record of records) {
|
for (const record of records) {
|
||||||
for (const node of Array.from(record.addedNodes).filter(
|
for (const node of Array.from(record.addedNodes).filter(
|
||||||
(node) => node instanceof HTMLElement
|
(node) => node instanceof HTMLElement,
|
||||||
) as HTMLElement[]) {
|
) as HTMLElement[]) {
|
||||||
const textareas = node.querySelectorAll("textarea, input");
|
const textareas = node.querySelectorAll("textarea, input");
|
||||||
for (const textarea of Array.from(textareas).filter(
|
for (const textarea of Array.from(textareas).filter(
|
||||||
(textarea) => textarea.dataset.preventEmojiInsert == null
|
(textarea) => textarea.dataset.preventEmojiInsert == null,
|
||||||
)) {
|
)) {
|
||||||
if (document.activeElement === textarea)
|
if (document.activeElement === textarea) activeTextarea = textarea;
|
||||||
activeTextarea = textarea;
|
|
||||||
textarea.addEventListener("focus", () => {
|
textarea.addEventListener("focus", () => {
|
||||||
activeTextarea = textarea;
|
activeTextarea = textarea;
|
||||||
});
|
});
|
||||||
|
@ -821,7 +817,7 @@ export async function openEmojiPicker(
|
||||||
openingEmojiPicker = null;
|
openingEmojiPicker = null;
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -833,7 +829,7 @@ export function popupMenu(
|
||||||
width?: number;
|
width?: number;
|
||||||
viaKeyboard?: boolean;
|
viaKeyboard?: boolean;
|
||||||
noReturnFocus?: boolean;
|
noReturnFocus?: boolean;
|
||||||
}
|
},
|
||||||
) {
|
) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let dispose;
|
let dispose;
|
||||||
|
@ -856,7 +852,7 @@ export function popupMenu(
|
||||||
resolve();
|
resolve();
|
||||||
dispose();
|
dispose();
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
).then((res) => {
|
).then((res) => {
|
||||||
dispose = res.dispose;
|
dispose = res.dispose;
|
||||||
});
|
});
|
||||||
|
@ -865,7 +861,7 @@ export function popupMenu(
|
||||||
|
|
||||||
export function contextMenu(
|
export function contextMenu(
|
||||||
items: MenuItem[] | Ref<MenuItem[]>,
|
items: MenuItem[] | Ref<MenuItem[]>,
|
||||||
ev: MouseEvent
|
ev: MouseEvent,
|
||||||
) {
|
) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -885,7 +881,7 @@ export function contextMenu(
|
||||||
resolve();
|
resolve();
|
||||||
dispose();
|
dispose();
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
).then((res) => {
|
).then((res) => {
|
||||||
dispose = res.dispose;
|
dispose = res.dispose;
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,11 +28,11 @@ export const categoryMapping = {
|
||||||
"People & Body": "people",
|
"People & Body": "people",
|
||||||
"Animals & Nature": "animals_and_nature",
|
"Animals & Nature": "animals_and_nature",
|
||||||
"Food & Drink": "food_and_drink",
|
"Food & Drink": "food_and_drink",
|
||||||
"Activities": "activity",
|
Activities: "activity",
|
||||||
"Travel & Places": "travel_and_places",
|
"Travel & Places": "travel_and_places",
|
||||||
"Objects": "objects",
|
Objects: "objects",
|
||||||
"Symbols": "symbols",
|
Symbols: "symbols",
|
||||||
"Flags": "flags",
|
Flags: "flags",
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const unicodeEmojiSkinTones = [
|
export const unicodeEmojiSkinTones = [
|
||||||
|
@ -52,19 +52,34 @@ export function addSkinTone(emoji: string, skinTone?: number) {
|
||||||
emojiComponents.medium_light_skin_tone,
|
emojiComponents.medium_light_skin_tone,
|
||||||
emojiComponents.medium_skin_tone,
|
emojiComponents.medium_skin_tone,
|
||||||
emojiComponents.medium_dark_skin_tone,
|
emojiComponents.medium_dark_skin_tone,
|
||||||
emojiComponents.dark_skin_tone
|
emojiComponents.dark_skin_tone,
|
||||||
];
|
];
|
||||||
return emoji + (skinToneModifiers[chosenSkinTone - 1] || "");
|
return emoji + (skinToneModifiers[chosenSkinTone - 1] || "");
|
||||||
}
|
}
|
||||||
|
|
||||||
const unicodeFifteenEmojis = [
|
const unicodeFifteenEmojis = [
|
||||||
'🫨', '🩷', '🩵', '🩶',
|
"🫨",
|
||||||
'🫷', '🫸', '🫎', '🫏',
|
"🩷",
|
||||||
'🪽', '🐦⬛', '🪿', '🪼',
|
"🩵",
|
||||||
'🪻', '🫚', '🫛', '🪭',
|
"🩶",
|
||||||
'🪮', '🪇', '🪈', '🪯',
|
"🫷",
|
||||||
'🛜'
|
"🫸",
|
||||||
]
|
"🫎",
|
||||||
|
"🫏",
|
||||||
|
"🪽",
|
||||||
|
"🐦⬛",
|
||||||
|
"🪿",
|
||||||
|
"🪼",
|
||||||
|
"🪻",
|
||||||
|
"🫚",
|
||||||
|
"🫛",
|
||||||
|
"🪭",
|
||||||
|
"🪮",
|
||||||
|
"🪇",
|
||||||
|
"🪈",
|
||||||
|
"🪯",
|
||||||
|
"🛜",
|
||||||
|
];
|
||||||
|
|
||||||
const newData = {};
|
const newData = {};
|
||||||
|
|
||||||
|
@ -84,7 +99,8 @@ Object.keys(data).forEach((originalCategory) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const emojilist: UnicodeEmojiDef[] = Object.keys(newData).reduce((acc, category) => {
|
export const emojilist: UnicodeEmojiDef[] = Object.keys(newData).reduce(
|
||||||
|
(acc, category) => {
|
||||||
const categoryItems = newData[category].map((item) => {
|
const categoryItems = newData[category].map((item) => {
|
||||||
return {
|
return {
|
||||||
emoji: item.emoji,
|
emoji: item.emoji,
|
||||||
|
@ -95,11 +111,14 @@ export const emojilist: UnicodeEmojiDef[] = Object.keys(newData).reduce((acc, ca
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return acc.concat(categoryItems);
|
return acc.concat(categoryItems);
|
||||||
}, []);
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
export function getNicelyLabeledCategory(internalName) {
|
export function getNicelyLabeledCategory(internalName) {
|
||||||
return Object.keys(categoryMapping).find(
|
return (
|
||||||
(key) => categoryMapping[key] === internalName
|
Object.keys(categoryMapping).find(
|
||||||
) || internalName;
|
(key) => categoryMapping[key] === internalName,
|
||||||
|
) || internalName
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,11 +358,13 @@ export function getNoteMenu(props: {
|
||||||
text: i18n.ts.copyLink,
|
text: i18n.ts.copyLink,
|
||||||
action: copyLink,
|
action: copyLink,
|
||||||
},
|
},
|
||||||
appearNote.url || appearNote.uri ? {
|
appearNote.url || appearNote.uri
|
||||||
|
? {
|
||||||
icon: "ph-link-simple ph-bold ph-lg",
|
icon: "ph-link-simple ph-bold ph-lg",
|
||||||
text: `${i18n.ts.copyLink} (${i18n.ts.remote})`,
|
text: `${i18n.ts.copyLink} (${i18n.ts.remote})`,
|
||||||
action: copyOriginal,
|
action: copyOriginal,
|
||||||
} : undefined,
|
}
|
||||||
|
: undefined,
|
||||||
shareAvailable()
|
shareAvailable()
|
||||||
? {
|
? {
|
||||||
icon: "ph-share-network ph-bold ph-lg",
|
icon: "ph-share-network ph-bold ph-lg",
|
||||||
|
@ -370,7 +372,7 @@ export function getNoteMenu(props: {
|
||||||
action: share,
|
action: share,
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
...($i.isModerator || $i.isAdmin ? [
|
...($i.isModerator || $i.isAdmin ? [
|
||||||
|
@ -435,8 +437,9 @@ export function getNoteMenu(props: {
|
||||||
type: "parent",
|
type: "parent",
|
||||||
icon: "ph-user ph-bold ph-lg",
|
icon: "ph-user ph-bold ph-lg",
|
||||||
text: i18n.ts.user,
|
text: i18n.ts.user,
|
||||||
children: getUserMenu(appearNote.user)
|
children: getUserMenu(appearNote.user),
|
||||||
} : undefined,
|
}
|
||||||
|
: undefined,
|
||||||
].filter((x) => x !== undefined);
|
].filter((x) => x !== undefined);
|
||||||
} else {
|
} else {
|
||||||
menu = [
|
menu = [
|
||||||
|
@ -459,11 +462,13 @@ export function getNoteMenu(props: {
|
||||||
text: i18n.ts.copyLink,
|
text: i18n.ts.copyLink,
|
||||||
action: copyLink,
|
action: copyLink,
|
||||||
},
|
},
|
||||||
appearNote.url || appearNote.uri ? {
|
appearNote.url || appearNote.uri
|
||||||
|
? {
|
||||||
icon: "ph-link-simple ph-bold ph-lg",
|
icon: "ph-link-simple ph-bold ph-lg",
|
||||||
text: `${i18n.ts.copyLink} (${i18n.ts.remote})`,
|
text: `${i18n.ts.copyLink} (${i18n.ts.remote})`,
|
||||||
action: copyOriginal,
|
action: copyOriginal,
|
||||||
} : undefined,
|
}
|
||||||
|
: undefined,
|
||||||
shareAvailable()
|
shareAvailable()
|
||||||
? {
|
? {
|
||||||
icon: "ph-share-network ph-bold ph-lg",
|
icon: "ph-share-network ph-bold ph-lg",
|
||||||
|
|
|
@ -227,7 +227,9 @@ export function getUserMenu(user, router: Router = mainRouter) {
|
||||||
let menu = [
|
let menu = [
|
||||||
{
|
{
|
||||||
type: "label",
|
type: "label",
|
||||||
text: user.host ? `@${user.username}@${user.host || host}` : `@${user.username}`
|
text: user.host
|
||||||
|
? `@${user.username}@${user.host || host}`
|
||||||
|
: `@${user.username}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "ph-at ph-bold ph-lg",
|
icon: "ph-at ph-bold ph-lg",
|
||||||
|
|
|
@ -337,7 +337,7 @@ export const defaultStore = markRaw(
|
||||||
showTimelineReplies: {
|
showTimelineReplies: {
|
||||||
where: "device",
|
where: "device",
|
||||||
default: true,
|
default: true,
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -8,16 +8,8 @@ console.log(themeColor("/ /__| (_| | | (__| < __/ |_| |"));
|
||||||
console.log(themeColor("\\____/\\__,_|_|\\___|_|\\_\\___|\\__, |"));
|
console.log(themeColor("\\____/\\__,_|_|\\___|_|\\_\\___|\\__, |"));
|
||||||
console.log(themeColor(" (___/ "));
|
console.log(themeColor(" (___/ "));
|
||||||
|
|
||||||
|
console.log(" Currently building Calckey!");
|
||||||
console.log(
|
console.log(
|
||||||
" Currently building Calckey!",
|
chalk.rgb(255, 136, 0)(" Hang on for a moment, as this may take a while."),
|
||||||
);
|
|
||||||
console.log(
|
|
||||||
chalk.rgb(
|
|
||||||
255,
|
|
||||||
136,
|
|
||||||
0,
|
|
||||||
)(
|
|
||||||
" Hang on for a moment, as this may take a while.",
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
console.log("");
|
console.log("");
|
||||||
|
|
|
@ -1,30 +1,57 @@
|
||||||
const fs = require('node:fs');
|
const fs = require("node:fs");
|
||||||
const execa = require('execa');
|
const execa = require("execa");
|
||||||
const { join } = require('node:path');
|
const { join } = require("node:path");
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
fs.rmSync(join(__dirname, '/../packages/backend/built'), { recursive: true, force: true });
|
fs.rmSync(join(__dirname, "/../packages/backend/built"), {
|
||||||
fs.rmSync(join(__dirname, '/../packages/backend/node_modules'), { recursive: true, force: true });
|
recursive: true,
|
||||||
|
force: true,
|
||||||
fs.rmSync(join(__dirname, '/../packages/backend/native-utils/built'), { recursive: true, force: true });
|
});
|
||||||
fs.rmSync(join(__dirname, '/../packages/backend/native-utils/node_modules'), { recursive: true, force: true });
|
fs.rmSync(join(__dirname, "/../packages/backend/node_modules"), {
|
||||||
|
recursive: true,
|
||||||
fs.rmSync(join(__dirname, '/../packages/client/built'), { recursive: true, force: true });
|
force: true,
|
||||||
fs.rmSync(join(__dirname, '/../packages/client/node_modules'), { recursive: true, force: true });
|
|
||||||
|
|
||||||
fs.rmSync(join(__dirname, '/../packages/sw/built'), { recursive: true, force: true });
|
|
||||||
fs.rmSync(join(__dirname, '/../packages/sw/node_modules'), { recursive: true, force: true });
|
|
||||||
|
|
||||||
fs.rmSync(join(__dirname, '/../built'), { recursive: true, force: true });
|
|
||||||
fs.rmSync(join(__dirname, '/../node_modules'), { recursive: true, force: true });
|
|
||||||
|
|
||||||
execa('pnpm', ['store', 'prune'], {
|
|
||||||
cwd: join(__dirname, '/../'),
|
|
||||||
stdio: 'inherit'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
execa('cargo', ['clean'], {
|
fs.rmSync(join(__dirname, "/../packages/backend/native-utils/built"), {
|
||||||
cwd: join(__dirname, '/../packages/backend/native-utils'),
|
recursive: true,
|
||||||
stdio: 'inherit'
|
force: true,
|
||||||
|
});
|
||||||
|
fs.rmSync(join(__dirname, "/../packages/backend/native-utils/node_modules"), {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
fs.rmSync(join(__dirname, "/../packages/client/built"), {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
fs.rmSync(join(__dirname, "/../packages/client/node_modules"), {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
fs.rmSync(join(__dirname, "/../packages/sw/built"), {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
fs.rmSync(join(__dirname, "/../packages/sw/node_modules"), {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
fs.rmSync(join(__dirname, "/../built"), { recursive: true, force: true });
|
||||||
|
fs.rmSync(join(__dirname, "/../node_modules"), {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
execa("pnpm", ["store", "prune"], {
|
||||||
|
cwd: join(__dirname, "/../"),
|
||||||
|
stdio: "inherit",
|
||||||
|
});
|
||||||
|
|
||||||
|
execa("cargo", ["clean"], {
|
||||||
|
cwd: join(__dirname, "/../packages/backend/native-utils"),
|
||||||
|
stdio: "inherit",
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,10 +1,22 @@
|
||||||
const fs = require('node:fs');
|
const fs = require("node:fs");
|
||||||
const { join } = require('node:path');
|
const { join } = require("node:path");
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
fs.rmSync(join(__dirname, '/../packages/backend/built'), { recursive: true, force: true });
|
fs.rmSync(join(__dirname, "/../packages/backend/built"), {
|
||||||
fs.rmSync(join(__dirname, '/../packages/backend/native-utils/built'), { recursive: true, force: true });
|
recursive: true,
|
||||||
fs.rmSync(join(__dirname, '/../packages/client/built'), { recursive: true, force: true });
|
force: true,
|
||||||
fs.rmSync(join(__dirname, '/../packages/sw/built'), { recursive: true, force: true });
|
});
|
||||||
fs.rmSync(join(__dirname, '/../built'), { recursive: true, force: true });
|
fs.rmSync(join(__dirname, "/../packages/backend/native-utils/built"), {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
fs.rmSync(join(__dirname, "/../packages/client/built"), {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
fs.rmSync(join(__dirname, "/../packages/sw/built"), {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
fs.rmSync(join(__dirname, "/../built"), { recursive: true, force: true });
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,45 +1,45 @@
|
||||||
const execa = require('execa');
|
const execa = require("execa");
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
await execa('pnpm', ['clean'], {
|
await execa("pnpm", ["clean"], {
|
||||||
cwd: __dirname + '/../',
|
cwd: __dirname + "/../",
|
||||||
stdout: process.stdout,
|
stdout: process.stdout,
|
||||||
stderr: process.stderr,
|
stderr: process.stderr,
|
||||||
});
|
});
|
||||||
|
|
||||||
execa('pnpm', ['dlx', 'gulp', 'watch'], {
|
execa("pnpm", ["dlx", "gulp", "watch"], {
|
||||||
cwd: __dirname + '/../',
|
cwd: __dirname + "/../",
|
||||||
stdout: process.stdout,
|
stdout: process.stdout,
|
||||||
stderr: process.stderr,
|
stderr: process.stderr,
|
||||||
});
|
});
|
||||||
|
|
||||||
execa('pnpm', ['--filter', 'backend', 'watch'], {
|
execa("pnpm", ["--filter", "backend", "watch"], {
|
||||||
cwd: __dirname + '/../',
|
cwd: __dirname + "/../",
|
||||||
stdout: process.stdout,
|
stdout: process.stdout,
|
||||||
stderr: process.stderr,
|
stderr: process.stderr,
|
||||||
});
|
});
|
||||||
|
|
||||||
execa('pnpm', ['--filter', 'client', 'watch'], {
|
execa("pnpm", ["--filter", "client", "watch"], {
|
||||||
cwd: __dirname + '/../',
|
cwd: __dirname + "/../",
|
||||||
stdout: process.stdout,
|
stdout: process.stdout,
|
||||||
stderr: process.stderr,
|
stderr: process.stderr,
|
||||||
});
|
});
|
||||||
|
|
||||||
execa('pnpm', ['--filter', 'sw', 'watch'], {
|
execa("pnpm", ["--filter", "sw", "watch"], {
|
||||||
cwd: __dirname + '/../',
|
cwd: __dirname + "/../",
|
||||||
stdout: process.stdout,
|
stdout: process.stdout,
|
||||||
stderr: process.stderr,
|
stderr: process.stderr,
|
||||||
});
|
});
|
||||||
|
|
||||||
const start = async () => {
|
const start = async () => {
|
||||||
try {
|
try {
|
||||||
await execa('pnpm', ['start'], {
|
await execa("pnpm", ["start"], {
|
||||||
cwd: __dirname + '/../',
|
cwd: __dirname + "/../",
|
||||||
stdout: process.stdout,
|
stdout: process.stdout,
|
||||||
stderr: process.stderr,
|
stderr: process.stderr,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await new Promise(resolve => setTimeout(resolve, 3000));
|
await new Promise((resolve) => setTimeout(resolve, 3000));
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue