ga4gh / gh-openapi-docs

Package for building OpenAPI schema docs and UI for gh-pages
Apache License 2.0
7 stars 5 forks source link

--version returns the incorrect version #51

Closed tschaffter closed 3 years ago

tschaffter commented 4 years ago

After installing gh-openapi-docs locally, I check that the latest version is installed (0.2.1).

$ npm list | grep "gh-openapi-docs"
+-- @ga4gh/gh-openapi-docs@0.2.1
npm ERR! peer dep missing: styled-components@^4.1.1, required by redoc@2.0.0-rc.40

The output of npx gh-openapi-docs --version (or node ./node_modules/@ga4gh/gh-openapi-docs/dist/bundle.js --version) tells that the version installed in 0.1.9.

$ node ./node_modules/@ga4gh/gh-openapi-docs/dist/bundle.js --version
{
  sha: '74199faa675483771cc091d029f1766c34655e32',
  abbreviatedSha: '74199faa67',
  branch: 'ci/add-build-and-publish',
  tag: null,
  committer: 'tschaffter <thomas.schaffter@gmail.com>',
  committerDate: '2020-09-02T15:54:09.000Z',
  author: 'tschaffter <thomas.schaffter@gmail.com>',
  authorDate: '2020-09-02T15:54:09.000Z',
  commitMessage: 'Add @ga4gh/gh-openapi-docs to dev dependencies',
  root: '/home/tschaffter/persist/dev/nlp-sandbox-schemas',
  commonGitDir: '/home/tschaffter/persist/dev/nlp-sandbox-schemas/.git',
  worktreeGitDir: '/home/tschaffter/persist/dev/nlp-sandbox-schemas/.git',
  lastTag: null,
  commitsSinceLastTag: 0,
  parents: [ 'b3ed610a6c073dbf251269fe843886166e0afc33' ]
}
{
  apiSpecPath: '',
  docsRoot: 'docs',
  uiRoot: 'swagger-ui',
  redocRoot: 'redoc-ui',
  defaultBranch: 'master',
  branchPathBase: 'preview',
  contactUrl: '',
  sha: '74199faa675483771cc091d029f1766c34655e32',
  abbreviatedSha: '74199faa67',
  branch: 'ci/add-build-and-publish',
  tag: null,
  committer: 'tschaffter <thomas.schaffter@gmail.com>',
  committerDate: '2020-09-02T15:54:09.000Z',
  author: 'tschaffter <thomas.schaffter@gmail.com>',
  authorDate: '2020-09-02T15:54:09.000Z',
  commitMessage: 'Add @ga4gh/gh-openapi-docs to dev dependencies',
  root: '/home/tschaffter/persist/dev/nlp-sandbox-schemas',
  commonGitDir: '/home/tschaffter/persist/dev/nlp-sandbox-schemas/.git',
  worktreeGitDir: '/home/tschaffter/persist/dev/nlp-sandbox-schemas/.git',
  lastTag: null,
  commitsSinceLastTag: 0,
  parents: [ 'b3ed610a6c073dbf251269fe843886166e0afc33' ],
  env: 'development',
  repoOrigin: 'git@github.com:data2health/nlp-sandbox-schemas.git',
  branchPath: '/home/tschaffter/persist/dev/nlp-sandbox-schemas/preview/ci/add-build-and-publish'
}
v0.1.9

Note: The above output should not include anything else than the version. I will create a second ticket to track this issue.

tschaffter commented 4 years ago

The following works:

  1. Cloning the branch develop of this repo
  2. npm install
  3. npm run build
  4. node ./dist/bundle.js --version v0.2.1

The issue is in the release available in npmjs, more precisely in the file dist/bundle.js. Here is the part that print version 0.1.9 despite the package.json file present in this release indicating 0.2.1.

/***/ "./package.json":
/*!**********************!*\
  !*** ./package.json ***!
  \**********************/
