Skip to content

Commit 7138a0d

Browse files
authored
Merge pull request #40 from alexandrtovmach/feat/ignore-files-opt
feat: Added ignoreFiles option to CLI
2 parents 5fd0396 + 4a784d2 commit 7138a0d

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ Plugin type options:
4343
## Installing a plugin
4444

4545
```shell
46-
xdpm install # Install the current folder into Adobe XD
47-
xdpm install path/to/plugin # Install the specified folder into Adobe XD
48-
xdpm install -w release # Install to Adobe XD CC Release (`r` is also valid; default)
49-
xdpm install -w prerelease # Install to Adobe XD CC Prerelease (`p` is also valid)
50-
xdpm install -o # Overwrite plugin if it exists
51-
xdpm install -c # Install cleanly (remove existing)
46+
xdpm install # Install the current folder into Adobe XD
47+
xdpm install path/to/plugin # Install the specified folder into Adobe XD
48+
xdpm install -w release # Install to Adobe XD CC Release (`r` is also valid; default)
49+
xdpm install -w prerelease # Install to Adobe XD CC Prerelease (`p` is also valid)
50+
xdpm install -o # Overwrite plugin if it exists
51+
xdpm install -c # Install cleanly (remove existing)
52+
xdpm install --ignore-files ".xdignore, .npmignore" # Override default list of .*ignore files ".gitignore, .xdignore, .npmignore"
5253
```
5354

5455
You can install a plugin folder into Adobe XD using `xdpm install [...folders]`. If you don't specify a folder `xdpm install` assumes your current directory is a plugin and will install it into Adobe XD.
@@ -58,11 +59,12 @@ If the plugin folder is not a valid XD plugin, you'll receive an error upon atte
5859
## Watching a plugin
5960

6061
```shell
61-
xdpm watch # Watch current folder and install changes into Adobe XD
62-
xdpm watch path/to/plugin # Watch the specified folder and install changes into Adobe XD
63-
xdpm watch -w release # Install to Adobe XD CC Release (`r` is also valid; default)
64-
xdpm watch -w prerelease # Install to Adobe XD CC Prerelease (`p` is also valid)
65-
xdpm watch -c # Perform clean installs when watching
62+
xdpm watch # Watch current folder and install changes into Adobe XD
63+
xdpm watch path/to/plugin # Watch the specified folder and install changes into Adobe XD
64+
xdpm watch -w release # Install to Adobe XD CC Release (`r` is also valid; default)
65+
xdpm watch -w prerelease # Install to Adobe XD CC Prerelease (`p` is also valid)
66+
xdpm watch -c # Perform clean installs when watching
67+
xdpm watch --ignore-files ".xdignore, .npmignore" # Override default list of .*ignore files ".gitignore, .xdignore, .npmignore"
6668
```
6769

6870
When developing a plugin, you can work directly in Adobe XD's `develop` folder, but this may not fit your particular workflow. In this case, you can invoke `xdpm watch` on a folder (or the current directory) and whenever changes are made, `xdpm install` will be automatically invoked to reinstall the plugins. This can simplify your development process significantly, especially if you don't use a build process.
@@ -111,6 +113,7 @@ Options:
111113
[r|p|d|release|pre|prerelease|dev|development] (Default is r)
112114
-k, --no-color Omit color from output
113115
--debug Show debug information
116+
--ignore-files Provide a custom list of .*ignore files, to override default ".gitignore, .xdignore, .npmignore"
114117
-h, --help Display help and usage details
115118

116119
Commands:

commands/install.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,26 @@ function install(opts, args) {
7373
} else {
7474
shell.mkdir(targetFolder);
7575
}
76-
76+
7777
// the comment below doesn't respect .xdignore (or other ignore files)
7878
// but this is the gist of what we're trying to accomplish
7979
// shell.cp("-R", path.join(sourcePath, "*"), targetFolder)
8080

81-
const files = ignoreWalk.sync({
81+
const walkConfig = {
8282
path: sourcePath,
8383
ignoreFiles: [".gitignore", ".xdignore", ".npmignore"],
8484
includeEmpty: false,
85-
}).filter(filterAlwaysIgnoredFile);
85+
}
86+
if (opts.ignoreFiles !== null) {
87+
walkConfig.ignoreFiles = opts.ignoreFiles
88+
.split(/,|\s/)
89+
.map((f) => f.trim())
90+
.filter(Boolean);
91+
}
92+
93+
const files = ignoreWalk
94+
.sync(walkConfig)
95+
.filter(filterAlwaysIgnoredFile);
8696

8797
files.forEach(file => {
8898
const srcFile = path.join(sourcePath, file);

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ const options = {
5151
"Which Adobe XD instance to target",
5252
["r", "p", "d", "release", "pre", "prerelease", "dev", "development"],
5353
"r"
54+
],
55+
ignoreFiles: [
56+
"ignore-files", "List of .*ignore files to proceed. Default is \".gitignore, .xdignore, .npmignore\"", 'string'
5457
]
5558
};
5659

0 commit comments

Comments
 (0)