Skip to content

Commit f1b0f71

Browse files
author
Radoslaw Kamysz
committed
removed mkdirp
1 parent c7f0ae5 commit f1b0f71

File tree

4 files changed

+12
-54
lines changed

4 files changed

+12
-54
lines changed

Diff for: index.ts

-2
This file was deleted.

Diff for: package-lock.json

+3-41
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "adobe-node",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "Control Adobe applications - such as Photoshop, Animate, Illustrator, InDesign - from node. Run JavaScript to remotely - from the command line - create, modify or export document content. This module can be used to automate the workflow by creating an action chain that can be executed without user intervention.",
55
"main": "dist/index",
66
"scripts": {
@@ -37,9 +37,7 @@
3737
},
3838
"dependencies": {
3939
"@types/minimist": "^1.2.0",
40-
"@types/mkdirp-promise": "^5.0.0",
4140
"minimist": "^1.2.0",
42-
"mkdirp-promise": "^5.0.1",
4341
"tslib": "^1.10.0"
4442
}
4543
}

Diff for: src/script-file-creator.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as path from "path";
22
import * as fs from "fs";
3-
import mkdirp = require('mkdirp-promise');
43
import { AdobeAppName, AdobeAppScriptFileType, CommandFileCreator, AdobeScriptBuilder, BroadcastBuilder, Config, Options } from "./api";
54
import newAdobeScriptBuilder from './script-builder';
65
import { newBroadcastBuilder } from './broadcast';
@@ -59,13 +58,14 @@ const newAdobeScriptFileCreator = (config: Config): CommandFileCreator => {
5958

6059
const createFile = (command: string, content: string): Promise<string> => new Promise((resolve, reject) => {
6160
const filePath: string = path.join(adobeScriptsPath, `${command}.${scriptingExtension.get(appName)}`);
62-
mkdirp(path.dirname(filePath))
63-
.then(() => {
64-
fs.writeFile(filePath, content, "utf-8", (err) => {
65-
return err ? reject(err) : resolve(filePath)
66-
});
67-
})
68-
.catch((error) => reject(error));
61+
const fileDirname: string = path.dirname(filePath);
62+
if(fs.existsSync(fileDirname)) {
63+
fs.writeFile(filePath, content, "utf-8", (err) => {
64+
return err ? reject(err) : resolve(filePath)
65+
});
66+
} else {
67+
return reject(`The path (${fileDirname}) is not valid.`)
68+
}
6969
});
7070

7171
return {

0 commit comments

Comments
 (0)