@adobe/alloy 2.21.0-beta.1 → 2.21.0-beta.3

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.
@@ -14,4 +14,4 @@ governing permissions and limitations under the License.
14
14
  */
15
15
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
16
16
  // see babel-plugin-version
17
- var _default = exports.default = "2.21.0-beta.1";
17
+ var _default = exports.default = "2.21.0-beta.3";
@@ -13,4 +13,4 @@ governing permissions and limitations under the License.
13
13
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
14
14
  // see babel-plugin-version
15
15
 
16
- export default "2.21.0-beta.1";
16
+ export default "2.21.0-beta.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/alloy",
3
- "version": "2.21.0-beta.1",
3
+ "version": "2.21.0-beta.3",
4
4
  "description": "Adobe Experience Platform Web SDK",
5
5
  "type": "module",
6
6
  "main": "libEs5/index.js",
@@ -10,6 +10,7 @@
10
10
  "libEs6"
11
11
  ],
12
12
  "bin": {
13
+ "alloy": "scripts/tui-builder.js",
13
14
  "build-alloy": "scripts/build-alloy.js"
14
15
  },
15
16
  "scripts": {
@@ -72,12 +73,13 @@
72
73
  "@adobe/reactor-object-assign": "^1.0.0",
73
74
  "@adobe/reactor-query-string": "^1.0.0",
74
75
  "css.escape": "^1.5.1",
76
+ "inquirer": "^9.2.23",
75
77
  "js-cookie": "3.0.5",
76
78
  "parse-uri": "^1.0.9",
77
79
  "uuid": "^9.0.1"
78
80
  },
79
81
  "devDependencies": {
80
- "@adobe/alloy": "2.21.0-beta.0",
82
+ "@adobe/alloy": "^2.21.0-beta.2",
81
83
  "@babel/cli": "^7.24.7",
82
84
  "@babel/core": "^7.24.7",
83
85
  "@babel/eslint-parser": "^7.24.7",
@@ -49,6 +49,8 @@ const getDefaultPath = () => {
49
49
  return process.cwd();
50
50
  };
51
51
 
52
+ let pathIsAbsolute = false;
53
+
52
54
  const argv = yargs(hideBin(process.argv))
53
55
  .scriptName("build-alloy")
54
56
  .example([
@@ -64,7 +66,7 @@ const argv = yargs(hideBin(process.argv))
64
66
  })
65
67
  .option("minify", {
66
68
  type: "boolean",
67
- default: false,
69
+ default: true,
68
70
  alias: "m",
69
71
  })
70
72
  .option("outputDir", {
@@ -72,8 +74,10 @@ const argv = yargs(hideBin(process.argv))
72
74
  default: getDefaultPath(),
73
75
  })
74
76
  .coerce("outputDir", (opt) => {
75
- if (opt !== getDefaultPath()) {
77
+ if (!path.isAbsolute(opt)) {
76
78
  opt = `${getDefaultPath()}${path.sep}${opt}`;
79
+ } else {
80
+ pathIsAbsolute = true;
77
81
  }
78
82
 
79
83
  try {
@@ -115,10 +119,11 @@ const buildWithComponents = async () => {
115
119
  const bundle = await rollup(rollupConfig);
116
120
  await bundle.write(rollupConfig.output[0]);
117
121
  console.log(
118
- `🎉 Wrote ${path.relative(
119
- process.cwd(),
120
- rollupConfig.output[0].file,
121
- )} (${getFileSizeInKB(rollupConfig.output[0].file)}).`,
122
+ `🎉 Wrote ${
123
+ pathIsAbsolute
124
+ ? rollupConfig.output[0].file
125
+ : path.relative(process.cwd(), rollupConfig.output[0].file)
126
+ } (${getFileSizeInKB(rollupConfig.output[0].file)}).`,
122
127
  );
123
128
  };
124
129
 
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env node
2
+
3
+ /*
4
+ Copyright 2024 Adobe. All rights reserved.
5
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License. You may obtain a copy
7
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ Unless required by applicable law or agreed to in writing, software distributed under
9
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
10
+ OF ANY KIND, either express or implied. See the License for the specific language
11
+ governing permissions and limitations under the License.
12
+ */
13
+
14
+ import inquirer from "inquirer";
15
+ import util from "util";
16
+ import { exec } from "child_process";
17
+ import components from "./helpers/alloyComponents.js";
18
+
19
+ const execAsync = util.promisify(exec);
20
+
21
+ inquirer
22
+ .prompt([
23
+ {
24
+ type: "checkbox",
25
+ name: "include",
26
+ message: "What components should be included in your Alloy build?",
27
+ choices: components,
28
+ },
29
+ {
30
+ type: "list",
31
+ name: "minify",
32
+ message: "How would you like your JavaScript to be?",
33
+ choices: [
34
+ { name: "Minified", value: true },
35
+ { name: "Unminified", value: false },
36
+ ],
37
+ },
38
+ {
39
+ type: "string",
40
+ name: "outputDir",
41
+ message: "Where would you like to save the build?",
42
+ default: process.cwd(),
43
+ },
44
+ ])
45
+ .then(async (answers) => {
46
+ const { include, minify, outputDir } = answers;
47
+ const exclude = components
48
+ .map((v) => v.value)
49
+ .filter((component) => !include.includes(component));
50
+
51
+ let params = `--outputDir ${outputDir}`;
52
+
53
+ if (exclude.length > 0) {
54
+ params += ` --exclude ${exclude.join(" ")}`;
55
+ }
56
+
57
+ if (!minify) {
58
+ params += " --no-minify";
59
+ }
60
+
61
+ const resultPromise = execAsync(`npm run build:cli -- ${params}`);
62
+ const output = await resultPromise;
63
+ console.log(output.stdout);
64
+ })
65
+ .catch((error) => {
66
+ if (error.isTtyError) {
67
+ console.error("Prompt couldn't be rendered in the current environment");
68
+ } else {
69
+ console.error("An error occurred: ", error);
70
+ }
71
+ });