at-builder 1.0.11 → 1.1.1

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 CHANGED
@@ -1,2 +1,105 @@
1
- # at-builder
1
+ # **at-builder**
2
2
 
3
+ [![npm version](https://badge.fury.io/js/at-builder.svg)](https://www.npmjs.com/package/at-builder)
4
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+
6
+ `at-builder` is a simple command-line tool designed to streamline Adobe Target activity creation and building processes.
7
+
8
+ ---
9
+
10
+ ## **Features**
11
+
12
+ - 🔧 **Prod Build**: Build target ready code in your local and ship to any target activity.
13
+ - 🚀 **Help Information**: Get detailed instructions on available commands and usage directly from the CLI.
14
+
15
+ ---
16
+
17
+ ## **Installation**
18
+
19
+ Install the package globally using NPM:
20
+
21
+ ```bash
22
+ npm install -g at-builder
23
+ ```
24
+
25
+ ---
26
+
27
+ ## **Usage**
28
+
29
+ Run the command-line tool:
30
+
31
+ ```bash
32
+ atb
33
+ ```
34
+
35
+ ### **Available Commands**
36
+
37
+ - **`new`**: Creates a new activity.
38
+ - **`build`**: Creates a build.
39
+
40
+ ### **Examples**
41
+
42
+ ```bash
43
+ # Create a new activity
44
+ atb -c new
45
+
46
+ # Build the project
47
+ atb -c
48
+ ```
49
+
50
+ ---
51
+
52
+ ## **API Documentation**
53
+
54
+ ### **`getVersion()`**
55
+
56
+ - **Description**: Retrieves the version number from the `package.json` file.
57
+ - **Returns**: *(string)* - The version number of the package.
58
+
59
+ #### **Example**
60
+
61
+ ```javascript
62
+ const { getVersion } = require("at-builder");
63
+
64
+ console.log(getVersion()); // Outputs the version number of the package
65
+ ```
66
+
67
+ ### **`getHelpInfo()`**
68
+
69
+ - **Description**: Provides a string containing help information for the `atb` command-line tool.
70
+ - **Returns**: *(string)* - The help information string.
71
+
72
+ #### **Example**
73
+
74
+ ```javascript
75
+ const { getHelpInfo } = require("at-builder");
76
+
77
+ console.log(getHelpInfo());
78
+ // Outputs detailed help information for the CLI tool
79
+ ```
80
+
81
+ ---
82
+
83
+ ## **Contributing**
84
+
85
+ Contributions are welcome! To contribute:
86
+
87
+ 1. Fork the repository.
88
+ 2. Create a new branch (`git checkout -b feature-branch-name`).
89
+ 3. Commit your changes (`git commit -m 'Add some feature'`).
90
+ 4. Push to the branch (`git push origin feature-branch-name`).
91
+ 5. Open a pull request.
92
+
93
+ ---
94
+
95
+ ## **License**
96
+
97
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
98
+
99
+ ---
100
+
101
+ ## **Support**
102
+
103
+ If you encounter any issues or have questions, feel free to open an [issue](https://github.com/upendrasengar/at-builder/issues).
104
+
105
+ ---
package/bin/index.js CHANGED
@@ -6,19 +6,6 @@ const config_1 = require("./constants/config");
6
6
  const path = require("path");
7
7
  const fs = require("fs");
8
8
  const readline = require('readline');
9
- // inquirer
10
- // .prompt([
11
- // ])
12
- // .then((answers) => {
13
- // // Use user feedback for... whatever!!
14
- // })
15
- // .catch((error) => {
16
- // if (error.isTtyError) {
17
- // // Prompt couldn't be rendered in the current environment
18
- // } else {
19
- // // Something else went wrong
20
- // }
21
- // });
22
9
  try {
23
10
  fs.accessSync(path.join(process.cwd(), ".env"), fs.constants.R_OK);
24
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "at-builder",
3
- "version": "1.0.11",
3
+ "version": "1.1.1",
4
4
  "main": "bin/index.js",
5
5
  "bin": {
6
6
  "atb": "bin/index.js"
package/puppeteer.js CHANGED
@@ -1,4 +1,4 @@
1
- require('dotenv').config();
1
+ require('dotenv').config({ path: path.join(executionPath,".env") });
2
2
  const puppeteer = require('puppeteer');
3
3
  const path = require('path');
4
4
  const fs = require('fs');
package/webpack.config.js CHANGED
@@ -1,6 +1,6 @@
1
- const { executionPath } = process.env;
1
+ const { PWD } = process.env;
2
2
  const path = require('path');
3
- require('dotenv').config({ path: path.join(executionPath,".env") });
3
+ require('dotenv').config({ path: path.join(PWD,".env") });
4
4
  const fs = require('fs');
5
5
  const WrapperPlugin = require('wrapper-webpack-plugin');
6
6
  const TerserPlugin = require("terser-webpack-plugin");
@@ -90,7 +90,7 @@ var traversePath = function (dir) {
90
90
 
91
91
  console.log("\x1b[33m%s\x1b[0m", `${process.env.ACTIVITY_FOLDER_NAME}`);
92
92
 
93
- const filepath = executionPath;
93
+ const filepath = PWD;
94
94
 
95
95
  var files = traversePath(path.join(filepath, 'Activities', process.env.ACTIVITY_FOLDER_NAME).toString());
96
96
 
@@ -107,7 +107,7 @@ files.forEach((file) => {
107
107
  }
108
108
  var newPath = `${distFolderPath}/build`;
109
109
  // Replace path with absolute path before making a key of the entries object
110
- entries[newPath.replace(executionPath, "")] = file;
110
+ entries[newPath.replace(PWD, "")] = file;
111
111
  });
112
112
 
113
113
  console.log("++++ENTRIES++++", entries);
@@ -119,6 +119,28 @@ const plugins = [
119
119
  extensions: "js",
120
120
  outputReport: true,
121
121
  fix: true
122
+ }),
123
+
124
+ new WrapperPlugin({
125
+ test: /\.js$/,
126
+ header: function (_, args) {
127
+ //Handle target issue for reloading the styles.
128
+
129
+ const preFix = process.env.TRACK ? process.env.TRACK : 'TargetBuild';
130
+ let _uniqueTestId = `${preFix}_${args.hash}`;
131
+ args._uniqueTestId = _uniqueTestId;
132
+ return `(function(){
133
+ if(!window.${_uniqueTestId}){
134
+ //# sourceURL=${_uniqueTestId}.js
135
+ `;
136
+ },
137
+ footer: function (_, args) {
138
+ return `\n
139
+ window.${args._uniqueTestId} = true;
140
+ }
141
+ })();`
142
+ },
143
+ afterOptimization: true,
122
144
  })
123
145
  ];
124
146
 
@@ -144,7 +166,7 @@ module.exports = {
144
166
  ...entries
145
167
  },
146
168
  output: {
147
- path: executionPath,
169
+ path: PWD,
148
170
  filename: '[name].js'
149
171
  },
150
172
  module: {
package/.babelrc DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "presets": [
3
- "@babel/preset-env",
4
- "@babel/preset-react"
5
- ],
6
- "plugins": [
7
- "transform-async-to-generator",
8
- "@babel/plugin-syntax-dynamic-import",
9
- "@babel/plugin-proposal-class-properties"
10
- ]
11
- }
package/.env DELETED
@@ -1,6 +0,0 @@
1
- ACTIVITY_FOLDER_NAME=test
2
- PUPPETEER_LANDING_PAGE="https://www.ups.com/ship/guided/origin?loc=en_US"
3
- TARGET_URL="www.ups.com/ship"
4
- LOGIN_URL="www.ups.com/lasso/login"
5
- VARIATION=Variation-1
6
- NODE_ENV=development