@adobe/ccweb-add-on-scaffolder 0.1.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.
- package/.c8rc.json +7 -0
- package/.mocharc.json +5 -0
- package/CODE_OF_CONDUCT.md +79 -0
- package/CONTRIBUTING.md +47 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/app/AddOnBuilder.d.ts +72 -0
- package/dist/app/AddOnBuilder.d.ts.map +1 -0
- package/dist/app/AddOnBuilder.js +25 -0
- package/dist/app/AddOnScaffolder.d.ts +36 -0
- package/dist/app/AddOnScaffolder.d.ts.map +1 -0
- package/dist/app/AddOnScaffolder.js +25 -0
- package/dist/app/PackageBuilder.d.ts +38 -0
- package/dist/app/PackageBuilder.d.ts.map +1 -0
- package/dist/app/PackageBuilder.js +25 -0
- package/dist/app/TemplateAddOnBuilder.d.ts +90 -0
- package/dist/app/TemplateAddOnBuilder.d.ts.map +1 -0
- package/dist/app/TemplateAddOnBuilder.js +273 -0
- package/dist/app/TemplateAddOnScaffolder.d.ts +63 -0
- package/dist/app/TemplateAddOnScaffolder.d.ts.map +1 -0
- package/dist/app/TemplateAddOnScaffolder.js +130 -0
- package/dist/app/TemplatePackageBuilder.d.ts +49 -0
- package/dist/app/TemplatePackageBuilder.d.ts.map +1 -0
- package/dist/app/TemplatePackageBuilder.js +92 -0
- package/dist/app/index.d.ts +30 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +30 -0
- package/dist/config/index.d.ts +26 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +26 -0
- package/dist/config/inversify.config.d.ts +27 -0
- package/dist/config/inversify.config.d.ts.map +1 -0
- package/dist/config/inversify.config.js +47 -0
- package/dist/config/inversify.types.d.ts +31 -0
- package/dist/config/inversify.types.d.ts.map +1 -0
- package/dist/config/inversify.types.js +31 -0
- package/dist/constants.d.ts +33 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +34 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/models/ScaffolderOptions.d.ts +65 -0
- package/dist/models/ScaffolderOptions.d.ts.map +1 -0
- package/dist/models/ScaffolderOptions.js +71 -0
- package/dist/models/index.d.ts +25 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +25 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/validators/AddOnTemplateValidator.d.ts +46 -0
- package/dist/validators/AddOnTemplateValidator.d.ts.map +1 -0
- package/dist/validators/AddOnTemplateValidator.js +78 -0
- package/dist/validators/TemplateValidator.d.ts +35 -0
- package/dist/validators/TemplateValidator.d.ts.map +1 -0
- package/dist/validators/TemplateValidator.js +25 -0
- package/dist/validators/index.d.ts +26 -0
- package/dist/validators/index.d.ts.map +1 -0
- package/dist/validators/index.js +26 -0
- package/package.json +57 -0
- package/src/app/AddOnBuilder.ts +79 -0
- package/src/app/AddOnScaffolder.ts +37 -0
- package/src/app/PackageBuilder.ts +40 -0
- package/src/app/TemplateAddOnBuilder.ts +319 -0
- package/src/app/TemplateAddOnScaffolder.ts +153 -0
- package/src/app/TemplatePackageBuilder.ts +102 -0
- package/src/app/index.ts +30 -0
- package/src/config/index.ts +26 -0
- package/src/config/inversify.config.ts +58 -0
- package/src/config/inversify.types.ts +31 -0
- package/src/constants.ts +36 -0
- package/src/index.ts +28 -0
- package/src/models/ScaffolderOptions.ts +86 -0
- package/src/models/index.ts +25 -0
- package/src/test/app/TemplateAddOnBuilder.spec.ts +1391 -0
- package/src/test/app/TemplateAddOnScaffolder.spec.ts +272 -0
- package/src/test/app/TemplatePackageBuilder.spec.ts +332 -0
- package/src/test/app/data/first-test-app/.template/template.json +10 -0
- package/src/test/app/data/first-test-app/package.json +19 -0
- package/src/test/app/data/first-test-app/src/manifest.json +21 -0
- package/src/test/app/data/first_test_app/.template/template.json +10 -0
- package/src/test/app/data/first_test_app/package.json +19 -0
- package/src/test/app/data/first_test_app/src/manifest.json +21 -0
- package/src/test/app/data/second-test-app/package.json +19 -0
- package/src/test/app/data/second-test-app/src/manifest.json +33 -0
- package/src/test/app/data/third-test-app/.template/template.json +10 -0
- package/src/test/app/data/third-test-app/package.json +19 -0
- package/src/test/app/data/third-test-app/src/manifest.json +23 -0
- package/src/test/models/ScaffolderOptions.spec.ts +61 -0
- package/src/test/validators/AppTemplateValidator.spec.ts +98 -0
- package/src/validators/AddOnTemplateValidator.ts +79 -0
- package/src/validators/TemplateValidator.ts +35 -0
- package/src/validators/index.ts +26 -0
- package/tsconfig.json +28 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
import type { Logger, PackageJson, TemplateJson } from "@adobe/ccweb-add-on-core";
|
|
26
|
+
import { IContainer as ICoreContainer, ITypes as ICoreTypes } from "@adobe/ccweb-add-on-core";
|
|
27
|
+
import type { interfaces } from "inversify";
|
|
28
|
+
import "reflect-metadata";
|
|
29
|
+
import type { AddOnBuilder, AddOnScaffolder, PackageBuilder } from "../app/index.js";
|
|
30
|
+
import { TemplateAddOnBuilder, TemplateAddOnScaffolder, TemplatePackageBuilder } from "../app/index.js";
|
|
31
|
+
import type { ScaffolderOptions } from "../models/ScaffolderOptions.js";
|
|
32
|
+
import type { TemplateValidator } from "../validators/index.js";
|
|
33
|
+
import { AddOnTemplateValidator } from "../validators/index.js";
|
|
34
|
+
import { ITypes } from "./inversify.types.js";
|
|
35
|
+
|
|
36
|
+
const container = ICoreContainer;
|
|
37
|
+
|
|
38
|
+
container
|
|
39
|
+
.bind<interfaces.Factory<AddOnBuilder>>(ITypes.AddOnBuilder)
|
|
40
|
+
.toFactory<AddOnBuilder, [ScaffolderOptions]>(context => {
|
|
41
|
+
return (options: ScaffolderOptions) => {
|
|
42
|
+
return new TemplateAddOnBuilder(options, context.container.get<Logger>(ICoreTypes.Logger));
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
container
|
|
47
|
+
.bind<interfaces.Factory<PackageBuilder>>(ITypes.PackageBuilder)
|
|
48
|
+
.toFactory<PackageBuilder, [PackageJson], [TemplateJson]>(() => {
|
|
49
|
+
return (packageJson: PackageJson) => (templateJson: TemplateJson) => {
|
|
50
|
+
return new TemplatePackageBuilder(packageJson, templateJson);
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
container.bind<TemplateValidator>(ITypes.TemplateValidator).to(AddOnTemplateValidator).inSingletonScope();
|
|
55
|
+
|
|
56
|
+
container.bind<AddOnScaffolder>(ITypes.AddOnScaffolder).to(TemplateAddOnScaffolder).inSingletonScope();
|
|
57
|
+
|
|
58
|
+
export { container as IContainer };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
export const ITypes = {
|
|
26
|
+
Command: Symbol.for("Command"),
|
|
27
|
+
AddOnScaffolder: Symbol.for("AddOnScaffolder"),
|
|
28
|
+
AddOnBuilder: Symbol.for("AddOnBuilder"),
|
|
29
|
+
PackageBuilder: Symbol.for("PackageBuilder"),
|
|
30
|
+
TemplateValidator: Symbol.for("TemplateValidator")
|
|
31
|
+
};
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
export const PACKAGE_NAME = "@adobe/ccweb-add-on-scaffolder";
|
|
26
|
+
export const PROGRAM_NAME = "ccweb-add-on-scaffolder";
|
|
27
|
+
|
|
28
|
+
export const PACKAGE_JSON = "package.json";
|
|
29
|
+
export const TEMPLATE_JSON = "template.json";
|
|
30
|
+
export const MANIFEST_JSON = "manifest.json";
|
|
31
|
+
|
|
32
|
+
export const TEMP_TEMPLATE_PATH = ".template";
|
|
33
|
+
|
|
34
|
+
export enum AnalyticsErrorMarkers {
|
|
35
|
+
ERROR_INVALID_ARGS = "ERROR_INVALID_ARGS"
|
|
36
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
export * from "./app/AddOnScaffolder.js";
|
|
26
|
+
export * from "./config/index.js";
|
|
27
|
+
export * from "./constants.js";
|
|
28
|
+
export * from "./models/index.js";
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
import type { EntrypointType } from "@adobe/ccweb-add-on-manifest";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Options for scaffolding an add-on.
|
|
29
|
+
*/
|
|
30
|
+
export class ScaffolderOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Path of the Add-on directory.
|
|
33
|
+
*/
|
|
34
|
+
readonly addOnDirectory: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Name of the Add-on.
|
|
38
|
+
*/
|
|
39
|
+
readonly addOnName: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Kind of the Add-on. For example: panel.
|
|
43
|
+
*/
|
|
44
|
+
readonly addOnKind: EntrypointType;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Path of the Add-on root directory.
|
|
48
|
+
*/
|
|
49
|
+
readonly rootDirectory: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Name of the template with which the Add-on is to be scaffolded.
|
|
53
|
+
*/
|
|
54
|
+
readonly templateName: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Verbose flag.
|
|
58
|
+
*/
|
|
59
|
+
readonly verbose: boolean;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Instantiate {@link ScaffolderOptions}.
|
|
63
|
+
* @param addOnDirectory - Path of the Add-on directory.
|
|
64
|
+
* @param addOnName - Name of the Add-on.
|
|
65
|
+
* @param addOnKind - Kind of the Add-on. For example: panel.
|
|
66
|
+
* @param rootDirectory - Path of the Add-on root directory.
|
|
67
|
+
* @param templateName - Name of the template with which the Add-on is to be scaffolded.
|
|
68
|
+
* @param verbose - Verbose flag.
|
|
69
|
+
* @returns Reference to a new {@link ScaffolderOptions} instance.
|
|
70
|
+
*/
|
|
71
|
+
constructor(
|
|
72
|
+
addOnDirectory: string,
|
|
73
|
+
addOnName: string,
|
|
74
|
+
addOnKind: EntrypointType,
|
|
75
|
+
rootDirectory: string,
|
|
76
|
+
templateName: string,
|
|
77
|
+
verbose: boolean
|
|
78
|
+
) {
|
|
79
|
+
this.addOnDirectory = addOnDirectory;
|
|
80
|
+
this.addOnName = addOnName;
|
|
81
|
+
this.addOnKind = addOnKind;
|
|
82
|
+
this.rootDirectory = rootDirectory;
|
|
83
|
+
this.templateName = templateName;
|
|
84
|
+
this.verbose = verbose;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
export * from "./ScaffolderOptions.js";
|