Skip to content

Commit

Permalink
Merge pull request #29 from flotiq/support-cjs-mjs
Browse files Browse the repository at this point in the history
Include cjs/mjs in compiled output
  • Loading branch information
trzcina authored Oct 24, 2024
2 parents 2166aa1 + 97b0267 commit df4049b
Show file tree
Hide file tree
Showing 4 changed files with 419 additions and 263 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function generateSDK(apiKey, compileToJs) {
console.log('Generating client from schema...');

// Generate command
const lambdaUrl = `https://0c8judkapg.execute-api.us-east-1.amazonaws.com/default/codegen-ts?token=${apiKey}`
const lambdaUrl = `https://0c8judkapg.execute-api.us-east-1.amazonaws.com/default/codegen-ts?token=${apiKey}`;
const zip = new admZip(await lambdaInvoke(lambdaUrl));
const tmpPath = getWorkingPath();
const tmpSDKPath = `${tmpPath}/flotiqApi`;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flotiq-codegen-ts",
"version": "1.2.2",
"version": "1.3.0",
"description": "CLI tool to generate API clients using Flotiq API and OpenAPI Generator",
"main": "index.js",
"bin": {
Expand Down
8 changes: 6 additions & 2 deletions src/build_to_js.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ const buildToJs = (tmpSDKPath) => {
return console.error(err.message);
}
});
execSync(`tsc -p ${sdkCopyPath}`, {stdio: 'inherit'});
fce.moveSync(`${sdkCopyPath}/dist/`, `${tmpSDKPath}`, {overwrite: true});
execSync(`npm run build`, {stdio: 'inherit', cwd: sdkCopyPath});
// Move main files (dist, package.json, README.nd) to the result dir
// Don't move typescript sources to the result dir
fce.moveSync(`${sdkCopyPath}/dist`, `${tmpSDKPath}/dist`, {overwrite: true});
fce.moveSync(`${sdkCopyPath}/package.json`, `${tmpSDKPath}/package.json`, {overwrite: true});
fce.moveSync(`${sdkCopyPath}/README.md`, `${tmpSDKPath}/README.md`, {overwrite: true});
}

module.exports = buildToJs;
Loading

0 comments on commit df4049b

Please sign in to comment.