Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

142 code generator main #182

Merged
merged 7 commits into from
May 31, 2017
Merged

142 code generator main #182

merged 7 commits into from
May 31, 2017

Conversation

wizzy25
Copy link
Contributor

@wizzy25 wizzy25 commented May 30, 2017

Summary

As part of this project, implement a package to generate discount codes

Description

This package is now complete and should be merged and released

resolves #142

wizzy25 and others added 6 commits April 28, 2017 09:19
affects: @commercetools/discount-code-generator

142
affects: @commercetools/discount-code-generator
Implement CLI to read attributes/parameters from user and output/save generated codes

affects: @commercetools/discount-code-generator
correct readme links
affects: @commercetools/discount-code-generator
@wizzy25 wizzy25 self-assigned this May 30, 2017
@codecov
Copy link

codecov bot commented May 30, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@98cbb7b). Click here to learn what that means.
The diff coverage is 79.16%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master    #182   +/-   ##
========================================
  Coverage          ?   96.6%           
========================================
  Files             ?      56           
  Lines             ?    1061           
  Branches          ?       0           
========================================
  Hits              ?    1025           
  Misses            ?      36           
  Partials          ?       0
Impacted Files Coverage Δ
packages/discount-code-generator/src/main.js 100% <100%> (ø)
packages/discount-code-generator/src/utils.js 37.5% <37.5%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98cbb7b...3a20a5c. Read the comment docs.

Copy link
Member

@emmenko emmenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't I review this already? It looks fine anyway ;)

@wizzy25 wizzy25 merged commit c389828 into master May 31, 2017
@wizzy25 wizzy25 deleted the 142-code-generator-main branch May 31, 2017 08:27
Copy link
Contributor

@junajan junajan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌻

--output, -o Path to store generated output file. [default: "stdout"]
--delimiter, -d Used CSV delimiter for input and/or output file. [default: ","]
--multivalueDelimiter, -m Used CSV delimiter in multivalue fields for input/output file. [default: ";"]
--logLevel, Logging level: error, warn, info or verbose. [default: "info"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nitpick - some params are written in camelCase and some in kebab-case

"type": "git",
"url": "https://github.com/commercetools/nodejs/tree/master/packages/discount-code-generator"
},
"homepage": "https://commercetools.github.io/nodejs/sdk/api/discountCodeGenerator.html",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this URL correct? Shouldn't there be cli/...?


Generate discount codes to be imported to the commercetools platform.

https://commercetools.github.io/nodejs/docs/cli/discount-code-generator.h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Url should be something like this: https://commercetools.github.io/nodejs/cli/csv-parser-price.html

reject(error)
})
.on('data', (data) => {
_attributes = data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be _attributes += data because the input file is loaded in chunks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That also works; but it's expecting just one line, so this is better; the data event gets fired once

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the input file can have only 64kb including those descriptions in multiple languages.

@wizzy25 wizzy25 restored the 142-code-generator-main branch May 31, 2017 08:32
@wizzy25 wizzy25 deleted the 142-code-generator-main branch May 31, 2017 08:34
outputStream.on('finish', () => {
resolve(total)
})
} else reject(new Error('Invalid file format. Must be CSV or JSON'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already handled when parsing input arguments.

@wizzy25
Copy link
Contributor Author

wizzy25 commented May 31, 2017

See #184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discount code generator module
3 participants