Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd74bcb1

Browse files
authored
Merge pull requestcoderoad#551 from coderoad/optimize-build
Optimize build
2 parents6ac8083 +a6cda20 commitd74bcb1

File tree

14 files changed

+5485
-17
lines changed

14 files changed

+5485
-17
lines changed

‎.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build
2+
dist
3+
node_modules

‎.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ package-lock.json
99
.npmrc
1010

1111
# output directory
12-
out
1312
build
13+
dist
1414
web-app/build/
1515
web-app/node_modules
1616

‎.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
"browserslist",
1717
"codeally",
1818
"coderoad",
19+
"esbuild",
1920
"flowtype",
21+
"fsevents",
22+
"outfile",
2023
"packagejson",
2124
"prismjs",
2225
"Traceback",

‎.vscodeignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
.gitignore
33

44
## VSCode
5-
.vscode/**
6-
.vscode-test/**
5+
.vscode
6+
.vscode-test
77
vsc-extension-quickstart.md
88

9-
## CI/CD
10-
.circleci
9+
## Modules
10+
node_modules/**
11+
!node_modules/fsevents/**
12+
!node_modules/jsdom/**
1113

1214
## TypeScript
1315
**/tsconfig.json

‎package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"coderoad",
3-
"version":"0.17.0",
3+
"version":"0.17.1",
44
"description":"Play interactive coding tutorials in your editor",
55
"keywords": [
66
"tutorial",
@@ -31,7 +31,10 @@
3131
"package":"./scripts/package.sh",
3232
"storybook":"yarn --cwd web-app storybook",
3333
"test":"jest",
34-
"watch":"tsc -watch -p ./"
34+
"esbuild-base":"esbuild ./src/extension.ts --bundle --outfile=build/extension.js --external:vscode --external:fsevents --external:jsdom --format=cjs --platform=node",
35+
"esbuild":"npm run esbuild-base -- --sourcemap",
36+
"esbuild-watch":"npm run esbuild-base -- --sourcemap --watch",
37+
"test-compile":"tsc -watch -p ./"
3538
},
3639
"dependencies": {
3740
"chokidar":"3.5.2",
@@ -56,6 +59,7 @@
5659
"@types/semver":"^7.3.9",
5760
"@typescript-eslint/eslint-plugin":"5.4.0",
5861
"@typescript-eslint/parser":"5.4.0",
62+
"esbuild":"0.14.0",
5963
"eslint-config-prettier":"8.3.0",
6064
"eslint-config-react-app":"6.0.0",
6165
"eslint-plugin-flowtype":"8.0.3",

‎scripts/build.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@ echo "Cleaning up previous build..."
88
rm -rf build
99

1010
# build extension
11-
echo"Compiling..."
12-
tsc -p ./
11+
echo"Bundling src..."
12+
npm run esbuild
1313

1414
# build web app
15+
echo"Building webapp..."
1516
cd web-app
1617
yarn build
1718
cd ..
1819

1920
# For Windows build: switch the next 2 lines
21+
echo"Bundling webapp..."
2022
if [["$OSTYPE"=="msys" ]];then
21-
echo"linux subsystem on windows selected"
23+
#linux subsystem on windows selected
2224
cp -R ./web-app/build/ ./
2325
else
24-
echo"Unix system selected"
26+
# unix
2527
cp -R ./web-app/build/. ./build/
2628
fi
2729

‎scripts/package.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ OUTPUT_FILE=coderoad-$PACKAGE_VERSION.vsix
1212
echo"Creating$OUTPUT_FILE..."
1313

1414
echo"Building..."
15-
GENERATE_SOURCEMAP=false# reduces output size by 5mb+
15+
exportGENERATE_SOURCEMAP=false# reduces output size by 5mb+
1616
yarn build
17+
npm run esbuild-base -- --minify
1718

1819
echo"Packaging Extension..."
1920
mkdir -p ./$RELEASES_FOLDER

‎src/services/node/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { WORKSPACE_ROOT } from '../../environment'
66

77
constasyncExec=promisify(cpExec)
88
constasyncRemoveFile=promisify(fs.unlink)
9-
constasyncReadFile=promisify(fs.readFile)
9+
exportconstasyncReadFile=promisify(fs.readFile)
1010
constasyncWriteFile=promisify(fs.writeFile)
1111

1212
interfaceExecParams{

‎src/services/webview/render.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import{JSDOM}from'jsdom'
22
import*aspathfrom'path'
33
import*asvscodefrom'vscode'
4+
import{asyncReadFile}from'../node'
45
import{onError}from'../telemetry'
56
import{CONTENT_SECURITY_POLICY_EXEMPTIONS}from'../../environment'
67

@@ -64,7 +65,18 @@ async function render(panel: vscode.WebviewPanel, rootPath: string): Promise<voi
6465
construnTimeScript=document.createElement('script')
6566
runTimeScript.nonce=getNonce()
6667
nonces.push(runTimeScript.nonce)
67-
constmanifest=awaitimport(path.join(rootPath,'asset-manifest.json'))
68+
69+
// note: file cannot be imported or results in esbuild error. Easier to read it.
70+
letmanifest
71+
try{
72+
constmanifestPath=path.join(rootPath,'asset-manifest.json')
73+
console.log(manifestPath)
74+
constmanifestFile=awaitasyncReadFile(manifestPath,'utf8')
75+
manifest=JSON.parse(manifestFile)
76+
}catch(e){
77+
thrownewError('Failed to read manifest file')
78+
}
79+
6880
runTimeScript.src=createUri(manifest.files['runtime-main.js'])
6981
document.body.appendChild(runTimeScript)
7082

‎tsconfig.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,15 @@
2626
"allowJs":true,
2727
"removeComments":true
2828
},
29-
"exclude": ["docs","node_modules",".vscode-test","build","resources","web-app","*.js","*.test.ts","scripts"]
29+
"exclude": [
30+
"docs",
31+
"node_modules",
32+
".vscode-test",
33+
"build",
34+
"resources",
35+
"web-app",
36+
"*.js",
37+
"*.test.ts",
38+
"scripts"
39+
]
3040
}

‎web-app/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SKIP_PREFLIGHT_CHECK=true
2-
VERSION=0.17.0
2+
VERSION=0.17.1
33
NODE_ENV=local
44
REACT_APP_DEBUG=false
55
REACT_APP_LOG=false

‎web-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"coderoad-app",
3-
"version":"0.17.0",
3+
"version":"0.17.1",
44
"private":true,
55
"scripts": {
66
"analyze":"source-map-explorer 'build/static/js/*.js'",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp