@bravemobile/react-native-code-push 8.3.1 → 9.0.0-alpha.0
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/CodePush.js +107 -136
- package/README.md +0 -5
- package/babel-plugin-code-push/index.js +197 -0
- package/babel-plugin-code-push/package-lock.json +10463 -0
- package/babel-plugin-code-push/package.json +26 -0
- package/babel-plugin-code-push/test/.babelrc.js +12 -0
- package/babel-plugin-code-push/test/cases/test1-config +15 -0
- package/babel-plugin-code-push/test/cases/test1-input +3 -0
- package/babel-plugin-code-push/test/cases/test1-output +11 -0
- package/babel-plugin-code-push/test/cases/test2-config +9 -0
- package/babel-plugin-code-push/test/cases/test2-input +3 -0
- package/babel-plugin-code-push/test/cases/test2-output +7 -0
- package/babel-plugin-code-push/test/codepush.config.js +15 -0
- package/babel-plugin-code-push/test/plugin.test.js +44 -0
- package/babel.config.js +3 -0
- package/cli/commands/bundleCommand/bundleCodePush.js +49 -0
- package/cli/commands/bundleCommand/index.js +25 -0
- package/cli/commands/createHistoryCommand/createReleaseHistory.js +53 -0
- package/cli/commands/createHistoryCommand/index.js +28 -0
- package/cli/commands/releaseCommand/addToReleaseHistory.js +75 -0
- package/cli/commands/releaseCommand/index.js +61 -0
- package/cli/commands/releaseCommand/release.js +88 -0
- package/cli/commands/showHistoryCommand/index.js +28 -0
- package/cli/commands/updateHistoryCommand/index.js +49 -0
- package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +62 -0
- package/cli/constant.js +3 -0
- package/cli/functions/getReactTempDir.js +16 -0
- package/cli/functions/makeCodePushBundle.js +27 -0
- package/cli/functions/prepareToBundleJS.js +12 -0
- package/cli/functions/runHermesEmitBinaryCommand.js +213 -0
- package/cli/functions/runReactNativeBundleCommand.js +59 -0
- package/cli/index.js +43 -0
- package/cli/utils/file-utils.js +42 -0
- package/cli/utils/fsUtils.js +49 -0
- package/cli/utils/hash-utils.js +227 -0
- package/cli/utils/promisfied-fs.js +29 -0
- package/cli/utils/showLogo.js +23 -0
- package/cli/utils/zip.js +89 -0
- package/code-push.config.example.supabase.ts +114 -0
- package/docs/setup-android.md +3 -11
- package/eslint.config.mjs +32 -0
- package/package-mixins.js +1 -8
- package/package.json +26 -23
- package/react-native.config.js +3 -1
- package/typings/react-native-code-push.d.ts +91 -16
- package/versioning/BaseVersioning.js +126 -0
- package/versioning/BaseVersioning.test.js +15 -0
- package/versioning/IncrementalVersioning.js +9 -0
- package/versioning/IncrementalVersioning.test.js +186 -0
- package/versioning/SemverVersioning.js +10 -0
- package/versioning/SemverVersioning.test.js +205 -0
- package/versioning/index.js +7 -0
- package/.azurepipelines/build-rn-code-push-1es.yml +0 -104
- package/.azurepipelines/test-rn-code-push.yml +0 -94
- package/.config/CredScanSuppressions.json +0 -14
- package/docs/setup-windows.md +0 -121
- package/request-fetch-adapter.js +0 -52
- package/scripts/postlink/android/postlink.js +0 -87
- package/scripts/postlink/ios/postlink.js +0 -116
- package/scripts/postlink/run.js +0 -11
- package/scripts/postunlink/android/postunlink.js +0 -74
- package/scripts/postunlink/ios/postunlink.js +0 -87
- package/scripts/postunlink/run.js +0 -11
- package/scripts/tools/linkToolsAndroid.js +0 -57
- package/scripts/tools/linkToolsIos.js +0 -130
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { SemverVersioning } from "./SemverVersioning";
|
|
2
|
+
|
|
3
|
+
describe('Semver Versioning Test', () => {
|
|
4
|
+
const MOCK_INFOS = { downloadUrl: '', packageHash: '' }
|
|
5
|
+
|
|
6
|
+
// When major version is released, it must be considered like below
|
|
7
|
+
const FIRST_RELEASE_INFO = { enabled: true, mandatory: false, ...MOCK_INFOS };
|
|
8
|
+
|
|
9
|
+
describe('findLatestRelease', () => {
|
|
10
|
+
it('should throw error when there is no releases', () => {
|
|
11
|
+
const RELEASED_BUNDLES = {}
|
|
12
|
+
expect(() => new SemverVersioning(RELEASED_BUNDLES).findLatestRelease())
|
|
13
|
+
.toThrow("There is no latest release.")
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('should return latest release', () => {
|
|
17
|
+
const RELEASED_BUNDLES = {
|
|
18
|
+
'1.0.0': { enabled: true, mandatory: false, downloadUrl: 'R1', packageHash: 'P1' },
|
|
19
|
+
'1.1.0': { enabled: true, mandatory: false, downloadUrl: 'R2', packageHash: 'P2' },
|
|
20
|
+
'1.1.1': { enabled: true, mandatory: true, downloadUrl: 'R3', packageHash: 'P3' },
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).findLatestRelease()).toEqual([
|
|
24
|
+
'1.1.1',
|
|
25
|
+
{ enabled: true, mandatory: true, downloadUrl: 'R3', packageHash: 'P3' }
|
|
26
|
+
])
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('should ignore not-enabled bundles and return latest release', () => {
|
|
30
|
+
const RELEASED_BUNDLES_1 = {
|
|
31
|
+
'1.0.0': { enabled: true, mandatory: false, downloadUrl: 'R1', packageHash: 'P1' },
|
|
32
|
+
'1.1.0': { enabled: false, mandatory: false, downloadUrl: 'R2', packageHash: 'P2' },
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const RELEASED_BUNDLES_2 = {
|
|
36
|
+
'1.0.0': { enabled: true, mandatory: false, downloadUrl: 'R1', packageHash: 'P1' },
|
|
37
|
+
'1.1.0': { enabled: false, mandatory: false, downloadUrl: 'R2', packageHash: 'P2' },
|
|
38
|
+
'1.1.1': { enabled: true, mandatory: true, downloadUrl: 'R3', packageHash: 'P3' },
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
expect(new SemverVersioning(RELEASED_BUNDLES_1).findLatestRelease()).toEqual([
|
|
42
|
+
'1.0.0',
|
|
43
|
+
{ enabled: true, mandatory: false, downloadUrl: 'R1', packageHash: 'P1' }
|
|
44
|
+
])
|
|
45
|
+
|
|
46
|
+
expect(new SemverVersioning(RELEASED_BUNDLES_2).findLatestRelease()).toEqual([
|
|
47
|
+
'1.1.1',
|
|
48
|
+
{ enabled: true, mandatory: true, downloadUrl: 'R3', packageHash: 'P3' }
|
|
49
|
+
])
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
describe('checkIsMandatory', () => {
|
|
54
|
+
describe('not-mandatory cases', () => {
|
|
55
|
+
it('should consider not-mandatory when the first major version is released', () => {
|
|
56
|
+
const RUNTIME_VERSION = '1.0.0';
|
|
57
|
+
const RELEASED_BUNDLES = {
|
|
58
|
+
'1.0.0': FIRST_RELEASE_INFO,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory(RUNTIME_VERSION)).toBe(false);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should consider not-mandatory when latest version is running', () => {
|
|
65
|
+
const RUNTIME_VERSION = '1.1.1';
|
|
66
|
+
const RELEASED_BUNDLES = {
|
|
67
|
+
'1.0.0': FIRST_RELEASE_INFO,
|
|
68
|
+
'1.1.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
69
|
+
'1.1.1': { enabled: true, mandatory: true, ...MOCK_INFOS },
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory(RUNTIME_VERSION)).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should consider not-mandatory when only not-mandatory version is released', () => {
|
|
76
|
+
const RUNTIME_VERSION = '1.0.0';
|
|
77
|
+
const RELEASED_BUNDLES = {
|
|
78
|
+
'1.0.0': FIRST_RELEASE_INFO,
|
|
79
|
+
'1.1.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory(RUNTIME_VERSION)).toBe(false);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should consider not-mandatory when only not-mandatory version is released after current runtime version', () => {
|
|
86
|
+
const RUNTIME_VERSION = '1.0.1';
|
|
87
|
+
const RELEASED_BUNDLES = {
|
|
88
|
+
'1.0.0': FIRST_RELEASE_INFO,
|
|
89
|
+
'1.0.1': { enabled: true, mandatory: true, ...MOCK_INFOS },
|
|
90
|
+
'1.1.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory(RUNTIME_VERSION)).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
describe('mandatory cases', () => {
|
|
98
|
+
it('should consider mandatory when mandatory release exists', () => {
|
|
99
|
+
const RUNTIME_VERSION = '1.0.0';
|
|
100
|
+
const RELEASED_BUNDLES = {
|
|
101
|
+
'1.0.0': FIRST_RELEASE_INFO,
|
|
102
|
+
'1.0.1': { enabled: true, mandatory: true, ...MOCK_INFOS },
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory(RUNTIME_VERSION)).toBe(true);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("should consider mandatory if there's a mandatory release between the runtime version and the latest", () => {
|
|
109
|
+
const RUNTIME_VERSION = '1.0.0'
|
|
110
|
+
const RELEASED_BUNDLES = {
|
|
111
|
+
'1.0.0': FIRST_RELEASE_INFO,
|
|
112
|
+
'1.2.0': { enabled: true, mandatory: true, ...MOCK_INFOS },
|
|
113
|
+
'1.3.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory(RUNTIME_VERSION)).toBe(true);
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
it('should consider mandatory when latest version < current runtime version (ROLLBACK)', () => {
|
|
120
|
+
const RELEASED_BUNDLES = {
|
|
121
|
+
'1.1.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
122
|
+
};
|
|
123
|
+
const currentVersion = '1.2.0'
|
|
124
|
+
|
|
125
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).shouldRollback(currentVersion)).toBe(true)
|
|
126
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory(currentVersion)).toBe(true)
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
describe('scenario test', () => {
|
|
131
|
+
it('Major Release > Mandatory > Not-mandatory > Mandatory > Not-mandatory', () => {
|
|
132
|
+
const RELEASED_BUNDLES = {
|
|
133
|
+
'1.0.0': FIRST_RELEASE_INFO,
|
|
134
|
+
'1.0.1': { enabled: true, mandatory: true, ...MOCK_INFOS },
|
|
135
|
+
'1.1.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
136
|
+
'1.1.1': { enabled: true, mandatory: true, ...MOCK_INFOS },
|
|
137
|
+
'1.2.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory('1.0.0')).toBe(true);
|
|
141
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory('1.0.1')).toBe(true);
|
|
142
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory('1.1.0')).toBe(true);
|
|
143
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory('1.1.1')).toBe(false);
|
|
144
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory('1.2.0')).toBe(false);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('When having not-enabled releases', () => {
|
|
148
|
+
const RELEASED_BUNDLES = {
|
|
149
|
+
'1.0.0': FIRST_RELEASE_INFO,
|
|
150
|
+
'1.0.1': { enabled: true, mandatory: true, ...MOCK_INFOS },
|
|
151
|
+
'1.1.0': { enabled: false, mandatory: false, ...MOCK_INFOS },
|
|
152
|
+
'1.1.1': { enabled: true, mandatory: true, ...MOCK_INFOS },
|
|
153
|
+
'1.2.0': { enabled: false, mandatory: false, ...MOCK_INFOS },
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory('1.0.0')).toBe(true);
|
|
157
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory('1.0.1')).toBe(true);
|
|
158
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory('1.1.0')).toBe(true);
|
|
159
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory('1.1.1')).toBe(false);
|
|
160
|
+
expect(new SemverVersioning(RELEASED_BUNDLES).checkIsMandatory('1.2.0')).toBe(true);
|
|
161
|
+
});
|
|
162
|
+
})
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
describe('shouldRollbackToBinary', () => {
|
|
166
|
+
it('should return false if it is not required to rollback', () => {
|
|
167
|
+
const RELEASED_BUNDLES_1 = {
|
|
168
|
+
'1.0.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
169
|
+
};
|
|
170
|
+
const RELEASED_BUNDLES_2 = {
|
|
171
|
+
'1.0.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
172
|
+
'1.1.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
173
|
+
'1.2.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
174
|
+
};
|
|
175
|
+
expect(new SemverVersioning(RELEASED_BUNDLES_1).shouldRollbackToBinary('1.0.0')).toBe(false)
|
|
176
|
+
expect(new SemverVersioning(RELEASED_BUNDLES_2).shouldRollbackToBinary('1.1.0')).toBe(false)
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
it('should return true if the destination version is the latest major version', () => {
|
|
180
|
+
const RELEASED_BUNDLES_1 = {
|
|
181
|
+
'1.0.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
182
|
+
'1.1.0': { enabled: false, mandatory: false, ...MOCK_INFOS },
|
|
183
|
+
'1.2.0': { enabled: false, mandatory: false, ...MOCK_INFOS },
|
|
184
|
+
};
|
|
185
|
+
const RELEASED_BUNDLES_2 = {
|
|
186
|
+
'1.2.0-rc.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
187
|
+
};
|
|
188
|
+
expect(new SemverVersioning(RELEASED_BUNDLES_1).shouldRollbackToBinary('1.2.0')).toBe(true)
|
|
189
|
+
expect(new SemverVersioning(RELEASED_BUNDLES_2).shouldRollbackToBinary('1.2.0-rc.2')).toBe(true)
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
it('should return false if the destination version is not the latest major version', () => {
|
|
193
|
+
const RELEASED_BUNDLES_1 = {
|
|
194
|
+
'1.0.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
195
|
+
'1.1.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
196
|
+
};
|
|
197
|
+
const RELEASED_BUNDLES_2 = {
|
|
198
|
+
'1.2.0-rc.0': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
199
|
+
'1.2.0-rc.1': { enabled: true, mandatory: false, ...MOCK_INFOS },
|
|
200
|
+
};
|
|
201
|
+
expect(new SemverVersioning(RELEASED_BUNDLES_1).shouldRollbackToBinary('1.2.0')).toBe(false)
|
|
202
|
+
expect(new SemverVersioning(RELEASED_BUNDLES_2).shouldRollbackToBinary('1.2.0-rc.2')).toBe(false)
|
|
203
|
+
})
|
|
204
|
+
})
|
|
205
|
+
})
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
trigger:
|
|
2
|
-
- master
|
|
3
|
-
|
|
4
|
-
pr:
|
|
5
|
-
- master
|
|
6
|
-
|
|
7
|
-
resources:
|
|
8
|
-
repositories:
|
|
9
|
-
- repository: 1ESPipelineTemplates
|
|
10
|
-
type: git
|
|
11
|
-
name: 1ESPipelineTemplates/1ESPipelineTemplates
|
|
12
|
-
ref: refs/tags/release
|
|
13
|
-
name: $(Build.SourceBranchName)_$(date:yyyyMMdd)$(rev:.r)
|
|
14
|
-
|
|
15
|
-
extends:
|
|
16
|
-
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
|
|
17
|
-
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
|
|
18
|
-
${{ else }}:
|
|
19
|
-
template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates
|
|
20
|
-
parameters:
|
|
21
|
-
pool:
|
|
22
|
-
name: 1ES-PT-CBL-Mariner-2.0-Gen2
|
|
23
|
-
os: linux
|
|
24
|
-
customBuildTags:
|
|
25
|
-
- ES365AIMigrationTooling-BulkMigrated
|
|
26
|
-
sdl:
|
|
27
|
-
sourceAnalysisPool: 1ES-PT-Windows-2022
|
|
28
|
-
credscan:
|
|
29
|
-
suppressionsFile: $(Build.SourcesDirectory)/.config/CredScanSuppressions.json
|
|
30
|
-
stages:
|
|
31
|
-
- stage: Stage
|
|
32
|
-
jobs:
|
|
33
|
-
- job: HostJob
|
|
34
|
-
templateContext:
|
|
35
|
-
outputs:
|
|
36
|
-
- output: pipelineArtifact
|
|
37
|
-
displayName: "Publish Artifact: artifacts"
|
|
38
|
-
path: '$(Build.ArtifactStagingDirectory)/npm'
|
|
39
|
-
artifactName: npm
|
|
40
|
-
|
|
41
|
-
steps:
|
|
42
|
-
- task: NodeTool@0
|
|
43
|
-
inputs:
|
|
44
|
-
versionSpec: '14.x'
|
|
45
|
-
displayName: 'Install Node.js'
|
|
46
|
-
|
|
47
|
-
- script: |
|
|
48
|
-
npm pack
|
|
49
|
-
npm install -g react-native-code-push*.tgz
|
|
50
|
-
displayName: 'Package react-native-code-push'
|
|
51
|
-
workingDirectory: $(Build.SourcesDirectory)
|
|
52
|
-
|
|
53
|
-
- task: DeleteFiles@1
|
|
54
|
-
inputs:
|
|
55
|
-
contents: node_modules
|
|
56
|
-
displayName: 'Delete node_modules'
|
|
57
|
-
|
|
58
|
-
- task: ArchiveFiles@2
|
|
59
|
-
inputs:
|
|
60
|
-
rootFolderOrFile: '$(Build.SourcesDirectory)'
|
|
61
|
-
includeRootFolder: false
|
|
62
|
-
archiveType: 'tar'
|
|
63
|
-
archiveFile: '$(Build.ArtifactStagingDirectory)/npm/$(Build.BuildId).tgz'
|
|
64
|
-
replaceExistingArchive: true
|
|
65
|
-
verbose: true
|
|
66
|
-
displayName: 'Prepare npm artifact'
|
|
67
|
-
|
|
68
|
-
- stage: APIScan
|
|
69
|
-
dependsOn: Stage
|
|
70
|
-
pool:
|
|
71
|
-
name: 1ES-PT-Windows-2022
|
|
72
|
-
os: windows
|
|
73
|
-
variables:
|
|
74
|
-
"agent.source.skip": true
|
|
75
|
-
jobs:
|
|
76
|
-
- job: APIScan
|
|
77
|
-
steps:
|
|
78
|
-
- task: DownloadPipelineArtifact@2
|
|
79
|
-
displayName: Download Build Artifacts for APIScan
|
|
80
|
-
inputs:
|
|
81
|
-
artifactName: npm
|
|
82
|
-
targetPath: '$(Agent.BuildDirectory)/npm'
|
|
83
|
-
- task: ExtractFiles@1
|
|
84
|
-
inputs:
|
|
85
|
-
archiveFilePatterns: '$(Agent.BuildDirectory)/npm/*.tgz'
|
|
86
|
-
destinationFolder: '$(Agent.BuildDirectory)/npm_extracted'
|
|
87
|
-
- task: AzureKeyVault@2
|
|
88
|
-
inputs:
|
|
89
|
-
azureSubscription: 'AC - Dev Infra & Build Pool'
|
|
90
|
-
KeyVaultName: 'mobile-center-sdk'
|
|
91
|
-
SecretsFilter: 'appcenter-sdk-managed-identity-clientid'
|
|
92
|
-
RunAsPreJob: false
|
|
93
|
-
- task: APIScan@2
|
|
94
|
-
displayName: 'Run APIScan'
|
|
95
|
-
inputs:
|
|
96
|
-
softwareFolder: '$(Agent.BuildDirectory)\npm_extracted'
|
|
97
|
-
softwareName: 'react-native-code-push'
|
|
98
|
-
softwareVersionNum: '$(Build.BuildId)'
|
|
99
|
-
isLargeApp: false
|
|
100
|
-
toolVersion: 'Latest'
|
|
101
|
-
verbosityLevel: verbose
|
|
102
|
-
condition: and(succeeded(), ne(variables['DisableAPIScan'], 'true'))
|
|
103
|
-
env:
|
|
104
|
-
AzureServicesAuthConnectionString: 'runAs=App;AppId=$(appcenter-sdk-managed-identity-clientid)'
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
trigger:
|
|
2
|
-
- master
|
|
3
|
-
|
|
4
|
-
pr:
|
|
5
|
-
- master
|
|
6
|
-
|
|
7
|
-
variables:
|
|
8
|
-
- name: api-level
|
|
9
|
-
value: '27'
|
|
10
|
-
|
|
11
|
-
pool:
|
|
12
|
-
vmImage: 'macOS-12'
|
|
13
|
-
|
|
14
|
-
stages:
|
|
15
|
-
- stage: RunTests
|
|
16
|
-
displayName: 'Run Android & IOS tests'
|
|
17
|
-
jobs:
|
|
18
|
-
- job: TestAndroid
|
|
19
|
-
timeoutInMinutes: 120
|
|
20
|
-
displayName: 'Test android'
|
|
21
|
-
steps:
|
|
22
|
-
|
|
23
|
-
- script: |
|
|
24
|
-
adb devices
|
|
25
|
-
displayName: 'Start adb server'
|
|
26
|
-
|
|
27
|
-
- script: |
|
|
28
|
-
$ANDROID_HOME/tools/bin/sdkmanager "system-images;android-$(api-level);google_apis;x86"
|
|
29
|
-
displayName: 'Download system image'
|
|
30
|
-
|
|
31
|
-
- script: |
|
|
32
|
-
$ANDROID_HOME/tools/bin/avdmanager create avd --force --name TestEmulator --abi google_apis/x86 --package 'system-images;android-$(api-level);google_apis;x86' --device "Nexus 6P"
|
|
33
|
-
displayName: 'Creating Android emulator'
|
|
34
|
-
|
|
35
|
-
- script: |
|
|
36
|
-
$ANDROID_HOME/emulator/emulator -avd TestEmulator -noaudio -no-window -no-snapshot-save -no-boot-anim -memory 6144 &
|
|
37
|
-
displayName: 'Start Android emulator'
|
|
38
|
-
|
|
39
|
-
- script: |
|
|
40
|
-
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done'
|
|
41
|
-
displayName: 'Wait for emulator to boot'
|
|
42
|
-
|
|
43
|
-
- script: |
|
|
44
|
-
adb shell settings put global window_animation_scale 0.0
|
|
45
|
-
displayName: 'Disable animations and transitions'
|
|
46
|
-
|
|
47
|
-
- script: |
|
|
48
|
-
adb shell settings put global transition_animation_scale 0.0
|
|
49
|
-
displayName: 'Disable animations and transitions'
|
|
50
|
-
|
|
51
|
-
- script: |
|
|
52
|
-
adb shell settings put global animator_duration_scale 0.0
|
|
53
|
-
displayName: 'Disable animations and transitions'
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
- task: JavaToolInstaller@0
|
|
57
|
-
inputs:
|
|
58
|
-
versionSpec: '11'
|
|
59
|
-
jdkArchitectureOption: 'x64'
|
|
60
|
-
jdkSourceOption: 'PreInstalled'
|
|
61
|
-
displayName: 'Change Java version'
|
|
62
|
-
|
|
63
|
-
- script: |
|
|
64
|
-
npm install
|
|
65
|
-
displayName: 'Package Installation'
|
|
66
|
-
|
|
67
|
-
- script: |
|
|
68
|
-
npm run build:tests && npm run test:setup:android
|
|
69
|
-
displayName: 'Setup Android tests'
|
|
70
|
-
|
|
71
|
-
- script: |
|
|
72
|
-
npm run test:fast:android
|
|
73
|
-
displayName: 'Run Android test'
|
|
74
|
-
|
|
75
|
-
- job: TestIOS
|
|
76
|
-
timeoutInMinutes: 120
|
|
77
|
-
displayName: 'Test IOS'
|
|
78
|
-
steps:
|
|
79
|
-
|
|
80
|
-
- script: |
|
|
81
|
-
npm install
|
|
82
|
-
displayName: 'Install dependencies'
|
|
83
|
-
|
|
84
|
-
- script: |
|
|
85
|
-
npm run build:tests && npm run test:setup:ios
|
|
86
|
-
displayName: 'Setup iOS tests'
|
|
87
|
-
|
|
88
|
-
- script: |
|
|
89
|
-
npm run test:fast:ios
|
|
90
|
-
displayName: 'Run tests'
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tool": "Credential Scanner",
|
|
3
|
-
"suppressions": [
|
|
4
|
-
{
|
|
5
|
-
"file": "/Examples/CodePushDemoApp/android/app/debug.keystore",
|
|
6
|
-
"_justification": "Used only in DemoApp"
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"file": "/Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/CodePushDemoAppCpp_TemporaryKey.pfx",
|
|
10
|
-
"_justification": "Used only in DemoApp"
|
|
11
|
-
}
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
|
package/docs/setup-windows.md
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
## Windows Setup
|
|
2
|
-
|
|
3
|
-
Once you've acquired the CodePush plugin, you need to integrate it into the Visual Studio project of your React Native app and configure it correctly. To do this, take the following steps:
|
|
4
|
-
|
|
5
|
-
### Plugin Installation and Configuration for React Native Windows 0.63.6 version and above
|
|
6
|
-
|
|
7
|
-
#### Plugin Installation (Windows-npx)
|
|
8
|
-
|
|
9
|
-
Once the plugin has been downloaded, run `npx react-native autolink-windows` in your application's root directory to automatically add the CodePush c++ project to your application's windows solution file.
|
|
10
|
-
|
|
11
|
-
#### Plugin Configuration (Windows)
|
|
12
|
-
|
|
13
|
-
1. Replace the following files located at `windows/<app name>` with those in the CodePushDemoAppCpp example app in this repo found at `Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp`:
|
|
14
|
-
1. app.h
|
|
15
|
-
2. app.cpp
|
|
16
|
-
3. app.xaml
|
|
17
|
-
|
|
18
|
-
2. In the above files, replace any occurance of `CodePushDemoAppCpp` with the name of your application
|
|
19
|
-
|
|
20
|
-
3. Enter your application's app version and deployment key to the `configMap` object at the top of your app's `OnLaunched` method in `App.cpp`:
|
|
21
|
-
|
|
22
|
-
```c++
|
|
23
|
-
...
|
|
24
|
-
void App::OnLaunched(activation::LaunchActivatedEventArgs const& e)
|
|
25
|
-
{
|
|
26
|
-
winrt::Microsoft::CodePush::ReactNative::CodePushConfig::SetHost(Host());
|
|
27
|
-
auto configMap{ winrt::single_threaded_map<hstring, hstring>() };
|
|
28
|
-
configMap.Insert(L"appVersion", L"1.0.0");
|
|
29
|
-
configMap.Insert(L"deploymentKey", L"<app deployment key>");
|
|
30
|
-
winrt::Microsoft::CodePush::ReactNative::CodePushConfig::Init(configMap);
|
|
31
|
-
...
|
|
32
|
-
}
|
|
33
|
-
...
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
#### Plugin Configuration (Windows) C#
|
|
37
|
-
|
|
38
|
-
1. add name space `Microsoft.CodePush` to `App.xaml.cs`
|
|
39
|
-
|
|
40
|
-
2. add app version and deployment key to `configMap` at the start of your app's `OnLaunched` method in `App.xaml.cs`.
|
|
41
|
-
|
|
42
|
-
```c#
|
|
43
|
-
using Microsoft.CodePush;
|
|
44
|
-
|
|
45
|
-
...
|
|
46
|
-
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
|
47
|
-
{
|
|
48
|
-
Microsoft.CodePush.ReactNative.CodePushConfig.SetHost(Host);
|
|
49
|
-
IDictionary<string, string> configMap = new Dictionary<string, string>();
|
|
50
|
-
configMap.Add("appVersion", "1.0.0");
|
|
51
|
-
configMap.Add("deploymentKey", "deployment key");
|
|
52
|
-
Microsoft.CodePush.ReactNative.CodePushConfig.Init(configMap);
|
|
53
|
-
...
|
|
54
|
-
}
|
|
55
|
-
...
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
### Plugin Installation and Configuration for React Native Windows lower than 0.60
|
|
60
|
-
|
|
61
|
-
#### Plugin Installation (Windows)
|
|
62
|
-
|
|
63
|
-
1. Open the Visual Studio solution located at `windows-legacy\<AppName>\<AppName>.sln` within your app
|
|
64
|
-
|
|
65
|
-
2. Right-click the solution node in the `Solution Explorer` window and select the `Add -> Existing Project...` menu item
|
|
66
|
-
|
|
67
|
-

|
|
68
|
-
|
|
69
|
-
3. Browse to the `node_modules\react-native-code-push\windows` directory, select the `CodePush.csproj` file and click `OK`
|
|
70
|
-
|
|
71
|
-
4. Back in the `Solution Explorer`, right-click the project node that is named after your app, and select the `Add -> Reference...` menu item
|
|
72
|
-
|
|
73
|
-

|
|
74
|
-
|
|
75
|
-
5. Select the `Projects` tab on the left hand side, check the `CodePush` item and then click `OK`
|
|
76
|
-
|
|
77
|
-

|
|
78
|
-
|
|
79
|
-
#### Plugin Configuration (Windows)
|
|
80
|
-
|
|
81
|
-
After installing the plugin, you need to configure your app to consult CodePush for the location of your JS bundle, since it will "take control" of managing the current and all future versions. To do this, update the `MainReactNativeHost.cs` file to use CodePush via the following changes:
|
|
82
|
-
|
|
83
|
-
```c#
|
|
84
|
-
...
|
|
85
|
-
// 1. Import the CodePush namespace
|
|
86
|
-
using CodePush.ReactNative;
|
|
87
|
-
...
|
|
88
|
-
class MainReactNativeHost : ReactNativeHost
|
|
89
|
-
{
|
|
90
|
-
// 2. Declare a private instance variable for the CodePushModule instance.
|
|
91
|
-
private CodePushReactPackage codePushReactPackage;
|
|
92
|
-
|
|
93
|
-
// 3. Update the JavaScriptBundleFile property to initalize the CodePush runtime,
|
|
94
|
-
// specifying the right deployment key, then use it to return the bundle URL from
|
|
95
|
-
// CodePush instead of statically from the binary. If you don't already have your
|
|
96
|
-
// deployment key, you can run "appcenter codepush deployment list -a <ownerName>/<appName> -k" to retrieve it.
|
|
97
|
-
protected override string JavaScriptBundleFile
|
|
98
|
-
{
|
|
99
|
-
get
|
|
100
|
-
{
|
|
101
|
-
codePushReactPackage = new CodePushReactPackage("deployment-key-here", this);
|
|
102
|
-
return codePushReactPackage.GetJavaScriptBundleFile();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// 4. Add the codePushReactPackage instance to the list of existing packages.
|
|
107
|
-
protected override List<IReactPackage> Packages
|
|
108
|
-
{
|
|
109
|
-
get
|
|
110
|
-
{
|
|
111
|
-
return new List<IReactPackage>
|
|
112
|
-
{
|
|
113
|
-
new MainReactPackage(),
|
|
114
|
-
...
|
|
115
|
-
codePushReactPackage
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
...
|
|
120
|
-
}
|
|
121
|
-
```
|
package/request-fetch-adapter.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const packageJson = require("./package.json");
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
async request(verb, url, requestBody, callback) {
|
|
5
|
-
if (typeof requestBody === "function") {
|
|
6
|
-
callback = requestBody;
|
|
7
|
-
requestBody = null;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const headers = {
|
|
11
|
-
"Accept": "application/json",
|
|
12
|
-
"Content-Type": "application/json",
|
|
13
|
-
"X-CodePush-Plugin-Name": packageJson.name,
|
|
14
|
-
"X-CodePush-Plugin-Version": packageJson.version,
|
|
15
|
-
"X-CodePush-SDK-Version": packageJson.dependencies["code-push"]
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
if (requestBody && typeof requestBody === "object") {
|
|
19
|
-
requestBody = JSON.stringify(requestBody);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
const response = await fetch(url, {
|
|
24
|
-
method: getHttpMethodName(verb),
|
|
25
|
-
headers: headers,
|
|
26
|
-
body: requestBody
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const statusCode = response.status;
|
|
30
|
-
const body = await response.text();
|
|
31
|
-
callback(null, { statusCode, body });
|
|
32
|
-
} catch (err) {
|
|
33
|
-
callback(err);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
function getHttpMethodName(verb) {
|
|
39
|
-
// Note: This should stay in sync with the enum definition in
|
|
40
|
-
// https://github.com/microsoft/code-push/blob/master/sdk/script/acquisition-sdk.ts#L6
|
|
41
|
-
return [
|
|
42
|
-
"GET",
|
|
43
|
-
"HEAD",
|
|
44
|
-
"POST",
|
|
45
|
-
"PUT",
|
|
46
|
-
"DELETE",
|
|
47
|
-
"TRACE",
|
|
48
|
-
"OPTIONS",
|
|
49
|
-
"CONNECT",
|
|
50
|
-
"PATCH"
|
|
51
|
-
][verb];
|
|
52
|
-
}
|