forked from baidu/amis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
18,062 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module.exports = { | ||
entry: { | ||
dir: './src' | ||
}, | ||
file: { | ||
test: /.*(ts|tsx|js|jsx)$/ | ||
}, | ||
includes: ['src/renderers'], | ||
importInfo: { | ||
source: 'i18n-runtime', | ||
imported: 'i18n', | ||
local: '_i18n' | ||
}, | ||
i18nModule: 'i18n-runtime', | ||
languages: [ | ||
{ | ||
name: 'en-US', | ||
path: './src/locale' | ||
}, | ||
{ | ||
name: 'zh-CN', | ||
path: './src/locale' | ||
} | ||
], | ||
output: { | ||
fileName: 'theme-editor-i18n', | ||
fileExtension: 'xlsx', | ||
path: './' | ||
}, | ||
translate: { | ||
appId: '', | ||
key: '', | ||
host: 'http://api.fanyi.baidu.com' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"name": "amis-theme-editor-helper", | ||
"version": "2.0.22-beta.9", | ||
"description": "amis主题编辑器通用方法", | ||
"main": "lib/index.js", | ||
"module": "esm/index.js", | ||
"types": "lib/index.d.ts", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "npm run clean-dist && NODE_ENV=production rollup -c ", | ||
"clean-dist": "rimraf lib/** esm/**", | ||
"i18n:update": "npx i18n update --config=./i18nConfig.js", | ||
"i18n:translate": "npx i18n translate --config=./i18nConfig.js --l=en-US", | ||
"i18n:merge": "npx i18n merge --config=./i18nConfig.js --l=en-US" | ||
}, | ||
"keywords": [ | ||
"amis", | ||
"theme-editor-helper" | ||
], | ||
"author": "@fex", | ||
"license": "ISC", | ||
"files": [ | ||
"lib", | ||
"esm" | ||
], | ||
"lint-staged": { | ||
"{src,scss,examples}/**/**/*.{js,jsx,ts,tsx,scss,json}": [ | ||
"prettier --write" | ||
] | ||
}, | ||
"dependencies": { | ||
"react": "^18.2.0", | ||
"react-color": "^2.19.3", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-url": "^7.0.0", | ||
"@svgr/rollup": "^6.4.0", | ||
"@types/async": "^2.0.45", | ||
"@types/classnames": "^2.2.3", | ||
"@types/codemirror": "^5.60.5", | ||
"@types/deep-diff": "^1.0.0", | ||
"@types/history": "^4.6.0", | ||
"@types/hoist-non-react-statics": "^3.0.1", | ||
"@types/lodash": "^4.14.76", | ||
"@types/node": "^14.0.24", | ||
"@types/react": "^18.0.24", | ||
"@types/react-dom": "^18.0.8", | ||
"@rollup/plugin-commonjs": "^22.0.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
"@rollup/plugin-typescript": "^8.3.2", | ||
"rollup": "^2.73.0", | ||
"rollup-plugin-auto-external": "^2.0.0", | ||
"rollup-plugin-license": "^2.7.0", | ||
"@types/react-color": "^3.0.6", | ||
"tslib": "^2.3.1", | ||
"typescript": "^4.6.4", | ||
"sass": "^1.49.7", | ||
"sass-loader": "^12.5.0", | ||
"style-loader": "^3.2.1" | ||
}, | ||
"peerDependencies": { | ||
"amis": "*", | ||
"amis-core": "*", | ||
"amis-ui": "*", | ||
"i18n-runtime": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
// rollup.config.js | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import json from '@rollup/plugin-json'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
import license from 'rollup-plugin-license'; | ||
import autoExternal from 'rollup-plugin-auto-external'; | ||
import postcss from 'rollup-plugin-postcss'; | ||
import { | ||
name, | ||
version, | ||
author, | ||
main, | ||
module, | ||
dependencies | ||
} from './package.json'; | ||
import path from 'path'; | ||
import svgr from '@svgr/rollup'; | ||
import fs from 'fs'; | ||
import i18nPlugin from 'plugin-react-i18n'; | ||
|
||
const i18nConfig = require('./i18nConfig'); | ||
|
||
const settings = { | ||
globals: {} | ||
}; | ||
|
||
const external = id => | ||
new RegExp( | ||
`^(?:${Object.keys(dependencies ?? {}) | ||
.concat(fs.readdirSync(path.join(__dirname, '../../node_modules'))) | ||
.map(value => | ||
value.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d') | ||
) | ||
.join('|')})` | ||
).test(id); | ||
const input = ['./src/index.ts']; | ||
|
||
export default [ | ||
{ | ||
input, | ||
|
||
output: [ | ||
{ | ||
...settings, | ||
dir: path.dirname(main), | ||
format: 'cjs', | ||
exports: 'named', | ||
preserveModulesRoot: './src', | ||
preserveModules: true // Keep directory structure and files | ||
} | ||
], | ||
external, | ||
plugins: getPlugins('cjs') | ||
}, | ||
{ | ||
input, | ||
|
||
output: [ | ||
{ | ||
...settings, | ||
dir: path.dirname(module), | ||
format: 'esm', | ||
exports: 'named', | ||
preserveModulesRoot: './src', | ||
preserveModules: true // Keep directory structure and files | ||
} | ||
], | ||
external, | ||
plugins: getPlugins('esm') | ||
} | ||
]; | ||
|
||
function transpileDynamicImportForCJS(options) { | ||
return { | ||
name: 'transpile-dynamic-import-for-cjs', | ||
renderDynamicImport({format, targetModuleId}) { | ||
if (format !== 'cjs') { | ||
return null; | ||
} | ||
|
||
return { | ||
left: 'Promise.resolve().then(function() {return new Promise(function(fullfill) {require([', | ||
right: | ||
'], function(mod) {fullfill(require("tslib").__importStar(mod))})})})' | ||
}; | ||
|
||
// return { | ||
// left: 'Promise.resolve().then(function() {return new Promise(function(fullfill) {require.ensure([', | ||
// right: | ||
// '], function(r) {fullfill(_interopDefaultLegacy(r("' + | ||
// targetModuleId + | ||
// '")))})})})' | ||
// }; | ||
} | ||
}; | ||
} | ||
|
||
function getPlugins(format = 'esm') { | ||
const typeScriptOptions = { | ||
typescript: require('typescript'), | ||
sourceMap: false, | ||
outputToFilesystem: true, | ||
...(format === 'esm' | ||
? { | ||
compilerOptions: { | ||
rootDir: './src', | ||
outDir: path.dirname(module) | ||
} | ||
} | ||
: { | ||
compilerOptions: { | ||
rootDir: './src', | ||
outDir: path.dirname(main) | ||
} | ||
}) | ||
}; | ||
|
||
return [ | ||
i18nPlugin(i18nConfig), | ||
typescript(typeScriptOptions), | ||
svgr({ | ||
svgProps: { | ||
className: 'icon' | ||
}, | ||
prettier: false, | ||
dimensions: false | ||
}), | ||
transpileDynamicImportForCJS(), | ||
autoExternal(), | ||
json(), | ||
postcss({ | ||
minimize: true | ||
}), | ||
resolve({ | ||
jsnext: true, | ||
main: true | ||
}), | ||
commonjs({ | ||
sourceMap: false | ||
}), | ||
license({ | ||
banner: ` | ||
${name} v${version} | ||
Copyright 2018<%= moment().format('YYYY') > 2018 ? '-' + moment().format('YYYY') : null %> ${author} | ||
` | ||
}) | ||
]; | ||
} |
Oops, something went wrong.