@iexec/iapp-maker 0.0.1-alpha-nightly-79e0105f6025d93833a45abc311c73fb2b5b6c26 → 0.0.1-alpha-nightly-6be476717b877e4857383c375d5f209dbd288f99
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +15 -0
- package/package.json +1 -1
- package/src/cmd/test.js +1 -1
- package/src/execDocker/docker.js +7 -10
- package/src/utils/initIAppWorkspace.js +3 -0
- package/templates/js/_.gitignore +9 -0
package/README.md
CHANGED
@@ -14,6 +14,21 @@ This CLI provides an interface to guide you through different steps:
|
|
14
14
|
(`iapp init` will also propose you to do so)
|
15
15
|
- Docker
|
16
16
|
|
17
|
+
> ℹ️ For MacOS users
|
18
|
+
>
|
19
|
+
> This tool use `docker buildx` to build images for `linux/amd64` platform
|
20
|
+
> compatible with iExec's decentralized workers.
|
21
|
+
>
|
22
|
+
> Make sure your docker builder supports AMD64 architecture:
|
23
|
+
>
|
24
|
+
> ```sh
|
25
|
+
> docker buildx inspect --bootstrap | grep -i platforms
|
26
|
+
> ```
|
27
|
+
>
|
28
|
+
> The output should include `linux/amd64` in the list of supported platforms. If
|
29
|
+
> not update te the latest Docker Desktop version which includes these
|
30
|
+
> requirements.
|
31
|
+
|
17
32
|
## Install
|
18
33
|
|
19
34
|
```sh
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@iexec/iapp-maker",
|
3
|
-
"version": "0.0.1-alpha-nightly-
|
3
|
+
"version": "0.0.1-alpha-nightly-6be476717b877e4857383c375d5f209dbd288f99",
|
4
4
|
"description": "A CLI to guide you through the process of building an iExec iApp",
|
5
5
|
"main": "src/index.js",
|
6
6
|
"type": "module",
|
package/src/cmd/test.js
CHANGED
@@ -113,7 +113,7 @@ export async function testApp({
|
|
113
113
|
const imageId = await dockerBuild({
|
114
114
|
isForTest: true,
|
115
115
|
progressCallback: (msg) => {
|
116
|
-
spinner.text = spinner.text +
|
116
|
+
spinner.text = spinner.text + color.comment(msg);
|
117
117
|
},
|
118
118
|
});
|
119
119
|
spinner.succeed(`App docker image built (${imageId})`);
|
package/src/execDocker/docker.js
CHANGED
@@ -24,22 +24,19 @@ export async function dockerBuild({
|
|
24
24
|
src: ['./'],
|
25
25
|
};
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
} else {
|
34
|
-
// AMD64 variant to deploy to iExec stack
|
35
|
-
platform = 'linux/amd64';
|
36
|
-
}
|
27
|
+
// by default force to build amd64 image which is architecture used in iExec workers
|
28
|
+
// this require buildx builder to support 'linux/amd64' (some devices may need QEMU for amd64 architecture emulation)
|
29
|
+
let platform = 'linux/amd64';
|
30
|
+
// for MacOS local testing only build arm64 variant
|
31
|
+
if (osType === 'Darwin' && isForTest) {
|
32
|
+
platform = 'linux/arm64';
|
37
33
|
}
|
38
34
|
|
39
35
|
// Perform the Docker build operation
|
40
36
|
const buildImageStream = await docker.buildImage(buildArgs, {
|
41
37
|
t: tag,
|
42
38
|
platform,
|
39
|
+
pull: true, // docker store does not support multi platform image, this can cause issues when switching build target platform, pulling ensures the right image is used
|
43
40
|
});
|
44
41
|
|
45
42
|
const imageId = await new Promise((resolve, reject) => {
|
@@ -91,6 +91,9 @@ async function copyChosenTemplateFiles({
|
|
91
91
|
const files = await fs.readdir(templateDir);
|
92
92
|
await Promise.all(files.map((file) => write(file)));
|
93
93
|
|
94
|
+
// rename _.gitignore (npm does not allow publishing files named .gitignore in a package)
|
95
|
+
await fs.rename('_.gitignore', '.gitignore');
|
96
|
+
|
94
97
|
// transform template: remove unwanted feature code inside " // <<feature>> ... // <</feature>>" tags
|
95
98
|
const code = (await fs.readFile(srcFile)).toString('utf8');
|
96
99
|
let modifiedCode = code;
|