@ama-openapi/create 0.0.0-placeholder.9 → 13.5.0-prerelease.12

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.
package/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright Amadeus SAS
2
+
3
+ Redistribution and use in source and binary forms, with or without modification,
4
+ are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation and/or
11
+ other materials provided with the distribution.
12
+
13
+ 3. Neither the name of the copyright holder nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software without
15
+ specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # Ama OpenAPI Create
2
+
3
+ [![Stable Version](https://img.shields.io/npm/v/@ama-openapi/create?style=for-the-badge)](https://www.npmjs.com/package/@ama-openapi/create)
4
+ [![Bundle Size](https://img.shields.io/bundlephobia/min/@ama-openapi/create?color=green&style=for-the-badge)](https://www.npmjs.com/package/@ama-openapi/create)
5
+
6
+ **@ama-openapi/create** is a template generator package that provides scaffolding and templates for creating OpenAPI-based projects.
7
+ It helps developers quickly set up new OpenAPI projects with best practices and a standardized structure.
8
+
9
+ ## Usage
10
+
11
+ ```shell
12
+ npm create @ama-openapi <command> -- [options]
13
+ ```
14
+
15
+ The following global options can be used with any command:
16
+
17
+ | Options | Description |
18
+ | --- | --- |
19
+ | `--version`, `-v` | Display the current version of the generator. |
20
+ | `--help`, `-h` | Display usage for the CLI commands. |
21
+
22
+ ## Available commands
23
+
24
+ ### Design Project
25
+
26
+ Create a new [OpenAPI](https://www.openapis.org/) design project via the following command :
27
+
28
+ ```shell
29
+ npm create @ama-openapi design <project-name> -- [options]
30
+ ```
31
+
32
+ The following options are available:
33
+
34
+ | Options | Default Value | Description |
35
+ | --- | --- | --- |
36
+ | `--target`, `-t` | `.` | Target directory where files will be generated. |
37
+
38
+ The command will generate a directory with the following structure:
39
+
40
+ ```text
41
+ my-openapi-project/
42
+ ├── .vscode/
43
+ │ ├── extensions.json
44
+ │ └── settings.json
45
+ ├── apis/
46
+ │ └── example.v1.yaml
47
+ ├── models/
48
+ │ └── exampleModel.v1.yaml
49
+ ├── responses/
50
+ │ └── exampleResponse.v1.yaml
51
+ ├── .gitignore
52
+ ├── openapi.manifest.yaml
53
+ ├── package.json
54
+ ├── redocly.yaml
55
+ ├── README.md
56
+ └── renovate.json
57
+ ```
58
+
59
+ > [!NOTE]
60
+ > The package includes several template files that are customized during project generation:
61
+ >
62
+ > - **API specifications**: Example OpenAPI YAML files
63
+ > - **Configuration files**: Project-specific configurations
64
+ > - **Development environment**: VS Code settings and extensions
65
+ > - **Package management**: Pre-configured `package.json` file with common scripts
66
+ > - **Renovate Configuration**: Extends the [@ama-openapi/core preset] package (https://github.com/AmadeusITGroup/otter/tree/main/packages/@ama-openapi/core/renovate/default.json)
67
+
68
+ ## Integration
69
+
70
+ This generator sets up the repository to work with:
71
+
72
+ - [@ama-openapi/core](https://www.npmjs.com/package/@ama-openapi/core): Core dependency management functionality
73
+ - [@ama-openapi/redocly-plugin](https://www.npmjs.com/package/@ama-openapi/redocly-plugin): Redocly CLI integration
74
+ - [@ama-openapi/cli](https://www.npmjs.com/package/@ama-openapi/cli): Command to manually retrieve the dependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ama-openapi/create",
3
- "version": "0.0.0-placeholder.9",
3
+ "version": "13.5.0-prerelease.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -18,7 +18,7 @@
18
18
  "postbuild": "cpy 'package.json' 'dist' && patch-package-json-main"
19
19
  },
20
20
  "peerDependencies": {
21
- "@o3r/telemetry": "0.0.0-placeholder.9",
21
+ "@o3r/telemetry": "~13.5.0-prerelease.12",
22
22
  "type-fest": "^4.30.1"
23
23
  },
24
24
  "peerDependenciesMeta": {
@@ -30,42 +30,41 @@
30
30
  }
31
31
  },
32
32
  "dependencies": {
33
- "@ama-openapi/core": "0.0.0-placeholder.9",
33
+ "@ama-openapi/core": "~13.5.0-prerelease.12",
34
34
  "ejs": "~3.1.9",
35
35
  "globby": "^11.1.0",
36
36
  "tslib": "^2.6.2",
37
37
  "yargs": "~18.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@angular-devkit/schematics": "~20.3.0",
40
+ "@angular-devkit/schematics": "~20.3.11",
41
41
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
42
42
  "@nx/eslint": "~21.6.0",
43
43
  "@nx/eslint-plugin": "~21.6.0",
44
44
  "@nx/jest": "~21.6.0",
45
45
  "@nx/js": "~21.6.0",
46
- "@o3r/build-helpers": "0.0.0-placeholder.9",
47
- "@o3r/eslint-config": "0.0.0-placeholder.9",
48
- "@o3r/eslint-plugin": "0.0.0-placeholder.9",
49
- "@o3r/telemetry": "0.0.0-placeholder.9",
50
- "@o3r/test-helpers": "0.0.0-placeholder.9",
51
- "@schematics/angular": "~20.3.0",
52
- "@stylistic/eslint-plugin": "~5.5.0",
46
+ "@o3r/build-helpers": "~13.5.0-prerelease.12",
47
+ "@o3r/eslint-config": "~13.5.0-prerelease.12",
48
+ "@o3r/eslint-plugin": "~13.5.0-prerelease.12",
49
+ "@o3r/telemetry": "~13.5.0-prerelease.12",
50
+ "@o3r/test-helpers": "~13.5.0-prerelease.12",
51
+ "@schematics/angular": "~20.3.11",
52
+ "@stylistic/eslint-plugin": "~5.6.0",
53
53
  "@types/ejs": "^3.1.2",
54
54
  "@types/jest": "~29.5.2",
55
55
  "@types/minimist": "^1.2.2",
56
56
  "@types/node": "~22.18.0",
57
- "@types/pid-from-port": "^1.1.0",
58
57
  "@types/semver": "^7.3.13",
59
58
  "@types/yargs": "~17.0.33",
60
- "@typescript-eslint/parser": "~8.46.0",
61
- "angular-eslint": "~20.5.0",
59
+ "@typescript-eslint/parser": "~8.47.0",
60
+ "angular-eslint": "~20.6.0",
62
61
  "cpy-cli": "^6.0.0",
63
- "eslint": "~9.38.0",
62
+ "eslint": "~9.39.0",
64
63
  "eslint-import-resolver-node": "~0.3.9",
65
64
  "eslint-import-resolver-typescript": "~4.4.0",
66
65
  "eslint-plugin-import": "~2.32.0",
67
66
  "eslint-plugin-import-newlines": "~1.4.0",
68
- "eslint-plugin-jest": "~29.0.0",
67
+ "eslint-plugin-jest": "~29.1.0",
69
68
  "eslint-plugin-jsdoc": "~54.7.0",
70
69
  "eslint-plugin-prefer-arrow": "~1.2.3",
71
70
  "eslint-plugin-unicorn": "~60.0.0",
@@ -76,14 +75,13 @@
76
75
  "jest-util": "~29.7.0",
77
76
  "jsonc-eslint-parser": "~2.4.0",
78
77
  "nx": "~21.6.0",
79
- "pid-from-port": "^1.1.3",
80
78
  "rimraf": "^6.0.1",
81
79
  "rxjs": "^7.8.1",
82
80
  "semver": "^7.5.2",
83
81
  "ts-jest": "~29.4.0",
84
82
  "type-fest": "^4.30.1",
85
83
  "typescript": "~5.9.2",
86
- "typescript-eslint": "~8.46.0"
84
+ "typescript-eslint": "~8.47.0"
87
85
  },
88
86
  "generatorDependencies": {
89
87
  "@redocly/openapi-core": "~2.11.0"
@@ -92,5 +90,74 @@
92
90
  "node": "^20.19.0 || ^22.17.0 || ^24.0.0",
93
91
  "yarn": ">=2.0.0 <5.0.0",
94
92
  "npm": ">=4"
95
- }
96
- }
93
+ },
94
+ "contributors": [
95
+ {
96
+ "name": "Yannick Adam",
97
+ "url": "https://github.com/yannickadam",
98
+ "email": "yannickadam@users.noreply.github.com"
99
+ },
100
+ {
101
+ "name": "Kilian Panot",
102
+ "url": "https://github.com/kpanot",
103
+ "email": "kpanot@users.noreply.github.com"
104
+ },
105
+ {
106
+ "name": "Jeremy Bourgeois",
107
+ "url": "https://github.com/jbourgeois-1A",
108
+ "email": "jbourgeois-1A@users.noreply.github.com"
109
+ },
110
+ {
111
+ "name": "Pierre Henri Ginoux",
112
+ "url": "https://github.com/pginoux-1A",
113
+ "email": "pginoux-1A@users.noreply.github.com"
114
+ },
115
+ {
116
+ "name": "Mircea Vasile Rednic",
117
+ "url": "https://github.com/mrednic-1A",
118
+ "email": "mrednic-1A@users.noreply.github.com"
119
+ },
120
+ {
121
+ "name": "Stephane Dalle",
122
+ "url": "https://github.com/sdalle-1A",
123
+ "email": "sdalle-1A@users.noreply.github.com"
124
+ },
125
+ {
126
+ "name": "Nicolas Hoffmann",
127
+ "url": "https://github.com/nhoffmann-1A",
128
+ "email": "nhoffmann-1A@users.noreply.github.com"
129
+ },
130
+ {
131
+ "name": "Victor Scaiceanu",
132
+ "url": "https://github.com/vscaiceanu-1a",
133
+ "email": "vscaiceanu-1A@users.noreply.github.com"
134
+ },
135
+ {
136
+ "name": "Florian Paul",
137
+ "url": "https://github.com/fpaul-1A",
138
+ "email": "fpaul-1A@users.noreply.github.com"
139
+ },
140
+ {
141
+ "name": "Corinne Paulve",
142
+ "url": "https://github.com/cpaulve-1A",
143
+ "email": "cpaulve-1A@users.noreply.github.com"
144
+ },
145
+ {
146
+ "name": "Matthieu Crouzet",
147
+ "url": "https://github.com/matthieu-crouzet",
148
+ "email": "matthieu-crouzet@users.noreply.github.com"
149
+ },
150
+ {
151
+ "name": "Salome Do",
152
+ "url": "https://github.com/sdo-1A",
153
+ "email": "sdo-1A@users.noreply.github.com"
154
+ }
155
+ ],
156
+ "bugs": "https://github.com/AmadeusITGroup/otter/issues",
157
+ "repository": {
158
+ "type": "git",
159
+ "url": "git+https://github.com/AmadeusITGroup/otter.git"
160
+ },
161
+ "license": "BSD-3-Clause",
162
+ "homepage": "https://amadeusitgroup.github.io/otter/"
163
+ }
@@ -1,4 +1,12 @@
1
+ <% if (standardGitignoreNode) { %>
1
2
  <%- standardGitignoreNode %>
3
+ <% } else { %>
4
+ # Dependency directory
5
+ node_modules/
6
+ <% } %>
2
7
 
3
- # Ignore external models
8
+ # External models directory
4
9
  /<%- externalModelPath %>
10
+
11
+ # Bundle specifications directory
12
+ /bundle
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "recommendations": [
3
- "42Crunch.vscode-openapi",
4
- "stoplight.spectral"
3
+ "Redocly.openapi-vs-code"
5
4
  ]
6
5
  }
@@ -1,9 +1,12 @@
1
1
  {
2
- "editor.defaultFormatter": "42Crunch.vscode-openapi",
2
+ "editor.defaultFormatter": "Redocly.openapi-vs-code",
3
3
  "files.readonlyFromPermissions": true,
4
4
  "files.readonlyInclude": {
5
5
  "**/.cache/**": true,
6
6
  "**/node_modules/**": true,
7
7
  "**/<%- externalModelPath %>/**/*.{json,yaml,yml}": true
8
+ },
9
+ "explorer.fileNesting.patterns": {
10
+ "package.json": "package-lock.json, openapi.manifest.yaml"
8
11
  }
9
12
  }
@@ -0,0 +1,52 @@
1
+ # <%- packageName %>
2
+
3
+ This package exposes [OpenApi specification](https://swagger.io/specification/) which can be used to use to generate an SDK or be referred in another specification.
4
+
5
+ ## How to work on it
6
+
7
+ **Requirements:**
8
+
9
+ - Code editor [Visual Studio Code](https://code.visualstudio.com/) with the recommended extension (proposed on start).
10
+ - [NodeJs](https://nodejs.org/) with a odd [LTS (or latest) version](https://nodejs.org/en/about/previous-releases).
11
+
12
+ **Setup:**
13
+
14
+ ```shell
15
+ npm install
16
+ ```
17
+
18
+ ### Add dependency
19
+
20
+ ```shell
21
+ npm install <artifact_name>
22
+ ```
23
+
24
+ and refer to its models via config in the [manifest](https://github.com/AmadeusITGroup/otter/tree/main/docs/openapi/MANIFEST_CONFIGURATION.md):
25
+
26
+ ```yaml
27
+ models:
28
+ <artifact_name>:
29
+ - models/first-model.yaml
30
+ - models/second-model.yaml
31
+ ```
32
+
33
+ > [!NOTE]
34
+ > The complete documentation is available on [Dependency concept documentation](https://github.com/AmadeusITGroup/otter/tree/main/docs/openapi/DEPENDENCY_RESOLUTION_CONCEPT.md).
35
+
36
+ ## Repository structure
37
+
38
+ The current repository has the following structure:
39
+
40
+ ```text
41
+ <%- projectFolder %>/
42
+ ├── .vscode/ # VsCode options and recommended extension
43
+ ├── apis/ # List of the Apis to bundle in the final specification
44
+ ├── models/ # Models to be referred locally and shared
45
+ ├── responses/ # List of responses used in the APIs
46
+ ├── .gitignore
47
+ ├── openapi.manifest.yaml
48
+ ├── package.json
49
+ ├── redocly.yaml
50
+ ├── README.md
51
+ └── renovate.json
52
+ ```
@@ -1 +1 @@
1
- # yaml-language-server: $schema=https://raw.githubusercontent.com/AmadeusITGroup/otter/refs/heads/feature/open-api/packages/@ama-openapi/core/schemas/manifest.schema.json
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/AmadeusITGroup/otter/refs/heads/main/packages/@ama-openapi/core/schemas/manifest.schema.json
@@ -1,9 +1,14 @@
1
1
  {
2
- "$schema": "https://raw.githubusercontent.com/AmadeusITGroup/otter/refs/heads/feature/open-api/packages/@ama-openapi/core/schemas/manifest.schema.json",
2
+ "$schema": "https://raw.githubusercontent.com/AmadeusITGroup/otter/refs/heads/main/packages/@ama-openapi/core/schemas/manifest.schema.json",
3
3
  "name": "<%- packageName %>",
4
+ "keywords": [
5
+ "open-api",
6
+ "ama-open-api",
7
+ "specification"
8
+ ],
4
9
  "preferUnplugged": true,
5
10
  "version": "0.0.0-placeholder",
6
- "description": "My Specification description",
11
+ "description": "Specification for <%- packageName %>",
7
12
  "main": "bundle/specification.yaml",
8
13
  "files": [
9
14
  <%-
@@ -34,5 +39,8 @@
34
39
  "module": "./bundle/specification.yaml",
35
40
  "default": "./bundle/specification.yaml"
36
41
  }
42
+ },
43
+ "engines": {
44
+ "node": "<%- nodeSupportedRange %>"
37
45
  }
38
46
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
3
  "extends": [
4
- "github>AmadeusITGroup/otter//packages/@ama-openapi/core/renovate#<%- version %>"
4
+ "github>AmadeusITGroup/otter//packages/@ama-openapi/core/renovate#v<%- version %>"
5
5
  ]
6
6
  }
@@ -1,18 +0,0 @@
1
- /**
2
- * Options for template generation
3
- */
4
- export interface CreateOptions {
5
- /** Target directory */
6
- target: string;
7
- /** Path to external models */
8
- externalModelPath: string;
9
- /** Version of the generator */
10
- version: string;
11
- /** Name of the package/artifact */
12
- packageName: string;
13
- }
14
- /**
15
- * Generate Template files
16
- * @param options
17
- */
18
- export declare const generateTemplate: (options: CreateOptions) => Promise<void[]>;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateTemplate = void 0;
4
- const node_fs_1 = require("node:fs");
5
- const node_path_1 = require("node:path");
6
- const core_1 = require("@ama-openapi/core");
7
- const ejs_1 = require("ejs");
8
- const globby_1 = require("globby");
9
- const TEMPLATE_EXTENSION = '.template';
10
- /**
11
- * Generate Template files
12
- * @param options
13
- */
14
- const generateTemplate = async (options) => {
15
- const { generatorDependencies } = JSON.parse(await node_fs_1.promises.readFile((0, node_path_1.resolve)(__dirname, '..', 'package.json'), { encoding: 'utf8' }));
16
- const templatesDirectory = (0, node_path_1.resolve)(__dirname, '..', 'templates');
17
- const regExpExtension = new RegExp(`\\${TEMPLATE_EXTENSION}$`);
18
- const exportedFiles = [
19
- 'bundle',
20
- 'models',
21
- ...core_1.DEFAULT_MANIFEST_FILENAMES
22
- ];
23
- const generatedCode = (0, globby_1.sync)('**/*', { cwd: templatesDirectory, dot: true })
24
- .map(async (templatePath) => {
25
- const templatePathAbsolute = (0, node_path_1.resolve)(templatesDirectory, templatePath);
26
- const content = await (0, ejs_1.renderFile)(templatePathAbsolute, {
27
- ...options,
28
- exportedFiles,
29
- redoclyVersion: generatorDependencies['@redocly/openapi-core'],
30
- standardGitignoreNode: await (await fetch('https://www.toptal.com/developers/gitignore/api/node')).text()
31
- }, { async: true });
32
- return {
33
- templatePath,
34
- content
35
- };
36
- })
37
- .map(async (file) => {
38
- const { templatePath, content } = await file;
39
- const outputPath = (0, node_path_1.resolve)(options.target, templatePath.replace(regExpExtension, ''));
40
- try {
41
- await node_fs_1.promises.mkdir((0, node_path_1.dirname)(outputPath), { recursive: true });
42
- }
43
- catch {
44
- // ignore error if folder already exists
45
- }
46
- await node_fs_1.promises.writeFile(outputPath, content, { encoding: 'utf8' });
47
- });
48
- return Promise.all(generatedCode);
49
- };
50
- exports.generateTemplate = generateTemplate;
package/src/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/src/index.js DELETED
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const node_fs_1 = require("node:fs");
5
- const node_path_1 = require("node:path");
6
- const core_1 = require("@ama-openapi/core");
7
- const yargs = require("yargs");
8
- const helpers_1 = require("yargs/helpers");
9
- const generate_template_1 = require("./generate-template");
10
- void (async () => {
11
- const version = JSON.parse(await node_fs_1.promises.readFile((0, node_path_1.resolve)(__dirname, '..', 'package.json'), { encoding: 'utf8' })).version;
12
- await yargs((0, helpers_1.hideBin)(process.argv))
13
- .option('target', {
14
- alias: 't',
15
- type: 'string',
16
- description: 'Target directory to generate the files into',
17
- default: process.cwd()
18
- })
19
- .command('design <name>', 'Name of the artifact / package to generate', (y) => {
20
- return y.positional('name', {
21
- type: 'string',
22
- demandOption: true,
23
- describe: 'Name of the artifact / package to generate'
24
- });
25
- }, async (argv) => {
26
- const options = {
27
- target: argv.target,
28
- externalModelPath: core_1.OUTPUT_DIRECTORY,
29
- version,
30
- packageName: argv.name
31
- };
32
- await (0, generate_template_1.generateTemplate)(options);
33
- })
34
- .version(version)
35
- .alias('h', 'help')
36
- .alias('v', 'version')
37
- .parse();
38
- })();