Skip to content

Commit

Permalink
Merge pull request #454 from snyk-tech-services/chore/downgrade-node-…
Browse files Browse the repository at this point in the history
…back-to-12

chore: downgrade node to 12
  • Loading branch information
ariadna-roman authored Jun 30, 2023
2 parents 4742360 + 4248f48 commit daf6714
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 36 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ orbs:
jobs:
build-test-monitor:
docker:
- image: circleci/node:14
- image: circleci/node:12
steps:
- slack/notify:
channel: C0137E8F72A
Expand All @@ -20,7 +20,7 @@ jobs:
only_for_branches: master
build-test:
docker:
- image: circleci/node:14
- image: circleci/node:12
steps:
- checkout
- run: npm install
Expand All @@ -33,7 +33,7 @@ jobs:
only_for_branches: master
build-test-from-fork:
docker:
- image: circleci/node:14
- image: circleci/node:12
steps:
- checkout
- run: npm install
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
12
8 changes: 4 additions & 4 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
{
"//": "build the macos",
"path": "@semantic-release/exec",
"cmd": "npx [email protected] dist/index.js -r './dist/**/*.js' -t mac-x64-14.15.3 -o snyk-api-import-macos"
"cmd": "npx [email protected] dist/index.js -r './dist/**/*.js' -t mac-x64-12.9.0 -o snyk-api-import-macos"
},
{
"//": "build the linux",
"path": "@semantic-release/exec",
"cmd": "npx [email protected] dist/index.js -r './dist/**/*.js' -t linux-x64-14.15.3 -o snyk-api-import-linux"
"cmd": "npx [email protected] dist/index.js -r './dist/**/*.js' -t linux-x64-12.9.0 -o snyk-api-import-linux"
},
{
"//": "build the alpine",
"path": "@semantic-release/exec",
"cmd": "npx [email protected] dist/index.js -r './dist/**/*.js' -t alpine-x64-14.15.3 -o snyk-api-import-alpine"
"cmd": "npx [email protected] dist/index.js -r './dist/**/*.js' -t alpine-x64-12.9.0 -o snyk-api-import-alpine"
},
{
"//": "build the windows binaries",
"path": "@semantic-release/exec",
"cmd": "npx [email protected] dist/index.js -r './dist/**/*.js' -t windows-x64-14.15.3 -o snyk-api-import-win.exe"
"cmd": "npx [email protected] dist/index.js -r './dist/**/*.js' -t windows-x64-12.9.0 -o snyk-api-import-win.exe"
},
{
"//": "shasum all binaries",
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 12.22.12
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"build-watch": "tsc -w",
"prepare": "npm run build",
"snyk-test": "snyk test",
"pkg-binaries-linux": "npx nexe@4.0.0-rc.2 dist/index.js -r './dist/**/*.js' -t linux-x64-14.15.3 -o snyk-api-import-linux",
"pkg-binaries": "npx nexe@4.0.0-rc.2 dist/index.js -r './dist/**/*.js' -t mac-x64-14.15.3 -o snyk-api-import-macos"
"pkg-binaries-linux": "npx nexe@3.3.7 dist/index.js -r './dist/**/*.js' -t linux-x64-12.9.0 -o snyk-api-import-linux",
"pkg-binaries": "npx nexe@3.3.7 dist/index.js -r './dist/**/*.js' -t mac-x64-12.9.0 -o snyk-api-import-macos"
},
"types": "./dist/index.d.ts",
"repository": {
Expand All @@ -30,7 +30,7 @@
"author": "Snyk Tech Services",
"license": "Apache-2.0",
"engines": {
"node": ">=14"
"node": ">=12"
},
"files": [
"bin",
Expand All @@ -47,7 +47,6 @@
"bottleneck": "2.19.5",
"bunyan": "1.8.15",
"debug": "4.3.4",
"fs-extra": "^11.1.1",
"lodash": "4.17.21",
"micromatch": "4.0.5",
"needle": "2.9.1",
Expand All @@ -65,7 +64,6 @@
"@semantic-release/exec": "5.0.0",
"@types/bunyan": "1.8.6",
"@types/debug": "4.1.5",
"@types/fs-extra": "^11.0.1",
"@types/jest": "^25.1.1",
"@types/lodash": "^4.14.149",
"@types/micromatch": "4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/git-clone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function gitClone(
} catch (err: any) {
debug(`Could not shallow clone the repo:\n ${err}`);
if (fs.existsSync(repoClonePath)) {
fs.rmSync(repoClonePath, { recursive: true, maxRetries: 3, force: true });
fs.rmdirSync(repoClonePath, { recursive: true, maxRetries: 3 });
}
return {
success: false,
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/sync/clone-and-analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export async function cloneAndAnalyze(
);

try {
fs.rmSync(repoPath, { recursive: true, maxRetries: 3, force: true });
fs.rmdirSync(repoPath, { recursive: true, maxRetries: 3 });
} catch (error) {
debug(`Failed to delete ${repoPath}. Error was ${error}.`);
}
Expand Down
4 changes: 2 additions & 2 deletions test/lib/git-clone.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('gitClone', () => {
afterEach(() => {
for (const f of removeFolders) {
try {
fs.rmSync(f, { recursive: true, force: true, maxRetries: 3 });
fs.rmdirSync(f, { recursive: true, maxRetries: 3 });
} catch (e) {
console.log('Failed to clean up test', e);
}
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('gitClone', () => {
afterEach(() => {
for (const f of removeFolders) {
try {
fs.rmSync(f, { recursive: true, maxRetries: 3, force: true });
fs.rmdirSync(f, { recursive: true, maxRetries: 3 });
} catch (e) {
console.log('Failed to clean up test', e);
}
Expand Down
2 changes: 1 addition & 1 deletion test/scripts/sync/clone-and-analyze.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('cloneAndAnalyze', () => {
afterEach(() => {
for (const f of removeFolders) {
try {
fs.rmSync(f, { recursive: true, maxRetries: 3, force: true });
fs.rmdirSync(f, { recursive: true, maxRetries: 3 });
} catch (e) {
console.log('Failed to clean up test', e);
}
Expand Down
27 changes: 9 additions & 18 deletions test/scripts/sync/sync-org-projects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { requestsManager } from 'snyk-request-manager';
import * as uuid from 'uuid';
import * as path from 'path';
import * as fs from 'fs';
import * as fse from 'fs-extra';
import {
updateOrgTargets,
updateTargets,
Expand Down Expand Up @@ -245,7 +244,7 @@ describe('updateTargets', () => {
cloneSpy.mockImplementation(() =>
Promise.resolve({
success: true,
repoPath: fixture('monorepo-new'),
repoPath: path.resolve(fixturesFolderPath, 'monorepo-new'),
gitResponse: '',
}),
);
Expand Down Expand Up @@ -354,7 +353,7 @@ describe('updateTargets', () => {
cloneSpy.mockImplementation(() =>
Promise.resolve({
success: true,
repoPath: fixture('goof'),
repoPath: path.resolve(fixturesFolderPath, 'goof'),
gitResponse: '',
}),
);
Expand Down Expand Up @@ -464,7 +463,7 @@ describe('updateTargets', () => {
cloneSpy.mockImplementation(() =>
Promise.resolve({
success: true,
repoPath: fixture('goof'),
repoPath: path.resolve(fixturesFolderPath, 'goof'),
gitResponse: '',
}),
);
Expand Down Expand Up @@ -555,7 +554,7 @@ describe('updateTargets', () => {
cloneSpy.mockImplementation(() =>
Promise.resolve({
success: true,
repoPath: fixture('goof'),
repoPath: path.resolve(fixturesFolderPath, 'goof'),
gitResponse: '',
}),
);
Expand Down Expand Up @@ -681,7 +680,7 @@ describe('updateTargets', () => {
cloneSpy.mockImplementation(() =>
Promise.resolve({
success: true,
repoPath: fixture('monorepo'),
repoPath: path.resolve(fixturesFolderPath, 'monorepo'),
gitResponse: '',
}),
);
Expand Down Expand Up @@ -891,7 +890,7 @@ describe('updateTargets', () => {
cloneSpy.mockImplementation(() =>
Promise.resolve({
success: true,
repoPath: fixture('monorepo'),
repoPath: path.resolve(fixturesFolderPath, 'monorepo'),
gitResponse: '',
}),
);
Expand Down Expand Up @@ -1034,7 +1033,7 @@ describe('updateTargets', () => {
cloneSpy.mockImplementation(() =>
Promise.resolve({
success: true,
repoPath: fixture('monorepo'),
repoPath: path.resolve(fixturesFolderPath, 'monorepo'),
gitResponse: '',
}),
);
Expand Down Expand Up @@ -1401,7 +1400,7 @@ describe('updateOrgTargets', () => {
cloneSpy.mockImplementation(() =>
Promise.resolve({
success: true,
repoPath: fixture('goof'),
repoPath: path.resolve(fixturesFolderPath, 'goof'),
gitResponse: '',
}),
);
Expand Down Expand Up @@ -1586,7 +1585,7 @@ describe('updateOrgTargets', () => {
cloneSpy.mockImplementation(() =>
Promise.resolve({
success: true,
repoPath: fixture('goof'),
repoPath: path.resolve(fixturesFolderPath, 'goof'),
gitResponse: '',
}),
);
Expand Down Expand Up @@ -1877,11 +1876,3 @@ describe('bulkImportTargetFiles', () => {
expect(updated.length).toEqual(5);
});
});

function fixture(name: string) {
const tempDir = fs.mkdtempSync('snyk-api-import-test-');
fse.copySync(path.resolve(fixturesFolderPath, name), tempDir, {
overwrite: true,
});
return tempDir;
}

0 comments on commit daf6714

Please sign in to comment.