Skip to content

Commit 3ba5d9c

Browse files
authored
GitHub actions revised (#1)
GitHub actions revised
2 parents aeaa227 + d2aaaed commit 3ba5d9c

File tree

4 files changed

+87
-9
lines changed

4 files changed

+87
-9
lines changed

.github/workflows/cli-test.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: xdpm CI
2+
3+
on: [push]
4+
5+
jobs:
6+
mac:
7+
runs-on: macos-latest
8+
strategy:
9+
matrix:
10+
node-version: [8.x, 10.x, 12.x]
11+
12+
steps:
13+
- uses: actions/checkout@v1
14+
- name: Use Node.js ${{ matrix.node-version }}
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: ${{ matrix.node-version }}
18+
- run: npm install
19+
- run: npm link
20+
- run: xdpm -v
21+
- run: xdpm validate
22+
continue-on-error: true
23+
- run: xdpm package
24+
continue-on-error: true
25+
- run: mkdir -p /Users/runner/Library/Application\ Support/Adobe/Adobe\ XD
26+
- run: xdpm install
27+
continue-on-error: true
28+
- run: git clone https://github.com/AdobeXD/plugin-samples.git
29+
- run: xdpm validate
30+
working-directory: ./plugin-samples/quick-start
31+
- run: xdpm package
32+
working-directory: ./plugin-samples/quick-start
33+
- run: echo "{}" > ./manifest.json
34+
working-directory: ./plugin-samples/quick-start
35+
- run: xdpm validate
36+
working-directory: ./plugin-samples/quick-start
37+
continue-on-error: true
38+
39+
windows:
40+
runs-on: windows-latest
41+
42+
strategy:
43+
matrix:
44+
node-version: [8.x, 10.x, 12.x]
45+
46+
steps:
47+
- uses: actions/checkout@v1
48+
- name: Use Node.js ${{ matrix.node-version }}
49+
uses: actions/setup-node@v1
50+
with:
51+
node-version: ${{ matrix.node-version }}
52+
- run: npm install
53+
- run: npm link
54+
- run: xdpm -v
55+
- run: xdpm validate
56+
continue-on-error: true
57+
- run: xdpm package
58+
continue-on-error: true
59+
- run: md C:\Users\runneradmin\AppData\Local\Packages\Adobe.CC.XD_adky2gkssdxte\LocalState
60+
- run: xdpm install
61+
continue-on-error: true
62+
- run: git clone https://github.com/AdobeXD/plugin-samples.git
63+
- run: xdpm validate
64+
working-directory: ./plugin-samples/quick-start
65+
- run: xdpm package
66+
working-directory: ./plugin-samples/quick-start
67+
- run: echo "{}" > ./manifest.json
68+
working-directory: ./plugin-samples/quick-start
69+
- run: xdpm validate
70+
working-directory: ./plugin-samples/quick-start
71+
continue-on-error: true

lib/manifestSchema.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const manifestScema = {
2-
required: ["id", "name", "version", "host", "uiEntryPoints"],
2+
required: ["id", "name", "version", "icons", "host", "uiEntryPoints"],
33
properties: {
44
id: {
55
type: "string",
@@ -20,6 +20,7 @@ const manifestScema = {
2020
minItems: 2,
2121
uniqueItems: true,
2222
items: {
23+
type: "object",
2324
required: ["path", "width", "height"],
2425
properties: {
2526
path: {

lib/validate.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,29 @@ function validate(manifest, { root, id } = {}) {
2424
let errors = [];
2525
var validate = ajv.compile(manifestScema);
2626
var valid = validate(manifest);
27+
2728
if ( id && manifest.id !== id ) {
2829
errors.push(
2930
`F1001: Manifest 'id' does not match expected id. Saw '${manifest.id}', expected '${id}'.`
3031
);
3132
}
33+
3234
if (!valid) {
3335
errors = validate.errors.map(
3436
e => `${e.dataPath} (${JSON.stringify(e.params)}) -> ${e.message} `
3537
);
3638
}
37-
manifest.icons.forEach((icon, idx) => {
38-
if (!fs.existsSync(path.join(root || ".", icon.path))) {
39-
errors.push(
40-
`W2004: Icon ${idx} has path ${icon.path}, but no icon was found there.`
41-
);
42-
}
43-
});
39+
40+
if (manifest.icons) {
41+
manifest.icons.forEach((icon, idx) => {
42+
if (!fs.existsSync(path.join(root || ".", icon.path))) {
43+
errors.push(
44+
`W2004: Icon ${idx} has path ${icon.path}, but no icon was found there.`
45+
);
46+
}
47+
});
48+
}
49+
4450
return errors;
4551
}
4652

package-lock.json

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

0 commit comments

Comments
 (0)