@anansi/cli 1.4.31 → 2.0.1

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ### [2.0.1](https://github.com/ntucker/anansi/compare/@anansi/cli@2.0.0...@anansi/cli@2.0.1) (2022-10-15)
7
+
8
+ ### 💅 Enhancement
9
+
10
+ * Fix compatibility with stackblitz ([13585de](https://github.com/ntucker/anansi/commit/13585de96e2c23696454298b41b5ccf395263abc))
11
+
12
+ ## [2.0.0](https://github.com/ntucker/anansi/compare/@anansi/cli@1.4.31...@anansi/cli@2.0.0) (2022-10-10)
13
+
14
+ ### ⚠ 💥 BREAKING CHANGES
15
+
16
+ * Requires node 14
17
+
18
+ ### 💅 Enhancement
19
+
20
+ * Move to ESM ([febdb01](https://github.com/ntucker/anansi/commit/febdb01583a257a39b7c9b5600e2ac556ccd122e))
21
+
22
+ ### 🐛 Bug Fix
23
+
24
+ * Node requirements for cli ([8dc6622](https://github.com/ntucker/anansi/commit/8dc6622d06a77aacbda77aa32f5b22bf5ae5f307))
25
+
6
26
  ### [1.4.31](https://github.com/ntucker/anansi/compare/@anansi/cli@1.4.30...@anansi/cli@1.4.31) (2022-10-07)
7
27
 
8
28
  **Note:** Version bump only for package @anansi/cli
@@ -0,0 +1,31 @@
1
+ import binVersionCheck from 'bin-version-check';
2
+ import latestVersion from 'latest-version';
3
+ import chalk from 'chalk';
4
+
5
+ import pkg from './package.json' assert { type: 'json' };
6
+
7
+ export const description = 'version';
8
+
9
+ export const verify = async () => {
10
+ const version = await latestVersion(pkg.name);
11
+ try {
12
+ const result = await binVersionCheck('anansi', `>=${version}`);
13
+ return result;
14
+ } catch (error) {
15
+ if (error.name === 'InvalidBinaryVersion') {
16
+ return `${chalk.red(
17
+ `Warning: ${pkg.name} is outdated. ${version} now available.`,
18
+ )}\n${chalk.cyan("Run 'npm update -g @anansi/cli' to update")}`;
19
+ }
20
+
21
+ console.log(error);
22
+ return;
23
+ }
24
+ };
25
+
26
+ export const verifyAndPrompt = async () => {
27
+ const error = await verify();
28
+ if (error) {
29
+ console.error(error);
30
+ }
31
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anansi/cli",
3
- "version": "1.4.31",
3
+ "version": "2.0.1",
4
4
  "description": "Fast React Web Apps",
5
5
  "homepage": "https://github.com/ntucker/anansi/tree/master/packages/cli#readme",
6
6
  "repository": {
@@ -22,11 +22,11 @@
22
22
  }
23
23
  ],
24
24
  "files": [
25
- "run.js",
26
- "check-version.js"
25
+ "run.mjs",
26
+ "check-version.mjs"
27
27
  ],
28
28
  "bin": {
29
- "anansi": "./run.js"
29
+ "anansi": "./run.mjs"
30
30
  },
31
31
  "keywords": [
32
32
  "cli",
@@ -47,11 +47,11 @@
47
47
  "jest"
48
48
  ],
49
49
  "engines": {
50
- "node": ">= 12.20.0",
50
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0",
51
51
  "npm": ">= 6.0.0"
52
52
  },
53
53
  "dependencies": {
54
- "@anansi/generator-js": "^10.0.0",
54
+ "@anansi/generator-js": "^10.0.2",
55
55
  "bin-version-check": "^4.0.0",
56
56
  "chalk": "^4.1.2",
57
57
  "commander": "^9.4.1",
@@ -1,11 +1,24 @@
1
1
  #!/usr/bin/env node
2
- const fs = require('fs');
3
- const execa = require('execa');
4
- const path = require('path');
5
- const { Command } = require('commander');
2
+ import fs from 'fs';
3
+ import execa from 'execa';
4
+ import path from 'path';
5
+ import { Command } from 'commander';
6
+ import { createRequire } from 'module';
7
+ import { dirname } from 'path';
8
+ import { fileURLToPath } from 'url';
6
9
 
7
- const { verifyAndPrompt } = require('./check-version');
8
- const { version } = require('./package.json');
10
+ // TODO: Use this once stackblitz works with it
11
+ //import pkg from './package.json' assert { type: 'json' };
12
+ import { verifyAndPrompt } from './check-version.mjs';
13
+
14
+ const __dirname = dirname(fileURLToPath(import.meta.url));
15
+ // need for require.resolve (until import.meta.resolve is not experimental)
16
+ const require = createRequire(import.meta.url);
17
+
18
+ const pkg = JSON.parse(
19
+ fs.readFileSync(path.join(__dirname, './package.json'), 'utf8'),
20
+ );
21
+ const { version } = pkg;
9
22
 
10
23
  const program = new Command();
11
24
 
package/check-version.js DELETED
@@ -1,31 +0,0 @@
1
- const binVersionCheck = require('bin-version-check');
2
- const latestVersion = require('latest-version');
3
- const chalk = require('chalk');
4
-
5
- const { name } = require('./package.json');
6
-
7
- exports.description = 'version';
8
-
9
- exports.verify = async () => {
10
- const version = await latestVersion(name);
11
- try {
12
- const result = await binVersionCheck('anansi', `>=${version}`);
13
- return result;
14
- } catch (error) {
15
- if (error.name === 'InvalidBinaryVersion') {
16
- return `${chalk.red(
17
- `Warning: ${name} is outdated. ${version} now available.`,
18
- )}\n${chalk.cyan("Run 'npm update -g @anansi/cli' to update")}`;
19
- }
20
-
21
- console.log(error);
22
- return;
23
- }
24
- };
25
-
26
- exports.verifyAndPrompt = async () => {
27
- const error = await exports.verify();
28
- if (error) {
29
- console.error(error);
30
- }
31
- };