Skip to content

Commit 5b22ab7

Browse files
authored
Merge pull request #19 from mvc-works/vite
migrating to vite
2 parents b941e95 + a4dfce2 commit 5b22ab7

15 files changed

+527
-4503
lines changed

.github/workflows/npm-publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v2
12-
- uses: actions/setup-node@v1
12+
- uses: actions/setup-node@v2
1313
with:
1414
node-version: 12
1515
registry-url: https://registry.npmjs.org/

.github/workflows/upload.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- master
8+
- main
89

910
jobs:
1011
upload-assets:
@@ -13,7 +14,7 @@ jobs:
1314
- uses: actions/checkout@v2
1415

1516
- name: Use Node.js
16-
uses: actions/setup-node@v1
17+
uses: actions/setup-node@v2
1718

1819
- name: Get yarn cache
1920
id: yarn-cache

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
/dist/
33
/lib/
44
/node_modules/
5-
/index.html

src/main.css renamed to assets/main.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11

22
body {
33
margin: 0;
4-
padding: 0;
4+
}
5+
6+
body * {
7+
box-sizing: border-box;
58
}
69

710
textarea {

index.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
<!DOCTYPE html>
3+
<html>
4+
5+
<head>
6+
<title>TextareaEditor</title>
7+
<link href="https://cdn.tiye.me/logo/calcit.png" rel="icon" type="image/png" />
8+
<meta charset="utf-8">
9+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
10+
<link rel="stylesheet" type="text/css" href="https://cdn.tiye.me/favored-fonts/main-fonts.css">
11+
<link rel="stylesheet" type="text/css" href="./assets/main.css">
12+
</head>
13+
14+
<body>
15+
<div class="app" >
16+
<textarea id="paper" placeholder="start coding"></textarea>
17+
</div>
18+
19+
<script type="module" src="./lib/main.js" ></script>
20+
21+
</body>
22+
23+
</html>

package.json

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,28 @@
44
"description": "Web app scaffold based on Webpack",
55
"main": "lib/codearea.js",
66
"scripts": {
7-
"clean": "rm -rfv dist/*",
8-
"watch": "yarn html && webpack-dev-server --config webpack.dev.cirru",
9-
"release": "yarn clean && webpack --config webpack.release.cirru && yarn release-html",
10-
"html": "cirruscript template.cirru",
11-
"release-html": "env=release cirruscript template.cirru",
12-
"up": "yarn release && tiye-up",
13-
"compile": "coffee -o lib -bc src/",
14-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"watch": "coffee -bcw -o lib src/*",
8+
"compile": "coffee -bc -o lib src/*",
9+
"release": "yarn compile && vite build --base=./"
1510
},
1611
"author": "jiyinyiyong",
1712
"license": "MIT",
1813
"keywords": [
1914
"workflow"
2015
],
2116
"devDependencies": {
22-
"assets-webpack-plugin": "^3.9.12",
23-
"cirru-script": "0.6.2",
24-
"cirru-script-loader": "0.5.5",
25-
"coffee-loader": "^0.9.0",
2617
"coffeescript": "^2.5.1",
27-
"css-loader": "^3.5.3",
28-
"duplicate-package-checker-webpack-plugin": "^3.0.0",
29-
"file-loader": "^6.0.0",
30-
"hsl": "^0.1.1",
31-
"http-server": "^0.12.3",
32-
"json-loader": "^0.5.3",
33-
"stir-template": "^0.2.2",
34-
"style-loader": "^1.2.1",
35-
"url-loader": "^4.1.0",
36-
"webpack": "^4.43.0",
37-
"webpack-cli": "^3.3.11",
38-
"webpack-dev-server": "^3.11.0",
39-
"webpack-hud": "^0.1.2"
18+
"rollup-plugin-coffee-script": "^2.0.0",
19+
"vite": "^2.5.8",
20+
"vite-plugin-coffee": "^2.2.1"
4021
},
4122
"dependencies": {},
4223
"repository": {
4324
"type": "git",
44-
"url": "https://github.com/mvc-works/webpack-workflow.git"
25+
"url": "https://github.com/mvc-works/codearea.git"
4526
},
4627
"bugs": {
47-
"url": "https://github.com/mvc-works/webpack-workflow/issues"
28+
"url": "https://github.com/mvc-works/codearea/issues"
4829
},
49-
"homepage": "https://github.com/mvc-works/webpack-workflow"
30+
"homepage": "https://github.com/mvc-works/codearea"
5031
}

src/codearea.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ call_shortcut =
406406
'ctrl shift 38': (target) -> key_ctrl_shift_up target
407407
'ctrl shift 40': (target) -> key_ctrl_shift_down target
408408

409-
exports.codearea = (area) ->
409+
export codearea = (area) ->
410410
if not area?
411411
throw new Error "expected an element as area, but got undefined"
412412

@@ -431,7 +431,7 @@ exports.codearea = (area) ->
431431

432432
area.addEventListener 'keydown', handleEvents
433433

434-
exports.teardownCodearea = (area) ->
434+
export teardownCodearea = (area) ->
435435
if not area.__codearea__?
436436
console.warn area, 'is not a textarea'
437437
return

src/main.cirru

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/main.coffee

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
import "../assets/main.css"
3+
4+
console.log "loaded"
5+
import {codearea} from "./codearea"
6+
7+
get = (id) ->
8+
document.getElementById id
9+
10+
window.onload = () ->
11+
paper = get "paper"
12+
codearea paper
13+
paper.focus()
14+
15+
paper.oninput = (event) ->
16+
console.log "input", (JSON.stringify event.target.value)

template.cirru

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)