/*! exports provided: name, version, dependencies, bin, main, scripts, devDependencies, nyc, default */
/***/ (function(module) {

eval("module.exports = JSON.parse(\"{\\\"name\\\":\\\"gh-openapi-docs\\\",\\\"version\\\":\\\"0.1.9\\\",\\\"dependencies\\\":{\\\"@babel/runtime\\\":\\\"^7.6.3\\\",\\\"chalk\\\":\\\"2.4.2\\\",\\\"git-repo-info\\\":\\\"^2.1.1\\\",\\\"is-ci\\\":\\\"^2.0.0\\\",\\\"json-refs\\\":\\\"^3.0.15\\\",\\\"json-schema-ref-parser\\\":\\\"^7.1.3\\\",\\\"loader-utils\\\":\\\"^1.4.0\\\",\\\"lodash\\\":\\\"^4.17.15\\\",\\\"oas-linter\\\":\\\"^3.0.2\\\",\\\"oas-resolver\\\":\\\"^2.2.7\\\",\\\"oas-validator\\\":\\\"^3.3.3\\\",\\\"redoc-cli\\\":\\\"^0.9.7\\\",\\\"remote-origin-url\\\":\\\"^2.0.0\\\",\\\"shelljs\\\":\\\"^0.7.0\\\",\\\"@redocly/openapi-cli\\\":\\\"0.8.4\\\",\\\"swagger-repo\\\":\\\"^2.0.0-rc.15\\\",\\\"swagger-ui-dist\\\":\\\"3.24.0\\\",\\\"update-notifier\\\":\\\"3.0.1\\\",\\\"yargs-parser\\\":\\\"15.0.0\\\"},\\\"bin\\\":{\\\"gh-openapi-docs\\\":\\\"./dist/bundle.js\\\"},\\\"main\\\":\\\"./src/lib/index.js\\\",\\\"scripts\\\":{\\\"fetch\\\":\\\"node src/fetchpages.js\\\",\\\"build:swagger\\\":\\\"node src/swagger-ui.js\\\",\\\"build:redoc\\\":\\\"node src/redoc-ui.js\\\",\\\"build\\\":\\\"npx webpack-cli --mode=development && chmod +x ./dist/bundle.js\\\",\\\"test\\\":\\\"npx mocha-webpack --webpack-config webpack.config-test.js --recursive \\\\\\\"src\\\\\\\" \\\\\\\"test/mocha\\\\\\\" --exit\\\",\\\"coverage\\\":\\\"npx nyc npm run test\\\",\\\"pushCoverageReport\\\":\\\"npx nyc report --reporter=text-lcov | npx coveralls\\\"},\\\"devDependencies\\\":{\\\"@babel/core\\\":\\\"^7.8.7\\\",\\\"@babel/plugin-syntax-dynamic-import\\\":\\\"^7.8.3\\\",\\\"@babel/plugin-transform-runtime\\\":\\\"^7.8.3\\\",\\\"@babel/polyfill\\\":\\\"^7.8.7\\\",\\\"@babel/preset-env\\\":\\\"^7.8.7\\\",\\\"@babel/register\\\":\\\"^7.9.0\\\",\\\"babel-loader\\\":\\\"^8.0.6\\\",\\\"cross-env\\\":\\\"^7.0.2\\\",\\\"istanbul-instrumenter-loader\\\":\\\"^3.0.1\\\",\\\"mocha\\\":\\\"^7.1.1\\\",\\\"mocha-webpack\\\":\\\"^2.0.0-beta.0\\\",\\\"nyc\\\":\\\"^15.0.1\\\",\\\"pkg\\\":\\\"^4.4.4\\\",\\\"webpack\\\":\\\"^4.42.0\\\",\\\"webpack-cli\\\":\\\"^3.3.11\\\",\\\"webpack-node-externals\\\":\\\"^1.7.2\\\"},\\\"nyc\\\":{\\\"instrument\\\":false,\\\"sourceMap\\\":false}}\");\n\n//# sourceURL=webpack:///./package.json?");
tschaffter commented 4 years ago

@jaeddy Does this issue ring a bell? Running npm run build on the branch develop of this repo works file and generate dist/bundle.js that contains the correct version as included in package.json. Can you share the protocol you follow to publish to npmjs?

tschaffter commented 4 years ago

This does not appear to be an issue in the current branch develop but is still an issue in the version installed from npmjs.

@jaeddy Can you create a new GH release to test our new workflow and publish automatically a new npmjs release?

tschaffter commented 3 years ago

The package version on npmjs is outdated. I'll reopen this ticket if I notice that the next release has the issue described in this ticket.