Skip to content

Commit d0a15a2

Browse files
authored
Merge pull request #241 from antfu/chore/npm
Distribute npm packages
2 parents 5ab8fe0 + e12545e commit d0a15a2

File tree

7 files changed

+359
-14
lines changed

7 files changed

+359
-14
lines changed

.github/workflows/publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v1
12+
- uses: actions/setup-node@v1
13+
with:
14+
node-version: 10
15+
- run: npm ci
16+
- run: npm test
17+
- run: npm run build
18+
19+
publish-npm:
20+
needs: build
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v1
24+
- uses: actions/setup-node@v1
25+
with:
26+
node-version: 10
27+
registry-url: https://registry.npmjs.org/
28+
- run: npm install
29+
- run: npm publish
30+
env:
31+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
File renamed without changes.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ node_modules/
44
build/wenyan-linux
55
build/wenyan-macos
66
build/wenyan-win.exe
7-
temp
7+
temp
8+
dist

README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ More sophisticated examples, such as the Sieve of Eratosthenes, Quicksort, Mande
6262

6363
### The Compiler
6464

65-
Clone the repo, (OR simply download `./build/wenyan.js` and set its executable bit using the terminal command `chmod +x wenyan.js`). Then run `./build/wenyan.js` to compile your wenyan souce code to target language. Calling the compiler without arguments prints the help message, reproduced below:
65+
```bash
66+
npm install -g wenyan-lang
67+
```
68+
69+
Calling the compiler without arguments prints the help message, reproduced below:
6670

6771
```
6872
Usage: wenyan [options] [input files]
@@ -76,21 +80,13 @@ Options:
7680
--output -o <string> : Output file (default: `/dev/stdout')
7781
--roman -r <boolean> : Romanize identifiers (default: `true')
7882
```
83+
7984
Try building the included examples first, e.g.:
8085

8186
```
82-
./build/wenyan.js examples/helloworld.wy -o helloworld.js
87+
wenyan examples/helloworld.wy -o helloworld.js
8388
```
8489

85-
#### Building platform-specific binaries
86-
87-
- Clone the repo
88-
- `npm install`
89-
- `npm run make_cmdline`
90-
91-
The macOS, Windows and Linux binaries will be in the `./build` folder.
92-
93-
9490
### [The online IDE](http://wenyan-lang.lingdong.works/ide.html)
9591

9692
![](screenshots/screenshot02.png)

package.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
{
22
"name": "wenyan-lang",
3+
"version": "0.0.1",
4+
"author": "LingDong<[email protected]>",
35
"repository": {
46
"type": "git",
57
"url": "https://github.com/LingDong-/wenyan-lang.git"
68
},
9+
"license": "MIT",
10+
"bin": {
11+
"wenyan": "./dist/cli.js"
12+
},
13+
"main": "./dist/core.js",
14+
"files": [
15+
"dist"
16+
],
717
"scripts": {
18+
"build": "npm run clear && webpack --mode production && chmod -x ./dist/cli.js",
19+
"dev": "npm run clear && webpack --mode development --watch",
20+
"clear": "rimraf ./dist",
21+
"release": "bump --commit --tag && git push --follow-tags",
822
"make_cmdline": "node ./tools/make_cmdline.js && pkg ./build/wenyan.js --out-path ./build",
923
"make_ide": "node ./tools/make_ide.js",
1024
"make_site": "node ./tools/make_site.js",
@@ -26,7 +40,6 @@
2640
"git add"
2741
]
2842
},
29-
"license": "MIT",
3043
"devDependencies": {
3144
"chai": "^4.2.0",
3245
"enzyme": "^3.10.0",
@@ -40,6 +53,11 @@
4053
"mocha": "^6.2.2",
4154
"mocha-snapshots": "^4.2.0",
4255
"pkg": "^4.4.2",
43-
"prettier": "^1.19.1"
56+
"prettier": "^1.19.1",
57+
"rimraf": "^3.0.0",
58+
"version-bump-prompt": "^5.0.6",
59+
"webpack": "^4.41.4",
60+
"webpack-cli": "^3.3.10",
61+
"webpack-shell-plugin": "^0.5.0"
4462
}
4563
}

0 commit comments

Comments
 (0)