npq 3.4.4 → 3.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,7 +48,7 @@ jobs:
48
48
  - uses: actions/checkout@v2
49
49
  - uses: actions/setup-node@v2
50
50
  with:
51
- node-version: '18'
51
+ node-version: '20'
52
52
  - name: install dependencies
53
53
  run: npm ci --ignore-engines --ignore-scripts
54
54
  - name: release
package/lib/cliCommons.js CHANGED
@@ -33,6 +33,14 @@ class cliCommons {
33
33
 
34
34
  static getOptions() {
35
35
  return {
36
+ S: {
37
+ alias: ['save', 'save-prod', 'save-optional', 'save-bundle'],
38
+ type: 'boolean'
39
+ },
40
+ g: {
41
+ alias: 'global',
42
+ type: 'boolean'
43
+ },
36
44
  P: {
37
45
  alias: ['save-prod', 'peer'],
38
46
  type: 'boolean'
@@ -30,7 +30,7 @@ class Marshall extends BaseMarshall {
30
30
  * @returns
31
31
  */
32
32
  async validate(pkg) {
33
- // @TODO move some of these utility functions about first package vesion
33
+ // @TODO move some of these utility functions about first package version
34
34
  // published, date diff, etc into the package repo utils
35
35
  const pakument = await this.packageRepoUtils.getPackageInfo(pkg.packageName)
36
36
 
@@ -67,16 +67,27 @@ class Marshall extends BaseMarshall {
67
67
 
68
68
  const firstPublishedDateString = pakument.time[firstVersionForUser.version]
69
69
 
70
- const dateDiffInMs = new Date(versionPublishedDateString) - new Date(firstPublishedDateString)
71
- let dateDiffInDays = 0
72
- if (dateDiffInMs > 0) {
73
- dateDiffInDays = Math.round(dateDiffInMs / (1000 * 60 * 60 * 24))
70
+ // get date in ms
71
+ const currentDate = new Date()
72
+ const dateDiffInMsVersionPublished = currentDate - new Date(versionPublishedDateString)
73
+ console.log(dateDiffInMsVersionPublished)
74
+ let dateDiffVersionPublished = 0
75
+ if (dateDiffInMsVersionPublished > 0) {
76
+ dateDiffVersionPublished = Math.round(dateDiffInMsVersionPublished / (1000 * 60 * 60 * 24))
74
77
  }
75
78
 
76
- if (dateDiffInDays <= 30) {
77
- throw new Error(
78
- `The user ${npmUser.name} <${npmUser.email}> published this package for the first time only ${dateDiffInDays} days ago.`
79
- )
79
+ if (dateDiffVersionPublished <= 45) {
80
+ const dateDiffInMs = new Date(versionPublishedDateString) - new Date(firstPublishedDateString)
81
+ let dateDiffInDays = 0
82
+ if (dateDiffInMs > 0) {
83
+ dateDiffInDays = Math.round(dateDiffInMs / (1000 * 60 * 60 * 24))
84
+ }
85
+
86
+ if (dateDiffInDays <= 30) {
87
+ throw new Error(
88
+ `The user ${npmUser.name} <${npmUser.email}> published this package for the first time only ${dateDiffInDays} days prior to this version.`
89
+ )
90
+ }
80
91
  }
81
92
 
82
93
  return versionPublishedDateString
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npq",
3
- "version": "3.4.4",
3
+ "version": "3.4.6",
4
4
  "description": "marshall your npm/npm package installs with high quality and class 🎖",
5
5
  "bin": {
6
6
  "npq": "./bin/npq.js",