Skip to content

Commit

Permalink
Merge pull request #46 from atom-community/node-spec-update [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Jun 26, 2022
2 parents 11d1ccb + 1ef635f commit 841c5c5
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 61 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ lib
dist-spec

# Downloaded spec
spec/fixtures/node-v10.20.1.tar.gz
spec/fixtures/node-*.tar.gz
spec/fixtures/node.lib
spec/fixtures/node_x64.lib
spec/fixtures/node-v10.20.1-headers.tar.gz
spec/fixtures/node-*-headers.tar.gz
spec/fixtures/repo.git
spec/fixtures/r.tmbundle
6 changes: 5 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# updating this changes the target Node version used by this package
# make sure to update the CI versions if you changed this
# also make sure to update the hash files in script/fixtures/SHASUM256.txt
target=v12.18.3

node-version=12.18.3
public-hoist-pattern[]=*
package-lock=false
lockfile=true
prefer-frozen-lockfile=true
child-concurrency=1 # node-gyp fails on windows
strict-peer-dependencies=false
strict-peer-dependencies=false
20 changes: 15 additions & 5 deletions script/get-fixtures.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
const { DownloaderHelper } = require("node-downloader-helper")
const gitly = require("gitly").default
const { join, dirname } = require("path")
const { readFileSync } = require("fs")

const downloadFolder = join(dirname(__dirname), "spec", "fixtures")

const downloadOptions = {
override: { skip: true },
}

const atomElectronVersion = readFileSync(`${dirname(__dirname)}/.npmrc`, "utf8").match(/target=(.*)\n/)[1]

const links = [
"https://nodejs.org/dist/v10.20.1/node-v10.20.1.tar.gz",
"https://nodejs.org/dist/v10.20.1/win-x86/node.lib",
"https://nodejs.org/dist/v10.20.1/node-v10.20.1-headers.tar.gz",
`https://nodejs.org/dist/${atomElectronVersion}/node-${atomElectronVersion}.tar.gz`,
`https://nodejs.org/dist/${atomElectronVersion}/win-x86/node.lib`,
`https://nodejs.org/dist/${atomElectronVersion}/node-${atomElectronVersion}-headers.tar.gz`,
"https://github.com/atom-community/apm/raw/master/spec/fixtures/repo.git",
]

const linkMaps = [["https://nodejs.org/dist/v10.20.1/win-x64/node.lib", "node_x64.lib"]]
const linkMaps = [[`https://nodejs.org/dist/${atomElectronVersion}/win-x64/node.lib`, `node_x64.lib`]]

const repos = ["https://github.com/textmate/r.tmbundle"]

