-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.sh
51 lines (48 loc) · 2.94 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
LF=$(printf '\\\012_')
LF=${LF%_}
EXTENSION_NAME='PaSoRich 2.0'
EXTENSION_ID=pasorich
COLLABORATOR=con3office
EXTENSION_DESCRIPTION="Read SmartCard IDm."
mkdir -p node_modules/scratch-vm/src/extensions/scratch3_${EXTENSION_ID}
cp ${EXTENSION_ID}/scratch-vm/src/extensions/scratch3_${EXTENSION_ID}/index.js node_modules/scratch-vm/src/extensions/scratch3_${EXTENSION_ID}/
mv node_modules/scratch-vm/src/extension-support/extension-manager.js node_modules/scratch-vm/src/extension-support/extension-manager.js_orig
sed -e "s|class ExtensionManager {$|builtinExtensions['${EXTENSION_ID}'] = () => require('../extensions/scratch3_${EXTENSION_ID}');${LF}${LF}class ExtensionManager {|g" node_modules/scratch-vm/src/extension-support/extension-manager.js_orig > node_modules/scratch-vm/src/extension-support/extension-manager.js
mkdir -p src/lib/libraries/extensions/${EXTENSION_ID}
cp ${EXTENSION_ID}/scratch-gui/src/lib/libraries/extensions/${EXTENSION_ID}/${EXTENSION_ID}_entry.png src/lib/libraries/extensions/${EXTENSION_ID}/
cp ${EXTENSION_ID}/scratch-gui/src/lib/libraries/extensions/${EXTENSION_ID}/${EXTENSION_ID}_inset.png src/lib/libraries/extensions/${EXTENSION_ID}/
mv src/lib/libraries/extensions/index.jsx src/lib/libraries/extensions/index.jsx_orig
DESCRIPTION="\
{${LF}\
name: (${LF}\
<FormattedMessage${LF}\
defaultMessage='${EXTENSION_NAME}'${LF}\
description='Name of the extension'${LF}\
id='gui.extension.${EXTENSION_ID}blocks.name'${LF}\
/>${LF}\
),${LF}\
extensionId: '${EXTENSION_ID}',${LF}\
collaborator: '${COLLABORATOR}',${LF}\
iconURL: ${EXTENSION_ID}IconURL,${LF}\
insetIconURL: ${EXTENSION_ID}InsetIconURL,${LF}\
description: (${LF}\
<FormattedMessage${LF}\
defaultMessage='${EXTENSION_DESCRIPTION}'${LF}\
description='Description of the extension'${LF}\
id='gui.extension.${EXTENSION_ID}blocks.description'${LF}\
/>${LF}\
),${LF}\
featured: true,${LF}\
translationMap: {${LF}\
'ja': {${LF}\
'gui.extension.${EXTENSION_ID}blocks.name': 'パソリッチ 2.0',${LF}\
'gui.extension.${EXTENSION_ID}blocks.description': 'ICカードのIDmを読み取る。'${LF}\
},${LF}\
'ja-Hira': {${LF}\
'gui.extension.${EXTENSION_ID}blocks.name': 'ぱそりっち 2.0',${LF}\
'gui.extension.${EXTENSION_ID}blocks.description': 'ICかーどのばんごうをよみとる。'${LF}\
}${LF}\
}${LF}\
},"
sed -e "s|^export default \[$|import ${EXTENSION_ID}IconURL from './${EXTENSION_ID}/${EXTENSION_ID}_entry.png';${LF}import ${EXTENSION_ID}InsetIconURL from './${EXTENSION_ID}/${EXTENSION_ID}_inset.png';${LF}${LF}export default [${LF}${DESCRIPTION}|g" src/lib/libraries/extensions/index.jsx_orig > src/lib/libraries/extensions/index.jsx