char 1.0.2 → 1.0.3

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/README.md CHANGED
@@ -1,50 +1,34 @@
1
1
  # char
2
2
 
3
- > Return the string representing a character whose Unicode code point is the integer `code`.
4
- ES6 implementation of **[`Python built-in chr()`](https://docs.python.org/3.6/library/functions.html#chr)** function
5
-
6
- [![Build Status](https://travis-ci.org/nhsz/char.svg?branch=master)](https://travis-ci.org/nhsz/char)
7
- [![Coverage Status](https://coveralls.io/repos/github/nhsz/char/badge.svg?branch=master)](https://coveralls.io/github/nhsz/char?branch=master)
8
- [![codebeat badge](https://codebeat.co/badges/a5fa0f50-f5f9-4313-8535-2e3dba3a6507)](https://codebeat.co/projects/github-com-nhsz-char-master)
9
- [![Codacy Badge](https://api.codacy.com/project/badge/Grade/0e5fc4e079eb481ab006e3338e4db30f)](https://www.codacy.com/app/nquiroz/char?utm_source=github.com&utm_medium=referral&utm_content=nhsz/char&utm_campaign=Badge_Grade)
10
- [![Code Climate](https://codeclimate.com/github/nhsz/char/badges/gpa.svg)](https://codeclimate.com/github/nhsz/char)
11
-
12
- [![NPM](https://nodei.co/npm/char.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/char/)
13
-
14
- This is the inverse of **[`ordr`](https://www.npmjs.com/package/ordr)**.
15
-
16
- **The valid range for the argument is from 0 through 1114111 (0x10FFFF in base 16)**. RangeError will be raised if `code` is outside that range.
17
-
3
+ Install the Char CLI from npm.
18
4
 
19
5
  ## Install
20
6
 
21
- ```
22
- $ npm install char
7
+ ```bash
8
+ npm install -g char
23
9
  ```
24
10
 
11
+ For nightly builds:
25
12
 
26
- ## Usage
27
-
28
- ```js
29
- const chr = require('char')
13
+ ```bash
14
+ npm install -g char@nightly
15
+ ```
30
16
 
31
- console.log(chr(65))
32
- // => 'A'
17
+ ## Platforms
33
18
 
34
- console.log(chr(97))
35
- // => 'a'
19
+ The npm package currently installs prebuilt binaries for:
36
20
 
37
- console.log(chr(8364))
38
- // => '€'
21
+ - macOS Apple Silicon
22
+ - macOS Intel
39
23
 
40
- console.log(chr(64))
41
- // => '@'
24
+ ## Usage
42
25
 
43
- console.log(chr(-1))
44
- // => RangeError: Invalid code point -1
26
+ ```bash
27
+ char --help
45
28
  ```
46
29
 
30
+ ## Links
47
31
 
48
- ## License
49
-
50
- MIT © **[`Nicolás Quiroz`](https://nicolasquiroz.com)**
32
+ - App: https://char.com
33
+ - Repository: https://github.com/fastrepl/char
34
+ - Issues: https://github.com/fastrepl/char/issues
package/bin/run.js ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require("node:child_process");
4
+ const { join } = require("node:path");
5
+
6
+ const bin = join(__dirname, "char");
7
+ const child = spawn(bin, process.argv.slice(2), {
8
+ stdio: "inherit",
9
+ env: { ...process.env, CHAR_MANAGED_BY_NPM: "1" },
10
+ });
11
+
12
+ child.on("error", (err) => {
13
+ console.error(err);
14
+ process.exit(1);
15
+ });
16
+
17
+ child.on("exit", (code, signal) => {
18
+ if (signal) {
19
+ process.kill(process.pid, signal);
20
+ } else {
21
+ process.exit(code ?? 1);
22
+ }
23
+ });
package/install.js ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require("node:child_process");
4
+ const { existsSync, mkdirSync } = require("node:fs");
5
+ const { join } = require("node:path");
6
+
7
+ const REPO = "fastrepl/char";
8
+
9
+ const TARGETS = {
10
+ "darwin-arm64": "aarch64-apple-darwin",
11
+ "darwin-x64": "x86_64-apple-darwin",
12
+ };
13
+
14
+ const target = TARGETS[`${process.platform}-${process.arch}`];
15
+ if (!target) {
16
+ console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
17
+ process.exit(1);
18
+ }
19
+
20
+ const version = require("./package.json").version;
21
+ const tag = `cli_v${version}`;
22
+ const archive = `char-${version}-${target}.tar.xz`;
23
+ const url = `https://github.com/${REPO}/releases/download/${tag}/${archive}`;
24
+
25
+ const binDir = join(__dirname, "bin");
26
+ if (!existsSync(binDir)) {
27
+ mkdirSync(binDir, { recursive: true });
28
+ }
29
+
30
+ const dest = join(binDir, "char");
31
+ if (existsSync(dest)) {
32
+ process.exit(0);
33
+ }
34
+
35
+ console.error(`Downloading char from ${url}`);
36
+ const tmp = join(require("node:os").tmpdir(), archive);
37
+ execSync(`curl -fsSL -o "${tmp}" "${url}"`, { stdio: "inherit" });
38
+ execSync(`tar -xf "${tmp}" -C "${binDir}"`, { stdio: "inherit" });
39
+ execSync(`rm -f "${tmp}"`);
40
+ execSync(`chmod +x "${dest}"`);
package/package.json CHANGED
@@ -1,35 +1,34 @@
1
1
  {
2
2
  "name": "char",
3
- "version": "1.0.2",
4
- "description": "Return the string representing a character whose Unicode code point is the integer code",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "nyc --reporter=html --reporter=text ava"
8
- },
3
+ "version": "1.0.3",
4
+ "description": "Live transcription and audio tools",
5
+ "license": "GPL-3.0",
9
6
  "repository": {
10
7
  "type": "git",
11
- "url": "git+https://github.com/nhsz/char.git"
8
+ "url": "git+https://github.com/fastrepl/char.git",
9
+ "directory": "apps/cli/npm"
10
+ },
11
+ "homepage": "https://char.com",
12
+ "bugs": {
13
+ "url": "https://github.com/fastrepl/char/issues"
12
14
  },
13
15
  "keywords": [
14
16
  "char",
15
- "string",
16
- "unicode",
17
- "python",
18
- "es6"
17
+ "cli",
18
+ "transcription",
19
+ "notes"
19
20
  ],
20
- "author": {
21
- "name": "Nicolás Quiroz",
22
- "email": "nh.quiroz@gmail.com",
23
- "url": "nicolasquiroz.com"
21
+ "bin": {
22
+ "char": "bin/run.js"
24
23
  },
25
- "license": "MIT",
26
- "bugs": {
27
- "url": "https://github.com/nhsz/char/issues"
24
+ "scripts": {
25
+ "postinstall": "node install.js"
28
26
  },
29
- "homepage": "https://github.com/nhsz/char#readme",
30
- "devDependencies": {
31
- "ava": "^0.19.1",
32
- "coveralls": "^2.13.1",
33
- "nyc": "^11.0.2"
27
+ "files": [
28
+ "bin/",
29
+ "install.js"
30
+ ],
31
+ "engines": {
32
+ "node": ">=18"
34
33
  }
35
34
  }
package/.npmignore DELETED
@@ -1,4 +0,0 @@
1
- node_modules/
2
- *.log
3
- coverage
4
- .nyc_output
package/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "8"
4
- - "6"
5
- install:
6
- - npm install
7
- script:
8
- - npm test
9
- after_success:
10
- - './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls'
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2017 Nicolás Quiroz
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/index.js DELETED
@@ -1,5 +0,0 @@
1
- 'use strict'
2
-
3
- module.exports = code => {
4
- return String.fromCodePoint(code)
5
- }
package/test.js DELETED
@@ -1,17 +0,0 @@
1
- import test from 'ava'
2
- import chr from './'
3
-
4
- test(t => {
5
- t.is(chr(65), 'A')
6
- t.is(chr(97), 'a')
7
- t.is(chr(8364), '€')
8
- t.is(chr(64), '@')
9
- })
10
-
11
- test(t => {
12
- const error = t.throws(() => {
13
- chr(-1)
14
- }, RangeError)
15
-
16
- t.is(error.message, 'Invalid code point -1')
17
- })