@apimatic/cli 1.1.0-alpha.9 → 1.1.0-beta.2
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/README.md +436 -374
- package/bin/run.js +5 -0
- package/lib/actions/action-result.d.ts +13 -0
- package/lib/actions/action-result.js +44 -0
- package/lib/actions/action-result.js.map +1 -0
- package/lib/actions/api/transform.d.ts +15 -0
- package/lib/actions/api/transform.js +48 -0
- package/lib/actions/api/transform.js.map +1 -0
- package/lib/actions/api/validate.d.ts +12 -0
- package/lib/actions/api/validate.js +41 -0
- package/lib/actions/api/validate.js.map +1 -0
- package/lib/actions/auth/login.d.ts +13 -0
- package/lib/actions/auth/login.js +55 -0
- package/lib/actions/auth/login.js.map +1 -0
- package/lib/actions/auth/logout.d.ts +8 -0
- package/lib/actions/auth/logout.js +15 -0
- package/lib/actions/auth/logout.js.map +1 -0
- package/lib/actions/auth/status.d.ts +11 -0
- package/lib/actions/auth/status.js +26 -0
- package/lib/actions/auth/status.js.map +1 -0
- package/lib/actions/portal/copilot.d.ts +16 -0
- package/lib/actions/portal/copilot.js +89 -0
- package/lib/actions/portal/copilot.js.map +1 -0
- package/lib/actions/portal/generate.d.ts +11 -5
- package/lib/actions/portal/generate.js +60 -55
- package/lib/actions/portal/generate.js.map +1 -0
- package/lib/actions/portal/quickstart.d.ts +16 -0
- package/lib/actions/portal/quickstart.js +146 -0
- package/lib/actions/portal/quickstart.js.map +1 -0
- package/lib/actions/portal/recipe/new-recipe.d.ts +15 -0
- package/lib/actions/portal/recipe/new-recipe.js +177 -0
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
- package/lib/actions/portal/serve.d.ts +15 -0
- package/lib/actions/portal/serve.js +118 -0
- package/lib/actions/portal/serve.js.map +1 -0
- package/lib/actions/portal/toc/new-toc.d.ts +17 -13
- package/lib/actions/portal/toc/new-toc.js +85 -122
- package/lib/actions/portal/toc/new-toc.js.map +1 -0
- package/lib/actions/quickstart.d.ts +10 -0
- package/lib/actions/quickstart.js +30 -0
- package/lib/actions/quickstart.js.map +1 -0
- package/lib/actions/sdk/generate.d.ts +13 -0
- package/lib/actions/sdk/generate.js +47 -0
- package/lib/actions/sdk/generate.js.map +1 -0
- package/lib/actions/sdk/quickstart.d.ts +14 -0
- package/lib/actions/sdk/quickstart.js +149 -0
- package/lib/actions/sdk/quickstart.js.map +1 -0
- package/lib/application/portal/recipe/portal-recipe.d.ts +8 -0
- package/lib/application/portal/recipe/portal-recipe.js +33 -0
- package/lib/application/portal/recipe/portal-recipe.js.map +1 -0
- package/lib/application/portal/recipe/recipe-generator.d.ts +21 -0
- package/lib/application/portal/recipe/recipe-generator.js +145 -0
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
- package/lib/application/portal/toc/toc-content-parser.d.ts +1 -1
- package/lib/application/portal/toc/toc-content-parser.js +9 -11
- package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
- package/lib/application/portal/toc/toc-structure-generator.d.ts +1 -1
- package/lib/application/portal/toc/toc-structure-generator.js +4 -8
- package/lib/application/portal/toc/toc-structure-generator.js.map +1 -0
- package/lib/client-utils/auth-manager.d.ts +7 -2
- package/lib/client-utils/auth-manager.js +26 -14
- package/lib/client-utils/auth-manager.js.map +1 -0
- package/lib/commands/api/transform.d.ts +10 -7
- package/lib/commands/api/transform.js +51 -111
- package/lib/commands/api/transform.js.map +1 -0
- package/lib/commands/api/validate.d.ts +7 -4
- package/lib/commands/api/validate.js +31 -74
- package/lib/commands/api/validate.js.map +1 -0
- package/lib/commands/auth/login.d.ts +3 -1
- package/lib/commands/auth/login.js +26 -68
- package/lib/commands/auth/login.js.map +1 -0
- package/lib/commands/auth/logout.d.ts +3 -1
- package/lib/commands/auth/logout.js +14 -21
- package/lib/commands/auth/logout.js.map +1 -0
- package/lib/commands/auth/status.d.ts +1 -0
- package/lib/commands/auth/status.js +18 -21
- package/lib/commands/auth/status.js.map +1 -0
- package/lib/commands/portal/copilot.d.ts +13 -0
- package/lib/commands/portal/copilot.js +34 -0
- package/lib/commands/portal/copilot.js.map +1 -0
- package/lib/commands/portal/generate.d.ts +7 -11
- package/lib/commands/portal/generate.js +26 -89
- package/lib/commands/portal/generate.js.map +1 -0
- package/lib/commands/portal/recipe/new.d.ts +12 -0
- package/lib/commands/portal/recipe/new.js +45 -0
- package/lib/commands/portal/recipe/new.js.map +1 -0
- package/lib/commands/portal/serve.d.ts +8 -8
- package/lib/commands/portal/serve.js +41 -125
- package/lib/commands/portal/serve.js.map +1 -0
- package/lib/commands/portal/toc/new.d.ts +5 -6
- package/lib/commands/portal/toc/new.js +45 -50
- package/lib/commands/portal/toc/new.js.map +1 -0
- package/lib/commands/quickstart.d.ts +9 -0
- package/lib/commands/quickstart.js +37 -0
- package/lib/commands/quickstart.js.map +1 -0
- package/lib/commands/sdk/generate.d.ts +10 -8
- package/lib/commands/sdk/generate.js +46 -131
- package/lib/commands/sdk/generate.js.map +1 -0
- package/lib/config/axios-config.js +4 -6
- package/lib/config/axios-config.js.map +1 -0
- package/lib/hooks/not-found.d.ts +3 -0
- package/lib/hooks/not-found.js +52 -0
- package/lib/hooks/not-found.js.map +1 -0
- package/lib/hooks/utils.d.ts +5 -0
- package/lib/hooks/utils.js +51 -0
- package/lib/hooks/utils.js.map +1 -0
- package/lib/index.js +2 -5
- package/lib/index.js.map +1 -0
- package/lib/infrastructure/debounce-service.d.ts +10 -0
- package/lib/infrastructure/debounce-service.js +52 -0
- package/lib/infrastructure/debounce-service.js.map +1 -0
- package/lib/infrastructure/env-info.d.ts +12 -0
- package/lib/infrastructure/env-info.js +58 -0
- package/lib/infrastructure/env-info.js.map +1 -0
- package/lib/infrastructure/file-service.d.ts +24 -0
- package/lib/infrastructure/file-service.js +120 -0
- package/lib/infrastructure/file-service.js.map +1 -0
- package/lib/infrastructure/launcher-service.d.ts +9 -0
- package/lib/infrastructure/launcher-service.js +72 -0
- package/lib/infrastructure/launcher-service.js.map +1 -0
- package/lib/infrastructure/network-service.d.ts +3 -0
- package/lib/infrastructure/network-service.js +7 -0
- package/lib/infrastructure/network-service.js.map +1 -0
- package/lib/infrastructure/service-error.d.ts +16 -0
- package/lib/infrastructure/service-error.js +49 -0
- package/lib/infrastructure/service-error.js.map +1 -0
- package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
- package/lib/infrastructure/services/api-client-factory.js +20 -0
- package/lib/infrastructure/services/api-client-factory.js.map +1 -0
- package/lib/infrastructure/services/api-service.d.ts +12 -0
- package/lib/infrastructure/services/api-service.js +79 -0
- package/lib/infrastructure/services/api-service.js.map +1 -0
- package/lib/infrastructure/services/auth-service.d.ts +11 -0
- package/lib/infrastructure/services/auth-service.js +37 -0
- package/lib/infrastructure/services/auth-service.js.map +1 -0
- package/lib/infrastructure/services/file-download-service.d.ts +15 -0
- package/lib/infrastructure/services/file-download-service.js +104 -0
- package/lib/infrastructure/services/file-download-service.js.map +1 -0
- package/lib/infrastructure/services/portal-service.d.ts +17 -12
- package/lib/infrastructure/services/portal-service.js +134 -99
- package/lib/infrastructure/services/portal-service.js.map +1 -0
- package/lib/infrastructure/services/telemetry-service.d.ts +9 -0
- package/lib/infrastructure/services/telemetry-service.js +38 -0
- package/lib/infrastructure/services/telemetry-service.js.map +1 -0
- package/lib/infrastructure/services/transformation-service.d.ts +23 -0
- package/lib/infrastructure/services/transformation-service.js +56 -0
- package/lib/infrastructure/services/transformation-service.js.map +1 -0
- package/lib/infrastructure/services/validation-service.d.ts +17 -0
- package/lib/infrastructure/services/validation-service.js +49 -0
- package/lib/infrastructure/services/validation-service.js.map +1 -0
- package/lib/infrastructure/tmp-extensions.d.ts +2 -0
- package/lib/infrastructure/tmp-extensions.js +6 -0
- package/lib/infrastructure/tmp-extensions.js.map +1 -0
- package/lib/infrastructure/zip-service.d.ts +6 -0
- package/lib/infrastructure/zip-service.js +39 -0
- package/lib/infrastructure/zip-service.js.map +1 -0
- package/lib/prompts/api/transform.d.ts +11 -0
- package/lib/prompts/api/transform.js +29 -0
- package/lib/prompts/api/transform.js.map +1 -0
- package/lib/prompts/api/validate.d.ts +12 -0
- package/lib/prompts/api/validate.js +40 -0
- package/lib/prompts/api/validate.js.map +1 -0
- package/lib/prompts/auth/login.d.ts +10 -0
- package/lib/prompts/auth/login.js +22 -0
- package/lib/prompts/auth/login.js.map +1 -0
- package/lib/prompts/auth/logout.d.ts +3 -0
- package/lib/prompts/auth/logout.js +7 -0
- package/lib/prompts/auth/logout.js.map +1 -0
- package/lib/prompts/auth/status.d.ts +8 -0
- package/lib/prompts/auth/status.js +22 -0
- package/lib/prompts/auth/status.js.map +1 -0
- package/lib/prompts/format.d.ts +31 -0
- package/lib/prompts/format.js +89 -0
- package/lib/prompts/format.js.map +1 -0
- package/lib/prompts/portal/copilot.d.ts +18 -0
- package/lib/prompts/portal/copilot.js +82 -0
- package/lib/prompts/portal/copilot.js.map +1 -0
- package/lib/prompts/portal/generate.d.ts +13 -8
- package/lib/prompts/portal/generate.js +36 -53
- package/lib/prompts/portal/generate.js.map +1 -0
- package/lib/prompts/portal/quickstart.d.ts +28 -29
- package/lib/prompts/portal/quickstart.js +102 -185
- package/lib/prompts/portal/quickstart.js.map +1 -0
- package/lib/prompts/portal/recipe/new-recipe.d.ts +29 -0
- package/lib/prompts/portal/recipe/new-recipe.js +165 -0
- package/lib/prompts/portal/recipe/new-recipe.js.map +1 -0
- package/lib/prompts/portal/serve.d.ts +9 -5
- package/lib/prompts/portal/serve.js +29 -19
- package/lib/prompts/portal/serve.js.map +1 -0
- package/lib/prompts/portal/toc/new-toc.d.ts +13 -8
- package/lib/prompts/portal/toc/new-toc.js +28 -36
- package/lib/prompts/portal/toc/new-toc.js.map +1 -0
- package/lib/prompts/prompt.d.ts +3 -0
- package/lib/prompts/prompt.js +37 -0
- package/lib/prompts/prompt.js.map +1 -0
- package/lib/prompts/quickstart.d.ts +6 -0
- package/lib/prompts/quickstart.js +25 -0
- package/lib/prompts/quickstart.js.map +1 -0
- package/lib/prompts/sdk/generate.d.ts +11 -0
- package/lib/prompts/sdk/generate.js +37 -0
- package/lib/prompts/sdk/generate.js.map +1 -0
- package/lib/prompts/sdk/quickstart.d.ts +32 -0
- package/lib/prompts/sdk/quickstart.js +140 -0
- package/lib/prompts/sdk/quickstart.js.map +1 -0
- package/lib/types/api/account.d.ts +10 -0
- package/lib/types/api/account.js +2 -0
- package/lib/types/api/account.js.map +1 -0
- package/lib/types/api/transform.d.ts +14 -25
- package/lib/types/api/transform.js +20 -23
- package/lib/types/api/transform.js.map +1 -0
- package/lib/types/build/build.d.ts +22 -0
- package/lib/types/build/build.js +7 -0
- package/lib/types/build/build.js.map +1 -0
- package/lib/types/build-context.d.ts +13 -0
- package/lib/types/build-context.js +33 -0
- package/lib/types/build-context.js.map +1 -0
- package/lib/types/common/command-metadata.d.ts +4 -0
- package/lib/types/common/command-metadata.js +2 -0
- package/lib/types/common/command-metadata.js.map +1 -0
- package/lib/types/events/domain-event.d.ts +8 -0
- package/lib/types/events/domain-event.js +11 -0
- package/lib/types/events/domain-event.js.map +1 -0
- package/lib/types/events/quickstart-completed.d.ts +7 -0
- package/lib/types/events/quickstart-completed.js +10 -0
- package/lib/types/events/quickstart-completed.js.map +1 -0
- package/lib/types/events/quickstart-initiated.d.ts +7 -0
- package/lib/types/events/quickstart-initiated.js +10 -0
- package/lib/types/events/quickstart-initiated.js.map +1 -0
- package/lib/types/events/recipe-creation-failed.d.ts +5 -0
- package/lib/types/events/recipe-creation-failed.js +8 -0
- package/lib/types/events/recipe-creation-failed.js.map +1 -0
- package/lib/types/events/toc-creation-failed.d.ts +5 -0
- package/lib/types/events/toc-creation-failed.js +8 -0
- package/lib/types/events/toc-creation-failed.js.map +1 -0
- package/lib/types/file/directory.d.ts +17 -0
- package/lib/types/file/directory.js +87 -0
- package/lib/types/file/directory.js.map +1 -0
- package/lib/types/file/directoryPath.d.ts +10 -0
- package/lib/types/file/directoryPath.js +26 -0
- package/lib/types/file/directoryPath.js.map +1 -0
- package/lib/types/file/fileName.d.ts +7 -0
- package/lib/types/file/fileName.js +21 -0
- package/lib/types/file/fileName.js.map +1 -0
- package/lib/types/file/filePath.d.ts +10 -0
- package/lib/types/file/filePath.js +32 -0
- package/lib/types/file/filePath.js.map +1 -0
- package/lib/types/file/resource-input.d.ts +5 -0
- package/lib/types/file/resource-input.js +42 -0
- package/lib/types/file/resource-input.js.map +1 -0
- package/lib/types/file/urlPath.d.ts +6 -0
- package/lib/types/file/urlPath.js +22 -0
- package/lib/types/file/urlPath.js.map +1 -0
- package/lib/types/flags-provider.d.ts +15 -0
- package/lib/types/flags-provider.js +34 -0
- package/lib/types/flags-provider.js.map +1 -0
- package/lib/types/portal-context.d.ts +13 -0
- package/lib/types/portal-context.js +38 -0
- package/lib/types/portal-context.js.map +1 -0
- package/lib/types/recipe/recipe.d.ts +22 -0
- package/lib/types/recipe/recipe.js +6 -0
- package/lib/types/recipe/recipe.js.map +1 -0
- package/lib/types/recipe-context.d.ts +9 -0
- package/lib/types/recipe-context.js +26 -0
- package/lib/types/recipe-context.js.map +1 -0
- package/lib/types/resource-context.d.ts +12 -0
- package/lib/types/resource-context.js +30 -0
- package/lib/types/resource-context.js.map +1 -0
- package/lib/types/sdk/generate.d.ts +9 -22
- package/lib/types/sdk/generate.js +25 -14
- package/lib/types/sdk/generate.js.map +1 -0
- package/lib/types/sdk-context.d.ts +14 -0
- package/lib/types/sdk-context.js +32 -0
- package/lib/types/sdk-context.js.map +1 -0
- package/lib/types/sdl/sdl.d.ts +10 -0
- package/lib/types/sdl/sdl.js +47 -3
- package/lib/types/sdl/sdl.js.map +1 -0
- package/lib/types/spec-context.d.ts +12 -0
- package/lib/types/spec-context.js +29 -0
- package/lib/types/spec-context.js.map +1 -0
- package/lib/types/temp-context.d.ts +11 -0
- package/lib/types/temp-context.js +27 -0
- package/lib/types/temp-context.js.map +1 -0
- package/lib/types/toc/toc.js +2 -10
- package/lib/types/toc/toc.js.map +1 -0
- package/lib/types/toc-context.d.ts +12 -0
- package/lib/types/toc-context.js +26 -0
- package/lib/types/toc-context.js.map +1 -0
- package/lib/types/transform-context.d.ts +13 -0
- package/lib/types/transform-context.js +30 -0
- package/lib/types/transform-context.js.map +1 -0
- package/lib/types/utils.d.ts +0 -9
- package/lib/types/utils.js +2 -3
- package/lib/types/utils.js.map +1 -0
- package/lib/utils/string-utils.d.ts +2 -0
- package/lib/utils/string-utils.js +37 -0
- package/lib/utils/string-utils.js.map +1 -0
- package/lib/utils/utils.d.ts +2 -44
- package/lib/utils/utils.js +14 -366
- package/lib/utils/utils.js.map +1 -0
- package/package.json +50 -31
- package/bin/run +0 -9
- package/lib/application/portal/toc/sdl-parser.d.ts +0 -13
- package/lib/application/portal/toc/sdl-parser.js +0 -53
- package/lib/client-utils/sdk-client.d.ts +0 -23
- package/lib/client-utils/sdk-client.js +0 -124
- package/lib/commands/portal/quickstart.d.ts +0 -10
- package/lib/commands/portal/quickstart.js +0 -79
- package/lib/config/env.d.ts +0 -27
- package/lib/config/env.js +0 -31
- package/lib/controllers/api/transform.d.ts +0 -5
- package/lib/controllers/api/transform.js +0 -56
- package/lib/controllers/api/validate.d.ts +0 -3
- package/lib/controllers/api/validate.js +0 -33
- package/lib/controllers/portal/generate.d.ts +0 -3
- package/lib/controllers/portal/generate.js +0 -110
- package/lib/controllers/portal/quickstart.d.ts +0 -14
- package/lib/controllers/portal/quickstart.js +0 -258
- package/lib/controllers/portal/serve.d.ts +0 -3
- package/lib/controllers/portal/serve.js +0 -138
- package/lib/controllers/sdk/generate.d.ts +0 -4
- package/lib/controllers/sdk/generate.js +0 -66
- package/lib/services/portal/server.d.ts +0 -14
- package/lib/services/portal/server.js +0 -101
- package/lib/types/api/validate.d.ts +0 -12
- package/lib/types/api/validate.js +0 -3
- package/lib/types/common/result.d.ts +0 -17
- package/lib/types/common/result.js +0 -36
- package/lib/types/portal/generate.d.ts +0 -26
- package/lib/types/portal/generate.js +0 -4
- package/lib/types/portal/quickstart.d.ts +0 -17
- package/lib/types/portal/quickstart.js +0 -3
- package/lib/validators/common/directoryValidator.d.ts +0 -9
- package/lib/validators/common/directoryValidator.js +0 -53
- package/lib/validators/common/portValidator.d.ts +0 -5
- package/lib/validators/common/portValidator.js +0 -20
- package/lib/validators/portal/serveValidator.d.ts +0 -6
- package/lib/validators/portal/serveValidator.js +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/actions/portal/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,MAAM,OAAO,cAAc;IAQzB,YAAY,SAAwB,EAAE,eAAgC,EAAE,UAAyB,IAAI;QAPpF,YAAO,GAA0B,IAAI,qBAAqB,EAAE,CAAC;QAC7D,oBAAe,GAAoB,IAAI,eAAe,EAAE,CAAC;QACzD,kBAAa,GAAkB,IAAI,aAAa,EAAE,CAAC;QAWpD,YAAO,GAAG,KAAK,EAC7B,cAA6B,EAC7B,eAA8B,EAC9B,KAAc,EACd,SAAkB,EAClB,kBAA2B,IAAI,EACR,EAAE;YACzB,IAAI,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;gBAC5C,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;gBACpD,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;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,KAAK,KAAK,QAAQ,EAAE,CAAC;wBACnC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;oBAC5C,CAAC;yBAAM,CAAC;wBACN,MAAM,YAAY,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;wBACnD,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;wBAC/D,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;wBAChD,IAAI,CAAC,OAAO,CAAC,+BAA+B,CAAC,UAAU,CAAC,CAAC;oBAC3D,CAAC;oBACD,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;gBAED,MAAM,iBAAiB,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACjE,MAAM,aAAa,CAAC,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;gBAEvD,IAAI,eAAe,EAAE,CAAC;oBACpB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;gBAChD,CAAC;gBAED,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QA9DA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CA4DF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
|
+
import { ActionResult } from "../action-result.js";
|
|
3
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
4
|
+
export declare class PortalQuickstartAction {
|
|
5
|
+
private readonly prompts;
|
|
6
|
+
private readonly zipService;
|
|
7
|
+
private readonly fileService;
|
|
8
|
+
private readonly configDir;
|
|
9
|
+
private readonly commandMetadata;
|
|
10
|
+
private readonly fileDownloadService;
|
|
11
|
+
private readonly buildFileUrl;
|
|
12
|
+
private readonly defaultSpecUrl;
|
|
13
|
+
private readonly repositoryFolderName;
|
|
14
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
|
|
15
|
+
readonly execute: () => Promise<ActionResult>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { getAuthInfo } from "../../client-utils/auth-manager.js";
|
|
2
|
+
import { FileService } from "../../infrastructure/file-service.js";
|
|
3
|
+
import { withDirPath } from "../../infrastructure/tmp-extensions.js";
|
|
4
|
+
import { ZipService } from "../../infrastructure/zip-service.js";
|
|
5
|
+
import { PortalQuickstartPrompts } from "../../prompts/portal/quickstart.js";
|
|
6
|
+
import { UrlPath } from "../../types/file/urlPath.js";
|
|
7
|
+
import { LoginAction } from "../auth/login.js";
|
|
8
|
+
import { ActionResult } from "../action-result.js";
|
|
9
|
+
import { PortalServeAction } from "./serve.js";
|
|
10
|
+
import { ValidateAction } from "../api/validate.js";
|
|
11
|
+
import { BuildContext } from "../../types/build-context.js";
|
|
12
|
+
import { TempContext } from "../../types/temp-context.js";
|
|
13
|
+
import { FileDownloadService } from "../../infrastructure/services/file-download-service.js";
|
|
14
|
+
import { getLanguagesConfig } from "../../types/build/build.js";
|
|
15
|
+
import { SpecContext } from "../../types/spec-context.js";
|
|
16
|
+
const defaultPort = 3000;
|
|
17
|
+
export class PortalQuickstartAction {
|
|
18
|
+
constructor(configDir, commandMetadata) {
|
|
19
|
+
this.prompts = new PortalQuickstartPrompts();
|
|
20
|
+
this.zipService = new ZipService();
|
|
21
|
+
this.fileService = new FileService();
|
|
22
|
+
this.fileDownloadService = new FileDownloadService();
|
|
23
|
+
this.buildFileUrl = new UrlPath(`https://github.com/apimatic/sample-docs-as-code-portal/archive/refs/heads/master.zip`);
|
|
24
|
+
this.defaultSpecUrl = new UrlPath(`https://raw.githubusercontent.com/apimatic/sample-docs-as-code-portal/refs/heads/master/src/spec/openapi.json`);
|
|
25
|
+
this.repositoryFolderName = "sample-docs-as-code-portal-master/src";
|
|
26
|
+
this.execute = async () => {
|
|
27
|
+
const storedAuth = await getAuthInfo(this.configDir.toString());
|
|
28
|
+
if (!(storedAuth === null || storedAuth === void 0 ? void 0 : storedAuth.authKey)) {
|
|
29
|
+
const loginResult = await new LoginAction(this.configDir, this.commandMetadata).execute();
|
|
30
|
+
if (loginResult.isFailed()) {
|
|
31
|
+
return ActionResult.failed();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return await withDirPath(async (tempDirectory) => {
|
|
35
|
+
// Step 1/4
|
|
36
|
+
this.prompts.importSpecStep();
|
|
37
|
+
let specPath;
|
|
38
|
+
while (!specPath) {
|
|
39
|
+
const inputPath = await this.prompts.specPathPrompt(this.defaultSpecUrl);
|
|
40
|
+
if (!inputPath) {
|
|
41
|
+
this.prompts.noSpecSpecified();
|
|
42
|
+
return ActionResult.cancelled();
|
|
43
|
+
}
|
|
44
|
+
if (inputPath instanceof UrlPath) {
|
|
45
|
+
const downloadFileResult = await this.prompts.downloadSpecFile(this.fileDownloadService.downloadFile(inputPath));
|
|
46
|
+
if (downloadFileResult.isErr()) {
|
|
47
|
+
this.prompts.serviceError(downloadFileResult.error);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const specContext = new SpecContext(tempDirectory);
|
|
51
|
+
specPath = await specContext.save(downloadFileResult.value.stream, downloadFileResult.value.filename);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const fileExists = await this.fileService.fileExists(inputPath);
|
|
56
|
+
if (!fileExists) {
|
|
57
|
+
this.prompts.specFileDoesNotExist();
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
specPath = inputPath;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Step 2/4
|
|
65
|
+
this.prompts.validateSpecStep();
|
|
66
|
+
const validateAction = new ValidateAction(this.configDir, this.commandMetadata);
|
|
67
|
+
const validationResult = await validateAction.execute(specPath, false);
|
|
68
|
+
if (validationResult.isFailed()) {
|
|
69
|
+
this.prompts.specValidationFailed();
|
|
70
|
+
if (!(await this.prompts.useDefaultSpecPrompt())) {
|
|
71
|
+
this.prompts.fixYourSpec();
|
|
72
|
+
return ActionResult.cancelled();
|
|
73
|
+
}
|
|
74
|
+
const downloadFileResult = await this.prompts.downloadSpecFile(this.fileDownloadService.downloadFile(this.defaultSpecUrl));
|
|
75
|
+
if (downloadFileResult.isErr()) {
|
|
76
|
+
this.prompts.serviceError(downloadFileResult.error);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const specContext = new SpecContext(tempDirectory);
|
|
80
|
+
specPath = await specContext.save(downloadFileResult.value.stream, downloadFileResult.value.filename);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Step 3/4
|
|
84
|
+
this.prompts.selectLanguagesStep();
|
|
85
|
+
const languages = await this.prompts.selectLanguagesPrompt();
|
|
86
|
+
if (!languages) {
|
|
87
|
+
this.prompts.noLanguagesSelected();
|
|
88
|
+
return ActionResult.cancelled();
|
|
89
|
+
}
|
|
90
|
+
// Step 4/4
|
|
91
|
+
this.prompts.selectInputDirectoryStep();
|
|
92
|
+
let inputDirectory;
|
|
93
|
+
while (true) {
|
|
94
|
+
inputDirectory = await this.prompts.inputDirectoryPathPrompt();
|
|
95
|
+
if (!inputDirectory) {
|
|
96
|
+
this.prompts.noInputDirectoryProvided();
|
|
97
|
+
return ActionResult.cancelled();
|
|
98
|
+
}
|
|
99
|
+
if (!(await this.fileService.directoryExists(inputDirectory))) {
|
|
100
|
+
this.prompts.inputDirectoryPathDoesNotExist(inputDirectory);
|
|
101
|
+
// TODO: Prompt user if he wants to create the directory
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (!(await this.fileService.directoryEmpty(inputDirectory))) {
|
|
105
|
+
this.prompts.inputDirectoryNotEmpty(inputDirectory);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
const masterBuildFile = await this.prompts.downloadBuildDirectory(this.fileDownloadService.downloadFile(this.buildFileUrl));
|
|
111
|
+
if (masterBuildFile.isErr()) {
|
|
112
|
+
this.prompts.serviceError(masterBuildFile.error);
|
|
113
|
+
return ActionResult.failed();
|
|
114
|
+
}
|
|
115
|
+
const tempContext = new TempContext(tempDirectory);
|
|
116
|
+
const masterBuildFilePath = await tempContext.save(masterBuildFile.value.stream);
|
|
117
|
+
await this.zipService.unArchive(masterBuildFilePath, tempDirectory);
|
|
118
|
+
const extractedFolder = tempDirectory.join(this.repositoryFolderName);
|
|
119
|
+
const tempBuildContext = new BuildContext(extractedFolder);
|
|
120
|
+
await tempBuildContext.deleteWorkflowDir();
|
|
121
|
+
const buildFile = await tempBuildContext.getBuildFileContents();
|
|
122
|
+
buildFile.generatePortal.languageConfig = getLanguagesConfig(languages);
|
|
123
|
+
await tempBuildContext.updateBuildFileContents(buildFile);
|
|
124
|
+
const sourceDirectory = inputDirectory.join("src");
|
|
125
|
+
await this.fileService.copyDirectoryContents(extractedFolder, sourceDirectory);
|
|
126
|
+
const specDirectory = sourceDirectory.join("spec");
|
|
127
|
+
const specContext = new SpecContext(specDirectory);
|
|
128
|
+
await specContext.replaceDefaultSpec(specPath);
|
|
129
|
+
const buildDirectoryStructure = await this.fileService.getDirectory(sourceDirectory);
|
|
130
|
+
this.prompts.printDirectoryStructure(inputDirectory, buildDirectoryStructure);
|
|
131
|
+
const portalDirectory = inputDirectory.join("portal");
|
|
132
|
+
const portalServeAction = new PortalServeAction(this.configDir, this.commandMetadata, null);
|
|
133
|
+
const result = await portalServeAction.execute(sourceDirectory, portalDirectory, defaultPort, true, false, () => {
|
|
134
|
+
this.prompts.nextSteps();
|
|
135
|
+
});
|
|
136
|
+
if (result.isFailed()) {
|
|
137
|
+
return ActionResult.failed();
|
|
138
|
+
}
|
|
139
|
+
return ActionResult.success();
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
this.configDir = configDir;
|
|
143
|
+
this.commandMetadata = commandMetadata;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=quickstart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/actions/portal/quickstart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,MAAM,WAAW,GAAW,IAAa,CAAC;AAE1C,MAAM,OAAO,sBAAsB;IAWjC,YAAY,SAAwB,EAAE,eAAgC;QAVrD,YAAO,GAA4B,IAAI,uBAAuB,EAAE,CAAC;QACjE,eAAU,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;QAzIA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;CAwIF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DirectoryPath } from "../../../types/file/directoryPath.js";
|
|
2
|
+
import { CommandMetadata } from "../../../types/common/command-metadata.js";
|
|
3
|
+
import { ActionResult } from "../../action-result.js";
|
|
4
|
+
export declare class PortalRecipeAction {
|
|
5
|
+
private readonly configDirectory;
|
|
6
|
+
private readonly commandMetadata;
|
|
7
|
+
private readonly prompts;
|
|
8
|
+
private readonly launcherService;
|
|
9
|
+
private readonly fileService;
|
|
10
|
+
private readonly portalService;
|
|
11
|
+
constructor(configDirectory: DirectoryPath, commandMetadata: CommandMetadata);
|
|
12
|
+
execute(buildDirectory: DirectoryPath, name?: string): Promise<ActionResult>;
|
|
13
|
+
private promptForContent;
|
|
14
|
+
private getTocStructure;
|
|
15
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { PortalRecipePrompts } from "../../../prompts/portal/recipe/new-recipe.js";
|
|
2
|
+
import { StepType } from "../../../types/recipe/recipe.js";
|
|
3
|
+
import { PortalService } from "../../../infrastructure/services/portal-service.js";
|
|
4
|
+
import { getEndpointDescription, getEndpointGroupsFromSdl } from "../../../types/sdl/sdl.js";
|
|
5
|
+
import { ActionResult } from "../../action-result.js";
|
|
6
|
+
import { TocContext } from "../../../types/toc-context.js";
|
|
7
|
+
import { FileName } from "../../../types/file/fileName.js";
|
|
8
|
+
import { PortalRecipe } from "../../../application/portal/recipe/portal-recipe.js";
|
|
9
|
+
import { PortalRecipeGenerator } from "../../../application/portal/recipe/recipe-generator.js";
|
|
10
|
+
import { BuildContext } from "../../../types/build-context.js";
|
|
11
|
+
import { ContentContext } from "../toc/new-toc.js";
|
|
12
|
+
import { SpecContext } from "../../../types/spec-context.js";
|
|
13
|
+
import { LauncherService } from "../../../infrastructure/launcher-service.js";
|
|
14
|
+
import { FileService } from "../../../infrastructure/file-service.js";
|
|
15
|
+
import { FilePath } from "../../../types/file/filePath.js";
|
|
16
|
+
import { withDirPath } from "../../../infrastructure/tmp-extensions.js";
|
|
17
|
+
import { TempContext } from "../../../types/temp-context.js";
|
|
18
|
+
import { RecipeContext } from "../../../types/recipe-context.js";
|
|
19
|
+
export class PortalRecipeAction {
|
|
20
|
+
constructor(configDirectory, commandMetadata) {
|
|
21
|
+
this.configDirectory = configDirectory;
|
|
22
|
+
this.commandMetadata = commandMetadata;
|
|
23
|
+
this.prompts = new PortalRecipePrompts();
|
|
24
|
+
this.launcherService = new LauncherService();
|
|
25
|
+
this.fileService = new FileService();
|
|
26
|
+
this.portalService = new PortalService();
|
|
27
|
+
}
|
|
28
|
+
async execute(buildDirectory, name) {
|
|
29
|
+
this.prompts.displayWelcomeMessage();
|
|
30
|
+
const buildContext = new BuildContext(buildDirectory);
|
|
31
|
+
if (!(await buildContext.validate())) {
|
|
32
|
+
this.prompts.invalidBuildDirectory(buildDirectory);
|
|
33
|
+
return ActionResult.failed();
|
|
34
|
+
}
|
|
35
|
+
const recipeName = name !== null && name !== void 0 ? name : (await this.prompts.recipeNamePrompt());
|
|
36
|
+
if (!recipeName) {
|
|
37
|
+
this.prompts.recipeNameEmpty();
|
|
38
|
+
return ActionResult.cancelled();
|
|
39
|
+
}
|
|
40
|
+
const contentDirectory = buildDirectory.join("content");
|
|
41
|
+
const contentContext = new ContentContext(contentDirectory);
|
|
42
|
+
if (!(await contentContext.exists())) {
|
|
43
|
+
this.prompts.contentFolderNotFound();
|
|
44
|
+
return ActionResult.failed();
|
|
45
|
+
}
|
|
46
|
+
const specDirectory = buildDirectory.join("spec");
|
|
47
|
+
const specContext = new SpecContext(specDirectory);
|
|
48
|
+
if (!(await specContext.validate())) {
|
|
49
|
+
this.prompts.specFileEmptyInvalid();
|
|
50
|
+
return ActionResult.failed();
|
|
51
|
+
}
|
|
52
|
+
// Setup TOC context
|
|
53
|
+
const tocContext = new TocContext(contentDirectory);
|
|
54
|
+
const tocData = await tocContext.parseTocData();
|
|
55
|
+
// Setup recipe context
|
|
56
|
+
const recipeContext = new RecipeContext(recipeName);
|
|
57
|
+
const recipeScriptFileName = recipeContext.getRecipeScriptFileName();
|
|
58
|
+
const recipeMarkdownFileName = recipeContext.getRecipeMarkdownFileName();
|
|
59
|
+
// Check if the recipe already exists
|
|
60
|
+
const recipeAlreadyExists = recipeContext.exists(tocData, recipeName, recipeMarkdownFileName);
|
|
61
|
+
if (recipeAlreadyExists && !(await this.prompts.overwriteApiRecipeInTocPrompt(recipeName))) {
|
|
62
|
+
return ActionResult.cancelled();
|
|
63
|
+
}
|
|
64
|
+
// Build the recipe
|
|
65
|
+
const recipe = new PortalRecipe(recipeName);
|
|
66
|
+
let stepIndex = 0;
|
|
67
|
+
this.prompts.displayStepsInformation();
|
|
68
|
+
let endpointGroups;
|
|
69
|
+
do {
|
|
70
|
+
const stepType = await this.prompts.stepTypeSelectionPrompt();
|
|
71
|
+
if (!stepType)
|
|
72
|
+
return ActionResult.cancelled();
|
|
73
|
+
const stepName = await this.prompts.stepNamePrompt(`Step ${++stepIndex}`);
|
|
74
|
+
if (!stepName)
|
|
75
|
+
return ActionResult.cancelled();
|
|
76
|
+
switch (stepType) {
|
|
77
|
+
case StepType.Content: {
|
|
78
|
+
const contentResult = await this.promptForContent();
|
|
79
|
+
recipe.addContentStep(stepName, contentResult);
|
|
80
|
+
this.prompts.displayStepAddedSuccessfullyMessage();
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case StepType.Endpoint: {
|
|
84
|
+
if (!endpointGroups) {
|
|
85
|
+
const sdlResult = await withDirPath(async (tempDirectory) => {
|
|
86
|
+
const tempContext = new TempContext(tempDirectory);
|
|
87
|
+
const specZipPath = await tempContext.zip(specDirectory);
|
|
88
|
+
const specFileStream = await this.fileService.getStream(specZipPath);
|
|
89
|
+
try {
|
|
90
|
+
return await this.prompts.generateSdl(this.portalService.generateSdl(specFileStream, this.configDirectory, this.commandMetadata));
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
specFileStream.close();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
if (sdlResult.isErr()) {
|
|
97
|
+
this.prompts.serviceError(sdlResult.error);
|
|
98
|
+
return ActionResult.failed();
|
|
99
|
+
}
|
|
100
|
+
endpointGroups = getEndpointGroupsFromSdl(sdlResult.value);
|
|
101
|
+
}
|
|
102
|
+
const endpointGroupName = await this.prompts.endpointGroupNamePrompt(endpointGroups);
|
|
103
|
+
if (!endpointGroupName)
|
|
104
|
+
return ActionResult.cancelled();
|
|
105
|
+
const endpointName = await this.prompts.endpointNamePrompt(endpointGroups, endpointGroupName);
|
|
106
|
+
if (!endpointName)
|
|
107
|
+
return ActionResult.cancelled();
|
|
108
|
+
const defaultDescription = getEndpointDescription(endpointGroups, endpointGroupName, endpointName);
|
|
109
|
+
const description = await this.prompts.endpointDescriptionPrompt(defaultDescription);
|
|
110
|
+
if (!description)
|
|
111
|
+
return ActionResult.cancelled();
|
|
112
|
+
recipe.addEndpointStep(stepName, description, endpointGroupName, endpointName);
|
|
113
|
+
this.prompts.displayStepAddedSuccessfullyMessage();
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} while (await this.prompts.addAnotherStepSelectionPrompt());
|
|
118
|
+
const serializableRecipe = recipe.toSerializableRecipe();
|
|
119
|
+
// Generate the recipe
|
|
120
|
+
const recipeGenerator = new PortalRecipeGenerator();
|
|
121
|
+
await recipeGenerator.createRecipe(serializableRecipe, tocData, tocContext.tocPath, recipeName, recipeScriptFileName, recipeMarkdownFileName, buildContext, buildDirectory);
|
|
122
|
+
const tocStructure = this.getTocStructure(recipeScriptFileName);
|
|
123
|
+
this.prompts.recipeCreated();
|
|
124
|
+
this.prompts.displayRecipeStructure(tocStructure);
|
|
125
|
+
this.prompts.nextSteps();
|
|
126
|
+
return ActionResult.success();
|
|
127
|
+
}
|
|
128
|
+
async promptForContent() {
|
|
129
|
+
return await withDirPath(async (tempDir) => {
|
|
130
|
+
const tempFile = new FilePath(tempDir, new FileName(`recipe-markdown-content.md`));
|
|
131
|
+
const defaultContent = "# The Heading Goes Here\n\n" +
|
|
132
|
+
"This is placeholder text for your API Recipe content step. " +
|
|
133
|
+
"Feel free to edit this. Save your changes and then close the file once you're done.";
|
|
134
|
+
await this.fileService.writeContents(tempFile, defaultContent);
|
|
135
|
+
this.prompts.openRecipeMarkdownEditor();
|
|
136
|
+
await this.launcherService.openInEditor(tempFile);
|
|
137
|
+
const fileContent = await this.fileService.getContents(tempFile);
|
|
138
|
+
return fileContent.replace(/\r\n|\r/g, "\n");
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
getTocStructure(recipeFileName) {
|
|
142
|
+
return {
|
|
143
|
+
name: "src",
|
|
144
|
+
items: [
|
|
145
|
+
{
|
|
146
|
+
name: "content",
|
|
147
|
+
items: [
|
|
148
|
+
{
|
|
149
|
+
name: "toc.yml",
|
|
150
|
+
description: "# Contains the API Recipes group with a new page for your API recipe"
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "static",
|
|
156
|
+
items: [
|
|
157
|
+
{
|
|
158
|
+
name: "scripts",
|
|
159
|
+
items: [
|
|
160
|
+
{
|
|
161
|
+
name: "recipes",
|
|
162
|
+
items: [
|
|
163
|
+
{
|
|
164
|
+
name: `${recipeFileName}`,
|
|
165
|
+
description: "# Generated recipe script file containing all of the steps"
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=new-recipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-recipe.js","sourceRoot":"","sources":["../../../../src/actions/portal/recipe/new-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,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
|
+
import { ActionResult } from "../action-result.js";
|
|
3
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
4
|
+
export declare class PortalServeAction {
|
|
5
|
+
private readonly prompts;
|
|
6
|
+
private readonly networkService;
|
|
7
|
+
private readonly launcherService;
|
|
8
|
+
private readonly application;
|
|
9
|
+
private readonly configDir;
|
|
10
|
+
private readonly commandMetadata;
|
|
11
|
+
private readonly authKey;
|
|
12
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
|
|
13
|
+
execute(buildDirectory: DirectoryPath, portalDirectory: DirectoryPath, port: number, openInBrowser: boolean, hotReload: boolean, onAfterServe?: () => void): Promise<ActionResult>;
|
|
14
|
+
private clearStandardInput;
|
|
15
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { createServer as createLiveReloadServer } from "livereload";
|
|
2
|
+
import connectLiveReload from "connect-livereload";
|
|
3
|
+
import express from "express";
|
|
4
|
+
import chokidar from "chokidar";
|
|
5
|
+
import crypto from "crypto";
|
|
6
|
+
import { Mutex } from "async-mutex";
|
|
7
|
+
import { PortalServePrompts } from "../../prompts/portal/serve.js";
|
|
8
|
+
import { ActionResult } from "../action-result.js";
|
|
9
|
+
import { GenerateAction } from "./generate.js";
|
|
10
|
+
import { NetworkService } from "../../infrastructure/network-service.js";
|
|
11
|
+
import { UrlPath } from "../../types/file/urlPath.js";
|
|
12
|
+
import { LauncherService } from "../../infrastructure/launcher-service.js";
|
|
13
|
+
import { DebounceService } from "../../infrastructure/debounce-service.js";
|
|
14
|
+
export class PortalServeAction {
|
|
15
|
+
constructor(configDir, commandMetadata, authKey = null) {
|
|
16
|
+
this.prompts = new PortalServePrompts();
|
|
17
|
+
this.networkService = new NetworkService();
|
|
18
|
+
this.launcherService = new LauncherService();
|
|
19
|
+
this.application = express();
|
|
20
|
+
this.configDir = configDir;
|
|
21
|
+
this.commandMetadata = commandMetadata;
|
|
22
|
+
this.authKey = authKey;
|
|
23
|
+
}
|
|
24
|
+
async execute(buildDirectory, portalDirectory, port, openInBrowser, hotReload, onAfterServe) {
|
|
25
|
+
const generatePortalAction = new GenerateAction(this.configDir, this.commandMetadata, this.authKey);
|
|
26
|
+
const result = await generatePortalAction.execute(buildDirectory, portalDirectory, true, false);
|
|
27
|
+
if (result.isFailed()) {
|
|
28
|
+
return ActionResult.failed();
|
|
29
|
+
}
|
|
30
|
+
const servePort = await this.networkService.getServerPort([port, 3000, 3001, 3002]);
|
|
31
|
+
if (servePort != port && !onAfterServe) {
|
|
32
|
+
this.prompts.usingFallbackPort(port, servePort);
|
|
33
|
+
}
|
|
34
|
+
const liveReloadPort = await this.networkService.getServerPort([35729, 35730, 35731, 35732]);
|
|
35
|
+
const liveReloadServer = createLiveReloadServer({ port: liveReloadPort });
|
|
36
|
+
const server = this.application
|
|
37
|
+
.use(connectLiveReload())
|
|
38
|
+
.use(express.static(portalDirectory.toString(), { extensions: ["html"] }))
|
|
39
|
+
.listen(servePort);
|
|
40
|
+
const portalUrl = new UrlPath(`http://localhost:${servePort}`);
|
|
41
|
+
this.prompts.portalServed(portalUrl);
|
|
42
|
+
if (openInBrowser) {
|
|
43
|
+
await this.launcherService.openUrlInBrowser(portalUrl);
|
|
44
|
+
}
|
|
45
|
+
this.prompts.promptForExit();
|
|
46
|
+
if (!hotReload) {
|
|
47
|
+
if (onAfterServe) {
|
|
48
|
+
onAfterServe();
|
|
49
|
+
}
|
|
50
|
+
this.clearStandardInput();
|
|
51
|
+
await this.prompts.blockExecution();
|
|
52
|
+
liveReloadServer.close();
|
|
53
|
+
server.close();
|
|
54
|
+
return ActionResult.success();
|
|
55
|
+
}
|
|
56
|
+
this.prompts.hotReloadEnabled(buildDirectory);
|
|
57
|
+
const watcher = chokidar.watch(buildDirectory.toString(), {
|
|
58
|
+
ignored: [/(^|[/\\])\..+/],
|
|
59
|
+
ignoreInitial: true,
|
|
60
|
+
persistent: true,
|
|
61
|
+
awaitWriteFinish: true,
|
|
62
|
+
atomic: true
|
|
63
|
+
});
|
|
64
|
+
const deletedDirectories = new Set();
|
|
65
|
+
// TODO: Verify if we need mutex and eventQueue after refactoring.
|
|
66
|
+
const eventQueue = new Map();
|
|
67
|
+
const mutex = new Mutex();
|
|
68
|
+
const debounceService = new DebounceService();
|
|
69
|
+
watcher
|
|
70
|
+
.on("all", async (event, path) => {
|
|
71
|
+
// triggers folder deletion as a single event
|
|
72
|
+
if (event == "unlinkDir") {
|
|
73
|
+
deletedDirectories.add(path);
|
|
74
|
+
}
|
|
75
|
+
if (event == "unlink") {
|
|
76
|
+
for (const dir of deletedDirectories) {
|
|
77
|
+
if (path.startsWith(dir)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const eventId = `${Date.now()}-${crypto.randomUUID()}`;
|
|
83
|
+
await mutex.runExclusive(async () => {
|
|
84
|
+
eventQueue.clear();
|
|
85
|
+
eventQueue.set(eventId, path);
|
|
86
|
+
});
|
|
87
|
+
await debounceService.batchSingleRequest(async () => {
|
|
88
|
+
this.prompts.changesDetected();
|
|
89
|
+
// TODO: Verify if this is needed.
|
|
90
|
+
if (!eventQueue.has(eventId)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
await generatePortalAction.execute(buildDirectory, portalDirectory, true, false, false);
|
|
94
|
+
liveReloadServer.refresh(portalDirectory.toString());
|
|
95
|
+
this.clearStandardInput();
|
|
96
|
+
});
|
|
97
|
+
})
|
|
98
|
+
.on("error", async () => {
|
|
99
|
+
this.prompts.watcherError();
|
|
100
|
+
});
|
|
101
|
+
// Wait for SIGINT or SIGTERM
|
|
102
|
+
this.clearStandardInput();
|
|
103
|
+
await this.prompts.blockExecution();
|
|
104
|
+
await watcher.close();
|
|
105
|
+
debounceService.close();
|
|
106
|
+
liveReloadServer.close();
|
|
107
|
+
server.close();
|
|
108
|
+
return ActionResult.success();
|
|
109
|
+
}
|
|
110
|
+
// This clears the standard input to allow interrupts like CTRL+C to work properly.
|
|
111
|
+
clearStandardInput() {
|
|
112
|
+
if (process.platform !== "darwin" && process.stdin.isTTY) {
|
|
113
|
+
process.stdin.setRawMode(false);
|
|
114
|
+
process.stdin.pause();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/actions/portal/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AACnD,OAAO,OAAoB,MAAM,SAAS,CAAC;AAC3C,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,MAAM,OAAO,iBAAiB;IAS5B,YAAmB,SAAwB,EAAE,eAAgC,EAAE,UAAyB,IAAI;QAR3F,YAAO,GAAuB,IAAI,kBAAkB,EAAE,CAAC;QACvD,mBAAc,GAAmB,IAAI,cAAc,EAAE,CAAC;QACtD,oBAAe,GAAoB,IAAI,eAAe,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,IAAI,EAAE;YACtB,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEL,6BAA6B;QAC7B,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAEpC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACtB,eAAe,CAAC,KAAK,EAAE,CAAC;QACxB,gBAAgB,CAAC,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;IAED,mFAAmF;IAC3E,kBAAkB;QACxB,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACzD,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAChC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TocGroup } from "../../../types/toc/toc.js";
|
|
2
|
+
import { DirectoryPath } from "../../../types/file/directoryPath.js";
|
|
3
|
+
import { CommandMetadata } from "../../../types/common/command-metadata.js";
|
|
4
|
+
import { ActionResult } from "../../action-result.js";
|
|
5
|
+
export declare class ContentContext {
|
|
6
|
+
private readonly contentDirectory;
|
|
7
|
+
private readonly fileService;
|
|
8
|
+
constructor(contentDirectory: DirectoryPath);
|
|
9
|
+
exists(): Promise<boolean>;
|
|
10
|
+
extractContentGroups(): Promise<TocGroup[]>;
|
|
11
|
+
}
|
|
2
12
|
export declare class PortalNewTocAction {
|
|
13
|
+
private readonly configDirectory;
|
|
14
|
+
private readonly commandMetadata;
|
|
3
15
|
private readonly prompts;
|
|
4
|
-
private readonly sdlParser;
|
|
5
16
|
private readonly tocGenerator;
|
|
6
|
-
private readonly
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
private handleExistingToc;
|
|
11
|
-
private extractSdlComponents;
|
|
12
|
-
private extractContentGroups;
|
|
13
|
-
private getDestinationPath;
|
|
14
|
-
private checkExistingToc;
|
|
15
|
-
private getContentFolderPath;
|
|
16
|
-
private getSpecFolderPath;
|
|
17
|
+
private readonly fileService;
|
|
18
|
+
private readonly portalService;
|
|
19
|
+
constructor(configDirectory: DirectoryPath, commandMetadata: CommandMetadata);
|
|
20
|
+
execute(buildDirectory: DirectoryPath, tocDirectory?: DirectoryPath, force?: boolean, expandEndpoints?: boolean, expandModels?: boolean): Promise<ActionResult>;
|
|
17
21
|
}
|