Skip to content

Commit

Permalink
chore: scope the package under private registry
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgenader committed Sep 1, 2022
1 parent 14ecbf8 commit b9b57c0
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 2 deletions.
97 changes: 97 additions & 0 deletions azure-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
trigger:
- nbt-prod

pool:
vmImage: "macOS-12"

variables:
- name: nodeVersion
value: "14.19.0"
- group: "NbtRegistry"

stages:
- stage: BuildJs
displayName: BuildJs
jobs:
- job: Build
steps:
- checkout: self
persistCredentials: true
clean: true

- task: NodeTool@0
inputs:
versionSpec: $(nodeVersion)
displayName: "Install Node"

- task: Cache@2
inputs:
key: 'node | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
node | "$(Agent.OS)"
path: node_modules
displayName: Cache node modules

- script: |
yarn install --network-concurrency 1
displayName: "Install node modules"
- script: |
yarn lint
displayName: "Lint"
- script: |
yarn test --passWithNoTests
displayName: "Unit tests Typescript"
- script: |
yarn audit || echo "Has Open source vulnerabilities"
displayName: "Open source vulnerabilities"
- stage: Publish
displayName: Publish package
condition: |
and
(
or
(
eq(variables['Build.Reason'], 'IndividualCI'),
eq(variables['Build.Reason'], 'Manual')
),
eq(variables['Build.SourceBranch'], 'refs/heads/master'),
succeeded('BuildJs')
)
jobs:
- job: Publish
steps:
- checkout: self
persistCredentials: true
clean: true

- task: NodeTool@0
inputs:
versionSpec: $(nodeVersion)
displayName: "Install Node"

- task: Cache@2
inputs:
key: 'node | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
node | "$(Agent.OS)"
path: node_modules
displayName: Cache node modules

- script: ./scripts/prepare-npmrc.sh
displayName: "Prepare .npmrc"
env:
PRIVATE_REGISTRY_URL: $(nbtPrivateRegistryUrl)
- task: npmAuthenticate@0
inputs:
workingFile: .npmrc

- script: |
yarn install --network-concurrency 1
displayName: "Install node modules"
- script: npm publish
displayName: "Publish package"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "react-native-msal",
"name": "@nbt-private/react-native-msal",
"version": "1.0.3",
"description": "React Native wrapper for iOS and Android",
"main": "build/index.js",
Expand Down
2 changes: 1 addition & 1 deletion react-native-msal.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Pod::Spec.new do |s|
s.name = "react-native-msal"
s.name = "@nbt-private/react-native-msal"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
Expand Down
9 changes: 9 additions & 0 deletions scripts/prepare-npmrc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -e

cat <<EOF > .npmrc
registry=https://registry.npmjs.org/
@nbt-private:registry=https://${PRIVATE_REGISTRY_URL}/npm/registry/
always-auth=true
EOF

0 comments on commit b9b57c0

Please sign in to comment.