From a48278344aa8409d454ecd241b15f27585973d75 Mon Sep 17 00:00:00 2001 From: Pablo Klaschka Date: Tue, 26 Nov 2019 14:04:50 +0100 Subject: [PATCH 01/11] Added initial CI action --- .github/workflows/cli-test.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/cli-test.yml diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml new file mode 100644 index 0000000..b383357 --- /dev/null +++ b/.github/workflows/cli-test.yml @@ -0,0 +1,21 @@ +name: xdpm CI + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [8.x, 10.x, 12.x] + + steps: + - uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm link + - run: xdpm -v From 343e83c626e055569975c8538b534599f631d20b Mon Sep 17 00:00:00 2001 From: Pablo Klaschka Date: Tue, 26 Nov 2019 14:11:43 +0100 Subject: [PATCH 02/11] Added a few more test commands --- .github/workflows/cli-test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml index b383357..f92347d 100644 --- a/.github/workflows/cli-test.yml +++ b/.github/workflows/cli-test.yml @@ -19,3 +19,9 @@ jobs: - run: npm install - run: npm link - run: xdpm -v + - run: xdpm validate + continue-on-error: true + - run: xdpm package + continue-on-error: true + - run: xdpm install + continue-on-error: true From b7aa58ae2eccd52633098733dabcac1bf78c1bdd Mon Sep 17 00:00:00 2001 From: Pablo Klaschka Date: Tue, 26 Nov 2019 14:14:52 +0100 Subject: [PATCH 03/11] Added real test --- .github/workflows/cli-test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml index f92347d..8ea04e3 100644 --- a/.github/workflows/cli-test.yml +++ b/.github/workflows/cli-test.yml @@ -25,3 +25,6 @@ jobs: continue-on-error: true - run: xdpm install continue-on-error: true + - run: git clone https://github.com/AdobeXD/plugin-samples.git + - run: cd plugin-samples/quick-start + - run: xdpm validate From 325d4720c0a2bea0c1c34ac245e4e4275d0e6a5f Mon Sep 17 00:00:00 2001 From: Pablo Klaschka Date: Tue, 26 Nov 2019 14:18:37 +0100 Subject: [PATCH 04/11] Trying to fix the action --- .github/workflows/cli-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml index 8ea04e3..afb1c26 100644 --- a/.github/workflows/cli-test.yml +++ b/.github/workflows/cli-test.yml @@ -26,5 +26,5 @@ jobs: - run: xdpm install continue-on-error: true - run: git clone https://github.com/AdobeXD/plugin-samples.git - - run: cd plugin-samples/quick-start - run: xdpm validate + working-directory: ./plugin-samples/quick-start From d79328c4172ac4a965fdeb3d9c935d907540d273 Mon Sep 17 00:00:00 2001 From: Pablo Klaschka Date: Tue, 26 Nov 2019 14:22:30 +0100 Subject: [PATCH 05/11] Added failing validation and packaging --- .github/workflows/cli-test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml index afb1c26..fac9d76 100644 --- a/.github/workflows/cli-test.yml +++ b/.github/workflows/cli-test.yml @@ -28,3 +28,10 @@ jobs: - run: git clone https://github.com/AdobeXD/plugin-samples.git - run: xdpm validate working-directory: ./plugin-samples/quick-start + - run: xdpm package + working-directory: ./plugin-samples/quick-start + - run: echo "{}" > ./manifest.json + working-directory: ./plugin-samples/quick-start + - run: xdpm validate + working-directory: ./plugin-samples/quick-start + continue-on-error: true From fe8227037d5b7addb607d453dda02bffbd4923ac Mon Sep 17 00:00:00 2001 From: Ash Date: Thu, 12 Dec 2019 12:55:32 -0500 Subject: [PATCH 06/11] Fix error when icons property isn't present in manifest. --- lib/manifestSchema.js | 3 ++- lib/validate.js | 20 +++++++++++++------- package-lock.json | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/manifestSchema.js b/lib/manifestSchema.js index 0c3e62b..f328cbd 100644 --- a/lib/manifestSchema.js +++ b/lib/manifestSchema.js @@ -1,5 +1,5 @@ const manifestScema = { - required: ["id", "name", "version", "host", "uiEntryPoints"], + required: ["id", "name", "version", "icons", "host", "uiEntryPoints"], properties: { id: { type: "string", @@ -20,6 +20,7 @@ const manifestScema = { minItems: 2, uniqueItems: true, items: { + type: "object", required: ["path", "width", "height"], properties: { path: { diff --git a/lib/validate.js b/lib/validate.js index bd02e7f..799f212 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -24,23 +24,29 @@ function validate(manifest, { root, id } = {}) { let errors = []; var validate = ajv.compile(manifestScema); var valid = validate(manifest); + if ( id && manifest.id !== id ) { errors.push( `F1001: Manifest 'id' does not match expected id. Saw '${manifest.id}', expected '${id}'.` ); } + if (!valid) { errors = validate.errors.map( e => `${e.dataPath} (${JSON.stringify(e.params)}) -> ${e.message} ` ); } - manifest.icons.forEach((icon, idx) => { - if (!fs.existsSync(path.join(root || ".", icon.path))) { - errors.push( - `W2004: Icon ${idx} has path ${icon.path}, but no icon was found there.` - ); - } - }); + + if (manifest.icons) { + manifest.icons.forEach((icon, idx) => { + if (!fs.existsSync(path.join(root || ".", icon.path))) { + errors.push( + `W2004: Icon ${idx} has path ${icon.path}, but no icon was found there.` + ); + } + }); + } + return errors; } diff --git a/package-lock.json b/package-lock.json index 1e77fb6..9005419 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@adobe/xdpm", - "version": "3.0.2", + "version": "3.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { From 8b7285d04e28bdb9357e9ae29cdbc16696dacac5 Mon Sep 17 00:00:00 2001 From: Ash Date: Thu, 12 Dec 2019 12:57:38 -0500 Subject: [PATCH 07/11] Trying 2 platforms in action. --- .github/workflows/cli-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml index fac9d76..566ab0a 100644 --- a/.github/workflows/cli-test.yml +++ b/.github/workflows/cli-test.yml @@ -4,7 +4,7 @@ on: [push] jobs: build: - runs-on: ubuntu-latest + runs-on: [macos-latest, windows-latest] strategy: matrix: From c775f3976291218f1277befdcfc90d0b1c65ef0c Mon Sep 17 00:00:00 2001 From: Ash Date: Thu, 12 Dec 2019 13:01:09 -0500 Subject: [PATCH 08/11] 2 platforms take 2. --- .github/workflows/cli-test.yml | 36 ++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml index 566ab0a..f761dfb 100644 --- a/.github/workflows/cli-test.yml +++ b/.github/workflows/cli-test.yml @@ -3,8 +3,40 @@ name: xdpm CI on: [push] jobs: - build: - runs-on: [macos-latest, windows-latest] + mac: + runs-on: macos-latest + strategy: + matrix: + node-version: [8.x, 10.x, 12.x] + + steps: + - uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm link + - run: xdpm -v + - run: xdpm validate + continue-on-error: true + - run: xdpm package + continue-on-error: true + - run: xdpm install + continue-on-error: true + - run: git clone https://github.com/AdobeXD/plugin-samples.git + - run: xdpm validate + working-directory: ./plugin-samples/quick-start + - run: xdpm package + working-directory: ./plugin-samples/quick-start + - run: echo "{}" > ./manifest.json + working-directory: ./plugin-samples/quick-start + - run: xdpm validate + working-directory: ./plugin-samples/quick-start + continue-on-error: true + + windows: + runs-on: windows-latest strategy: matrix: From 4f6072a97da7245963b1eb1778784d5f6bee4519 Mon Sep 17 00:00:00 2001 From: Ash Date: Thu, 12 Dec 2019 13:08:49 -0500 Subject: [PATCH 09/11] Make sure the right dirs are in place for xdpm install. --- .github/workflows/cli-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml index f761dfb..111b583 100644 --- a/.github/workflows/cli-test.yml +++ b/.github/workflows/cli-test.yml @@ -22,6 +22,7 @@ jobs: continue-on-error: true - run: xdpm package continue-on-error: true + - run: mkdir -p /Users/runner/Library/Application\ Support/Adobe/Adobe\ XD - run: xdpm install continue-on-error: true - run: git clone https://github.com/AdobeXD/plugin-samples.git From 68d77bc9e584c5374f8d5c4dcec901d394412e16 Mon Sep 17 00:00:00 2001 From: Ash Date: Thu, 12 Dec 2019 13:12:11 -0500 Subject: [PATCH 10/11] Make sure the right dirs are in place for xdpm install for win. --- .github/workflows/cli-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml index 111b583..b8c84f6 100644 --- a/.github/workflows/cli-test.yml +++ b/.github/workflows/cli-test.yml @@ -56,6 +56,7 @@ jobs: continue-on-error: true - run: xdpm package continue-on-error: true + - run: mkdir -p /Users/runner/Library/Application\ Support/Adobe/Adobe\ XD - run: xdpm install continue-on-error: true - run: git clone https://github.com/AdobeXD/plugin-samples.git From d2aaaed45c8a045fbb7c333cb30bde0cbf1e7334 Mon Sep 17 00:00:00 2001 From: Ash Date: Thu, 12 Dec 2019 13:16:02 -0500 Subject: [PATCH 11/11] Make sure the right dirs are in place for xdpm install for win. --- .github/workflows/cli-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml index b8c84f6..d213e68 100644 --- a/.github/workflows/cli-test.yml +++ b/.github/workflows/cli-test.yml @@ -56,7 +56,7 @@ jobs: continue-on-error: true - run: xdpm package continue-on-error: true - - run: mkdir -p /Users/runner/Library/Application\ Support/Adobe/Adobe\ XD + - run: md C:\Users\runneradmin\AppData\Local\Packages\Adobe.CC.XD_adky2gkssdxte\LocalState - run: xdpm install continue-on-error: true - run: git clone https://github.com/AdobeXD/plugin-samples.git