@variousjs/create 0.1.0 → 0.3.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/bin/copy.js +19 -29
- package/bin/create.js +17 -0
- package/demo/dist/card.js +1 -695
- package/demo/dist/card.js.map +1 -1
- package/demo/dist/entry.js +1 -1
- package/demo/dist/entry.js.map +1 -1
- package/demo/dist/next.js +1 -222
- package/demo/dist/next.js.map +1 -1
- package/demo/index.html +6 -18
- package/package.json +6 -8
- package/src/components/next.tsx +4 -5
- package/src/entry/container.tsx +2 -3
- package/{webpack.base.config.js → webpack/base.js} +8 -12
- package/{webpack.component.config.js → webpack/component.js} +1 -1
- package/{webpack.entry.config.js → webpack/entry.js} +1 -1
- package/.gitignore.copy +0 -3
- package/package-lock.json.copy +0 -6512
- package/package.json.copy +0 -41
package/demo/dist/next.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.js","mappings":"
|
|
1
|
+
{"version":3,"file":"next.js","mappings":"oHAAAA,EAAOC,QAAUC,G,gBCAjBF,EAAOC,QAAUE,G,gBCAjBH,EAAOC,QAAUG,ICCbC,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaP,QAGrB,IAAID,EAASK,EAAyBE,GAAY,CAGjDN,QAAS,IAOV,OAHAS,EAAoBH,GAAUP,EAAQA,EAAOC,QAASK,GAG/CN,EAAOC,QCpBfK,EAAoBK,EAAI,SAASX,GAChC,IAAIY,EAASZ,GAAUA,EAAOa,WAC7B,WAAa,OAAOb,EAAgB,SACpC,WAAa,OAAOA,GAErB,OADAM,EAAoBQ,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRN,EAAoBQ,EAAI,SAASb,EAASe,GACzC,IAAI,IAAIC,KAAOD,EACXV,EAAoBY,EAAEF,EAAYC,KAASX,EAAoBY,EAAEjB,EAASgB,IAC5EE,OAAOC,eAAenB,EAASgB,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EX,EAAoBY,EAAI,SAASK,EAAKC,GAAQ,OAAOL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,ICC/FlB,EAAoBsB,EAAI,SAAS3B,GACX,oBAAX4B,QAA0BA,OAAOC,aAC1CX,OAAOC,eAAenB,EAAS4B,OAAOC,YAAa,CAAEC,MAAO,WAE7DZ,OAAOC,eAAenB,EAAS,aAAc,CAAE8B,OAAO,K,qrCCGvD,MAKI,IAAIC,EAAAA,MAJNC,EADF,EACEA,YACAC,EAFF,EAEEA,QACAC,EAHF,EAGEA,SACAC,EAJF,EAIEA,SAGFH,EAAY,CAAEF,MAAO,I,UAEfM,EAAAA,SAAAA,I,muBAMJ,WACE,IAAQC,EAASC,KAAKC,MAAMC,OAApBH,KACAP,EAAUQ,KAAKC,MAAfT,MAER,OACE,kBAAC,EAAAW,aAAD,CACEC,MAAO,CAAEC,UAAW,IACpBC,UAAQ,EACRC,MAAM,iBACNC,KAAK,SAEL,kBAAC,EAAAL,aAAA,KAAD,CAAmBM,MAAM,SAASV,EAAKW,MACvC,kBAAC,EAAAP,aAAA,KAAD,CAAmBM,MAAM,SAASjB,S,mBAlBpCM,CAAUa,EAAAA,W,EAAVb,E,EAAAA,W,EAAAA,W,oCACc,WAAON,GAAP,sFACVoB,EAAQf,IACdD,EAAS,CAAEJ,MAAOA,EAAQoB,EAAMpB,QAAS,GAFzB,0C,kOADdM,G,6FAwBN,UAAeH,EAAQ,QAAvB,CAAgCG,G","sources":["webpack://@variousjs/create/external amd {\"root\":\"React\",\"amd\":\"react\"}","webpack://@variousjs/create/external amd {\"root\":\"antd\",\"amd\":\"antd\"}","webpack://@variousjs/create/external amd {\"root\":\"various\",\"amd\":\"@variousjs/various\"}","webpack://@variousjs/create/webpack/bootstrap","webpack://@variousjs/create/webpack/runtime/compat get default export","webpack://@variousjs/create/webpack/runtime/define property getters","webpack://@variousjs/create/webpack/runtime/hasOwnProperty shorthand","webpack://@variousjs/create/webpack/runtime/make namespace object","webpack://@variousjs/create/./src/components/next.tsx"],"sourcesContent":["module.exports = __WEBPACK_EXTERNAL_MODULE__161__;","module.exports = __WEBPACK_EXTERNAL_MODULE__937__;","module.exports = __WEBPACK_EXTERNAL_MODULE__437__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import React, { Component } from 'react'\nimport { ComponentProps, Store, Connect as CT } from '@variousjs/various'\nimport { Descriptions } from 'antd'\nimport { Store as GlobalStore } from '../types'\n\ntype S = { value: number }\ntype Connect = CT<S>\n\nconst {\n createStore,\n connect,\n dispatch,\n getStore,\n} = new Store<S>()\n\ncreateStore({ value: 0 })\n\nclass X extends Component<Connect & ComponentProps<GlobalStore>> {\n static setValue = async (value: number) => {\n const store = getStore()\n dispatch({ value: value + store.value }, true)\n }\n\n render() {\n const { user } = this.props.$store\n const { value } = this.props\n\n return (\n <Descriptions\n style={{ marginTop: 30 }}\n bordered\n title=\"Next Component\"\n size=\"small\"\n >\n <Descriptions.Item label=\"Store\">{user.name}</Descriptions.Item>\n <Descriptions.Item label=\"Value\">{value}</Descriptions.Item>\n </Descriptions>\n )\n }\n}\n\nexport default connect('value')(X)\n"],"names":["module","exports","__WEBPACK_EXTERNAL_MODULE__161__","__WEBPACK_EXTERNAL_MODULE__937__","__WEBPACK_EXTERNAL_MODULE__437__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","Store","createStore","connect","dispatch","getStore","X","user","this","props","$store","Descriptions","style","marginTop","bordered","title","size","label","name","Component","store"],"sourceRoot":""}
|
package/demo/index.html
CHANGED
|
@@ -4,13 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<title> VariousJS </title>
|
|
6
6
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/antd@4.16.13/dist/antd.compact.min.css" />
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<div id="root"></div>
|
|
10
|
-
<script src="https://cdn.jsdelivr.net/npm/requirejs@2.3.6/require.js"></script>
|
|
11
|
-
<script src="https://cdn.jsdelivr.net/npm/@variousjs/various/dist/index.js"></script>
|
|
12
7
|
<script>
|
|
13
|
-
var
|
|
8
|
+
var VARIOUS_CONFIG = {
|
|
14
9
|
root: '#root',
|
|
15
10
|
entry: './dist/entry.js',
|
|
16
11
|
routerMode: 'hash',
|
|
@@ -18,8 +13,6 @@ var config = {
|
|
|
18
13
|
// 内置依赖,如果不定义会默认使用 unpkg cdn 链接
|
|
19
14
|
react: 'https://cdn.jsdelivr.net/npm/react@17.0.2/umd/react.production.min.js',
|
|
20
15
|
'react-dom': 'https://cdn.jsdelivr.net/npm/react-dom@17.0.2/umd/react-dom.production.min.js',
|
|
21
|
-
'react-router-dom': 'https://cdn.jsdelivr.net/npm/react-router-dom@5.3.0/umd/react-router-dom.min.js',
|
|
22
|
-
nycticorax: 'https://cdn.jsdelivr.net/npm/nycticorax@2.0.6/dist/umd/index.js',
|
|
23
16
|
|
|
24
17
|
// 依赖定义
|
|
25
18
|
moment: 'https://cdn.jsdelivr.net/npm/moment@2.29.1/min/moment.min.js',
|
|
@@ -57,16 +50,11 @@ var config = {
|
|
|
57
50
|
},
|
|
58
51
|
],
|
|
59
52
|
}
|
|
60
|
-
|
|
61
|
-
var various = new window.Various(config)
|
|
62
|
-
|
|
63
|
-
various.onError = function(e) {
|
|
64
|
-
console.log(e)
|
|
65
|
-
document.write(e.message)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
various.start()
|
|
69
53
|
</script>
|
|
70
|
-
|
|
54
|
+
</head>
|
|
55
|
+
<body>
|
|
56
|
+
<div id="root"></div>
|
|
57
|
+
<script src="https://cdn.jsdelivr.net/npm/requirejs@2.3.6/require.js"></script>
|
|
58
|
+
<script src="https://cdn.jsdelivr.net/npm/@variousjs/various@0.4.0/dist/index.js"></script>
|
|
71
59
|
</body>
|
|
72
60
|
</html>
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@variousjs/create",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "VariousJS boilerplate",
|
|
5
5
|
"bin": "bin/create.js",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"lint": "eslint . --ext .ts,.tsx,.js",
|
|
11
|
-
"start": "webpack --progress --config webpack
|
|
12
|
-
"build": "webpack --progress --config webpack
|
|
13
|
-
"prepublishOnly": "
|
|
14
|
-
"postinstall": "COPY_ENV=init node bin/copy.js"
|
|
10
|
+
"lint": "tsc --noemit && eslint . --ext .ts,.tsx,.js",
|
|
11
|
+
"start": "webpack --progress --config ./webpack/component.js & webpack serve --config ./webpack/entry.js --progress",
|
|
12
|
+
"build": "webpack --progress --config ./webpack/base.js",
|
|
13
|
+
"prepublishOnly": "node bin/copy.js"
|
|
15
14
|
},
|
|
16
15
|
"repository": {
|
|
17
16
|
"type": "git",
|
|
@@ -37,7 +36,7 @@
|
|
|
37
36
|
"@types/react-router-dom": "^5.3.1",
|
|
38
37
|
"@typescript-eslint/eslint-plugin": "^4.31.2",
|
|
39
38
|
"@typescript-eslint/parser": "^4.31.2",
|
|
40
|
-
"@variousjs/various": "0.0
|
|
39
|
+
"@variousjs/various": "^0.4.0",
|
|
41
40
|
"babel-loader": "^8.2.2",
|
|
42
41
|
"css-loader": "^6.3.0",
|
|
43
42
|
"eslint": "^7.32.0",
|
|
@@ -48,7 +47,6 @@
|
|
|
48
47
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
49
48
|
"less": "^4.1.1",
|
|
50
49
|
"less-loader": "^10.0.1",
|
|
51
|
-
"nycticorax": "^2.0.6",
|
|
52
50
|
"style-loader": "^3.3.0",
|
|
53
51
|
"typescript": "^4.4.3",
|
|
54
52
|
"webpack": "^5.54.0",
|
package/src/components/next.tsx
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import React, { Component } from 'react'
|
|
2
|
-
import
|
|
3
|
-
import { ComponentProps } from '@variousjs/various'
|
|
2
|
+
import { ComponentProps, Store, Connect as CT } from '@variousjs/various'
|
|
4
3
|
import { Descriptions } from 'antd'
|
|
5
4
|
import { Store as GlobalStore } from '../types'
|
|
6
5
|
|
|
7
|
-
type
|
|
8
|
-
type Connect = CT<
|
|
6
|
+
type S = { value: number }
|
|
7
|
+
type Connect = CT<S>
|
|
9
8
|
|
|
10
9
|
const {
|
|
11
10
|
createStore,
|
|
12
11
|
connect,
|
|
13
12
|
dispatch,
|
|
14
13
|
getStore,
|
|
15
|
-
} = new
|
|
14
|
+
} = new Store<S>()
|
|
16
15
|
|
|
17
16
|
createStore({ value: 0 })
|
|
18
17
|
|
package/src/entry/container.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { Component, ComponentType } from 'react'
|
|
2
|
-
import { Route } from '
|
|
3
|
-
import { ContainerProps } from '@variousjs/various'
|
|
2
|
+
import { ContainerProps, Router, Route } from '@variousjs/various'
|
|
4
3
|
import { Radio, Badge, Button } from 'antd'
|
|
5
4
|
import { Store, Config } from '../types'
|
|
6
5
|
import csses from './entry.less'
|
|
@@ -20,7 +19,7 @@ class Container extends Component<ContainerProps<Store, Config>> {
|
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
render() {
|
|
23
|
-
const {
|
|
22
|
+
const { $component, $config, $store } = this.props
|
|
24
23
|
|
|
25
24
|
return (
|
|
26
25
|
<div className={csses.container}>
|
|
@@ -3,14 +3,14 @@ const path = require('path')
|
|
|
3
3
|
const config = {
|
|
4
4
|
stats: 'minimal',
|
|
5
5
|
entry: {
|
|
6
|
-
entry: path.join(__dirname, '
|
|
6
|
+
entry: path.join(__dirname, '../src/entry'),
|
|
7
7
|
|
|
8
8
|
// 组件入口定义
|
|
9
|
-
card: path.join(__dirname, '
|
|
10
|
-
next: path.join(__dirname, '
|
|
9
|
+
card: path.join(__dirname, '../src/components/card.tsx'),
|
|
10
|
+
next: path.join(__dirname, '../src/components/next.tsx'),
|
|
11
11
|
},
|
|
12
12
|
output: {
|
|
13
|
-
path: path.resolve(__dirname, '
|
|
13
|
+
path: path.resolve(__dirname, '../demo/dist'),
|
|
14
14
|
publicPath: '/dist/',
|
|
15
15
|
filename: '[name].js',
|
|
16
16
|
libraryTarget: 'amd',
|
|
@@ -26,13 +26,9 @@ const config = {
|
|
|
26
26
|
root: 'ReactDOM',
|
|
27
27
|
amd: 'react-dom',
|
|
28
28
|
},
|
|
29
|
-
'
|
|
30
|
-
root: '
|
|
31
|
-
amd: '
|
|
32
|
-
},
|
|
33
|
-
nycticorax: {
|
|
34
|
-
root: 'Nycticorax',
|
|
35
|
-
amd: 'nycticorax',
|
|
29
|
+
'@variousjs/various': {
|
|
30
|
+
root: 'various',
|
|
31
|
+
amd: '@variousjs/various',
|
|
36
32
|
},
|
|
37
33
|
|
|
38
34
|
// 自定义
|
|
@@ -53,7 +49,7 @@ const config = {
|
|
|
53
49
|
host: '0.0.0.0',
|
|
54
50
|
https: true,
|
|
55
51
|
static: {
|
|
56
|
-
directory: path.join(__dirname, '
|
|
52
|
+
directory: path.join(__dirname, '../demo'),
|
|
57
53
|
},
|
|
58
54
|
// 监听文件构建后重新刷新页面,包括 html 文件
|
|
59
55
|
watchFiles: ['demo'],
|
package/.gitignore.copy
DELETED