-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into cascading/10.3.0-rc-main
- Loading branch information
Showing
58 changed files
with
2,484 additions
and
1,472 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
593 changes: 297 additions & 296 deletions
593
.yarn/releases/yarn-4.1.1.cjs → .yarn/releases/yarn-4.2.2.cjs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
"build:lint": "yarn nx run-many --target=build --projects=eslint-plugin --parallel $(yarn get:cpus-number)", | ||
"build:swagger-gen": "yarn nx run-many --target=build-swagger --parallel $(yarn get:cpus-number)", | ||
"prepare:publish": "yarn prepare-publish \"$(yarn workspaces:list)\" --append dist", | ||
"publish": "yarn run prepare:publish && yarn nx run-many --target=publish --parallel $(yarn get:cpus-number) --nx-bail", | ||
"publish": "yarn run prepare:publish && yarn nx run-many --target=publish --exclude=tag:private --parallel $(yarn get:cpus-number) --nx-bail", | ||
"publish:extensions": "yarn nx run-many --target=publish-extension --parallel $(yarn get:cpus-number)", | ||
"publish:extensions:affected": "yarn nx affected --target=publish-extension --parallel $(yarn get:cpus-number)", | ||
"lint": "yarn nx run-many --target=lint --parallel $(yarn get:cpus-number)", | ||
|
@@ -41,7 +41,8 @@ | |
"verdaccio:start-persistent": "docker run -d -it --rm --name verdaccio -p 4873:4873 -v \"$(yarn get:current-dir)/.verdaccio/conf\":/verdaccio/conf -v \"$(yarn get:current-dir)/.verdaccio/storage\":/verdaccio/storage:z verdaccio/verdaccio", | ||
"verdaccio:clean": "rimraf -g \".verdaccio/storage/@{o3r,ama-sdk,ama-terasu}\"", | ||
"verdaccio:login": "yarn cpy --cwd=./.verdaccio/conf .npmrc . --rename=.npmrc-logged && npx --yes npm-cli-login -u verdaccio -p verdaccio -e [email protected] -r http://127.0.0.1:4873 --config-path \".verdaccio/conf/.npmrc-logged\"", | ||
"verdaccio:publish": "yarn verdaccio:clean && yarn set:version 999.0.$(node -e 'process.stdout.write(String(Date.now()))') --include \"!**/!(dist)/package.json\" --include !package.json && yarn verdaccio:login && yarn run publish --userconfig \".verdaccio/conf/.npmrc-logged\" --tag=latest --@o3r:registry=http://127.0.0.1:4873 --@ama-sdk:registry=http://127.0.0.1:4873 --@ama-terasu:registry=http://127.0.0.1:4873", | ||
"verdaccio:prepare-publish": "yarn verdaccio:clean && yarn set:version 999.0.$(node -e 'process.stdout.write(String(Date.now()))') --include \"!**/!(dist)/package.json\" --include !package.json && yarn verdaccio:login && replace-in-files --regex=\"private(.*)true\" --replacement=private\\$1false '**/dist/package.json' && yarn run prepare:publish", | ||
"verdaccio:publish": "yarn run verdaccio:prepare-publish && yarn nx run-many --target=publish --parallel $(yarn get:cpus-number) --nx-bail --userconfig \".verdaccio/conf/.npmrc-logged\" --tag=latest --@o3r:registry=http://127.0.0.1:4873 --@ama-sdk:registry=http://127.0.0.1:4873 --@ama-terasu:registry=http://127.0.0.1:4873", | ||
"verdaccio:stop": "docker container stop $(docker ps -a -q --filter=\"name=verdaccio\")", | ||
"verdaccio:all": "yarn verdaccio:stop && yarn verdaccio:start && yarn verdaccio:publish", | ||
"watch:vscode-extension": "yarn nx run vscode-extension:compile:watch", | ||
|
@@ -187,7 +188,7 @@ | |
"@o3r/eslint-plugin": "workspace:^", | ||
"@o3r/telemetry": "workspace:^", | ||
"@o3r/workspace": "workspace:^", | ||
"@playwright/test": "~1.43.0", | ||
"@playwright/test": "~1.44.0", | ||
"@popperjs/core": "^2.11.5", | ||
"@schematics/angular": "~17.3.0", | ||
"@stylistic/eslint-plugin-ts": "^1.5.4", | ||
|
@@ -238,6 +239,7 @@ | |
"postcss-scss": "~4.0.9", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0", | ||
"replace-in-files-cli": "^2.2.0", | ||
"rimraf": "^5.0.1", | ||
"sass": "~1.76.0", | ||
"sass-loader": "^14.0.0", | ||
|
@@ -255,6 +257,9 @@ | |
"yaml-eslint-parser": "^1.2.2" | ||
}, | ||
"dependenciesMeta": { | ||
"@swc/core": { | ||
"built": true | ||
}, | ||
"esbuild": { | ||
"built": true | ||
} | ||
|
@@ -272,5 +277,5 @@ | |
"tools/@*/*", | ||
"apps/*" | ||
], | ||
"packageManager": "yarn@4.1.1" | ||
"packageManager": "yarn@4.2.2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/env node | ||
|
||
/* | ||
* Update the OpenAPI spec from an NPM package | ||
*/ | ||
|
||
import * as minimist from 'minimist'; | ||
import { existsSync } from 'node:fs'; | ||
import { createRequire } from 'node:module'; | ||
import { extname, join } from 'node:path'; | ||
import { copyFile, readFile } from 'node:fs/promises'; | ||
import type { PackageJson } from 'type-fest'; | ||
import type { OpenApiToolsConfiguration } from '../src/fwk/open-api-tools-configuration'; | ||
|
||
const argv = minimist(process.argv.slice(2)); | ||
const packageName = argv._[0]; | ||
const { help, output, 'package-path': packagePath, quiet } = argv; | ||
const openApiConfigDefaultPath = './openapitools.json'; | ||
const supportedExtensions = ['json', 'yaml', 'yml']; | ||
const noop = () => undefined; | ||
const logger = quiet ? {error: noop, warn: noop, log: noop, info: noop, debug: noop} : console; | ||
|
||
if (help) { | ||
console.log(`This script can be used to update your local spec file from a given locally installed npm package. | ||
Usage: amasdk-update-spec-from-npm <package-name> [--package-path] [--output] [--quiet] | ||
package-name The full identifier of the npm package (e.g. @my-scope/my-package) | ||
--package-path The relative path inside the npm package where to find the spec file (default: './openapi.yml') | ||
--output The path where the spec file should be copied (default: './openapi.yml') | ||
--quiet Don't log anything | ||
`); | ||
process.exit(0); | ||
} | ||
|
||
if (!packageName) { | ||
logger.error('Need to provide packageName, use `amasdk-update-spec-from-npm --help` for more information'); | ||
process.exit(-1); | ||
} | ||
|
||
void (async () => { | ||
let specSourcePath; | ||
const appRequire = createRequire(join(process.cwd(), 'package.json')); | ||
const packageJsonPath = appRequire.resolve(`${packageName}/package.json`); | ||
if (!packagePath) { | ||
const packageJson = JSON.parse(await readFile(packageJsonPath, {encoding: 'utf8'})) as PackageJson; | ||
const exportMatcher = new RegExp(`openapi\\.(?:${supportedExtensions.join('|')})$`); | ||
const matchingExport = packageJson.exports && Object.keys(packageJson.exports).find((exportPath) => exportMatcher.test(exportPath)); | ||
if (matchingExport) { | ||
specSourcePath = appRequire.resolve(`${packageName}/${matchingExport}`); | ||
} | ||
} else { | ||
specSourcePath = packageJsonPath.replace(/package.json$/, packagePath); | ||
} | ||
if (!specSourcePath || !existsSync(specSourcePath)) { | ||
logger.error(`Unable to find source spec from ${packageName}, please make sure it is correctly exported in package.json`); | ||
process.exit(-2); | ||
} | ||
|
||
let specDestinationPath = output; | ||
if (!specDestinationPath) { | ||
const specSourceExtension = extname(specSourcePath); | ||
specDestinationPath = `./openapi${specSourceExtension}`; | ||
if (existsSync(openApiConfigDefaultPath)) { | ||
const openApiConfig = JSON.parse(await readFile(openApiConfigDefaultPath, {encoding: 'utf8'})) as OpenApiToolsConfiguration; | ||
const generators = Object.values(openApiConfig['generator-cli']?.generators ?? {}); | ||
if (generators.length === 1 && generators[0].inputSpec && extname(generators[0].inputSpec) === specSourceExtension) { | ||
specDestinationPath = generators[0].inputSpec; | ||
} | ||
} | ||
} | ||
|
||
logger.info(`Updating spec file from "${specSourcePath}" to "${specDestinationPath}" (CWD: "${process.cwd()}")`); | ||
await copyFile(specSourcePath, specDestinationPath); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/@ama-sdk/core/src/fwk/open-api-tools-configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** Configuration of an Open API generator */ | ||
export interface OpenApiToolsGenerator { | ||
/** Location of the OpenAPI spec, as URL or file */ | ||
inputSpec: string; | ||
/** Output path for the generated SDK */ | ||
output: string; | ||
/** Generator to use */ | ||
generatorName: string; | ||
/** Path to configuration file. It can be JSON or YAML */ | ||
config?: string; | ||
/** Sets specified global properties */ | ||
globalProperty?: string | Record<string, any>; | ||
} | ||
|
||
/** Global configuration of Open API generators */ | ||
export interface OpenApiToolsGeneratorCli { | ||
/** Open API version */ | ||
version: string; | ||
/** Location of the generator JAR file */ | ||
storageDir?: string; | ||
/** Generators configuration */ | ||
generators: Record<string, OpenApiToolsGenerator>; | ||
} | ||
|
||
/** Global configuration of Open API Tools */ | ||
export interface OpenApiToolsConfiguration { | ||
/** Generators CLI configuration */ | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
'generator-cli': OpenApiToolsGeneratorCli; | ||
} |
Oops, something went wrong.