Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Commit

Permalink
publish files
Browse files Browse the repository at this point in the history
  • Loading branch information
bradmartin committed Mar 7, 2019
1 parent 68a3607 commit f5ad371
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
47 changes: 47 additions & 0 deletions publish/pack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

SOURCE_DIR=../src
TO_SOURCE_DIR=src
PACK_DIR=package
ROOT_DIR=..
PUBLISH=--publish

install() {
npm i
}

pack() {

echo 'Clearing /src and /package...'
node_modules/.bin/rimraf "$TO_SOURCE_DIR"
node_modules/.bin/rimraf "$PACK_DIR"

# copy src
echo 'Copying src...'
node_modules/.bin/ncp "$SOURCE_DIR" "$TO_SOURCE_DIR"

# copy README & LICENSE to src
echo 'Copying README and LICENSE to /src...'
node_modules/.bin/ncp "$ROOT_DIR"/LICENSE "$TO_SOURCE_DIR"/LICENSE
node_modules/.bin/ncp "$ROOT_DIR"/README.md "$TO_SOURCE_DIR"/README.md

# compile package and copy files required by npm
echo 'Building /src...'
cd "$TO_SOURCE_DIR"
node_modules/.bin/tsc
cd ..

echo 'Creating package...'
# create package dir
mkdir "$PACK_DIR"

# create the package
cd "$PACK_DIR"
npm pack ../"$TO_SOURCE_DIR"

# delete source directory used to create the package
cd ..
node_modules/.bin/rimraf "$TO_SOURCE_DIR"
}

install && pack
9 changes: 9 additions & 0 deletions publish/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "nativescript-publish",
"version": "1.0.0",
"description": "Publish helper",
"devDependencies": {
"ncp": "^2.0.0",
"rimraf": "^2.5.0"
}
}
11 changes: 11 additions & 0 deletions publish/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

PACK_DIR=package

publish() {
cd $PACK_DIR
echo 'Publishing to npm...'
npm publish *.tgz
}

./pack.sh && publish

0 comments on commit f5ad371

Please sign in to comment.