at-builder 1.2.1 → 1.2.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/bin/index.js CHANGED
@@ -103,8 +103,20 @@ const runCommand = (commandArr, env) => {
103
103
  const handleInit = async (verbose) => {
104
104
  if (verbose)
105
105
  logger_1.default.info("verbose", "Initializing new .env file");
106
- runCommand(["init -y"], productionEnv);
107
- runCommand(["install @babel/runtime", "-D"], productionEnv);
106
+ // Run npm init in the current working directory (where user ran atb init)
107
+ (0, child_process_1.spawn)("npm", ["init", "-y"], {
108
+ cwd: process.cwd(),
109
+ env: process.env,
110
+ shell: true,
111
+ stdio: "inherit",
112
+ });
113
+ // Install @babel/runtime as dev dependency in the current directory
114
+ (0, child_process_1.spawn)("npm", ["install", "@babel/runtime", "-D"], {
115
+ cwd: process.cwd(),
116
+ env: process.env,
117
+ shell: true,
118
+ stdio: "inherit",
119
+ });
108
120
  (0, config_1.setupEnv)(process.cwd());
109
121
  };
110
122
  /**
@@ -39,9 +39,8 @@ class AdobeTargetBuildGeneratorPlugin {
39
39
  function wrapFileContent(content, outputPath) {
40
40
  const headerContent = (typeof header === 'function') ? header(content, outputPath) : header;
41
41
  const footerContent = (typeof footer === 'function') ? footer(content, outputPath) : footer;
42
- return `${headerContent}
43
- ${content}
44
- ${footerContent}`;
42
+ return `
43
+ ${headerContent}${content}${footerContent}`;
45
44
  }
46
45
 
47
46
  function generateTargetReadyBuild({ source, targetPath }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "at-builder",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "main": "bin/index.js",
5
5
  "bin": {
6
6
  "atb": "bin/index.js"
package/src/index.ts CHANGED
@@ -110,8 +110,23 @@ const runCommand = (commandArr: string[], env: NodeJS.ProcessEnv): void => {
110
110
  */
111
111
  const handleInit = async (verbose: boolean): Promise<void> => {
112
112
  if (verbose) logger.info("verbose", "Initializing new .env file");
113
- runCommand(["init -y"], productionEnv);
114
- runCommand(["install @babel/runtime","-D"], productionEnv);
113
+
114
+ // Run npm init in the current working directory (where user ran atb init)
115
+ spawn("npm", ["init", "-y"], {
116
+ cwd: process.cwd(),
117
+ env: process.env,
118
+ shell: true,
119
+ stdio: "inherit",
120
+ });
121
+
122
+ // Install @babel/runtime as dev dependency in the current directory
123
+ spawn("npm", ["install", "@babel/runtime", "-D"], {
124
+ cwd: process.cwd(),
125
+ env: process.env,
126
+ shell: true,
127
+ stdio: "inherit",
128
+ });
129
+
115
130
  setupEnv(process.cwd());
116
131
  };
117
132
 
package/webpack.config.js CHANGED
@@ -105,16 +105,17 @@ const plugins = [
105
105
  //Handle target issue for reloading the styles.
106
106
  let _uniqueTestId = `TargetBuild_${args.hash}`;
107
107
  args._uniqueTestId = _uniqueTestId;
108
- return `(function(){
109
- if(!window.${_uniqueTestId}){
110
- //# sourceURL=${_uniqueTestId}.js
111
- `;
108
+ return `
109
+ (function(){
110
+ if(!window.${_uniqueTestId}){
111
+ //# sourceURL=${_uniqueTestId}.js
112
+ `;
112
113
  },
113
114
  footer: function (_, args) {
114
115
  return `\n
115
- window.${args._uniqueTestId} = true;
116
- }
117
- })();`
116
+ window.${args._uniqueTestId} = true;
117
+ }
118
+ })();\n`
118
119
  },
119
120
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
120
121
  })