Skip to content

Commit c1f57f2

Browse files
authored
Merge branch 'master' into always_restore_cache
2 parents fdfff5d + 4f01cb1 commit c1f57f2

File tree

4 files changed

+58
-38
lines changed

4 files changed

+58
-38
lines changed

script/vsts/nightly-release.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
jobs:
22
- job: GetReleaseVersion
33
pool:
4-
vmImage: 'windows-latest'
4+
vmImage: 'ubuntu-latest'
55
steps:
66
# This has to be done separately because VSTS inexplicably
7-
# exits the script block after `npm install` completes.
7+
# exits the script block after `npm ci` completes.
88
- script: |
9-
cd script\vsts
10-
npm install
11-
displayName: npm install
12-
- script: node script\vsts\get-release-version.js --nightly
9+
cd script/vsts
10+
npm ci
11+
displayName: npm ci
12+
- script: node script/vsts/get-release-version.js --nightly
1313
name: Version
1414
env:
1515
REPO_OWNER: $(REPO_OWNER)
@@ -23,7 +23,7 @@ jobs:
2323

2424
- job: Release
2525
pool:
26-
vmImage: vs2017-win2016
26+
vmImage: 'ubuntu-latest'
2727

2828
dependsOn:
2929
- GetReleaseVersion
@@ -38,11 +38,11 @@ jobs:
3838
- template: platforms/templates/preparation.yml
3939

4040
#This has to be done separately because VSTS inexplicably
41-
#exits the script block after `npm install` completes.
41+
#exits the script block after `npm ci` completes.
4242
- script: |
43-
cd script\vsts
44-
npm install
45-
displayName: npm install
43+
cd script/vsts
44+
npm ci
45+
displayName: npm ci
4646
4747
- task: DownloadBuildArtifacts@0
4848
inputs:
@@ -51,7 +51,7 @@ jobs:
5151
displayName: Download Release Artifacts
5252

5353
- script: |
54-
node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --create-github-release --assets-path "$(System.ArtifactsDirectory)" --linux-repo-name "atom"
54+
node $(Build.SourcesDirectory)/script/vsts/upload-artifacts.js --create-github-release --assets-path "$(System.ArtifactsDirectory)" --linux-repo-name "atom"
5555
env:
5656
GITHUB_TOKEN: $(GITHUB_TOKEN)
5757
ATOM_RELEASE_VERSION: $(ReleaseVersion)
@@ -77,8 +77,8 @@ jobs:
7777

7878
- script: |
7979
cd script/lib
80-
npm install
81-
displayName: npm install
80+
npm ci
81+
displayName: npm ci
8282
- script: |
8383
cd script/lib/update-dependency
8484
node index.js

script/vsts/pull-requests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ trigger: none # No CI builds, only PR builds
33
jobs:
44
- job: GetReleaseVersion
55
pool:
6-
vmImage: 'windows-latest'
6+
vmImage: 'ubuntu-latest'
77
steps:
88
# This has to be done separately because VSTS inexplicably
9-
# exits the script block after `npm install` completes.
9+
# exits the script block after `npm ci` completes.
1010
- script: |
11-
cd script\vsts
12-
npm install
13-
displayName: npm install
14-
- script: node script\vsts\get-release-version.js
11+
cd script/vsts
12+
npm ci
13+
displayName: npm ci
14+
- script: node script/vsts/get-release-version.js
1515
name: Version
1616
env:
1717
REPO_OWNER: $(REPO_OWNER)

script/vsts/release-branch-build.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ pr: none # no PR triggers
77
jobs:
88
- job: GetReleaseVersion
99
pool:
10-
vmImage: 'windows-latest'
10+
vmImage: 'ubuntu-latest'
1111
steps:
1212
# This has to be done separately because VSTS inexplicably
13-
# exits the script block after `npm install` completes.
13+
# exits the script block after `npm ci` completes.
1414
- script: |
15-
cd script\vsts
16-
npm install
17-
displayName: npm install
18-
- script: node script\vsts\get-release-version.js
15+
cd script/vsts
16+
npm ci
17+
displayName: npm ci
18+
- script: node script/vsts/get-release-version.js
1919
name: Version
2020
env:
2121
REPO_OWNER: $(REPO_OWNER)
@@ -28,7 +28,7 @@ jobs:
2828

