@applicaster/zapplicaster-cli 13.0.0-alpha.1839726411 → 13.0.0-alpha.1868511506
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 +0 -1
- package/package.json +34 -33
- package/src/commands/migrateZappPlugin/__tests__/__snapshots__/migrateZappPlugin.test.js.snap +5 -5
- package/src/commands/prepareWorkspace/__tests__/__snapshots__/appBootstrapper.test.js.snap +2 -2
- package/src/commands/prepareWorkspace/__tests__/__snapshots__/configurator.test.js.snap +6 -6
- package/src/commands/prepareWorkspace/__tests__/__snapshots__/prepareWorkspace.test.js.snap +26 -26
- package/src/commands/prepareWorkspace/__tests__/__snapshots__/workspaceCreator.test.js.snap +16 -16
- package/src/commands/prepareWorkspace/__tests__/configFilesRetriever.test.js +12 -14
- package/src/commands/prepareWorkspace/appBootstrapper.js +8 -6
- package/src/commands/prepareWorkspace/configFilesRetriever.js +9 -22
- package/src/commands/prepareWorkspace/index.js +6 -6
- package/src/commands/prepareWorkspace/runtimeConfigurationUrlsCreator.js +3 -0
- package/src/commands/publishPlugin/__tests__/__snapshots__/configurator.test.js.snap +7 -7
- package/src/commands/publishPlugin/__tests__/__snapshots__/generateManifest.test.js.snap +5 -5
- package/src/commands/publishPlugin/__tests__/__snapshots__/publishPlugin.test.js.snap +27 -27
- package/src/commands/publishPlugin/__tests__/npmPublish.test.js +6 -5
- package/src/commands/publishPlugin/generateManifest.js +3 -4
- package/src/commands/publishPlugin/updateCorePluginsIfNeeded.js +6 -9
- package/src/download/__tests__/__snapshots__/download.test.js.snap +1 -1
- package/src/download/__tests__/download.test.js +14 -9
- package/src/download/index.js +2 -9
- package/src/file/__tests__/__snapshots__/file.test.js.snap +6 -6
- package/src/logger/__tests__/loggerError.test.js +4 -6
- package/src/plugins/__tests__/__snapshots__/plugins.test.js.snap +10 -10
- package/src/plugins/__tests__/plugins.test.js +1 -1
- package/src/render/__tests__/render.test.js +6 -8
- package/src/settings/__tests__/settings.test.js +3 -4
- package/src/shell/__tests__/__snapshots__/shell.test.js.snap +3 -3
- package/src/taskRunner/__tests__/taskRunner.test.js +1 -1
- package/src/templates/__tests__/__snapshots__/templates.test.js.snap +6 -6
- package/src/templates/newWorkspaceTemplate/index.js +0 -5
- package/src/zapp/__tests__/zapp.test.js +7 -9
- package/src/logger/__tests__/__snapshots__/loggerError.test.js.snap +0 -22
- package/src/zapp/__tests__/__snapshots__/zapp.test.js.snap +0 -18
package/README.md
CHANGED
|
@@ -98,7 +98,6 @@ const template = {
|
|
|
98
98
|
getJsonContent: config => ({ ... }) // function to get the config file's content from the CLI's configuration object. optional
|
|
99
99
|
}
|
|
100
100
|
],
|
|
101
|
-
remoteFiles: config => [] // function which returns an array of remote urls to save as config files. optional
|
|
102
101
|
}
|
|
103
102
|
```
|
|
104
103
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapplicaster-cli",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.1868511506",
|
|
4
4
|
"description": "CLI Tool for the zapp app and Quick Brick project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@applicaster/zapp-react-dom-cli-template": "13.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-android-tv-cli-template": "13.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-cli-template": "13.0.0-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-tvos-cli-template": "13.0.0-alpha.
|
|
35
|
+
"@applicaster/zapp-react-dom-cli-template": "13.0.0-alpha.1868511506",
|
|
36
|
+
"@applicaster/zapp-react-native-android-tv-cli-template": "13.0.0-alpha.1868511506",
|
|
37
|
+
"@applicaster/zapp-react-native-cli-template": "13.0.0-alpha.1868511506",
|
|
38
|
+
"@applicaster/zapp-react-native-tvos-cli-template": "13.0.0-alpha.1868511506",
|
|
39
39
|
"axios": "^0.28.0",
|
|
40
40
|
"camelize": "^1.0.0",
|
|
41
41
|
"chalk": "^2.3.2",
|
|
@@ -47,34 +47,35 @@
|
|
|
47
47
|
"shelljs": "^0.8.1",
|
|
48
48
|
"simple-git": "^3.16.0"
|
|
49
49
|
},
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@applicaster/applicaster-types": "*",
|
|
52
|
+
"@applicaster/blur": "*",
|
|
53
|
+
"@applicaster/quick-brick-xray": "*",
|
|
54
|
+
"@applicaster/react-native-color-thief": "*",
|
|
55
|
+
"@applicaster/zapp-react-dom-ui-components": "*",
|
|
56
|
+
"@applicaster/zapp-react-native-redux": "*",
|
|
57
|
+
"@applicaster/zapp-react-native-tvos-app": "*",
|
|
58
|
+
"@applicaster/zapp-react-native-tvos-ui-components": "*",
|
|
59
|
+
"@babel/runtime": "*",
|
|
60
|
+
"@react-native-community/netinfo": "*",
|
|
61
|
+
"@types/node": "*",
|
|
62
|
+
"@types/react-native": "*",
|
|
63
|
+
"core-js": "*",
|
|
64
|
+
"immer": "*",
|
|
65
|
+
"react": "*",
|
|
66
|
+
"react-dom": "*",
|
|
67
|
+
"react-hot-loader": "*",
|
|
68
|
+
"react-native": "*",
|
|
69
|
+
"react-native-fs": "*",
|
|
70
|
+
"react-native-gesture-handler": "*",
|
|
71
|
+
"react-native-linear-gradient": "*",
|
|
72
|
+
"react-native-safe-area-context": "*",
|
|
73
|
+
"react-native-svg": "*",
|
|
74
|
+
"react-native-web": "*",
|
|
75
|
+
"react-native-webview": "*",
|
|
76
|
+
"uglify-js": "*",
|
|
77
|
+
"validate-color": "*",
|
|
78
|
+
"zustand": "*"
|
|
78
79
|
},
|
|
79
80
|
"gitHead": "a473487564142c55cdb50f02505cf0b60fe75658"
|
|
80
81
|
}
|
package/src/commands/migrateZappPlugin/__tests__/__snapshots__/migrateZappPlugin.test.js.snap
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`migrateZappPlugin returns the properly formatted command object 1`] = `
|
|
4
|
-
|
|
4
|
+
{
|
|
5
5
|
"configurator": [MockFunction],
|
|
6
6
|
"name": "migrate Zapp Plugin",
|
|
7
7
|
"startMessage": "We're updating your plugin to be compatible with QuickBrick",
|
|
8
|
-
"steps":
|
|
9
|
-
|
|
8
|
+
"steps": [
|
|
9
|
+
{
|
|
10
10
|
"completion": "Done !",
|
|
11
11
|
"error": "Could not update your package.json",
|
|
12
12
|
"run": [MockFunction],
|
|
13
13
|
"start": "Updating package.json",
|
|
14
14
|
},
|
|
15
|
-
|
|
15
|
+
{
|
|
16
16
|
"completion": "Done !",
|
|
17
17
|
"error": "Could not create the plugin entry point",
|
|
18
18
|
"run": [MockFunction],
|
|
19
19
|
"start": "Creating plugin entry point",
|
|
20
20
|
},
|
|
21
|
-
|
|
21
|
+
{
|
|
22
22
|
"completion": "Your plugin is ready ! Simply publish it to npm, and it will be ready to use in any QuickBrick app",
|
|
23
23
|
"error": "Could not update Zappifest ! please update it manually by refering to https://developer-zapp.applicaster.com/quick-brick/migration-guide.html",
|
|
24
24
|
"run": [MockFunction],
|
|
@@ -454,8 +454,8 @@ Array [
|
|
|
454
454
|
exports[`appBootstrapper throws if npm install fails 1`] = `[Error: Couldn't not install npm dependencies !]`;
|
|
455
455
|
|
|
456
456
|
exports[`appBootstrapper uses yarn to install if provided in the options 1`] = `
|
|
457
|
-
|
|
458
|
-
|
|
457
|
+
[
|
|
458
|
+
[
|
|
459
459
|
"cd path/to/workspace && yarn",
|
|
460
460
|
],
|
|
461
461
|
]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`configurator builds the configuration object 1`] = `
|
|
4
|
-
|
|
4
|
+
{
|
|
5
5
|
"appVersionId": "APP_VERSION_ID",
|
|
6
6
|
"buildMobile": undefined,
|
|
7
|
-
"buildParams":
|
|
7
|
+
"buildParams": {
|
|
8
8
|
"appVersionId": "APP_VERSION_ID",
|
|
9
9
|
"assets_url": "https://assets-secure.applicaster.com/zapp/accounts/5ae06cef8fba0f00084bd3c6/apps/com.quickbricktest/apple_store/1.8/styles/assets_styles.json",
|
|
10
10
|
"otherParam": "param",
|
|
@@ -15,7 +15,7 @@ Object {
|
|
|
15
15
|
"openSdk": false,
|
|
16
16
|
"platform": "ios",
|
|
17
17
|
"spinnerColor": undefined,
|
|
18
|
-
"template":
|
|
18
|
+
"template": {
|
|
19
19
|
"foo": "bar",
|
|
20
20
|
},
|
|
21
21
|
"verbose": false,
|
|
@@ -25,10 +25,10 @@ Object {
|
|
|
25
25
|
`;
|
|
26
26
|
|
|
27
27
|
exports[`configurator sets a null path if none is provided and the cli doesn't run in zapp RN repo 1`] = `
|
|
28
|
-
|
|
28
|
+
{
|
|
29
29
|
"appVersionId": "APP_VERSION_ID",
|
|
30
30
|
"buildMobile": undefined,
|
|
31
|
-
"buildParams":
|
|
31
|
+
"buildParams": {
|
|
32
32
|
"appVersionId": "APP_VERSION_ID",
|
|
33
33
|
"assets_url": "https://assets-secure.applicaster.com/zapp/accounts/5ae06cef8fba0f00084bd3c6/apps/com.quickbricktest/apple_store/1.8/styles/assets_styles.json",
|
|
34
34
|
"otherParam": "param",
|
|
@@ -39,7 +39,7 @@ Object {
|
|
|
39
39
|
"openSdk": false,
|
|
40
40
|
"platform": "ios",
|
|
41
41
|
"spinnerColor": undefined,
|
|
42
|
-
"template":
|
|
42
|
+
"template": {
|
|
43
43
|
"foo": "bar",
|
|
44
44
|
},
|
|
45
45
|
"verbose": false,
|
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`prepareWorkspace runs the task 1`] = `
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
[
|
|
5
|
+
[
|
|
6
6
|
"prepare workspace",
|
|
7
7
|
"We're preparing your app - you'll be happily coding in no time !",
|
|
8
8
|
],
|
|
9
9
|
]
|
|
10
10
|
`;
|
|
11
11
|
|
|
12
|
-
exports[`prepareWorkspace runs the task 2`] = `
|
|
12
|
+
exports[`prepareWorkspace runs the task 2`] = `[]`;
|
|
13
13
|
|
|
14
|
-
exports[`prepareWorkspace runs the task 3`] = `
|
|
14
|
+
exports[`prepareWorkspace runs the task 3`] = `[]`;
|
|
15
15
|
|
|
16
|
-
exports[`prepareWorkspace runs the task 4`] = `
|
|
16
|
+
exports[`prepareWorkspace runs the task 4`] = `[]`;
|
|
17
17
|
|
|
18
18
|
exports[`prepareWorkspace runs the task 5`] = `
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
[
|
|
20
|
+
[
|
|
21
21
|
"checking prerequisites...",
|
|
22
22
|
],
|
|
23
|
-
|
|
23
|
+
[
|
|
24
24
|
"Gathering configuration",
|
|
25
25
|
],
|
|
26
|
-
|
|
26
|
+
[
|
|
27
27
|
"Creating workspace",
|
|
28
28
|
],
|
|
29
|
-
|
|
30
|
-
"Retrieving configuration files",
|
|
31
|
-
],
|
|
32
|
-
Array [
|
|
29
|
+
[
|
|
33
30
|
"Creating runtime URLs configuration file",
|
|
34
31
|
],
|
|
35
|
-
|
|
32
|
+
[
|
|
33
|
+
"Retrieving configuration files",
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
36
|
"Bootstraping app project",
|
|
37
37
|
],
|
|
38
|
-
|
|
38
|
+
[
|
|
39
39
|
"Checking workspace dependencies",
|
|
40
40
|
],
|
|
41
41
|
]
|
|
42
42
|
`;
|
|
43
43
|
|
|
44
44
|
exports[`prepareWorkspace runs the task 6`] = `
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
[
|
|
46
|
+
[
|
|
47
47
|
"All good - moving on",
|
|
48
48
|
],
|
|
49
|
-
|
|
49
|
+
[
|
|
50
50
|
"configuration retrieved",
|
|
51
51
|
],
|
|
52
|
-
|
|
52
|
+
[
|
|
53
53
|
"Workspace created !",
|
|
54
54
|
],
|
|
55
|
-
|
|
56
|
-
"Configuration files retrieved !",
|
|
57
|
-
],
|
|
58
|
-
Array [
|
|
55
|
+
[
|
|
59
56
|
"Runtime configuration URLs file created",
|
|
60
57
|
],
|
|
61
|
-
|
|
58
|
+
[
|
|
59
|
+
"Configuration files retrieved !",
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
62
|
"Successfully bootstrapped the app!",
|
|
63
63
|
],
|
|
64
|
-
|
|
64
|
+
[
|
|
65
65
|
"Your app is ready!",
|
|
66
66
|
],
|
|
67
67
|
]
|
|
68
68
|
`;
|
|
69
69
|
|
|
70
|
-
exports[`prepareWorkspace runs the task 7`] = `
|
|
70
|
+
exports[`prepareWorkspace runs the task 7`] = `[]`;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`workspaceCreator creates the directories if they don't exist 1`] = `
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
[
|
|
5
|
+
[
|
|
6
6
|
"path/to/workspace",
|
|
7
7
|
],
|
|
8
|
-
|
|
8
|
+
[
|
|
9
9
|
"path/to/workspace/config/ios",
|
|
10
10
|
],
|
|
11
|
-
|
|
11
|
+
[
|
|
12
12
|
"path/to/workspace/config",
|
|
13
13
|
],
|
|
14
|
-
|
|
14
|
+
[
|
|
15
15
|
"path/to/workspace/fonts/ios",
|
|
16
16
|
],
|
|
17
|
-
|
|
17
|
+
[
|
|
18
18
|
"path/to/workspace/fonts",
|
|
19
19
|
],
|
|
20
|
-
|
|
20
|
+
[
|
|
21
21
|
"path/to/workspace",
|
|
22
22
|
],
|
|
23
|
-
|
|
23
|
+
[
|
|
24
24
|
"path/to/workspace/assets/ios",
|
|
25
25
|
],
|
|
26
|
-
|
|
26
|
+
[
|
|
27
27
|
"path/to/workspace/assets",
|
|
28
28
|
],
|
|
29
|
-
|
|
29
|
+
[
|
|
30
30
|
"path/to/workspace",
|
|
31
31
|
],
|
|
32
32
|
]
|
|
33
33
|
`;
|
|
34
34
|
|
|
35
35
|
exports[`workspaceCreator creates the directories if they don't exist 2`] = `
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
[
|
|
37
|
+
[
|
|
38
38
|
"path/to/workspace/config/ios",
|
|
39
39
|
],
|
|
40
|
-
|
|
40
|
+
[
|
|
41
41
|
"path/to/workspace/fonts",
|
|
42
42
|
],
|
|
43
|
-
|
|
43
|
+
[
|
|
44
44
|
"path/to/workspace/fonts/ios",
|
|
45
45
|
],
|
|
46
|
-
|
|
46
|
+
[
|
|
47
47
|
"path/to/workspace/assets",
|
|
48
48
|
],
|
|
49
|
-
|
|
49
|
+
[
|
|
50
50
|
"path/to/workspace/assets/ios",
|
|
51
51
|
],
|
|
52
52
|
]
|
|
@@ -11,6 +11,7 @@ jest.mock("../../../download", () => ({
|
|
|
11
11
|
|
|
12
12
|
jest.mock("../../../render", () => ({
|
|
13
13
|
renderConfigFile: jest.fn(() => mock_curriedRenderConfigFile),
|
|
14
|
+
saveConfigFile: jest.fn(),
|
|
14
15
|
}));
|
|
15
16
|
|
|
16
17
|
const {
|
|
@@ -22,6 +23,11 @@ const {
|
|
|
22
23
|
const { renderConfigFile } = require("../../../render");
|
|
23
24
|
|
|
24
25
|
const { build_params: buildParams } = require("./fixtures/buildParams.json");
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
runtimeConfigurationUrlsCreator,
|
|
29
|
+
} = require("../runtimeConfigurationUrlsCreator");
|
|
30
|
+
|
|
25
31
|
const destinationPath = "path/to/workspace";
|
|
26
32
|
const platform = "ios";
|
|
27
33
|
const template = {};
|
|
@@ -34,7 +40,11 @@ const configuration = {
|
|
|
34
40
|
};
|
|
35
41
|
|
|
36
42
|
describe("configFilesRetriever", () => {
|
|
37
|
-
|
|
43
|
+
beforeAll((done) => {
|
|
44
|
+
runtimeConfigurationUrlsCreator(configuration).then(() => {
|
|
45
|
+
done();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
38
48
|
|
|
39
49
|
afterEach(() => {
|
|
40
50
|
mock_curriedSaveRemoteJsonToFile.mockClear();
|
|
@@ -47,19 +57,7 @@ describe("configFilesRetriever", () => {
|
|
|
47
57
|
await configFilesRetriever(configuration);
|
|
48
58
|
|
|
49
59
|
expect(saveRemoteJsonToFile).toHaveBeenCalledWith(configuration);
|
|
50
|
-
expect(mock_curriedSaveRemoteJsonToFile).toHaveBeenCalledTimes(
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it("also downloads remote files from the template", async () => {
|
|
54
|
-
const config = {
|
|
55
|
-
...configuration,
|
|
56
|
-
template: { remoteFiles: () => ["additional_file"] },
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
await configFilesRetriever(config);
|
|
60
|
-
|
|
61
|
-
expect(saveRemoteJsonToFile).toHaveBeenCalledWith(config);
|
|
62
|
-
expect(mock_curriedSaveRemoteJsonToFile).toHaveBeenCalledTimes(6);
|
|
60
|
+
expect(mock_curriedSaveRemoteJsonToFile).toHaveBeenCalledTimes(4);
|
|
63
61
|
});
|
|
64
62
|
|
|
65
63
|
it("saves custom config files form the template", async () => {
|
|
@@ -83,12 +83,14 @@ async function appBootstrapper(configuration) {
|
|
|
83
83
|
logger.log("injecting dependencies...");
|
|
84
84
|
const { dependencies, scripts } = template;
|
|
85
85
|
|
|
86
|
-
const pluginConfigurations = require(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
const pluginConfigurations = require(
|
|
87
|
+
getFileDestinationPath({
|
|
88
|
+
destinationPath,
|
|
89
|
+
platform,
|
|
90
|
+
folder: "config",
|
|
91
|
+
fileName: "plugin_configurations.json",
|
|
92
|
+
})
|
|
93
|
+
);
|
|
92
94
|
|
|
93
95
|
const getExcludedNodeModules = R.compose(
|
|
94
96
|
R.map((plug) => new RegExp(plug)),
|
|
@@ -24,34 +24,21 @@ const { renderConfigFile } = require("../../render");
|
|
|
24
24
|
* @param {configuration} configuration
|
|
25
25
|
*/
|
|
26
26
|
async function configFilesRetriever(configuration) {
|
|
27
|
-
const { buildParams, template } = configuration;
|
|
27
|
+
const { buildParams, template, runtimeConfigurationUrls } = configuration;
|
|
28
28
|
|
|
29
|
-
const { configFiles = []
|
|
29
|
+
const { configFiles = [] } = template;
|
|
30
30
|
|
|
31
31
|
if (Array.isArray(configFiles) && !R.propEq("length", 0, configFiles)) {
|
|
32
32
|
await Promise.all(R.map(renderConfigFile(configuration), configFiles));
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const configFilesUrls =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
R.prop(R.__, buildParams),
|
|
43
|
-
])
|
|
44
|
-
)
|
|
45
|
-
),
|
|
46
|
-
R.reject(
|
|
47
|
-
R.compose(
|
|
48
|
-
R.either(R.isNil, R.compose(R.not, R.test(/(.json)$/i))),
|
|
49
|
-
R.prop(R.__, buildParams)
|
|
50
|
-
)
|
|
51
|
-
),
|
|
52
|
-
R.filter(R.test(/(_url)$/i)),
|
|
53
|
-
R.keys
|
|
54
|
-
)(buildParams);
|
|
35
|
+
const configFilesUrls = Object.entries(runtimeConfigurationUrls).map(
|
|
36
|
+
([key, value]) => {
|
|
37
|
+
const newKey = key.replace("_url", ".json");
|
|
38
|
+
|
|
39
|
+
return [newKey, value];
|
|
40
|
+
}
|
|
41
|
+
);
|
|
55
42
|
|
|
56
43
|
// download files & save json files
|
|
57
44
|
await Promise.all(
|
|
@@ -32,18 +32,18 @@ const prepareWorkspaceTask = {
|
|
|
32
32
|
error: "Could not create workspace",
|
|
33
33
|
completion: "Workspace created !",
|
|
34
34
|
},
|
|
35
|
-
{
|
|
36
|
-
start: "Retrieving configuration files",
|
|
37
|
-
run: configFilesRetriever,
|
|
38
|
-
error: "Could not retrieve configuration files",
|
|
39
|
-
completion: "Configuration files retrieved !",
|
|
40
|
-
},
|
|
41
35
|
{
|
|
42
36
|
start: "Creating runtime URLs configuration file",
|
|
43
37
|
run: runtimeConfigurationUrlsCreator,
|
|
44
38
|
error: "Could not create runtime_configuration_urls.json",
|
|
45
39
|
completion: "Runtime configuration URLs file created",
|
|
46
40
|
},
|
|
41
|
+
{
|
|
42
|
+
start: "Retrieving configuration files",
|
|
43
|
+
run: configFilesRetriever,
|
|
44
|
+
error: "Could not retrieve configuration files",
|
|
45
|
+
completion: "Configuration files retrieved !",
|
|
46
|
+
},
|
|
47
47
|
{
|
|
48
48
|
start: "Bootstraping app project",
|
|
49
49
|
run: appBootstrapper,
|
|
@@ -31,6 +31,9 @@ async function runtimeConfigurationUrlsCreator(configuration) {
|
|
|
31
31
|
runtimeConfigurationUrls
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
+
// Intentionally mutating parameter to pass runtimeConfigurationUrls to the next step
|
|
35
|
+
configuration.runtimeConfigurationUrls = runtimeConfigurationUrls;
|
|
36
|
+
|
|
34
37
|
return true;
|
|
35
38
|
}
|
|
36
39
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`publish plugin configurator returns the configuration 1`] = `
|
|
4
|
-
|
|
4
|
+
{
|
|
5
5
|
"dryRun": false,
|
|
6
6
|
"manifestOnly": false,
|
|
7
7
|
"next": false,
|
|
8
|
-
"platforms":
|
|
8
|
+
"platforms": [
|
|
9
9
|
"ios",
|
|
10
10
|
"android",
|
|
11
11
|
],
|
|
12
|
-
"pluginPackageJson":
|
|
13
|
-
"applicaster":
|
|
14
|
-
"supportedPlatforms":
|
|
12
|
+
"pluginPackageJson": {
|
|
13
|
+
"applicaster": {
|
|
14
|
+
"supportedPlatforms": [
|
|
15
15
|
"ios",
|
|
16
16
|
"android",
|
|
17
17
|
],
|
|
@@ -30,8 +30,8 @@ Object {
|
|
|
30
30
|
`;
|
|
31
31
|
|
|
32
32
|
exports[`publish plugin configurator returns the configuration 2`] = `
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
[
|
|
34
|
+
[
|
|
35
35
|
"Publishing plugin for ios,android",
|
|
36
36
|
],
|
|
37
37
|
]
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`generate manifest logs and skips the file writing with the dry run flag 1`] = `
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
[
|
|
5
|
+
[
|
|
6
6
|
"Running with --dry-run flag. Not writing manifests",
|
|
7
7
|
],
|
|
8
|
-
|
|
8
|
+
[
|
|
9
9
|
"manifest: ",
|
|
10
10
|
"{ name: 'my plugin name', platform: 'android', version: '1.5.0' }",
|
|
11
11
|
],
|
|
12
|
-
|
|
12
|
+
[
|
|
13
13
|
"Running with --dry-run flag. Not writing manifests",
|
|
14
14
|
],
|
|
15
|
-
|
|
15
|
+
[
|
|
16
16
|
"manifest: ",
|
|
17
17
|
"{ name: 'my plugin name', platform: 'ios', version: '1.5.0' }",
|
|
18
18
|
],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`publish plugin command runs the task 1`] = `
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
[
|
|
5
|
+
[
|
|
6
6
|
"publish plugin",
|
|
7
7
|
"Publishing plugin",
|
|
8
8
|
],
|
|
@@ -10,83 +10,83 @@ Array [
|
|
|
10
10
|
`;
|
|
11
11
|
|
|
12
12
|
exports[`publish plugin command runs the task 2`] = `
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
[
|
|
14
|
+
[
|
|
15
15
|
"Template in path: /plugins/my-plugin/apple/.jazzy.json, not exist. Skipping",
|
|
16
16
|
],
|
|
17
|
-
|
|
17
|
+
[
|
|
18
18
|
"Podspec: undefined, not exist. Skipping",
|
|
19
19
|
],
|
|
20
20
|
]
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
23
|
exports[`publish plugin command runs the task 3`] = `
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
[
|
|
25
|
+
[
|
|
26
26
|
"Couldn't update core plugins",
|
|
27
27
|
[TypeError: Cannot read properties of undefined (reading 'name')],
|
|
28
28
|
],
|
|
29
29
|
]
|
|
30
30
|
`;
|
|
31
31
|
|
|
32
|
-
exports[`publish plugin command runs the task 4`] = `
|
|
32
|
+
exports[`publish plugin command runs the task 4`] = `[]`;
|
|
33
33
|
|
|
34
34
|
exports[`publish plugin command runs the task 5`] = `
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
[
|
|
36
|
+
[
|
|
37
37
|
"checking prerequisites...",
|
|
38
38
|
],
|
|
39
|
-
|
|
39
|
+
[
|
|
40
40
|
"Gathering configuration",
|
|
41
41
|
],
|
|
42
|
-
|
|
42
|
+
[
|
|
43
43
|
"generating templates for Apple platform",
|
|
44
44
|
],
|
|
45
|
-
|
|
45
|
+
[
|
|
46
46
|
"generating manifests",
|
|
47
47
|
],
|
|
48
|
-
|
|
48
|
+
[
|
|
49
49
|
"publishing to npm",
|
|
50
50
|
],
|
|
51
|
-
|
|
51
|
+
[
|
|
52
52
|
"publishing manifest",
|
|
53
53
|
],
|
|
54
|
-
|
|
54
|
+
[
|
|
55
55
|
"updating core plugins",
|
|
56
56
|
],
|
|
57
|
-
|
|
57
|
+
[
|
|
58
58
|
"Committing to git",
|
|
59
59
|
],
|
|
60
60
|
]
|
|
61
61
|
`;
|
|
62
62
|
|
|
63
63
|
exports[`publish plugin command runs the task 6`] = `
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
[
|
|
65
|
+
[
|
|
66
66
|
"All good - moving on",
|
|
67
67
|
],
|
|
68
|
-
|
|
68
|
+
[
|
|
69
69
|
"configuration retrieved",
|
|
70
70
|
],
|
|
71
|
-
|
|
71
|
+
[
|
|
72
72
|
"Your manifests have been generated in the manifests folder of your plugin",
|
|
73
73
|
],
|
|
74
|
-
|
|
74
|
+
[
|
|
75
75
|
"Your manifests have been generated in the manifests folder of your plugin",
|
|
76
76
|
],
|
|
77
|
-
|
|
77
|
+
[
|
|
78
78
|
"Your plugin was successfully published to NPM",
|
|
79
79
|
],
|
|
80
|
-
|
|
80
|
+
[
|
|
81
81
|
"Zappifest uploaded ! Your plugin is available in Zapp",
|
|
82
82
|
],
|
|
83
|
-
|
|
83
|
+
[
|
|
84
84
|
"Core plugins updated",
|
|
85
85
|
],
|
|
86
|
-
|
|
86
|
+
[
|
|
87
87
|
"Done !",
|
|
88
88
|
],
|
|
89
89
|
]
|
|
90
90
|
`;
|
|
91
91
|
|
|
92
|
-
exports[`publish plugin command runs the task 7`] = `
|
|
92
|
+
exports[`publish plugin command runs the task 7`] = `[]`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const mock_publish_error = new Error("Failed to publish package");
|
|
2
2
|
|
|
3
|
-
jest.
|
|
3
|
+
jest.doMock("../../../shell", () => ({
|
|
4
4
|
runInShellAsync: jest.fn((command) => {
|
|
5
5
|
return command.includes("fail")
|
|
6
6
|
? Promise.reject(mock_publish_error)
|
|
@@ -8,20 +8,20 @@ jest.mock("../../../shell", () => ({
|
|
|
8
8
|
}),
|
|
9
9
|
}));
|
|
10
10
|
|
|
11
|
-
jest.
|
|
11
|
+
jest.doMock("../../../logger", () => ({
|
|
12
12
|
log: jest.fn(),
|
|
13
13
|
warn: jest.fn(),
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
|
-
jest.
|
|
16
|
+
jest.doMock("../../utils/wait", () => ({
|
|
17
17
|
wait: jest.fn(() => Promise.resolve(false)),
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
|
-
jest.
|
|
20
|
+
jest.doMock("../../utils/isPackagePublished", () => ({
|
|
21
21
|
isPackagePublished: jest.fn(() => Promise.resolve(false)),
|
|
22
22
|
}));
|
|
23
23
|
|
|
24
|
-
jest.
|
|
24
|
+
jest.doMock("../../utils/retryPublishCommand", () => ({
|
|
25
25
|
retryPublishCommand: jest.fn((command) => {
|
|
26
26
|
return command.includes("fail")
|
|
27
27
|
? Promise.reject(mock_publish_error)
|
|
@@ -45,6 +45,7 @@ const { retryPublishCommand } = require("../../utils/retryPublishCommand");
|
|
|
45
45
|
|
|
46
46
|
function clearMocks() {
|
|
47
47
|
logger.log.mockClear();
|
|
48
|
+
retryPublishCommand.mockClear();
|
|
48
49
|
runInShellAsync.mockClear();
|
|
49
50
|
jest.resetModules();
|
|
50
51
|
}
|
|
@@ -58,10 +58,9 @@ async function generateManifest(configuration) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
try {
|
|
61
|
-
const manifestConfig = require(
|
|
62
|
-
pluginPath,
|
|
63
|
-
|
|
64
|
-
));
|
|
61
|
+
const manifestConfig = require(
|
|
62
|
+
resolve(pluginPath, "manifests/manifest.config.js")
|
|
63
|
+
);
|
|
65
64
|
|
|
66
65
|
const packageJson = require(resolve(pluginPath, "package.json"));
|
|
67
66
|
|
|
@@ -9,10 +9,9 @@ const QUICK_BRICK_WORKSPACE_NAME = "quick-brick";
|
|
|
9
9
|
const CORE_PLUGINS_PATH = "packages/quick-brick-core-plugins";
|
|
10
10
|
|
|
11
11
|
async function updateCorePluginsIfNeeded(configuration) {
|
|
12
|
-
const { name: workspaceName } = require(
|
|
13
|
-
process.cwd(),
|
|
14
|
-
|
|
15
|
-
));
|
|
12
|
+
const { name: workspaceName } = require(
|
|
13
|
+
path.join(process.cwd(), PACKAGE_DOT_JSON)
|
|
14
|
+
);
|
|
16
15
|
|
|
17
16
|
if (workspaceName !== QUICK_BRICK_WORKSPACE_NAME) {
|
|
18
17
|
return;
|
|
@@ -21,11 +20,9 @@ async function updateCorePluginsIfNeeded(configuration) {
|
|
|
21
20
|
const { version, pluginPackageJson } = configuration;
|
|
22
21
|
const { name } = pluginPackageJson;
|
|
23
22
|
|
|
24
|
-
const corePluginsPackageJson = require(
|
|
25
|
-
process.cwd(),
|
|
26
|
-
|
|
27
|
-
PACKAGE_DOT_JSON
|
|
28
|
-
));
|
|
23
|
+
const corePluginsPackageJson = require(
|
|
24
|
+
path.join(process.cwd(), CORE_PLUGINS_PATH, PACKAGE_DOT_JSON)
|
|
25
|
+
);
|
|
29
26
|
|
|
30
27
|
const { dependencies } = corePluginsPackageJson;
|
|
31
28
|
const isPluginCore = R.contains(name, R.keys(dependencies));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`saveRemoteJsonToFile throws an error if the download fails 1`] = `[Error: An error occurred while trying to retrieve
|
|
3
|
+
exports[`saveRemoteJsonToFile throws an error if the download fails 1`] = `[Error: An error occurred while trying to retrieve file.json: Request failed with status code 500]`;
|
|
@@ -38,10 +38,11 @@ const platform = "ios";
|
|
|
38
38
|
|
|
39
39
|
describe("saveRemoteJsonToFile", () => {
|
|
40
40
|
const fileUrl = "http://host.com/file.json";
|
|
41
|
-
const fileUrlWithError = "http://host.com/error.json";
|
|
42
41
|
|
|
43
42
|
const fileName = getFileName(fileUrl);
|
|
44
43
|
|
|
44
|
+
const fileUrlWithError = "http://host.com/error.json";
|
|
45
|
+
|
|
45
46
|
const filePath = `${destinationPath}/config/${platform}/${fileName}`;
|
|
46
47
|
|
|
47
48
|
const fileContent = {
|
|
@@ -61,7 +62,10 @@ describe("saveRemoteJsonToFile", () => {
|
|
|
61
62
|
});
|
|
62
63
|
|
|
63
64
|
it("downloads the file and writes it to the path", async () => {
|
|
64
|
-
await saveRemoteJsonToFile({ destinationPath, platform })(
|
|
65
|
+
await saveRemoteJsonToFile({ destinationPath, platform })([
|
|
66
|
+
fileName,
|
|
67
|
+
fileUrl,
|
|
68
|
+
]);
|
|
65
69
|
|
|
66
70
|
expect(loggerSpy).toHaveBeenCalledWith(
|
|
67
71
|
`saving ${fileName} from ${fileUrl}`
|
|
@@ -71,10 +75,10 @@ describe("saveRemoteJsonToFile", () => {
|
|
|
71
75
|
});
|
|
72
76
|
|
|
73
77
|
it("can download files from an object", async () => {
|
|
74
|
-
await saveRemoteJsonToFile({ destinationPath, platform })(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
await saveRemoteJsonToFile({ destinationPath, platform })([
|
|
79
|
+
fileName,
|
|
80
|
+
fileUrl,
|
|
81
|
+
]);
|
|
78
82
|
|
|
79
83
|
expect(loggerSpy).toHaveBeenCalledWith(
|
|
80
84
|
`saving ${fileName} from ${fileUrl}`
|
|
@@ -87,9 +91,10 @@ describe("saveRemoteJsonToFile", () => {
|
|
|
87
91
|
expect.assertions(1);
|
|
88
92
|
|
|
89
93
|
try {
|
|
90
|
-
await saveRemoteJsonToFile({ destinationPath, platform })(
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
await saveRemoteJsonToFile({ destinationPath, platform })([
|
|
95
|
+
fileName,
|
|
96
|
+
fileUrlWithError,
|
|
97
|
+
]);
|
|
93
98
|
} catch (e) {
|
|
94
99
|
expect(e).toMatchSnapshot();
|
|
95
100
|
}
|
package/src/download/index.js
CHANGED
|
@@ -12,8 +12,6 @@ const getFileName = R.ifElse(
|
|
|
12
12
|
R.prop("name")
|
|
13
13
|
);
|
|
14
14
|
|
|
15
|
-
const getFileUrl = R.unless(R.is(String), R.prop("url"));
|
|
16
|
-
|
|
17
15
|
/**
|
|
18
16
|
* saves a remote json file in the app's configuration folder.
|
|
19
17
|
* curried function of the shape saveRemoteJsonToFile(configuration)(fileUrl)
|
|
@@ -24,11 +22,8 @@ const getFileUrl = R.unless(R.is(String), R.prop("url"));
|
|
|
24
22
|
* @returns {Promise<Object>} status of the file write operation
|
|
25
23
|
*/
|
|
26
24
|
function saveRemoteJsonToFile({ destinationPath, platform }) {
|
|
27
|
-
return async function (
|
|
25
|
+
return async function ([fileName, fileUrl]) {
|
|
28
26
|
try {
|
|
29
|
-
const fileName = getFileName(file);
|
|
30
|
-
const fileUrl = getFileUrl(file);
|
|
31
|
-
|
|
32
27
|
logger.log(`saving ${fileName} from ${fileUrl}`);
|
|
33
28
|
|
|
34
29
|
const { data: fileContent } = await axios.get(fileUrl);
|
|
@@ -44,10 +39,8 @@ function saveRemoteJsonToFile({ destinationPath, platform }) {
|
|
|
44
39
|
|
|
45
40
|
return result;
|
|
46
41
|
} catch (e) {
|
|
47
|
-
const filename = typeof file === "string" ? file : file.name;
|
|
48
|
-
|
|
49
42
|
throw new Error(
|
|
50
|
-
`An error occurred while trying to retrieve ${
|
|
43
|
+
`An error occurred while trying to retrieve ${fileName}: ${e.message}`
|
|
51
44
|
);
|
|
52
45
|
}
|
|
53
46
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`copyFiles when destination path has no package.json doesn't skips the copy 1`] = `
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
[
|
|
5
|
+
[
|
|
6
6
|
"some/source/path/foo.json",
|
|
7
7
|
"some/destination/Path/foo.json",
|
|
8
8
|
],
|
|
9
|
-
|
|
9
|
+
[
|
|
10
10
|
"some/source/path/package.json",
|
|
11
11
|
"some/destination/Path/package.json",
|
|
12
12
|
],
|
|
@@ -14,12 +14,12 @@ Array [
|
|
|
14
14
|
`;
|
|
15
15
|
|
|
16
16
|
exports[`copyFiles when there is no package.json to copy copies the files 1`] = `
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
[
|
|
18
|
+
[
|
|
19
19
|
"some/source/path/foo.json",
|
|
20
20
|
"some/destination/Path/foo.json",
|
|
21
21
|
],
|
|
22
|
-
|
|
22
|
+
[
|
|
23
23
|
"some/source/path/bar.json",
|
|
24
24
|
"some/destination/Path/bar.json",
|
|
25
25
|
],
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import logger from "../";
|
|
2
|
+
|
|
1
3
|
const processSpy = jest.spyOn(process, "exit").mockImplementation(jest.fn());
|
|
2
4
|
const consoleSpy = jest.spyOn(console, "error").mockImplementation(jest.fn());
|
|
3
5
|
|
|
@@ -16,14 +18,13 @@ describe("when env is not test", () => {
|
|
|
16
18
|
});
|
|
17
19
|
|
|
18
20
|
it("exits the process when logger.error is called", () => {
|
|
19
|
-
const logger = require("../index");
|
|
20
21
|
const error = new Error("error");
|
|
21
22
|
error.stack = "stack";
|
|
22
23
|
|
|
23
24
|
logger.error("error message", error);
|
|
24
25
|
|
|
25
26
|
expect(processSpy).toHaveBeenCalledWith(1);
|
|
26
|
-
expect(consoleSpy
|
|
27
|
+
expect(consoleSpy).toHaveBeenCalledTimes(2);
|
|
27
28
|
});
|
|
28
29
|
});
|
|
29
30
|
|
|
@@ -45,7 +46,6 @@ describe("when env is not test and process exit code is defined", () => {
|
|
|
45
46
|
});
|
|
46
47
|
|
|
47
48
|
it("exits the process when logger.error is called and uses the process exit code", () => {
|
|
48
|
-
const logger = require("../index");
|
|
49
49
|
const error = new Error("error");
|
|
50
50
|
|
|
51
51
|
logger.error("error message", error);
|
|
@@ -60,9 +60,7 @@ describe("when error passed has no stack", () => {
|
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
it("doesn't print the stack", () => {
|
|
63
|
-
const logger = require("../index");
|
|
64
|
-
|
|
65
63
|
logger.error("error message", "error without a stack");
|
|
66
|
-
expect(consoleSpy
|
|
64
|
+
expect(consoleSpy).toHaveBeenCalledTimes(1);
|
|
67
65
|
});
|
|
68
66
|
});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`gatherDependencies excludes plugins which don't have dependency_name or identifier 1`] = `
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
[
|
|
5
|
+
{
|
|
6
6
|
"api": undefined,
|
|
7
|
-
"configuration":
|
|
7
|
+
"configuration": {
|
|
8
8
|
"foo": "bar",
|
|
9
9
|
},
|
|
10
10
|
"identifier": "applicaster",
|
|
11
11
|
"moduleName": "applicaster",
|
|
12
12
|
"name": "Applicaster",
|
|
13
|
-
"npm_dependencies":
|
|
13
|
+
"npm_dependencies": [],
|
|
14
14
|
"packageName": "@applicaster/zapp-pipes-provider-applicaster",
|
|
15
|
-
"type":
|
|
15
|
+
"type": [
|
|
16
16
|
"data_source_provider",
|
|
17
17
|
],
|
|
18
18
|
"version": "1.4.2",
|
|
@@ -21,13 +21,13 @@ Array [
|
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
23
|
exports[`getPluginDependencies maps the plugins from plugin configurations 1`] = `
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
[
|
|
25
|
+
{
|
|
26
26
|
"name": "@applicaster/zapp-pipes-provider-applicaster",
|
|
27
27
|
"type": "dependencies",
|
|
28
28
|
"version": "1.4.2",
|
|
29
29
|
},
|
|
30
|
-
|
|
30
|
+
{
|
|
31
31
|
"name": "npm-package",
|
|
32
32
|
"type": "dependencies",
|
|
33
33
|
"version": "1.3.4",
|
|
@@ -36,7 +36,7 @@ Array [
|
|
|
36
36
|
`;
|
|
37
37
|
|
|
38
38
|
exports[`getSDKAssets retrieves list of assets for native platform and returns an object of assets 1`] = `
|
|
39
|
-
|
|
39
|
+
{
|
|
40
40
|
"image": "./assets/android/drawable-xxxhdpi/image.png",
|
|
41
41
|
"intro": "./assets/android/drawable-xxxhdpi/intro.mp4",
|
|
42
42
|
"splashBackground": "./assets/android/drawable-xxxhdpi/splashBackground.png",
|
|
@@ -44,7 +44,7 @@ Object {
|
|
|
44
44
|
`;
|
|
45
45
|
|
|
46
46
|
exports[`getSDKAssets retrieves list of assets for web platform and returns an object of assets 1`] = `
|
|
47
|
-
|
|
47
|
+
{
|
|
48
48
|
"image": "./assets/lg_tv/image.png",
|
|
49
49
|
"intro": "./assets/lg_tv/intro.mp4",
|
|
50
50
|
"splashBackground": "./assets/lg_tv/splashBackground.png",
|
|
@@ -103,7 +103,7 @@ describe("gatherDependencies", () => {
|
|
|
103
103
|
const pluginConfigurations = [applicasterManifest, nonJSPlugin, rnPlugin];
|
|
104
104
|
const result = gatherDependencies(pluginConfigurations);
|
|
105
105
|
|
|
106
|
-
expect(result).
|
|
106
|
+
expect(result).toHaveLength(2);
|
|
107
107
|
expect(result[0]).toHaveProperty("name", name);
|
|
108
108
|
expect(result[1]).toHaveProperty("name", rnPlugin.plugin.name);
|
|
109
109
|
});
|
|
@@ -69,10 +69,9 @@ describe("injectDependencies", () => {
|
|
|
69
69
|
"./fixtures/packageWithDependencies"
|
|
70
70
|
);
|
|
71
71
|
|
|
72
|
-
const templatePackageJson = require(
|
|
73
|
-
templatePackageJsonPath,
|
|
74
|
-
|
|
75
|
-
));
|
|
72
|
+
const templatePackageJson = require(
|
|
73
|
+
resolve(templatePackageJsonPath, "./package.json")
|
|
74
|
+
);
|
|
76
75
|
|
|
77
76
|
await injectDependencies(dependencies, templatePackageJsonPath);
|
|
78
77
|
|
|
@@ -126,10 +125,9 @@ describe("injectScripts", () => {
|
|
|
126
125
|
"./fixtures/packageWithDependencies"
|
|
127
126
|
);
|
|
128
127
|
|
|
129
|
-
const templatePackageJson = require(
|
|
130
|
-
templatePackageJsonPath,
|
|
131
|
-
|
|
132
|
-
));
|
|
128
|
+
const templatePackageJson = require(
|
|
129
|
+
resolve(templatePackageJsonPath, "./package.json")
|
|
130
|
+
);
|
|
133
131
|
|
|
134
132
|
await injectScripts(scripts, templatePackageJsonPath);
|
|
135
133
|
|
|
@@ -35,10 +35,9 @@ describe("isZappReactNativeRepo", () => {
|
|
|
35
35
|
|
|
36
36
|
describe("getCLIProperties", () => {
|
|
37
37
|
it("returns the cli package's name & version", () => {
|
|
38
|
-
const { name, version } = require(
|
|
39
|
-
__dirname,
|
|
40
|
-
|
|
41
|
-
));
|
|
38
|
+
const { name, version } = require(
|
|
39
|
+
path.resolve(__dirname, "../../../package.json")
|
|
40
|
+
);
|
|
42
41
|
|
|
43
42
|
expect(getCLIProperties()).toEqual({
|
|
44
43
|
name,
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
exports[`curlFile throws an error if the command fails 1`] = `"Shell execution failed for curl -O FAILING_COMMAND - Error"`;
|
|
4
4
|
|
|
5
5
|
exports[`curlMultipleFiles moves the files to the destination 1`] = `
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
[
|
|
7
|
+
[
|
|
8
8
|
"foo.ext",
|
|
9
9
|
"path/to/files",
|
|
10
10
|
],
|
|
11
|
-
|
|
11
|
+
[
|
|
12
12
|
"bar.ext",
|
|
13
13
|
"path/to/files",
|
|
14
14
|
],
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`resolveAppTemplate retrieves the template for the device_target if provided, and device has specific template 1`] = `
|
|
4
|
-
|
|
4
|
+
{
|
|
5
5
|
"name": "tvos app template",
|
|
6
6
|
}
|
|
7
7
|
`;
|
|
8
8
|
|
|
9
9
|
exports[`resolveAppTemplate retrieves the template for the device_target if provided, and device has specific template 2`] = `
|
|
10
|
-
|
|
10
|
+
{
|
|
11
11
|
"name": "android_tv app template",
|
|
12
12
|
}
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
15
|
exports[`resolveAppTemplate retrieves the template for the platform if not provided 1`] = `
|
|
16
|
-
|
|
16
|
+
{
|
|
17
17
|
"name": "rn app template",
|
|
18
18
|
}
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
21
|
exports[`resolveAppTemplate retrieves the template for the platform if not provided 2`] = `
|
|
22
|
-
|
|
22
|
+
{
|
|
23
23
|
"name": "rn app template",
|
|
24
24
|
}
|
|
25
25
|
`;
|
|
26
26
|
|
|
27
27
|
exports[`resolveAppTemplate retrieves the template from the provided path if provided 1`] = `
|
|
28
|
-
|
|
29
|
-
"template":
|
|
28
|
+
{
|
|
29
|
+
"template": {
|
|
30
30
|
"foo": "bar",
|
|
31
31
|
},
|
|
32
32
|
}
|
|
@@ -86,11 +86,6 @@ const template = {
|
|
|
86
86
|
type: "devDependencies",
|
|
87
87
|
},
|
|
88
88
|
{ name: "react-dom", version: "^16.4.0", type: "devDependencies" },
|
|
89
|
-
{
|
|
90
|
-
name: "react-router-enzyme-context",
|
|
91
|
-
version: "^1.2.0",
|
|
92
|
-
type: "devDependencies",
|
|
93
|
-
},
|
|
94
89
|
{ name: "react-test-renderer", version: "16.4.1", type: "devDependencies" },
|
|
95
90
|
{
|
|
96
91
|
name: "regenerator-runtime",
|
|
@@ -49,28 +49,26 @@ describe("getAppVersionsParams", () => {
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
it("returns the app's build params", async () => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
);
|
|
52
|
+
const res = await getAppVersionParams(VERSION_ID);
|
|
53
|
+
|
|
54
|
+
expect(res).toEqual(build_params.build_params);
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
it("trims the app version id string before sending the request", async () => {
|
|
58
58
|
// eslint-disable-next-line no-irregular-whitespace
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
);
|
|
59
|
+
const res = await getAppVersionParams(` ${VERSION_ID} `);
|
|
60
|
+
|
|
61
|
+
expect(res).toEqual(build_params.build_params);
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
it("throws if response is not 2xx / 3xx", async () => {
|
|
65
65
|
const { getAppVersionParams } = require("../index");
|
|
66
66
|
|
|
67
|
-
expect.assertions(2);
|
|
68
|
-
|
|
69
67
|
try {
|
|
70
68
|
await getAppVersionParams(FAILING_VERSION_ID);
|
|
71
69
|
} catch (e) {
|
|
72
70
|
expect(e).toEqual(new Error("Request failed with status code 404"));
|
|
73
|
-
expect(consoleSpy
|
|
71
|
+
expect(consoleSpy).toHaveBeenCalledTimes(3);
|
|
74
72
|
}
|
|
75
73
|
});
|
|
76
74
|
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`when env is not test exits the process when logger.error is called 1`] = `
|
|
4
|
-
Array [
|
|
5
|
-
Array [
|
|
6
|
-
"❌ ",
|
|
7
|
-
"[41m[37merror message[39m[49m",
|
|
8
|
-
],
|
|
9
|
-
Array [
|
|
10
|
-
"[31mstack[39m",
|
|
11
|
-
],
|
|
12
|
-
]
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
exports[`when error passed has no stack doesn't print the stack 1`] = `
|
|
16
|
-
Array [
|
|
17
|
-
Array [
|
|
18
|
-
"❌ ",
|
|
19
|
-
"[41m[37merror message[39m[49m",
|
|
20
|
-
],
|
|
21
|
-
]
|
|
22
|
-
`;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`getAppVersionsParams throws if response is not 2xx / 3xx 1`] = `
|
|
4
|
-
Array [
|
|
5
|
-
Array [
|
|
6
|
-
"⚠ ",
|
|
7
|
-
"[33mFailed getting build params from zapp[39m",
|
|
8
|
-
],
|
|
9
|
-
Array [
|
|
10
|
-
"⚠ ",
|
|
11
|
-
"[33murl: \\"\\"[39m",
|
|
12
|
-
],
|
|
13
|
-
Array [
|
|
14
|
-
"⚠ ",
|
|
15
|
-
"[33mparams: {\\"access_token\\":\\"fake_zapp_token\\",\\"app_version_id\\":\\"09876POI\\"}[39m",
|
|
16
|
-
],
|
|
17
|
-
]
|
|
18
|
-
`;
|