Skip to content

Commit ed1c574

Browse files
authored
Cleanups to publish to npm (#22)
1. Updated the CI build to automatically publish packages to npm feed 2. Added the recommended files from Microsoft 3. Added license headers to every source file Co-authored-by: Thomas Tay <[email protected]>
1 parent cd1b218 commit ed1c574

12 files changed

+210
-64
lines changed

.github/workflows/main.yml

-59
This file was deleted.

.github/workflows/pr.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This is a workflow that runs on PR builds.
2+
3+
name: "PR build"
4+
5+
# Controls when the action will run.
6+
on:
7+
# Triggers the workflow on pull request events for the master branch
8+
pull_request:
9+
branches: [master]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
# This workflow contains a single job called "build"
17+
build:
18+
# The type of runner that the job will run on
19+
runs-on: ubuntu-latest
20+
# Steps represent a sequence of tasks that will be executed as part of the job
21+
steps:
22+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
26+
# Sets up Node and an .npmrc file. This is the official Github supported way to set up node.
27+
- uses: actions/setup-node@v2
28+
with:
29+
node-version: "12"
30+
registry-url: "https://registry.npmjs.org"
31+
cache: "yarn"
32+
always-auth: "true"
33+
34+
- name: Install packages
35+
run: yarn --frozen-lockfile
36+
37+
- name: Set Firefox Env Variable
38+
run: export FIREFOX_BIN=$(which firefox)
39+
40+
- name: Set Chrome Env Variable
41+
run: export CHROME_BIN=$(which chrome)
42+
43+
- name: Print environment variables
44+
run: echo "CHROME_BIN = $CHROME_BIN FIREFOX_BIN = $FIREFOX_BIN"
45+
46+
- name: CI BUILD + UT
47+
run: yarn ci-test
48+
49+
- name: Check whether version was bumped in PR
50+
id: actions_project_version_check
51+
uses: "thomastay/[email protected]"
52+
with:
53+
token: ${{ secrets.GITHUB_TOKEN }}
54+
file-to-check: package.json
55+
fail-build-if-not-bumped: false
56+
target-branch: master
57+
58+
- name: "Automated Version Bump"
59+
uses: "phips28/gh-action-bump-version@master"
60+
if: ${{ steps.actions_project_version_check.outputs.semver == 'no-update' }}
61+
with:
62+
tag-prefix: "v"
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
66+
- name: Final check for version bump
67+
uses: "thomastay/[email protected]"
68+
with:
69+
token: ${{ secrets.GITHUB_TOKEN }}
70+
file-to-check: package.json
71+
fail-build-if-not-bumped: true
72+
target-branch: master

.github/workflows/push.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This is a workflow that runs on every successful merge to master
2+
3+
name: CI
4+
5+
# Controls when the action will run.
6+
on:
7+
# Triggers the workflow on push events for the master branch
8+
push:
9+
branches: [master]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
bump-version-and-publish:
17+
# The type of runner that the job will run on
18+
runs-on: ubuntu-latest
19+
# Steps represent a sequence of tasks that will be executed as part of the job
20+
steps:
21+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
25+
# Sets up Node and an .npmrc file. This is the official Github supported way to set up node.
26+
- uses: actions/setup-node@v2
27+
with:
28+
node-version: "12"
29+
registry-url: "https://registry.npmjs.org"
30+
cache: "yarn"
31+
always-auth: "true"
32+
33+
- name: Install packages
34+
run: yarn --frozen-lockfile
35+
36+
- name: Set Firefox Env Variable
37+
run: export FIREFOX_BIN=$(which firefox)
38+
39+
- name: Set Chrome Env Variable
40+
run: export CHROME_BIN=$(which chrome)
41+
42+
- name: Print environment variables
43+
run: echo "CHROME_BIN = $CHROME_BIN FIREFOX_BIN = $FIREFOX_BIN"
44+
45+
- name: CI BUILD + UT
46+
run: yarn ci-test
47+
48+
- name: Publish package
49+
run: yarn publish --access public
50+
env:
51+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ index.ts
1515
*.spec.js
1616
/.github
1717
/dist/src/tests
18+
*.log

.npmrc

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
package-lock=false
2-
registry=https://registry.yarnpkg.com
3-
@microsoft:registry=https://npm.pkg.github.com
1+
registry=https://registry.npmjs.org
2+
always-auth=true

CODE_OF_CONDUCT.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Microsoft Open Source Code of Conduct
2+
3+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4+
5+
Resources:
6+
7+
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8+
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9+
- Contact [[email protected]](mailto:[email protected]) with questions or concerns

CONTRIBUTING.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Contributing
2+
3+
This project welcomes contributions and suggestions. Most contributions require you to
4+
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
5+
and actually do, grant us the rights to use your contribution. For details, visit
6+
https://cla.microsoft.com.
7+
8+
When you submit a pull request, a CLA-bot will automatically determine whether you need
9+
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
10+
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
11+
12+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
13+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
14+
or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
15+
16+
# Rules
17+
18+
1. Do not push to master. Create a branch and push to it. The branch policy will forbid this.
19+
1. You don't need to manually squash your commits. All commits will be merged via a squash commit.

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,11 @@ Look through package.json for more details.
6363
The default runner will launch both firefox + chrome in debug mode.
6464

6565
To iterate over tests, instead of the `yarn build` command mentioned above, run `yarn watch` instead.
66+
67+
## Contributing
68+
69+
Please read [the Contributing guide](./CONTRIBUTING.md).
70+
71+
## Trademarks
72+
73+
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft’s Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.

SECURITY.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->
2+
3+
## Security
4+
5+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
6+
7+
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](<https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)>), please report it to us as described below.
8+
9+
## Reporting Security Issues
10+
11+
**Please do not report security vulnerabilities through public GitHub issues.**
12+
13+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
14+
15+
If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
16+
17+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
18+
19+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20+
21+
- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22+
- Full paths of source file(s) related to the manifestation of the issue
23+
- The location of the affected source code (tag/branch/commit or direct URL)
24+
- Any special configuration required to reproduce the issue
25+
- Step-by-step instructions to reproduce the issue
26+
- Proof-of-concept or exploit code (if possible)
27+
- Impact of the issue, including how an attacker might exploit the issue
28+
29+
This information will help us triage your report more quickly.
30+
31+
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
32+
33+
## Preferred Languages
34+
35+
We prefer all communications to be in English.
36+
37+
## Policy
38+
39+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
40+
41+
<!-- END MICROSOFT SECURITY.MD BLOCK -->

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/objectstoreprovider",
3-
"version": "0.6.28",
3+
"version": "0.6.29",
44
"description": "A cross-browser object store library",
55
"author": "Mukundan Kavanur Kidambi <[email protected]>",
66
"scripts": {
@@ -19,7 +19,7 @@
1919
},
2020
"main": "dist/index.js",
2121
"publishConfig": {
22-
"registry": "https://npm.pkg.github.com"
22+
"registry": "https://registry.npmjs.org"
2323
},
2424
"dependencies": {
2525
"@collectable/core": "^5.0.1",

src/Promise.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
13
declare interface Promise<T> {
24
finally: (onfinally?: (() => void) | null | undefined) => Promise<T>;
35
always: <U>(func: (value: T | any) => U | PromiseLike<U>) => Promise<U>;

src/tests/ObjectStoreProvider.spec.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
14
import { assert } from "chai"; // Mocha doesn't work with import * as syntax, hence this hack.
25
import { find, each, times, values, keys, some, filter } from "lodash";
36
import {

0 commit comments

Comments
 (0)