2929
- job: UploadArtifacts
3030
pool:
31-
vmImage: vs2017-win2016
31+
vmImage: 'ubuntu-latest'
3232

3333
dependsOn:
3434
- GetReleaseVersion
@@ -42,16 +42,14 @@ jobs:
4242
IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ]
4343

4444
steps:
45-
- template: platforms/templates/preparation.yml
46-
4745
# This has to be done separately because VSTS inexplicably
48-
# exits the script block after `npm install` completes.
46+
# exits the script block after `npm ci` completes.
4947
- script: |
50-
cd script\vsts
51-
npm install
48+
cd script/vsts
49+
npm ci
5250
env:
5351
GITHUB_TOKEN: $(GITHUB_TOKEN)
54-
displayName: npm install
52+
displayName: npm ci
5553
5654
- task: DownloadBuildArtifacts@0
5755
inputs:
@@ -60,7 +58,7 @@ jobs:
6058
displayName: Download Release Artifacts
6159

6260
- script: |
63-
node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --create-github-release --assets-path "$(System.ArtifactsDirectory)" --linux-repo-name "atom-staging"
61+
node $(Build.SourcesDirectory)/script/vsts/upload-artifacts.js --create-github-release --assets-path "$(System.ArtifactsDirectory)" --linux-repo-name "atom-staging"
6462
env:
6563
GITHUB_TOKEN: $(GITHUB_TOKEN)
6664
ATOM_RELEASE_VERSION: $(ReleaseVersion)
@@ -75,7 +73,7 @@ jobs:
7573
condition: and(succeeded(), eq(variables['Atom.AutoDraftRelease'], 'true'), eq(variables['IsReleaseBranch'], 'true'))
7674
7775
- script: |
78-
node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --assets-path "$(System.ArtifactsDirectory)" --s3-path "vsts-artifacts/$(Build.BuildId)/"
76+
node $(Build.SourcesDirectory)/script/vsts/upload-artifacts.js --assets-path "$(System.ArtifactsDirectory)" --s3-path "vsts-artifacts/$(Build.BuildId)/"
7977
env:
8078
ATOM_RELEASE_VERSION: $(ReleaseVersion)
8179
ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY)

src/package.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -881,8 +881,9 @@ module.exports = class Package {
881881
requireMainModule() {
882882
if (this.bundledPackage && this.packageManager.packagesCache[this.name]) {
883883
if (this.packageManager.packagesCache[this.name].main) {
884-
this.mainModule = require(this.packageManager.packagesCache[this.name]
885-
.main);
884+
this.mainModule = this._require(
885+
this.packageManager.packagesCache[this.name].main
886+
);
886887
return this.mainModule;
887888
}
888889
} else if (this.mainModuleRequired) {
@@ -904,7 +905,7 @@ module.exports = class Package {
904905

905906
const previousViewProviderCount = this.viewRegistry.getViewProviderCount();
906907
const previousDeserializerCount = this.deserializerManager.getDeserializerCount();
907-
this.mainModule = require(mainModulePath);
908+
this.mainModule = this._require(mainModulePath);
908909
if (
909910
this.viewRegistry.getViewProviderCount() ===
910911
previousViewProviderCount &&
@@ -921,6 +922,27 @@ module.exports = class Package {
921922
}
922923
}
923924

925+
// a require function with both ES5 and ES6 default export support
926+
_require(path) {
927+
const modul = require(path);
928+
if (modul === null || modul === undefined) {
929+
// if null do not bother
930+
return modul;
931+
} else {
932+
if (
933+
modul.__esModule === true &&
934+
typeof modul.default === 'object' &&
935+
typeof modul.default.activate === 'function'
936+
) {
937+
// __esModule flag is true and the activate function exists inside it, which means
938+
// an object containing the main functions (e.g. activate, etc) is default exported
939+
return modul.default;
940+
} else {
941+
return modul;
942+
}
943+
}
944+
}
945+
924946
getMainModulePath() {
925947
if (this.resolvedMainModulePath) return this.mainModulePath;
926948
this.resolvedMainModulePath = true;

0 commit comments

Comments
 (0)