8000 my_node_js_integration_test.yml · avdim/github-script@10ad4ef · GitHub
[go: up one dir, main page]

Skip to content
< 8000 header class="HeaderMktg header-logged-out js-details-container js-header Details f4 py-3" role="banner" data-is-top="true" data-color-mode=light data-light-theme=light data-dark-theme=dark>

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 10ad4ef

Browse files
committed
my_node_js_integration_test.yml
1 parent 715373e commit 10ad4ef

File tree

8 files changed

+68
-15
lines changed

8 files changed

+68
-15
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
path: ~/.npm
1717
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
1818
restore-keys: ${{runner.os}}-npm-
19-
- run: npm ci
19+
# - run: npm ci #todo better use ci
20+
- run: npm install
2021
- run: npm run style:check
2122
- run: npm test
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
push:
3+
branches: [ main, avdim ]
4+
pull_request:
5+
branches: [ main, avdim ]
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
node-version: [10.x, 12.x, 14.x]
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- run: npm ci
23+
- run: ./integration_test.sh
24+
# - run: npm run build --if-present
25+
# - run: npm test

__test__/migrate.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import * as fs from 'fs'
44
const migrate = require('../src/npm-migrate')
5+
const npmUtils = require('../src/npm_utils')
56
const moduleName = 'test-package'
67
const from = 'http://localhost:55551'
78
const to = 'http://localhost:55552'
@@ -13,6 +14,9 @@ describe('migrate', () => {
1314
.then((migrated:any) => console.log("migrated", migrated)) // list of migrated packages
1415
.catch((err:any) => console.error("my err", err))
1516

17+
let resultVersions: Array<string> = await npmUtils.getVersionList(moduleName, to);
18+
expect(resultVersions.indexOf("1.0.1") >= 0).toEqual(true)
19+
1620
expect('a').toEqual('a')
1721
})
1822
})

integration_test.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,11 @@ npm publish
2424
cd -
2525
npm-cli-login -u Username -p Password -e test@example.com -r http://localhost:55552
2626

27-
echo "check: http://localhost:55551"
28-
read check1
29-
jest --testNamePattern=migrate
27+
#echo "check: http://localhost:55551"
28+
#read check1
29+
jest --testNamePattern=migrate && echo "jest migrate test success" && clear
3030
#npm test
3131

32-
echo "check: http://localhost:55552"
33-
read check2
34-
35-
#todo make assert
36-
echo "test complete success"
37-
38-
clear
32+
#echo "check: http://localhost:55552"
33+
#read check2
34+
#clear #todo clear if fails

src/npm-migrate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const curry = require('lodash.curry')
44

55
const { unpack, pack } = require('./tgz')
66
const cleanup = require('./cleanup')
7-
const { getVersionList, getTarballs, publishSeries } = require('./npm_utils')
7+
const { getDiffVersionList, getTarballs, publishSeries } = require('./npm_utils')
88
const updatePackage = require('./update2')
99

1010
module.exports = function (moduleName, oldRegistry, newRegistry, options = { debug: false }) {
@@ -22,7 +22,7 @@ module.exports = function (moduleName, oldRegistry, newRegistry, options = { deb
2222
let curried_publishSeries = curry(publishSeries)
2323
curried_publishSeries = curried_publishSeries(newRegistry)
2424

25-
return getVersionList(moduleName, oldRegistry, newRegistry)
25+
return getDiffVersionList(moduleName, oldRegistry, newRegistry)
2626
.then(curried_getTarballs)
2727
.then(unpack)
2828
.then(curried_updatePackage)

src/npm_utils.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function getRemainingVersions (moduleName, oldRegistry, newRegistry, oldRegistry
8282

8383
}
8484

85-
module.exports.getVersionList = function (moduleName, oldRegistry, newRegistry) {
85+
module.exports.getDiffVersionList = function (moduleName, oldRegistry, newRegistry) {
8686

8787
return new Promise((resolve, reject) => {
8888

@@ -107,6 +107,27 @@ module.exports.getVersionList = function (moduleName, oldRegistry, newRegistry)
107107
})
108108
}
109109

110+
module.exports.getVersionList = function (moduleName, registryStr) {
111+
112+
return new Promise((resolve, reject) => {
113+
114+
const newRegistry = registryStr
115+
console.log("newRegistry: ", newRegistry)
116+
npm.config.set('registry', newRegistry);
117+
npm.commands.info([moduleName], (err, data) => {
118+
119+
const latest = Object.keys(data)[0];
120+
const newRegistryVersions = data[latest].versions;
121+
console.log('New Registry Versions', newRegistryVersions);
122+
123+
resolve(newRegistryVersions);
124+
125+
});
126+
// npm.config.set('registry', oldRegistry);
127+
128+
})
129+
}
130+
110131

111132
module.exports.getTarballs = function (moduleName, registry, versions) {
112133

test-package-dir/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "test-package",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "test-package description",
55
"main": "test-package-entry-point.js",
66
"scripts": {

todo.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1+
12
https://gitlab.com/lt.petuska/npm-publish
3+
Users/dim/Desktop/github/petuska/npm-publish
4+
5+
https://github.com/tutu-ru-mobile/upload-to-github-release/blob/master/src/index.ts
6+
https://github.com/tutu-ru-mobile/cancel-previous-pull-request
7+
https://github.com/tutu-ru-mobile/action_create_pull_request

0 commit comments

Comments
 (0)
0