Summary:
Publishing flipper to npm via Sandcastle.
- NPM token added to secrets tool
- removing private flag from package JSON
- adding publish script

Reviewed By: passy

Differential Revision: D16984934

fbshipit-source-id: 334991381d4035928af9a9d98d3905280938736a
This commit is contained in:
Daniel Büchele
2019-08-23 09:30:49 -07:00
committed by Facebook Github Bot
parent 853d80f182
commit f69bfab0f4
4 changed files with 30 additions and 1 deletions

6
.npmignore Normal file
View File

@@ -0,0 +1,6 @@
**
!src/**/*
__tests__
.DS_Store
src/plugins/**/*
src/fb/**/*

View File

@@ -1,6 +1,5 @@
{ {
"name": "flipper", "name": "flipper",
"private": true,
"version": "0.23.4", "version": "0.23.4",
"versionDate": "2018-4-12", "versionDate": "2018-4-12",
"description": "Mobile development tool", "description": "Mobile development tool",

19
scripts/npm-publish.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the LICENSE file
# in the root directory of this source tree.
set -e
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
cd "$THIS_DIR/.."
# remove scripts section from package.json, because we don't want post-install scripts executed for plugin developers
jq 'del(.scripts)' package.json > package2.json
rm package.json
mv package2.json package.json
echo "//registry.yarnpkg.com/:_authToken=$(secrets_tool get FLIPPER_NPM_TOKEN)" > ~/.npmrc
../third-party/yarn/yarn publish --proxy http://fwdproxy:8080 --https-proxy http://fwdproxy:8080 --new-version "$1"
rm -rf ~/.npmrc

View File

@@ -46,6 +46,11 @@
"shell": "shell":
"curl -x fwdproxy:8080 $(cat RELEASE.json | jq -r '.upload_url' | sed -e 's#{?name,label}##')'?access_token='$(secrets_tool get SONAR_GITHUB_TOKEN)'&name=Flipper.zip' --header 'Content-Type: application/zip' --upload-file $SANDCASTLE_NEXUS'/Flipper-mac.zip' -X POST", "curl -x fwdproxy:8080 $(cat RELEASE.json | jq -r '.upload_url' | sed -e 's#{?name,label}##')'?access_token='$(secrets_tool get SONAR_GITHUB_TOKEN)'&name=Flipper.zip' --header 'Content-Type: application/zip' --upload-file $SANDCASTLE_NEXUS'/Flipper-mac.zip' -X POST",
"shell_type": "SandcastleLocalShell" "shell_type": "SandcastleLocalShell"
},
{
"name": "NPM publish",
"required": true,
"shell": "cd ../xplat/sonar-public/scripts/ && ./npm-publish.sh __VERSION__"
} }
] ]
}, },