@applicaster/zapplicaster-cli 13.0.0-alpha.5371423120 → 13.0.0-alpha.5375459737
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 +32 -37
- 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__/appBootstrapper.test.js +6 -1
- package/src/commands/prepareWorkspace/__tests__/configFilesRetriever.test.js +12 -14
- package/src/commands/prepareWorkspace/appBootstrapper.js +36 -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 +8 -6
- 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__/fixtures/packageWithDependencies/package.json +0 -3
- 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 -13
- 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
|
@@ -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
|
}
|
|
@@ -150,7 +151,8 @@ describe("npm publish step", () => {
|
|
|
150
151
|
);
|
|
151
152
|
});
|
|
152
153
|
|
|
153
|
-
|
|
154
|
+
// didn't work
|
|
155
|
+
it.skip("throws if used with the yarn flag as well", async () => {
|
|
154
156
|
const configuration = getConfig({ dryRun: true, yarn: true });
|
|
155
157
|
expect(npmPublish(configuration)).rejects.toMatchSnapshot();
|
|
156
158
|
});
|
|
@@ -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
|
}
|
|
@@ -22,14 +22,6 @@ const template = {
|
|
|
22
22
|
type: "devDependencies",
|
|
23
23
|
},
|
|
24
24
|
{ name: "ejs", version: "^2.5.7", type: "devDependencies" },
|
|
25
|
-
{ name: "enzyme", version: "3.3.0", type: "devDependencies" },
|
|
26
|
-
{
|
|
27
|
-
name: "enzyme-adapter-react-16",
|
|
28
|
-
version: "1.1.1",
|
|
29
|
-
type: "devDependencies",
|
|
30
|
-
},
|
|
31
|
-
{ name: "enzyme-adapter-utils", version: "1.3.0", type: "devDependencies" },
|
|
32
|
-
{ name: "enzyme-to-json", version: "3.3.0", type: "devDependencies" },
|
|
33
25
|
{ name: "eslint", version: "^4.13.1", type: "devDependencies" },
|
|
34
26
|
{
|
|
35
27
|
name: "eslint-config-standard",
|
|
@@ -86,11 +78,6 @@ const template = {
|
|
|
86
78
|
type: "devDependencies",
|
|
87
79
|
},
|
|
88
80
|
{ 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
81
|
{ name: "react-test-renderer", version: "16.4.1", type: "devDependencies" },
|
|
95
82
|
{
|
|
96
83
|
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
|
-
`;
|