generator-aspnet-oauth 9.0.1 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,47 +1,48 @@
1
1
  'use strict';
2
- const fetch = require('cross-fetch');
3
- const Generator = require('yeoman-generator');
4
- const queryString = require('query-string');
5
- const yosay = require('yosay');
6
-
7
- module.exports = class extends Generator {
2
+ import fetch from 'cross-fetch';
3
+ import Generator from 'yeoman-generator';
4
+ import queryString from 'query-string';
5
+ import yosay from 'yosay';
8
6
 
7
+ export default class extends Generator {
9
8
  initializing() {
10
9
  this.templateData = {};
11
10
  this.log(yosay('Welcome to the classy ASP.NET OAuth Provider generator!'));
12
11
  }
13
12
 
14
13
  async prompting() {
15
- const prompts = [{
16
- type: 'input',
17
- name: 'name',
18
- message: 'What is the name of the provider you want to create?',
19
- store: true
20
- },
21
- {
22
- type: 'input',
23
- name: 'authorname',
24
- message: 'What is your name?',
25
- store: true
26
- },
27
- {
28
- type: 'input',
29
- name: 'authorizationendpoint',
30
- message: 'What is the Authorization Endpoint for this service?',
31
- store: true
32
- },
33
- {
34
- type: 'input',
35
- name: 'tokenendpoint',
36
- message: 'What is the Token Endpoint for this service?',
37
- store: true
38
- },
39
- {
40
- type: 'input',
41
- name: 'userinformationendpoint',
42
- message: 'What is the User Information Endpoint for this service?',
43
- store: true
44
- }];
14
+ const prompts = [
15
+ {
16
+ type: 'input',
17
+ name: 'name',
18
+ message: 'What is the name of the provider you want to create?',
19
+ store: true,
20
+ },
21
+ {
22
+ type: 'input',
23
+ name: 'authorname',
24
+ message: 'What is your name?',
25
+ store: true,
26
+ },
27
+ {
28
+ type: 'input',
29
+ name: 'authorizationendpoint',
30
+ message: 'What is the Authorization Endpoint for this service?',
31
+ store: true,
32
+ },
33
+ {
34
+ type: 'input',
35
+ name: 'tokenendpoint',
36
+ message: 'What is the Token Endpoint for this service?',
37
+ store: true,
38
+ },
39
+ {
40
+ type: 'input',
41
+ name: 'userinformationendpoint',
42
+ message: 'What is the User Information Endpoint for this service?',
43
+ store: true,
44
+ },
45
+ ];
45
46
 
46
47
  const answers = await this.prompt(prompts);
47
48
 
@@ -58,15 +59,34 @@ module.exports = class extends Generator {
58
59
  }
59
60
 
60
61
  writing() {
61
- this.fs.copyTpl(this.templatePath('Project.csproj'), this.applicationName + '/' + this.applicationName + '.csproj', this.templateData)
62
- this.fs.copyTpl(this.templatePath('AuthenticationDefaults.cs'), this.applicationName + '/' + this.name + 'AuthenticationDefaults.cs', this.templateData)
63
- this.fs.copyTpl(this.templatePath('AuthenticationExtensions.cs'), this.applicationName + '/' + this.name + 'AuthenticationExtensions.cs', this.templateData)
64
- this.fs.copyTpl(this.templatePath('AuthenticationHandler.cs'), this.applicationName + '/' + this.name + 'AuthenticationHandler.cs', this.templateData)
65
- this.fs.copyTpl(this.templatePath('AuthenticationOptions.cs'), this.applicationName + '/' + this.name + 'AuthenticationOptions.cs', this.templateData)
62
+ this.fs.copyTpl(
63
+ this.templatePath('Project.csproj'),
64
+ this.applicationName + '/' + this.applicationName + '.csproj',
65
+ this.templateData
66
+ );
67
+ this.fs.copyTpl(
68
+ this.templatePath('AuthenticationDefaults.cs'),
69
+ this.applicationName + '/' + this.name + 'AuthenticationDefaults.cs',
70
+ this.templateData
71
+ );
72
+ this.fs.copyTpl(
73
+ this.templatePath('AuthenticationExtensions.cs'),
74
+ this.applicationName + '/' + this.name + 'AuthenticationExtensions.cs',
75
+ this.templateData
76
+ );
77
+ this.fs.copyTpl(
78
+ this.templatePath('AuthenticationHandler.cs'),
79
+ this.applicationName + '/' + this.name + 'AuthenticationHandler.cs',
80
+ this.templateData
81
+ );
82
+ this.fs.copyTpl(
83
+ this.templatePath('AuthenticationOptions.cs'),
84
+ this.applicationName + '/' + this.name + 'AuthenticationOptions.cs',
85
+ this.templateData
86
+ );
66
87
  }
67
88
 
68
89
  async getCurrentVersion() {
69
-
70
90
  let response = await fetch('https://api.nuget.org/v3/index.json');
71
91
 
72
92
  if (!response.ok) {
@@ -74,7 +94,9 @@ module.exports = class extends Generator {
74
94
  }
75
95
 
76
96
  const serviceIndex = await response.json();
77
- const baseAddress = serviceIndex.resources.find(resource => resource['@type'] === 'SearchQueryService/3.5.0')['@id'];
97
+ const baseAddress = serviceIndex.resources.find(
98
+ (resource) => resource['@type'] === 'SearchQueryService/3.5.0'
99
+ )['@id'];
78
100
 
79
101
  if (!baseAddress) {
80
102
  throw new Error('Failed to determine the base address for the NuGet search query service.');
@@ -84,14 +106,16 @@ module.exports = class extends Generator {
84
106
  prerelease: false,
85
107
  q: 'PackageId:AspNet.Security.OAuth.GitHub',
86
108
  semVerLevel: '2.0.0',
87
- take: 1
109
+ take: 1,
88
110
  });
89
111
 
90
112
  const searchUrl = `${baseAddress}?${query}`;
91
113
  response = await fetch(searchUrl);
92
114
 
93
115
  if (!response.ok) {
94
- throw new Error(`Failed to search for NuGet package from '${searchUrl}'. HTTP status code: ${response.status}.`);
116
+ throw new Error(
117
+ `Failed to search for NuGet package from '${searchUrl}'. HTTP status code: ${response.status}.`
118
+ );
95
119
  }
96
120
 
97
121
  const searchResult = await response.json();
@@ -115,4 +139,4 @@ module.exports = class extends Generator {
115
139
 
116
140
  return versionParts.join(dot);
117
141
  }
118
- };
142
+ }
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "generator-aspnet-oauth",
3
- "version": "9.0.1",
3
+ "version": "11.0.0",
4
4
  "description": "Yeoman generator for OAuth Providers for ASP.NET Core",
5
5
  "license": "MIT",
6
+ "type": "module",
6
7
  "main": "app/index.js",
7
8
  "repository": {
8
9
  "type": "git",
9
10
  "url": "git+https://github.com/aspnet-contrib/generator-aspnet-oauth.git"
10
11
  },
11
12
  "engines": {
12
- "node": ">=22"
13
+ "node": ">=24"
13
14
  },
14
15
  "author": {
15
16
  "name": "Jerrie Pelser",
@@ -17,7 +18,10 @@
17
18
  "url": "https://github.com/jerriep"
18
19
  },
19
20
  "scripts": {
20
- "test": "mocha"
21
+ "format": "prettier --write **/*.js",
22
+ "format-check": "prettier --check **/*.js",
23
+ "test": "mocha",
24
+ "all": "npm run format && npm test"
21
25
  },
22
26
  "files": [
23
27
  "generators"
@@ -29,15 +33,27 @@
29
33
  "oauth"
30
34
  ],
31
35
  "dependencies": {
32
- "cross-fetch": "^4.1.0",
33
- "query-string": "^7.1.1",
34
- "yosay": "^2.0.2",
35
- "yeoman-generator": "^5.7.0"
36
+ "cross-fetch": "4.1.0",
37
+ "query-string": "10.0.0",
38
+ "yeoman-generator": "10.3.0",
39
+ "yosay": "3.0.0"
36
40
  },
37
41
  "devDependencies": {
38
- "glob": "^11.0.1",
39
- "mocha": "^11.1.0",
40
- "yeoman-assert": "^3.1.1",
41
- "yeoman-test": "^6.3.0"
42
+ "glob": "13.0.6",
43
+ "mocha": "12.0.3",
44
+ "prettier": "3.9.10",
45
+ "yeoman-environment": "8.5.1",
46
+ "yeoman-test": "11.8.2"
47
+ },
48
+ "prettier": {
49
+ "arrowParens": "always",
50
+ "bracketSpacing": true,
51
+ "printWidth": 100,
52
+ "quoteProps": "consistent",
53
+ "semi": true,
54
+ "singleQuote": true,
55
+ "tabWidth": 2,
56
+ "trailingComma": "es5",
57
+ "useTabs": false
42
58
  }
43
59
  }