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 +14 -2
- package/lib/at-build-generator.cjs +2 -3
- package/package.json +1 -1
- package/src/index.ts +17 -2
- package/webpack.config.js +8 -7
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
|
-
|
|
107
|
-
|
|
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
|
|
43
|
-
|
|
44
|
-
${footerContent}`;
|
|
42
|
+
return `
|
|
43
|
+
${headerContent}${content}${footerContent}`;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
function generateTargetReadyBuild({ source, targetPath }) {
|
package/package.json
CHANGED
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
|
-
|
|
114
|
-
|
|
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 `
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
window.${args._uniqueTestId} = true;
|
|
117
|
+
}
|
|
118
|
+
})();\n`
|
|
118
119
|
},
|
|
119
120
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
|
|
120
121
|
})
|