From 28dae39ddd7034bbdd4f27a34962deacc01b990e Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Fri, 12 May 2017 19:48:03 -0400 Subject: [PATCH 1/9] Use stages instead of travis-after-all Also, parallelize tap tests --- .travis.yml | 49 +++++++++++++++++++++++++------------------------ package.json | 3 ++- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 29c45a807..0e68449f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,9 @@ language: node_js node_js: - 6 - node +env: + - NPM_SCRIPT=tap:unit -- --jobs=4 + - NPM_SCRIPT=tap:integration -- --jobs=4 sudo: false cache: directories: @@ -9,27 +12,25 @@ cache: install: - npm install - npm update -after_script: -- | - # RELEASE_BRANCHES and NPM_TOKEN defined in Travis settings panel - declare exitCode - $(npm bin)/travis-after-all - exitCode=$? - if [[ - # Execute after all jobs finish successfully - $exitCode = 0 && - # Only release on release branches - $RELEASE_BRANCHES =~ $TRAVIS_BRANCH && - # Don't release on PR builds - $TRAVIS_PULL_REQUEST = "false" - ]]; then - # Authenticate NPM - echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc - # Set version to timestamp - npm --no-git-tag-version version $($(npm bin)/json -f package.json version)-prerelease.$(date +%s) - npm publish - # Publish to gh-pages as most recent committer - git config --global user.email $(git log --pretty=format:"%ae" -n1) - git config --global user.name $(git log --pretty=format:"%an" -n1) - npm run --silent deploy -- -x -r $GH_PAGES_REPO - fi +script: npm run $NPM_SCRIPT +jobs: + include: + - env: NPM_SCRIPT=lint + node_js: 6 + - stage: release + node_js: 6 + script: true + before_deploy: npm --no-git-tag-version version $($(npm bin)/json -f package.json version)-prerelease.$(date +%s) + deploy: + - provider: script + on: + condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH + skip_cleanup: true + script: + - git config --global user.email $(git log --pretty=format:"%ae" -n1) + - git config --global user.name $(git log --pretty=format:"%an" -n1) + - npm run --silent deploy -- -x -r $GH_PAGES_REPO + - provider: npm + on: + condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH + api_key: $NPM_TOKEN diff --git a/package.json b/package.json index d51b27e2e..fe7347371 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,8 @@ "prepublish-watch": "npm run watch", "start": "./node_modules/.bin/webpack-dev-server", "tap": "./node_modules/.bin/tap ./test/{unit,integration}/*.js", + "tap:unit": "./node_modules/.bin/tap ./test/unit/*.js", + "tap:integration": "./node_modules/.bin/tap ./test/integration/*.js", "test": "npm run lint && npm run tap", "watch": "./node_modules/.bin/webpack --progress --colors --watch", "version": "./node_modules/.bin/json -f package.json -I -e \"this.repository.sha = '$(git log -n1 --pretty=format:%H)'\"" @@ -50,7 +52,6 @@ "socket.io-client": "1.7.3", "stats.js": "^0.17.0", "tap": "^10.2.0", - "travis-after-all": "^1.4.4", "webpack": "^2.4.1", "webpack-dev-server": "^2.4.1" } From 3431fb39c8461e5bffc23b67f9a1c3278b65d6df Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Sat, 13 May 2017 20:25:34 -0400 Subject: [PATCH 2/9] Don't run prepublish on install --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fe7347371..d20b86728 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,7 @@ "coverage": "./node_modules/.bin/tap ./test/{unit,integration}/*.js --coverage --coverage-report=lcov", "deploy": "touch playground/.nojekyll && ./node_modules/.bin/gh-pages -t -d playground -m \"Build for $(git log --pretty=format:%H -n1)\"", "lint": "./node_modules/.bin/eslint .", - "prepublish": "npm run build", - "prepublish-watch": "npm run watch", + "prepublish": "in-publish && npm run build || not-in-publish", "start": "./node_modules/.bin/webpack-dev-server", "tap": "./node_modules/.bin/tap ./test/{unit,integration}/*.js", "tap:unit": "./node_modules/.bin/tap ./test/unit/*.js", @@ -40,6 +39,7 @@ "highlightjs": "^9.8.0", "htmlparser2": "3.9.2", "immutable": "3.8.1", + "in-publish": "^2.0.0", "json": "^9.0.4", "lodash.defaultsdeep": "4.6.0", "minilog": "3.1.0", From 3f53c3fd5c7d3a93146d9cecfcaa7661c4735e40 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Sun, 14 May 2017 15:48:21 -0400 Subject: [PATCH 3/9] Allow condition alone to control release --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0e68449f0..e4be6aad9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ jobs: deploy: - provider: script on: + all_branches: true condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH skip_cleanup: true script: @@ -32,5 +33,6 @@ jobs: - npm run --silent deploy -- -x -r $GH_PAGES_REPO - provider: npm on: + all_branches: true condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH api_key: $NPM_TOKEN From e173a0ae2cc59884831b9a19c8241ef6ea1c9720 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Sun, 14 May 2017 15:56:06 -0400 Subject: [PATCH 4/9] Fix NPM_SCRIPT vars --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e4be6aad9..fab21efd1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ node_js: - 6 - node env: - - NPM_SCRIPT=tap:unit -- --jobs=4 - - NPM_SCRIPT=tap:integration -- --jobs=4 + - NPM_SCRIPT="tap:unit -- --jobs=4" + - NPM_SCRIPT="tap:integration -- --jobs=4" sudo: false cache: directories: From bd3a29650b73f3c668342c3c69dd14a5d7e58688 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Mon, 17 Jul 2017 12:02:48 -0400 Subject: [PATCH 5/9] Fix variable import scoping --- src/serialization/sb2.js | 61 ++++++++++++++++++++++++++------- src/virtual-machine.js | 7 ++-- test/fixtures/data.sb2 | Bin 55147 -> 55296 bytes test/unit/serialization_sb2.js | 17 +++++++++ test/unit/virtual-machine.js | 39 +++++++++++++++++++++ 5 files changed, 110 insertions(+), 14 deletions(-) diff --git a/src/serialization/sb2.js b/src/serialization/sb2.js index 2946756de..48e89f448 100644 --- a/src/serialization/sb2.js +++ b/src/serialization/sb2.js @@ -77,15 +77,16 @@ const flatten = function (blocks) { * a list of blocks in a branch (e.g., in forever), * or a list of blocks in an argument (e.g., move [pick random...]). * @param {Array.} blockList SB2 JSON-format block list. + * @param {Function} getVariableId function to retreive a variable's ID based on name * @return {Array.} Scratch VM-format block list. */ -const parseBlockList = function (blockList) { +const parseBlockList = function (blockList, getVariableId) { const resultingList = []; let previousBlock = null; // For setting next. for (let i = 0; i < blockList.length; i++) { const block = blockList[i]; // eslint-disable-next-line no-use-before-define - const parsedBlock = parseBlock(block); + const parsedBlock = parseBlock(block, getVariableId); if (typeof parsedBlock === 'undefined') continue; if (previousBlock) { parsedBlock.parent = previousBlock.id; @@ -102,14 +103,15 @@ const parseBlockList = function (blockList) { * This should only handle top-level scripts that include X, Y coordinates. * @param {!object} scripts Scripts object from SB2 JSON. * @param {!Blocks} blocks Blocks object to load parsed blocks into. + * @param {Function} getVariableId function to retreive a variable's ID based on name */ -const parseScripts = function (scripts, blocks) { +const parseScripts = function (scripts, blocks, getVariableId) { for (let i = 0; i < scripts.length; i++) { const script = scripts[i]; const scriptX = script[0]; const scriptY = script[1]; const blockList = script[2]; - const parsedBlockList = parseBlockList(blockList); + const parsedBlockList = parseBlockList(blockList, getVariableId); if (parsedBlockList[0]) { // Adjust script coordinates to account for // larger block size in scratch-blocks. @@ -127,6 +129,30 @@ const parseScripts = function (scripts, blocks) { } }; +/** + * Create a callback for assigning fixed IDs to imported variables + * Generator stores the global variable mapping in a closure + * @param {!string} targetId the id of the target to scope the variable to + * @return {string} variable ID + */ +const generateVariableIdGetter = (function () { + let globalVariableNameMap = {}; + const namer = (targetId, name) => `${targetId}-${name}`; + return function (targetId, topLevel) { + // Reset the global variable map if topLevel + if (topLevel) globalVariableNameMap = {}; + return function (name) { + if (topLevel) { // Store the name/id pair in the globalVariableNameMap + globalVariableNameMap[name] = namer(targetId, name); + return globalVariableNameMap[name]; + } + // Not top-level, so first check the global name map + if (globalVariableNameMap[name]) return globalVariableNameMap[name]; + return namer(targetId, name); + }; + }; +}()); + /** * Parse a single "Scratch object" and create all its in-memory VM objects. * @param {!object} object From-JSON "Scratch object:" sprite, stage, watcher. @@ -180,19 +206,18 @@ const parseScratchObject = function (object, runtime, topLevel) { soundPromises.push(loadSound(sound, runtime)); } } - // If included, parse any and all scripts/blocks on the object. - if (object.hasOwnProperty('scripts')) { - parseScripts(object.scripts, blocks); - } + // Create the first clone, and load its run-state from JSON. const target = sprite.createClone(); + const getVariableId = generateVariableIdGetter(target.id, topLevel); + // Load target properties from JSON. if (object.hasOwnProperty('variables')) { for (let j = 0; j < object.variables.length; j++) { const variable = object.variables[j]; const newVariable = new Variable( - null, + getVariableId(variable.name), variable.name, variable.value, variable.isPersistent @@ -200,6 +225,12 @@ const parseScratchObject = function (object, runtime, topLevel) { target.variables[newVariable.id] = newVariable; } } + + // If included, parse any and all scripts/blocks on the object. + if (object.hasOwnProperty('scripts')) { + parseScripts(object.scripts, blocks, getVariableId); + } + if (object.hasOwnProperty('lists')) { for (let k = 0; k < object.lists.length; k++) { const list = object.lists[k]; @@ -294,9 +325,10 @@ const sb2import = function (json, runtime, optForceSprite) { /** * Parse a single SB2 JSON-formatted block and its children. * @param {!object} sb2block SB2 JSON-formatted block. + * @param {Function} getVariableId function to retreive a variable's ID based on name * @return {object} Scratch VM format block. */ -const parseBlock = function (sb2block) { +const parseBlock = function (sb2block, getVariableId) { // First item in block object is the old opcode (e.g., 'forward:'). const oldOpcode = sb2block[0]; // Convert the block using the specMap. See sb2specmap.js. @@ -341,10 +373,10 @@ const parseBlock = function (sb2block) { let innerBlocks; if (typeof providedArg[0] === 'object' && providedArg[0]) { // Block list occupies the input. - innerBlocks = parseBlockList(providedArg); + innerBlocks = parseBlockList(providedArg, getVariableId); } else { // Single block occupies the input. - innerBlocks = [parseBlock(providedArg)]; + innerBlocks = [parseBlock(providedArg, getVariableId)]; } let previousBlock = null; for (let j = 0; j < innerBlocks.length; j++) { @@ -426,6 +458,11 @@ const parseBlock = function (sb2block) { name: expectedArg.fieldName, value: providedArg }; + + if (expectedArg.fieldName === 'VARIABLE') { + // Add `id` property to variable fields + activeBlock.fields[expectedArg.fieldName].id = getVariableId(providedArg); + } } } // Special cases to generate mutations. diff --git a/src/virtual-machine.js b/src/virtual-machine.js index 0cc3b7bb6..c3a0ba191 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -545,8 +545,11 @@ class VirtualMachine extends EventEmitter { * of the current editing target's blocks. */ emitWorkspaceUpdate () { - // @todo Include variables scoped to editing target also. - const variableMap = this.runtime.getTargetForStage().variables; + const variableMap = Object.assign({}, + this.runtime.getTargetForStage().variables, + this.editingTarget.variables + ); + const variables = Object.keys(variableMap).map(k => variableMap[k]); const xmlString = ` diff --git a/test/fixtures/data.sb2 b/test/fixtures/data.sb2 index a1a815efaa467375fbb1e5ec83c8ce0c5408d13f..e4b8c0b1c8658629cb8b77eb4afc10ac3bf0de7d 100644 GIT binary patch delta 1743 zcmaF8j=5n2bA5m}GYc030|N(xQQ||dWJ~4#a8?Ee0RaXE9-wGJQGQlxa*1A6aem(0 zaPQ*VW&(Dn_cuM&ocVEug2#u4^I~>;nr@usbH{UXpsC~p230kYgN&M%dB^_m zyj^t3InS4mP5k$Vb8BBquFQg zoHBUoq%mz~lGgVwmkIy$W|_yBxnBOXinYk^blc&hccU_O8tpDEv#Z{$In^y$O-uF8 z$I8zNJyxH1&L&rX=(MXUmS_ED5wQ1yoZ+W65&o{9S$^6&KZxGjDSsuXK_Rl)6^e0i^C#O~I7{>=Qly833(s@>J6 z7G`i&=qhY2vVXEi@OM}5q}5}8#r~ui`+%~Uq_i6*I(T7`|gfw zJgFKJ-WX3_^sQ&>6th2F_lj;>zP+!kr*HjU+1``$xCp!5N#}PTdDJ`QRpX=*?sFfi zjLog8b=|%AYxKR2qWfZtq>L0@y+xlg$#tLpuCSkOv@w4pII6a|${)HKju6#G1^`$Oqr``*{;M3(>e|$YFwC`|V zfrfVrO^XJe6DVyYJNIusJ)Ir~R|YC^>&5 zIf7cTDoiKOR)PDeV82H>>7L8NX4z|M2*Ub6ji@OJDyjtz!)= zce|nxUH(l{zw-3@hUY#veyg{Bx&L+J2CKDO+N2UDbT}qQzxiSQlsEI+6y|B^PsKtH zr&hb&?tFjk64$L=NlD+Gy5?4jyg&J%uVVWNU%!TM-nx3Ovb6$#KKkg%ySzQba&nvf z&i<9HQIhF*cco9cW#Fc?QshGMmg{F{vjtp`zOv5XJ#=&b=tjo<}d4_vcIxbdD~ibtZgR+e>=A&KmPrH!@I>PLhELyXI^w?x@_A_Ii z97CUYd*PjU$qNT11hbR4tPclNG1&4SJYG|E?Tbk59`+RD>z`YyW{L|=D>}pZ*rubv zC+S$tkv#^!&(9_rzp!a@=uZj|u&rC}&>uo_dF$2FotwMH(rb=i*ddXY2EB;qTJw+Z%UH zU8T@m&rmjfQl44J`jKW{tXi!!HRK+j+A{809~T|I=Q@>Jp`5?8JW0;)af!ET zPy5NFb&KvBy57nNFgY^IYuD_&=k>cn4>AiqYWY$))#T~ZDTV4cG$egFty^Nmu4=^2 za@k+vy(0FTKKBWo{N;{!ZzrDI__w6v)BkuT`)|_^EdFW|`Fq~F6&LS)Upvbv>-?OJ zXZm&YWhSWCGl)7D&-}aDz31ITAMPlTml<0{<|oLMG++37h(+)X>xrv>%zs*cO}V?G zpq`(R({%6c-SOd%-Alf2aG9I`$I``(@`O6I}iy1&= z@#dc_{H)9%1~=CuNigGsvY!N);bIdHP!b!jH; PE0g`Mi?h{T16cw9Wby_L delta 1611 zcmZvcdpOg39LIkdVTIg6ildgLmKiZhv1~cb0eZSA=dEVdm`}usI_g}B;&mdDzAm9lbh$IvM z02v^MwG;nRzo@ zBwQl|3QwTCW53I%yS? zu{9LF+nto$j*8w6?^K5w-r=WEradyr9NoQ3tl=XI4K{II3VTfWNApYFtqnyDfutxP3fbW)C!Z%=C@U zEyWwbWq}VoJK-yg=h@gtEGwk55%FkImRnm&I3l;9@BNwi?sw>Y_oDQeG2GGNHmS=! zB%jl~gkvRsqt}vl#;6Di3J_<+>J|1AF`I1?i97ch0#i43)F)?iPkcNyk zn|j5mG9tj0dv5+5a$n%p^s+;9OD-I*ocRQ5YRS|~yYV>Hk16$i7xPx?{RS@RFv3*( zaqeJgA2xHm;Y4I_5of$9F`jHtJ2rXGj~c$T$?5e_(>VHCmoL0nCE~tK37h-PwAapW zS`~~IB9~C*SyD2r0XKTG~keh#+8O0%i~!m!GkwY%06!C&vP(U;|C!Gl4C6fMv#`^7}f}3 zP@Tjxde!rz^~@Qstw9_|l}2r&=)EKS-ulfi}RZIi3o%m}%w zO`e|+a?2)A+Af~;@4dIPb*G&S9#dZ^;7pri=p0!^XvX|zSY4}}E)$`q7f%N9N{+B% z1RP7bA!}e$hVTgYu#};9y;9Qny4|z>x_rk%BiPjSr_xVDMrGRdM0=kNPEF~S(IlN= z6(UTq9U`y%n%f_Yo-mhELN;MDUS2&P9KA&?M?g8O8?sY3WG@qY?)De~=E~NvL>RZm zg{RYFnXtwWr)hfTeaDx`2H@F8&Aju;L1gHTFB*x>9sy3n?ag0h0dQ7(BlmHsDgo#7 z<^?yTDnD>PyoyU&&^Av8RR-d=-j-&B2TFmEvKa4^5+=|gt$ zcpB!gs}Z|U^>V_;HR7tpDeee?*wvV`@*uNZBQo?&FpWF()ymavvjxZ@KIL0siMZNT zwW-lgt*-tDMPy0jbs^P%n!@*0^F@VL1-k&i z@JFFHPZK;~4gf|!_!f^@7|B2+0f2bEZ(@xRHwp6z{ZA8o_5$^ZfrKa&&G##*J>q`r VD^eT9#id2};syZNIPp&W{0m!}$D9BF diff --git a/test/unit/serialization_sb2.js b/test/unit/serialization_sb2.js index cd3294f0a..68535b408 100644 --- a/test/unit/serialization_sb2.js +++ b/test/unit/serialization_sb2.js @@ -51,3 +51,20 @@ test('default', t => { t.end(); }); }); + +test('data scoping', t => { + // Get SB2 JSON (string) + const uri = path.resolve(__dirname, '../fixtures/data.sb2'); + const file = extract(uri); + const json = JSON.parse(file); + + // Create runtime instance & load SB2 into it + const rt = new Runtime(); + sb2.deserialize(json, rt).then(targets => { + const globalVariableIds = Object.keys(targets[0].variables); + const localVariableIds = Object.keys(targets[1].variables); + t.equal(targets[0].variables[globalVariableIds[0]].name, 'foo'); + t.equal(targets[1].variables[localVariableIds[0]].name, 'local'); + t.end(); + }); +}); diff --git a/test/unit/virtual-machine.js b/test/unit/virtual-machine.js index 9361ab918..94958569e 100644 --- a/test/unit/virtual-machine.js +++ b/test/unit/virtual-machine.js @@ -147,3 +147,42 @@ test('renameCostume sets the costume name', t => { t.equal(vm.editingTarget.sprite.costumes[1].name, 'hello2'); t.end(); }); + +test('emitWorkspaceUpdate', t => { + const vm = new VirtualMachine(); + vm.runtime.targets = [ + { + isStage: true, + variables: { + global: { + toXML: () => 'global' + } + } + }, { + variables: { + unused: { + toXML: () => 'unused' + } + } + }, { + variables: { + local: { + toXML: () => 'local' + } + }, + blocks: { + toXML: () => 'blocks' + } + } + ]; + vm.editingTarget = vm.runtime.targets[2]; + + let xml = null; + vm.emit = (event, data) => (xml = data.xml); + vm.emitWorkspaceUpdate(); + t.notEqual(xml.indexOf('global'), -1); + t.notEqual(xml.indexOf('local'), -1); + t.equal(xml.indexOf('unused'), -1); + t.notEqual(xml.indexOf('blocks'), -1); + t.end(); +}); From 0e11ff1c236ff56e1e129f5d22efecfe9e3c7eee Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Wed, 19 Jul 2017 10:28:54 -0400 Subject: [PATCH 6/9] Fix provider 'on' key being converted to 'true' --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fab21efd1..8ebf98bfb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ jobs: before_deploy: npm --no-git-tag-version version $($(npm bin)/json -f package.json version)-prerelease.$(date +%s) deploy: - provider: script - on: + "on": all_branches: true condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH skip_cleanup: true @@ -32,7 +32,7 @@ jobs: - git config --global user.name $(git log --pretty=format:"%an" -n1) - npm run --silent deploy -- -x -r $GH_PAGES_REPO - provider: npm - on: + "on": all_branches: true condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH api_key: $NPM_TOKEN From 55d0b2650ccc90eeb1255c8ac5c7ccef8f7e88dd Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Wed, 19 Jul 2017 11:54:51 -0400 Subject: [PATCH 7/9] Convert multi-entry script to single scalar Multi-entries aren't supported https://docs.travis-ci.com/user/deployment/script --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8ebf98bfb..7294016ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,10 +27,7 @@ jobs: all_branches: true condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH skip_cleanup: true - script: - - git config --global user.email $(git log --pretty=format:"%ae" -n1) - - git config --global user.name $(git log --pretty=format:"%an" -n1) - - npm run --silent deploy -- -x -r $GH_PAGES_REPO + script: git config --global user.email $(git log --pretty=format:"%ae" -n1) && git config --global user.name $(git log --pretty=format:"%an" -n1) && npm run --silent deploy -- -x -r $GH_PAGES_REPO - provider: npm "on": all_branches: true From 7eae7e19576accbb8a02309946619c6022c6acbf Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Wed, 19 Jul 2017 12:04:22 -0400 Subject: [PATCH 8/9] Build the vm so we can deploy it Whoops. Also move the git deploy setup to before_deploy. --- .travis.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7294016ca..87bd1a1bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,15 +19,18 @@ jobs: node_js: 6 - stage: release node_js: 6 - script: true - before_deploy: npm --no-git-tag-version version $($(npm bin)/json -f package.json version)-prerelease.$(date +%s) + env: NPM_SCRIPT=build + before_deploy: + - npm --no-git-tag-version version $($(npm bin)/json -f package.json version)-prerelease.$(date +%s) + - git config --global user.email $(git log --pretty=format:"%ae" -n1) + - git config --global user.name $(git log --pretty=format:"%an" -n1) deploy: - provider: script "on": all_branches: true condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH skip_cleanup: true - script: git config --global user.email $(git log --pretty=format:"%ae" -n1) && git config --global user.name $(git log --pretty=format:"%an" -n1) && npm run --silent deploy -- -x -r $GH_PAGES_REPO + script: npm run --silent deploy -- -x -r $GH_PAGES_REPO - provider: npm "on": all_branches: true From e0e10b61c529299d5e78720f8eafd645fa0fdfc3 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Wed, 19 Jul 2017 13:48:55 -0400 Subject: [PATCH 9/9] Finish configuring npm deploy More followup fixes on #567, wasn't possible to test npm deployments really. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 87bd1a1bd..955aa5bae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,4 +35,6 @@ jobs: "on": all_branches: true condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH + skip_cleanup: true + email: $NPM_EMAIL api_key: $NPM_TOKEN