Skip to content

Commit fe58e6a

Browse files
committed
initial commit
0 parents  commit fe58e6a

15 files changed

+8657
-0
lines changed

.babelrc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"targets": {
7+
"node": "current"
8+
}
9+
}
10+
],
11+
"@babel/preset-typescript"
12+
]
13+
}

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
quote_type = single
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
bin/
3+
.history/
4+
**/*.min.js
5+
**/*-min.js
6+
**/*.bundle.js

.eslintrc.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended",
5+
"plugin:prettier/recommended"
6+
],
7+
"parser": "@typescript-eslint/parser",
8+
"plugins": ["@typescript-eslint"],
9+
"root": true
10+
}

.github/workflows/publish.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Node.js Package
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions/setup-node@v2
12+
with:
13+
node-version: '16'
14+
registry-url: 'https://registry.npmjs.org'
15+
- run: npm ci
16+
- run: npm run build
17+
- run: npm publish
18+
env:
19+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
2+
3+
# Created by https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,node
4+
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,visualstudiocode,node
5+
6+
### Node ###
7+
# Logs
8+
logs
9+
*.log
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
lerna-debug.log*
14+
15+
# Diagnostic reports (https://nodejs.org/api/report.html)
16+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
17+
18+
# Runtime data
19+
pids
20+
*.pid
21+
*.seed
22+
*.pid.lock
23+
24+
# Directory for instrumented libs generated by jscoverage/JSCover
25+
lib-cov
26+
27+
# Coverage directory used by tools like istanbul
28+
coverage
29+
*.lcov
30+
31+
# nyc test coverage
32+
.nyc_output
33+
34+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
35+
.grunt
36+
37+
# Bower dependency directory (https://bower.io/)
38+
bower_components
39+
40+
# node-waf configuration
41+
.lock-wscript
42+
43+
# Compiled binary addons (https://nodejs.org/api/addons.html)
44+
build/Release
45+
46+
# Dependency directories
47+
node_modules/
48+
jspm_packages/
49+
50+
# TypeScript v1 declaration files
51+
typings/
52+
53+
# TypeScript cache
54+
*.tsbuildinfo
55+
56+
# Optional npm cache directory
57+
.npm
58+
59+
# Optional eslint cache
60+
.eslintcache
61+
62+
# Microbundle cache
63+
.rpt2_cache/
64+
.rts2_cache_cjs/
65+
.rts2_cache_es/
66+
.rts2_cache_umd/
67+
68+
# Optional REPL history
69+
.node_repl_history
70+
71+
# Output of 'npm pack'
72+
*.tgz
73+
74+
# Yarn Integrity file
75+
.yarn-integrity
76+
77+
# dotenv environment variables file
78+
.env
79+
.env.test
80+
.env*.local
81+
82+
# parcel-bundler cache (https://parceljs.org/)
83+
.cache
84+
.parcel-cache
85+
86+
# Next.js build output
87+
.next
88+
89+
# Nuxt.js build / generate output
90+
.nuxt
91+
dist
92+
93+
# Gatsby files
94+
.cache/
95+
# Comment in the public line in if your project uses Gatsby and not Next.js
96+
# https://nextjs.org/blog/next-9-1#public-directory-support
97+
# public
98+
99+
# vuepress build output
100+
.vuepress/dist
101+
102+
# Serverless directories
103+
.serverless/
104+
105+
# FuseBox cache
106+
.fusebox/
107+
108+
# DynamoDB Local files
109+
.dynamodb/
110+
111+
# TernJS port file
112+
.tern-port
113+
114+
# Stores VSCode versions used for testing VSCode extensions
115+
.vscode-test
116+
117+
### VisualStudioCode ###
118+
.vscode/*
119+
!.vscode/settings.json
120+
!.vscode/tasks.json
121+
!.vscode/launch.json
122+
!.vscode/extensions.json
123+
*.code-workspace
124+
125+
### VisualStudioCode Patch ###
126+
# Ignore all local history of files
127+
.history
128+
.ionide
129+
130+
### Windows ###
131+
# Windows thumbnail cache files
132+
Thumbs.db
133+
Thumbs.db:encryptable
134+
ehthumbs.db
135+
ehthumbs_vista.db
136+
137+
# Dump file
138+
*.stackdump
139+
140+
# Folder config file
141+
[Dd]esktop.ini
142+
143+
# Recycle Bin used on file shares
144+
$RECYCLE.BIN/
145+
146+
# Windows Installer files
147+
*.cab
148+
*.msi
149+
*.msix
150+
*.msm
151+
*.msp
152+
153+
# Windows shortcuts
154+
*.lnk
155+
156+
# End of https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,node
157+
158+
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
159+
temp
160+
bin

.npmignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.github
2+
.history
3+
.babelrc
4+
.vscode
5+
.editorconfig
6+
.eslintignore
7+
.eslintrc.js
8+
.prettierrc.js
9+
CHANGELOG.md
10+
main.ts
11+
rollup.config.js
12+
tsconfig.json

.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
3+
}

.vscode/settings.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "vue"],
3+
"editor.codeActionsOnSave": {
4+
"source.fixAll.eslint": true
5+
},
6+
"editor.formatOnSave": true,
7+
"editor.defaultFormatter": "esbenp.prettier-vscode",
8+
"files.eol": "\n",
9+
"editor.tabSize": 2
10+
}

README.md

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<h1 align="center">
2+
<img src="https://avatars.githubusercontent.com/u/35199565" width="124px"/><br/>
3+
@intility/azure-app-redirect-uris
4+
</h1>
5+
6+
<p align="center">
7+
CLI to add and remove redirect uris from an Azure App Registration.
8+
<br />
9+
Useful for CI/CD pipelines using branch/review deployments.
10+
</p>
11+
12+
<p align="center">
13+
<a href="https://github.com/Intility/helm-version/actions">
14+
<img alt="pipeline" src="https://github.com/Intility/azure-app-redirect-uris/actions/workflows/publish.yml/badge.svg" style="max-width:100%;" />
15+
</a>
16+
<a href="https://www.npmjs.com/package/@intility/helm-version">
17+
<img alt="package version" src="https://img.shields.io/npm/v/@intility/azure-app-redirect-uris?label=%40intility%2Fazure-app-redirect-uris" style="max-width:100%;" />
18+
</a>
19+
</p>
20+
21+
## Usage
22+
23+
```
24+
Usage: npx @intility/azure-app-redirect-uris [options] <appId> <platform> <action> <redirectUri>
25+
26+
CLI to add and remove redirect uris from an Azure App Registration.
27+
28+
Arguments:
29+
appId The app id
30+
platform Redirect URI platform (choices: "publicClient", "web", "spa")
31+
action The action to perform (choices: "add", "remove")
32+
redirectUri The redirect URI
33+
34+
Options:
35+
-V, --version output the version number
36+
-h, --help display help for command
37+
```
38+
39+
The command uses [`DefaultAzureCredential` from `@azure/identity`](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/README.md#defaultazurecredential) to authenticate.
40+
41+
If authenticating using a Service Principal (clientId & clientSecret/clientCertificate), the app needs the `Application.ReadWrite.OwnedBy` permission (and be owner of the application you want to modify), or `Application.ReadWrite.All`.
42+
43+
### As a GitLab job
44+
45+
```yaml
46+
# Run after deployment
47+
verify:azure:
48+
image: node:16
49+
variables:
50+
APP_OBJECT_ID: 00000000-0000-0000-0000-000000000000
51+
URL: http://localhost:3000
52+
# These variables should be defined in CI/CD settings
53+
# AZURE_TENANT_ID:
54+
# AZURE_CLIENT_ID:
55+
# AZURE_CLIENT_SECRET:
56+
script:
57+
- npx @intility/azure-app-redirect-uris $APP_OBJECT_ID spa add $URL
58+
59+
# Run after deployment takedown
60+
stop:azure:
61+
image: node:16
62+
variables:
63+
APP_OBJECT_ID: 00000000-0000-0000-0000-000000000000
64+
URL: http://localhost:3000
65+
# These variables should be defined in CI/CD settings
66+
# AZURE_TENANT_ID:
67+
# AZURE_CLIENT_ID:
68+
# AZURE_CLIENT_SECRET:
69+
script:
70+
- npx @intility/azure-app-redirect-uris $APP_OBJECT_ID spa remove $URL
71+
```
72+
73+
## Contributing
74+
75+
To build this project, you can run this command:
76+
77+
```
78+
npm run build
79+
```
80+
81+
Also, you can use `npm run watch` to build on file changes.
82+
83+
Run `node bin/cli.js [arguments/options]` to test the command after compilation.
84+
85+
This project was created with [create-typescript-cli](https://github.com/backrunner/create-typescript-cli).

0 commit comments

Comments
 (0)