feat: Convert all app files to JS

This commit is contained in:
Faruk AYDIN
2024-01-05 17:44:21 +01:00
parent b95478b635
commit 43dba351c3
1030 changed files with 5114 additions and 6436 deletions

View File

@@ -1,23 +1,25 @@
import path from 'node:path';
import defineAction from '../../../../helpers/define-action';
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Create folder',
key: 'createFolder',
description: 'Create a new folder with the given parent folder and folder name',
description:
'Create a new folder with the given parent folder and folder name',
arguments: [
{
label: 'Folder',
key: 'parentFolder',
type: 'string' as const,
type: 'string',
required: true,
description: 'Enter the parent folder path, like /TextFiles/ or /Documents/Taxes/',
description:
'Enter the parent folder path, like /TextFiles/ or /Documents/Taxes/',
variables: true,
},
{
label: 'Folder Name',
key: 'folderName',
type: 'string' as const,
type: 'string',
required: true,
description: 'Enter the name for the new folder',
variables: true,
@@ -25,11 +27,13 @@ export default defineAction({
],
async run($) {
const parentFolder = $.step.parameters.parentFolder as string;
const folderName = $.step.parameters.folderName as string;
const parentFolder = $.step.parameters.parentFolder;
const folderName = $.step.parameters.folderName;
const folderPath = path.join(parentFolder, folderName);
const response = await $.http.post('/2/files/create_folder_v2', { path: folderPath });
const response = await $.http.post('/2/files/create_folder_v2', {
path: folderPath,
});
$.setActionItem({ raw: response.data });
},

View File

@@ -0,0 +1,4 @@
import createFolder from './create-folder/index.js';
import renameFile from './rename-file/index.js';
export default [createFolder, renameFile];

View File

@@ -1,4 +0,0 @@
import createFolder from "./create-folder";
import renameFile from "./rename-file";
export default [createFolder, renameFile];

View File

@@ -1,5 +1,5 @@
import path from 'node:path';
import defineAction from '../../../../helpers/define-action';
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Rename file',
@@ -9,25 +9,25 @@ export default defineAction({
{
label: 'File Path',
key: 'filePath',
type: 'string' as const,
type: 'string',
required: true,
description:
'Write the full path to the file such as /Folder1/File.pdf',
description: 'Write the full path to the file such as /Folder1/File.pdf',
variables: true,
},
{
label: 'New Name',
key: 'newName',
type: 'string' as const,
type: 'string',
required: true,
description: "Enter the new name for the file (without the extension, e.g., '.pdf')",
description:
"Enter the new name for the file (without the extension, e.g., '.pdf')",
variables: true,
},
],
async run($) {
const filePath = $.step.parameters.filePath as string;
const newName = $.step.parameters.newName as string;
const filePath = $.step.parameters.filePath;
const newName = $.step.parameters.newName;
const fileObject = path.parse(filePath);
const newPath = path.format({
dir: fileObject.dir,