async function main() {
console.log(`Downloading fixtures for node ${atomElectronVersion}`)
await Promise.all([
...links.map((link) => new DownloaderHelper(link, downloadFolder, downloadOptions).start()),
...links.map((link) => {
console.log(`Downloading ${link}`)
return new DownloaderHelper(link, downloadFolder, downloadOptions).start()
}),
...linkMaps.map((linkMap) => {
const link = linkMap[0]
console.log(`Downloading ${link}`)
downloadOptions.fileName = linkMap[1]
return new DownloaderHelper(link, downloadFolder, downloadOptions).start()
}),
...repos.map((repo) => {
console.log(`Downloading ${repo}`)
const repoParts = repo.split("/")
return gitly(repo, join(downloadFolder, repoParts[repoParts.length - 1]), { throw: true })
}),
Expand Down
22 changes: 12 additions & 10 deletions spec/ci-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const wrench = require("wrench")
const CSON = require("season")
import * as apm from "../lib/apm-cli"

const atomElectronVersion = fs.readFileSync(`${path.dirname(__dirname)}/.npmrc`, "utf8").match(/target=(.*)\n/)[1]

describe("apm ci", function () {
let [atomHome, resourcePath, server] = Array.from([])

Expand All @@ -29,19 +31,19 @@ describe("apm ci", function () {
delete process.env.npm_config_cache

const app = express()
app.get("/node/v10.20.1/node-v10.20.1.tar.gz", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node-v10.20.1.tar.gz"))
app.get(`/node/${atomElectronVersion}/node-${atomElectronVersion}.tar.gz`, (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", `node-${atomElectronVersion}.tar.gz`))
)
app.get("/node/v10.20.1/node-v10.20.1-headers.tar.gz", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node-v10.20.1-headers.tar.gz"))
app.get(`/node/${atomElectronVersion}/node-${atomElectronVersion}-headers.tar.gz`, (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", `node-${atomElectronVersion}-headers.tar.gz`))
)
app.get("/node/v10.20.1/node.lib", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node.lib"))
app.get(`/node/${atomElectronVersion}/node.lib`, (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", `node.lib`))
)
app.get("/node/v10.20.1/x64/node.lib", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node_x64.lib"))
app.get(`/node/${atomElectronVersion}/x64/node.lib`, (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", `node_x64.lib`))
)
app.get("/node/v10.20.1/SHASUMS256.txt", (request, response) =>
app.get(`/node/${atomElectronVersion}/SHASUMS256.txt`, (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "SHASUMS256.txt"))
)
app.get("/test-module-with-dependencies", (request, response) =>
Expand Down Expand Up @@ -69,7 +71,7 @@ describe("apm ci", function () {
server.listen(3000, "127.0.0.1", function () {
process.env.ATOM_ELECTRON_URL = "http://localhost:3000/node"
process.env.ATOM_PACKAGES_URL = "http://localhost:3000/packages"
process.env.ATOM_ELECTRON_VERSION = "v10.20.1"
process.env.ATOM_ELECTRON_VERSION = atomElectronVersion
process.env.npm_config_registry = "http://localhost:3000/"
return (live = true)
})
Expand Down
22 changes: 12 additions & 10 deletions spec/clean-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const http = require("http")
const wrench = require("wrench")
import * as apm from "../lib/apm-cli"

const atomElectronVersion = fs.readFileSync(`${path.dirname(__dirname)}/.npmrc`, "utf8").match(/target=(.*)\n/)[1]

describe("apm clean", function () {
let [moduleDirectory, server] = Array.from([])

Expand All @@ -21,19 +23,19 @@ describe("apm clean", function () {

const app = express()

app.get("/node/v10.20.1/node-v10.20.1.tar.gz", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node-v10.20.1.tar.gz"))
app.get(`/node/${atomElectronVersion}/node-${atomElectronVersion}.tar.gz`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node-${atomElectronVersion}.tar.gz`))
)
app.get("/node/v10.20.1/node-v10.20.1-headers.tar.gz", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node-v10.20.1-headers.tar.gz"))
app.get(`/node/${atomElectronVersion}/node-${atomElectronVersion}-headers.tar.gz`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node-${atomElectronVersion}-headers.tar.gz`))
)
app.get("/node/v10.20.1/node.lib", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node.lib"))
app.get(`/node/${atomElectronVersion}/node.lib`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node.lib`))
)
app.get("/node/v10.20.1/x64/node.lib", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node_x64.lib"))
app.get(`/node/${atomElectronVersion}/x64/node.lib`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node_x64.lib`))
)
app.get("/node/v10.20.1/SHASUMS256.txt", (request, response) =>
app.get(`/node/${atomElectronVersion}/SHASUMS256.txt`, (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "SHASUMS256.txt"))
)
app.get("/test-module", (request, response) =>
Expand All @@ -51,7 +53,7 @@ describe("apm clean", function () {
const atomHome = temp.mkdirSync("apm-home-dir-")
process.env.ATOM_HOME = atomHome
process.env.ATOM_ELECTRON_URL = "http://localhost:3000/node"
process.env.ATOM_ELECTRON_VERSION = "v10.20.1"
process.env.ATOM_ELECTRON_VERSION = atomElectronVersion
process.env.npm_config_registry = "http://localhost:3000/"

moduleDirectory = path.join(temp.mkdirSync("apm-test-module-"), "test-module-with-dependencies")
Expand Down
4 changes: 2 additions & 2 deletions spec/fixtures/SHASUMS256.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
f2777bf2b140033c01d5f912df510dfa394e748f92bbaed24c832abf36cb3bdf ./node-v10.20.1-headers.tar.gz
ea39a70b715bfbd0281979c95a5b81136ffdc0e5bf66b1fd7dc3ef3473ce2c5a ./node-v10.20.1.tar.gz
164edc71e46cf86ac5d9fcac00dc69c09bb09614b767c4c775aa7747b42e8188 ./node-v12.18.3-headers.tar.gz
6ea85f80e01b007cc9b566b8836513bc5102667d833bad4c1092be60fa60c2d4 ./node-v12.18.3.tar.gz
213d72051a68c37afc37a5d185a4c5bfacc985bc35331024e5f28635f084da70 ./x64/node.lib
e5224f36cf5ae52ee8532e383142073fd6c28866745e9967992de28cfbf5b63a ./node.lib
22 changes: 12 additions & 10 deletions spec/install-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import * as apm from "../lib/apm-cli"
import Install from "../lib/install"
import { sync as resolveSync } from "resolve"

const atomElectronVersion = fs.readFileSync(`${path.dirname(__dirname)}/.npmrc`, "utf8").match(/target=(.*)\n/)[1]

describe("apm install", function () {
let [atomHome, resourcePath] = Array.from([])

Expand All @@ -36,19 +38,19 @@ describe("apm install", function () {

beforeEach(function () {
const app = express()
app.get("/node/v10.20.1/node-v10.20.1.tar.gz", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node-v10.20.1.tar.gz"))
app.get(`/node/${atomElectronVersion}/node-${atomElectronVersion}.tar.gz`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node-${atomElectronVersion}.tar.gz`))
)
app.get("/node/v10.20.1/node-v10.20.1-headers.tar.gz", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node-v10.20.1-headers.tar.gz"))
app.get(`/node/${atomElectronVersion}/node-${atomElectronVersion}-headers.tar.gz`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node-${atomElectronVersion}-headers.tar.gz`))
)
app.get("/node/v10.20.1/node.lib", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node.lib"))
app.get(`/node/${atomElectronVersion}/node.lib`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node.lib`))
)
app.get("/node/v10.20.1/x64/node.lib", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node_x64.lib"))
app.get(`/node/${atomElectronVersion}/x64/node.lib`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node_x64.lib`))
)
app.get("/node/v10.20.1/SHASUMS256.txt", (request, response) =>
app.get(`/node/${atomElectronVersion}/SHASUMS256.txt`, (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "SHASUMS256.txt"))
)
app.get("/test-module", (request, response) =>
Expand Down Expand Up @@ -103,7 +105,7 @@ describe("apm install", function () {
process.env.ATOM_HOME = atomHome
process.env.ATOM_ELECTRON_URL = "http://localhost:3000/node"
process.env.ATOM_PACKAGES_URL = "http://localhost:3000/packages"
process.env.ATOM_ELECTRON_VERSION = "v10.20.1"
process.env.ATOM_ELECTRON_VERSION = atomElectronVersion
process.env.npm_config_registry = "http://localhost:3000/"
return (live = true)
})
Expand Down
23 changes: 13 additions & 10 deletions spec/rebuild-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ const temp = require("temp")
const express = require("express")
const http = require("http")
import * as apm from "../lib/apm-cli"
import fs from "fs"

const atomElectronVersion = fs.readFileSync(`${path.dirname(__dirname)}/.npmrc`, "utf8").match(/target=(.*)\n/)[1]

describe("apm rebuild", function () {
let [server, originalPathEnv] = Array.from([])
Expand All @@ -18,19 +21,19 @@ describe("apm rebuild", function () {
spyOnConsole()

const app = express()
app.get("/node/v10.20.1/node-v10.20.1.tar.gz", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node-v10.20.1.tar.gz"))
app.get(`/node/${atomElectronVersion}/node-${atomElectronVersion}.tar.gz`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node-${atomElectronVersion}.tar.gz`))
)
app.get("/node/v10.20.1/node-v10.20.1-headers.tar.gz", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node-v10.20.1-headers.tar.gz"))
app.get(`/node/${atomElectronVersion}/node-${atomElectronVersion}-headers.tar.gz`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node-${atomElectronVersion}-headers.tar.gz`))
)
app.get("/node/v10.20.1/node.lib", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node.lib"))
app.get(`/node/${atomElectronVersion}/node.lib`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node.lib`))
)
app.get("/node/v10.20.1/x64/node.lib", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node_x64.lib"))
app.get(`/node/${atomElectronVersion}/x64/node.lib`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node_x64.lib`))
)
app.get("/node/v10.20.1/SHASUMS256.txt", (request, response) =>
app.get(`/node/${atomElectronVersion}/SHASUMS256.txt`, (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "SHASUMS256.txt"))
)

Expand All @@ -42,7 +45,7 @@ describe("apm rebuild", function () {
process.env.ATOM_HOME = atomHome
process.env.ATOM_ELECTRON_URL = "http://localhost:3000/node"
process.env.ATOM_PACKAGES_URL = "http://localhost:3000/packages"
process.env.ATOM_ELECTRON_VERSION = "v10.20.1"
process.env.ATOM_ELECTRON_VERSION = atomElectronVersion
process.env.ATOM_RESOURCE_PATH = temp.mkdirSync("atom-resource-path-")

originalPathEnv = process.env.PATH
Expand Down
22 changes: 12 additions & 10 deletions spec/stars-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const http = require("http")
const temp = require("temp")
import * as apm from "../lib/apm-cli"

const atomElectronVersion = fs.readFileSync(`${path.dirname(__dirname)}/.npmrc`, "utf8").match(/target=(.*)\n/)[1]

describe("apm stars", function () {
let [atomHome, server] = Array.from([])

Expand All @@ -23,19 +25,19 @@ describe("apm stars", function () {
app.get("/users/hubot/stars", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "stars.json"))
)
app.get("/node/v10.20.1/node-v10.20.1.tar.gz", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node-v10.20.1.tar.gz"))
app.get(`/node/${atomElectronVersion}/node-${atomElectronVersion}.tar.gz`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node-${atomElectronVersion}.tar.gz`))
)
app.get("/node/v10.20.1/node-v10.20.1-headers.tar.gz", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node-v10.20.1-headers.tar.gz"))
app.get(`/node/${atomElectronVersion}/node-${atomElectronVersion}-headers.tar.gz`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node-${atomElectronVersion}-headers.tar.gz`))
)
app.get("/node/v10.20.1/node.lib", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node.lib"))
app.get(`/node/${atomElectronVersion}/node.lib`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node.lib`))
)
app.get("/node/v10.20.1/x64/node.lib", (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "node_x64.lib"))
app.get(`/node/${atomElectronVersion}/x64/node.lib`, (request, response) =>
response.sendFile(path.join(__dirname, `fixtures`, `node_x64.lib`))
)
app.get("/node/v10.20.1/SHASUMS256.txt", (request, response) =>
app.get(`/node/${atomElectronVersion}/SHASUMS256.txt`, (request, response) =>
response.sendFile(path.join(__dirname, "fixtures", "SHASUMS256.txt"))
)
app.get("/tarball/test-module-1.2.0.tgz", (request, response) =>
Expand All @@ -57,7 +59,7 @@ describe("apm stars", function () {
process.env.ATOM_API_URL = "http://localhost:3000"
process.env.ATOM_ELECTRON_URL = "http://localhost:3000/node"
process.env.ATOM_PACKAGES_URL = "http://localhost:3000/packages"
process.env.ATOM_ELECTRON_VERSION = "v10.20.1"
process.env.ATOM_ELECTRON_VERSION = atomElectronVersion
process.env.npm_config_registry = "http://localhost:3000/"

return (live = true)
Expand Down
4 changes: 3 additions & 1 deletion spec/upgrade-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const apmRun = function (args, callback) {
runs(callback)
}

const atomElectronVersion = fs.readFileSync(`${path.dirname(__dirname)}/.npmrc`, "utf8").match(/target=(.*)\n/)[1]

describe("apm upgrade", function () {
let [atomApp, atomHome, packagesDir, server] = Array.from([])

Expand Down Expand Up @@ -48,7 +50,7 @@ describe("apm upgrade", function () {
process.env.ATOM_HOME = atomHome
process.env.ATOM_ELECTRON_URL = "http://localhost:3000/node"
process.env.ATOM_PACKAGES_URL = "http://localhost:3000/packages"
process.env.ATOM_ELECTRON_VERSION = "v10.20.1"
process.env.ATOM_ELECTRON_VERSION = atomElectronVersion
process.env.ATOM_RESOURCE_PATH = atomApp

fs.writeFileSync(path.join(atomApp, "package.json"), JSON.stringify({ version: "0.10.0" }))
Expand Down

0 comments on commit 841c5c5

Please sign in to comment.