API-Flow
API-Flow copied to clipboard
Install via NPM/Yarn fails
To repeat:
npm install philsturgeon/API-flow --save-dev
const ApiFlow = require('api-flow').default; // if from yarn/npm
const path = require('path');
const options = {
source: {
format: 'swagger',
version: 'v2.0'
},
target: {
format: 'raml',
version: 'v1.0'
}
}
const promise = ApiFlow.transform({
options,
uri: path.resolve(__dirname, './my_super_swagger.yml')
})
promise.then((data) => {
// do some cool stuff with the data
})
Result:
Error: Cannot find module '/myproject/node_modules/api-flow/dist/node/api-flow.js'. Please verify that the package.json has a valid "main" entry
Why?
You don't add a build step in package.json, so dist/node/api-flow.js is never created.