Skip to content

Commit

Permalink
Restructure PlugJS
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospassos committed May 18, 2020
1 parent 4771521 commit 928ff79
Show file tree
Hide file tree
Showing 21 changed files with 517 additions and 706 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"consistent-return": "off",
"default-case": "off",
"import/extensions": ["error", "never"],
"import/no-unresolved": "off",
"import/prefer-default-export": "off",
"indent": ["error", 4, {"SwitchCase": 1}],
"linebreak-style": ["error", "unix"],
Expand Down
64 changes: 27 additions & 37 deletions .github/workflows/deploy-published-releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,38 @@ jobs:
npm ci
rm -rf ~/.npmrc
- name: Build bundles
- name: Build package
run: |-
npm run rollup
npm run rollup-min
npm run build
# Clear dependencies from package-lock.json
mv package.json package-full.json
cat package-full.json | \
jq 'del(.dependencies) | del(.devDependencies) | del(.testDependencies) | del(.jest) | del(.scripts)' | \
jq '.main = "build/index.js" | .types = "build/index.d.ts"' | \
jq ".version = \"${GITHUB_REF##*/}\"" > package.json
cat package.json
- name: Prepare release
run: |-
cp package.json LICENSE README.md build/
cd build
sed -i -e "s~\"version\": \"0.0.0-dev\"~\"version\": \"${GITHUB_REF##*/}\"~" package.json
echo
echo "Clearing lock"
echo
- name: Publish pre-release to NPM
if: ${{ github.event.release.prerelease }}
run: |-
cd build
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
npm publish --access public --tag next
env:
NPM_TOKEN: ${{ secrets.BOT_TOKEN }}

rm -rf node_modules
npm install
rm package-full.json
- name: Publish release to NPM
if: ${{ !github.event.release.prerelease }}
run: |-
cd build
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.BOT_TOKEN }}

- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: bundle
path: build
- name: Bundle package
run: |-
rm -rf build
npm run bundle
- name: Authenticate to GCP
if: ${{ !github.event.release.prerelease }}
Expand All @@ -70,19 +76,3 @@ jobs:
# Allow for faster updates during beta, should be removed once its stable enough to distribute over global cdn
gsutil -m setmeta -h "Cache-Control: no-cache, no-store, no-transform" "gs://${GCLOUD_BUCKET}/js/v1/lib/plug.js"
- name: npm publish prerelease
if: ${{ github.event.release.prerelease }}
run: |-
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
npm publish --access public --tag next
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: npm publish
if: ${{ !github.event.release.prerelease }}
run: |-
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Croct.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://croct.com">
<img src="https://github.com/croct-tech/repository-template-php/raw/master/images/logo.svg" alt="Croct" width="80" height="80" />
<img src="https://cdn.croct.io/brand/logo/repo-icon-green.svg" alt="Croct" height="80" />
</a>
<br />
<strong>Plug JS</strong>
Expand All @@ -9,17 +9,17 @@
</p>
<p align="center">
<a href="https://www.npmjs.com/package/@croct/plug"><img alt="Version" src="https://img.shields.io/npm/v/@croct/plug"/></a>
<a href="https://github.com/croct-tech/plug-js/actions?query=workflow%3AValidations"><img alt="Build" src="https://github.com/croct-tech/plug-js/workflows/Validations/badge.svg"/></a>
<a href="https://codeclimate.com/repos/5e7251a86589d75edf000f9e/maintainability"><img alt="Maintainability" src="https://api.codeclimate.com/v1/badges/2288af031dccbec256d9/maintainability"/></a>
<a href="https://codeclimate.com/repos/5e7251a86589d75edf000f9e/test_coverage"><img alt="Coverage" src="https://api.codeclimate.com/v1/badges/2288af031dccbec256d9/test_coverage"/></a>
<a href="https://bundlephobia.com/result?p=@croct/plug"><img alt="Gzipped Size" src="https://img.shields.io/bundlephobia/minzip/@croct/plug"/></a>
<img alt="Build" src="https://github.com/croct-tech/plug-js/workflows/Validations/badge.svg" />
<a href="https://codeclimate.com/repos/5e7251a86589d75edf000f9e/maintainability"><img alt="Maintainability" src="https://api.codeclimate.com/v1/badges/2288af031dccbec256d9/maintainability" /></a>
<a href="https://codeclimate.com/repos/5e7251a86589d75edf000f9e/test_coverage"><img alt="Coverage" src="https://api.codeclimate.com/v1/badges/2288af031dccbec256d9/test_coverage" /></a>
<br />
<br />
<a href="https://github.com/croct-tech/plug-js/releases">Releases</a>
<a href="https://github.com/croct-tech/plug-js/releases">📦Releases</a>
·
<a href="https://github.com/croct-tech/plug-js/issues">Report Bug</a>
<a href="https://github.com/croct-tech/plug-js/issues/new?labels=bug&template=bug-report.md">🐞Report Bug</a>
·
<a href="https://github.com/croct-tech/plug-js/issues">Request Feature</a>
<a href="https://github.com/croct-tech/plug-js/issues/new?labels=enhancement&template=feature-request.md">✨Request Feature</a>
</p>

## Introduction
Expand Down Expand Up @@ -90,7 +90,6 @@ Then, to run all tests:
npm test
```

## Copyright Notice
Copyright © 2015-2020 Croct Limited, All Rights Reserved.
## License

All information contained herein is, and remains the property of Croct Limited. The intellectual, design and technical concepts contained herein are proprietary to Croct Limited s and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from Croct Limited.
This project is released under the [MIT License](LICENSE).
Loading

0 comments on commit 928ff79

Please sign in to comment.