noshift.js 0.0.4 → 0.1.0
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 +79 -0
- package/commands/create.js +14 -3
- package/package.json +10 -2
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# NoShift.js
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
```bash
|
|
5
|
+
npm install -g noshift.js@latest
|
|
6
|
+
npx nsjs create
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## English
|
|
10
|
+
|
|
11
|
+
### Language
|
|
12
|
+
NoShift.js
|
|
13
|
+
|
|
14
|
+
### Extension
|
|
15
|
+
`.nsjs`
|
|
16
|
+
|
|
17
|
+
### Summary
|
|
18
|
+
Typing symbols with Shift is tiring. NoShift.js is a JavaScript-like language that allows you to write JavaScript **without using the Shift key**.
|
|
19
|
+
It compiles to plain JavaScript.
|
|
20
|
+
|
|
21
|
+
The mapping is based on the keyboard layout of the creator’s laptop.
|
|
22
|
+
|
|
23
|
+
## 日本語
|
|
24
|
+
### 言語名
|
|
25
|
+
NoShift.js
|
|
26
|
+
|
|
27
|
+
### 張子
|
|
28
|
+
.nsjs
|
|
29
|
+
|
|
30
|
+
### 概略
|
|
31
|
+
記号を入力するときに Shift を押すのが面倒なので、Shift を押さずに JavaScript が書ける言語を作りました。
|
|
32
|
+
NoShift.js は JavaScript に変換されます。
|
|
33
|
+
|
|
34
|
+
この記号変換の基準は、作者のノートパソコンのキーボード配列です。
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
! --> ^1
|
|
38
|
+
" --> ^2
|
|
39
|
+
$ --> ^4
|
|
40
|
+
% --> ^5
|
|
41
|
+
& --> ^6
|
|
42
|
+
' --> ^7
|
|
43
|
+
( --> ^8
|
|
44
|
+
) --> ^9
|
|
45
|
+
= --> ^-
|
|
46
|
+
~ --> ^^
|
|
47
|
+
| --> ^\
|
|
48
|
+
` --> ^@
|
|
49
|
+
{ --> ^[
|
|
50
|
+
} --> ^]
|
|
51
|
+
+ --> ^;
|
|
52
|
+
* --> ^:
|
|
53
|
+
< --> ^,
|
|
54
|
+
> --> ^.
|
|
55
|
+
? --> ^/
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Escaping in strings
|
|
59
|
+
Examples:
|
|
60
|
+
```nsjs
|
|
61
|
+
^2^5^2 --> "^5"
|
|
62
|
+
^7^5^7 --> '^5'
|
|
63
|
+
^@^5^@ --> `^5`
|
|
64
|
+
```
|
|
65
|
+
Template literals (${} syntax)
|
|
66
|
+
|
|
67
|
+
```nsjs
|
|
68
|
+
^@^5^4^[^2Hello World!^2^]^@ --> `^5${"Hello World!"}`
|
|
69
|
+
```
|
|
70
|
+
Hello World!
|
|
71
|
+
Example:
|
|
72
|
+
|
|
73
|
+
```nsjs
|
|
74
|
+
console.log^8^2Hello World!^2^9;
|
|
75
|
+
Result:
|
|
76
|
+
```
|
|
77
|
+
```js
|
|
78
|
+
console.log("Hello World!");
|
|
79
|
+
```
|
package/commands/create.js
CHANGED
|
@@ -89,6 +89,16 @@ export default async function create(projectNameArg) {
|
|
|
89
89
|
console.log(t("initializingNpm"));
|
|
90
90
|
execSync("npm init -y", { stdio: "inherit" });
|
|
91
91
|
|
|
92
|
+
// package.json に scripts.dev / scripts.build を追加
|
|
93
|
+
const pkgPath = path.join(projectPath, "package.json");
|
|
94
|
+
const pkgRaw = await fs.readFile(pkgPath, "utf-8");
|
|
95
|
+
const pkg = JSON.parse(pkgRaw);
|
|
96
|
+
|
|
97
|
+
pkg.scripts.dev = "node ./node_modules/noshift.js/commands/dev.js";
|
|
98
|
+
pkg.scripts.build = "node ./node_modules/noshift.js/commands/build.js";
|
|
99
|
+
|
|
100
|
+
await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2));
|
|
101
|
+
|
|
92
102
|
// nsjs.config.js を作成
|
|
93
103
|
const configContent = `export default {
|
|
94
104
|
build: "", // 空なら ./build にビルドされます
|
|
@@ -129,8 +139,9 @@ export default async function create(projectNameArg) {
|
|
|
129
139
|
await fs.writeFile("src/index.nsjs", "console.log^8^2Hello World!^2^9;");
|
|
130
140
|
|
|
131
141
|
// README.md
|
|
132
|
-
const readme =
|
|
133
|
-
|
|
142
|
+
const readme =
|
|
143
|
+
lang === "ja"
|
|
144
|
+
? `# ${projectName}
|
|
134
145
|
|
|
135
146
|
これは [noshift.js](https://github.com/otoneko1102/NoShift.js) プロジェクトです。
|
|
136
147
|
|
|
@@ -146,7 +157,7 @@ npm run dev
|
|
|
146
157
|
npm run build
|
|
147
158
|
\`\`\`
|
|
148
159
|
`
|
|
149
|
-
|
|
160
|
+
: `# ${projectName}
|
|
150
161
|
|
|
151
162
|
This is a [NoShift.js](https://github.com/otoneko1102/NoShift.js) project.
|
|
152
163
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "noshift.js",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Joke language.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"nsjs": "./bin/cli.js"
|
|
@@ -10,11 +10,19 @@
|
|
|
10
10
|
"dev": "node commands/dev.js",
|
|
11
11
|
"build": "node commands/build.js"
|
|
12
12
|
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/otoneko1102/NoShift.js.git"
|
|
16
|
+
},
|
|
13
17
|
"keywords": [
|
|
14
|
-
"noshift"
|
|
18
|
+
"noshift", "nsjs", "joke"
|
|
15
19
|
],
|
|
16
20
|
"author": "otoneko.",
|
|
17
21
|
"license": "MIT",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/otoneko1102/NoShift.js/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://otoneko1102.github.io/NoShift.js/",
|
|
18
26
|
"dependencies": {
|
|
19
27
|
"commander": "^14.0.0",
|
|
20
28
|
"inquirer": "^12.6.3"
|