From 5ecf25d10e582f0723f9356bdb9a2d06f0c2fc3c Mon Sep 17 00:00:00 2001 From: Alan Velasco Date: Tue, 25 Jun 2019 19:55:51 -0700 Subject: [PATCH] Added fs-extra for creation of a dist and deploy procedure --- package.json | 4 +++- scripts/create-dist | 6 +++--- scripts/deploy.sh | 2 +- yarn.lock | 21 +++++++++++++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3fb8acf2..0d7f8af4 100644 --- a/package.json +++ b/package.json @@ -33,12 +33,14 @@ "module": "./dist/twemoji.esm.js", "unpkg": "./dist/twemoji.min.js", "scripts": { + "version": "yarn version", "build": "./scripts/generate", "test": "phantomjs ./src/test/testrunner.js", - "deploy": "./scripts/deploy.sh gh-pages-new 12.0.4", + "deploy": "./scripts/deploy.sh gh-pages 12.0.4", "prepublish": "run-s version build test deploy" }, "dependencies": { + "fs-extra": "^8.0.1", "twemoji-parser": "12.0.0" }, "files": [ diff --git a/scripts/create-dist b/scripts/create-dist index cbea5fdb..fff1e4a9 100755 --- a/scripts/create-dist +++ b/scripts/create-dist @@ -4,7 +4,7 @@ https://github.com/twitter/twemoji/blob/gh-pages/LICENSE */ -const fs = require('fs'); +const fs = require('fs-extra'); const path = require('path'); const { spawnSync } = require('child_process'); @@ -56,5 +56,5 @@ fs.writeFileSync(distFile('twemoji.min.js'), `${copyright}\n${minifiedContents}` fs.writeFileSync(distFile('twemoji.esm.js'), `${copyright}\n${minifiedContents}\nexport default twemoji;`); // Copy the png assets and svgs to the dist folder -fs.copyFileSync(file('assets/svg'), distFile('svg')); -fs.copyFileSync(file('assets/72x72'), distFile('72x72')); \ No newline at end of file +fs.copySync(file('assets/svg'), distFile('svg')); +fs.copySync(file('assets/72x72'), distFile('72x72')); \ No newline at end of file diff --git a/scripts/deploy.sh b/scripts/deploy.sh index d5d6c980..4276475c 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -4,7 +4,7 @@ ROOT=$( cd $(dirname $0)/.. /bin/pwd ) -OUTPUT="$ROOT/dist/" +OUT="$ROOT/dist/" PUBLISH_BRANCH=$1 VERSION=$2 diff --git a/yarn.lock b/yarn.lock index 6fe0f40c..d4a308ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -328,6 +328,15 @@ fs-extra@^1.0.0: jsonfile "^2.1.0" klaw "^1.0.0" +fs-extra@^8.0.1: + version "8.0.1" + resolved "https://artifactory.twitter.biz:443/api/npm/js-virtual/fs-extra/-/fs-extra-8.0.1.tgz#90294081f978b1f182f347a440a209154344285b" + integrity sha1-kClAgfl4sfGC80ekQKIJFUNEKFs= + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + function-bind@^1.0.2, function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -493,6 +502,13 @@ jsonfile@^2.1.0: optionalDependencies: graceful-fs "^4.1.6" +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://artifactory.twitter.biz:443/api/npm/js-virtual/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + optionalDependencies: + graceful-fs "^4.1.6" + jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" @@ -965,6 +981,11 @@ uglify-to-browserify@~1.0.0: resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" integrity sha1-bgkk1r2mta/jSeOabWMoUKD4grc= +universalify@^0.1.0: + version "0.1.2" + resolved "https://artifactory.twitter.biz:443/api/npm/js-virtual/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha1-tkb2m+OULavOzJ1mOcgNwQXvqmY= + uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"