Skip to content

Commit 4186da8

Browse files
authored
Merge pull request #12864 from CesiumGS/sandcastle-v2
Merge Sandcastle v2
2 parents 3d23b9b + 55f21c9 commit 4186da8

File tree

1,292 files changed

+55317
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,292 files changed

+55317
-68
lines changed

.github/actions/verify-package/script.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ cp cesium*.tgz ../test
1515
cp Specs/test.*js ../test
1616
cd ../test
1717

18-
npm install cesium*.tgz
18+
npm install cesium-engine*.tgz
19+
npm install cesium-widgets*.tgz
20+
npm install cesium-1.*.tgz
1921
NODE_ENV=development node test.cjs
2022
NODE_ENV=production node test.cjs
21-
node test.mjs
23+
node test.mjs

.github/workflows/deploy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2323
GITHUB_REPO: ${{ github.repository }}
2424
GITHUB_SHA: ${{ github.sha }}
25+
BASE_URL: /cesium/${{ github.ref_name }}/
26+
DEPLOYED_URL: https://ci-builds.cesium.com/cesium/${{ github.ref_name }}/
2527
steps:
2628
- uses: actions/checkout@v5
2729
- name: install node 22
@@ -40,6 +42,8 @@ jobs:
4042
run: npm pack --workspaces &> /dev/null
4143
- name: build apps
4244
run: npm run build-apps
45+
- name: build sandcastle v2
46+
run: npm run build-ci -w packages/sandcastle -- -l warn
4347
- uses: ./.github/actions/verify-package
4448
- name: deploy to s3
4549
if: ${{ env.AWS_ACCESS_KEY_ID != '' }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: sandcastle-dev
2+
on:
3+
push:
4+
branches:
5+
- 'cesium.com'
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
env:
10+
PROD: true
11+
AWS_ACCESS_KEY_ID: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
12+
AWS_SECRET_ACCESS_KEY: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
13+
AWS_REGION: us-east-1
14+
BRANCH: ${{ github.ref_name }}
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
GITHUB_REPO: ${{ github.repository }}
17+
GITHUB_SHA: ${{ github.sha }}
18+
steps:
19+
- uses: actions/checkout@v5
20+
- name: install node 22
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '22'
24+
- name: npm install
25+
run: npm install
26+
- name: build website release
27+
run: npm run website-release
28+
- name: build types
29+
run: npm run build-ts
30+
- name: build prod sandcastle
31+
run: npm run build-prod -w packages/sandcastle -- -l warn
32+
- name: deploy to dev-sandcastle.cesium.com
33+
if: ${{ env.AWS_ACCESS_KEY_ID != '' }}
34+
run: |
35+
aws s3 sync Build/Sandcastle2/ s3://cesium-dev-sandcastle-website/ --cache-control "public, max-age=1800" --delete

.markdownlintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/node_modules
2+
packages/sandcastle/node_modules
23
/ThirdParty
34
/Tools/**
45

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
!**/*.html
1919
!**/*.md
2020
!**/*.ts
21+
!**/*.tsx
2122

2223
# Re-ignore a few things caught above
2324

@@ -33,6 +34,9 @@ packages/widgets/Build/**
3334
packages/widgets/index.js
3435
packages/widgets/Source/ThirdParty/**
3536

37+
packages/sandcastle/node_modules/**
38+
Apps/Sandcastle2/**
39+
3640
Specs/jasmine/**
3741

3842
Apps/Sandcastle/ThirdParty

Apps/Sandcastle/CesiumSandcastle.css

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ body {
4949
float: right;
5050
}
5151

52+
#banner {
53+
text-align: center;
54+
background: #daf6ff;
55+
56+
a {
57+
color: blue;
58+
}
59+
}
60+
5261
#codeContainer {
5362
width: 40%;
5463
}
@@ -186,25 +195,6 @@ a.linkButton:hover {
186195
overflow: auto !important;
187196
}
188197

189-
.feedback {
190-
width: 250px;
191-
192-
.future-banner {
193-
display: flex;
194-
justify-content: center;
195-
align-items: stretch;
196-
text-align: center;
197-
flex-direction: column;
198-
199-
h3 {
200-
margin: 0 1em;
201-
}
202-
p {
203-
margin: 1em 1.5em;
204-
}
205-
}
206-
}
207-
208198
.claro .dijitTabContainerTop-tabs .dijitTabChecked .dijitTabContent {
209199
background-position: 0 -103px;
210200
}

Apps/Sandcastle/index.html

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@
7676
data-dojo-type="dijit.layout.BorderContainer"
7777
data-dojo-props="design: 'headline', gutters: true, liveSplitters: true"
7878
>
79+
<div
80+
id="banner"
81+
data-dojo-type="dijit.layout.ContentPane"
82+
data-dojo-props="region: 'top'"
83+
>
84+
<a href="https://dev-sandcastle.cesium.com"
85+
>Try the new version of Sandcastle today!</a
86+
>
87+
</div>
7988
<div
8089
id="toolbar"
8190
data-dojo-type="dijit.Toolbar"
@@ -341,36 +350,8 @@
341350
</div>
342351
</div>
343352
</div>
344-
<div
345-
class="feedback"
346-
data-dojo-type="dijit.layout.TabContainer"
347-
data-dojo-props="region: 'right'"
348-
>
349-
<div
350-
class="future-banner"
351-
data-dojo-type="dijit.layout.ContentPane"
352-
data-dojo-props="title: 'Feedback'"
353-
>
354-
<h3>Help needed</h3>
355-
<p>
356-
We're currently gathering user feedback to make Sandcastle even
357-
better.
358-
</p>
359-
<button data-dojo-type="dijit/form/Button" type="button">
360-
Please share your thoughts!
361-
<script
362-
type="dojo/on"
363-
data-dojo-event="click"
364-
data-dojo-args="evt"
365-
>
366-
window.open("https://community.cesium.com/t/upgrading-sandcastle-we-need-your-input/39715/", "_blank")
367-
</script>
368-
</button>
369-
</div>
370-
</div>
371353
</div>
372354
</div>
373-
374355
<div class="dijitTooltip dijitTooltipBelow" id="docPopup">
375356
<div
376357
class="dijitTooltipContainer dijitTooltipContents"

eslint.config.js

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import globals from "globals";
22
import html from "eslint-plugin-html";
33
import configCesium from "@cesium/eslint-config";
4+
import reactHooks from "eslint-plugin-react-hooks";
5+
import reactRefresh from "eslint-plugin-react-refresh";
6+
import tseslint from "typescript-eslint";
47

58
export default [
69
{
@@ -15,6 +18,11 @@ export default [
1518
"Apps/HelloWorld.html",
1619
"Apps/Sandcastle/jsHintOptions.js",
1720
"Apps/Sandcastle/gallery/gallery-index.js",
21+
"Apps/Sandcastle2/",
22+
"packages/sandcastle/public/",
23+
"packages/sandcastle/templates/Sandcastle.d.ts",
24+
"packages/sandcastle/templates/Sandcastle.js",
25+
"packages/sandcastle/gallery/pagefind/",
1826
"packages/engine/Source/Scene/GltfPipeline/**/*",
1927
"packages/engine/Source/Shaders/**/*",
2028
"Specs/jasmine/*",
@@ -32,7 +40,13 @@ export default [
3240
...configCesium.configs.node,
3341
},
3442
{
35-
files: [".github/**/*.js", "scripts/**/*.js", "gulpfile.js", "server.js"],
43+
files: [
44+
".github/**/*.js",
45+
"scripts/**/*.js",
46+
"packages/sandcastle/scripts/**/*.js",
47+
"gulpfile.js",
48+
"server.js",
49+
],
3650
...configCesium.configs.node,
3751
languageOptions: {
3852
...configCesium.configs.node.languageOptions,
@@ -41,6 +55,7 @@ export default [
4155
},
4256
{
4357
files: ["packages/**/*.js", "Apps/**/*.js", "Specs/**/*.js", "**/*.html"],
58+
ignores: ["packages/sandcastle/scripts/**/*.js"],
4459
...configCesium.configs.browser,
4560
plugins: { html },
4661
rules: {
@@ -86,6 +101,48 @@ export default [
86101
sourceType: "module",
87102
},
88103
},
104+
...[...tseslint.configs.recommended].map((config) => ({
105+
// This is needed to restrict to a specific path unless using the tseslint.config function
106+
// https://typescript-eslint.io/packages/typescript-eslint#config
107+
...config,
108+
files: ["packages/sandcastle/**/*.{ts,tsx}"],
109+
})),
110+
{
111+
// This config came from the vite project generation
112+
files: ["packages/sandcastle/**/*.{ts,tsx}"],
113+
languageOptions: {
114+
ecmaVersion: 2020,
115+
globals: globals.browser,
116+
},
117+
plugins: {
118+
"react-hooks": reactHooks,
119+
"react-refresh": reactRefresh,
120+
},
121+
rules: {
122+
...reactHooks.configs.recommended.rules,
123+
"react-refresh/only-export-components": [
124+
"warn",
125+
{ allowConstantExport: true },
126+
],
127+
},
128+
},
129+
{
130+
files: ["packages/sandcastle/gallery/**/*.js"],
131+
languageOptions: {
132+
ecmaVersion: 2022,
133+
sourceType: "module",
134+
},
135+
rules: {
136+
"no-alert": "off",
137+
},
138+
},
139+
{
140+
files: ["packages/sandcastle/gallery/hello-world/main.js"],
141+
rules: {
142+
// ignore this rule here to avoid the excessive eslint-disable comment in our bare minimum example
143+
"no-unused-vars": "off",
144+
},
145+
},
89146
{
90147
files: ["Specs/**/*", "packages/**/Specs/**/*"],
91148
languageOptions: {

gulpfile.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,18 @@ if (/\.0$/.test(version)) {
4343
version = version.substring(0, version.length - 2);
4444
}
4545
const karmaConfigFile = resolve("./Specs/karma.conf.cjs");
46+
function getWorkspaces(onlyDependencies = false) {
47+
const dependencies = Object.keys(packageJson.dependencies);
48+
return onlyDependencies
49+
? packageJson.workspaces.filter((workspace) => {
50+
return dependencies.includes(
51+
workspace.replace("packages", `@${scope}`),
52+
);
53+
})
54+
: packageJson.workspaces;
55+
}
4656

47-
const devDeployUrl = "https://ci-builds.cesium.com/cesium/";
57+
const devDeployUrl = process.env.DEPLOYED_URL;
4858
const isProduction = process.env.PROD;
4959

5060
//Gulp doesn't seem to have a way to get the currently running tasks for setting
@@ -247,7 +257,7 @@ export async function buildTs() {
247257
} else if (argv.workspace) {
248258
workspaces = argv.workspace;
249259
} else {
250-
workspaces = packageJson.workspaces;
260+
workspaces = getWorkspaces(true);
251261
}
252262

253263
// Generate types for passed packages in order.
@@ -400,7 +410,7 @@ export async function buildDocs() {
400410
stdio: "inherit",
401411
env: Object.assign({}, process.env, {
402412
CESIUM_VERSION: version,
403-
CESIUM_PACKAGES: packageJson.workspaces,
413+
CESIUM_PACKAGES: getWorkspaces(true),
404414
}),
405415
},
406416
);
@@ -698,12 +708,10 @@ export async function deployStatus() {
698708
const status = argv.status;
699709
const message = argv.message;
700710

701-
const deployUrl = `${devDeployUrl + process.env.BRANCH}/`;
711+
const deployUrl = `${devDeployUrl}`;
702712
const zipUrl = `${deployUrl}Cesium-${version}.zip`;
703713
const npmUrl = `${deployUrl}cesium-${version}.tgz`;
704-
const coverageUrl = `${
705-
devDeployUrl + process.env.BRANCH
706-
}/Build/Coverage/index.html`;
714+
const coverageUrl = `${devDeployUrl}Build/Coverage/index.html`;
707715

708716
return Promise.all([
709717
setStatus(status, deployUrl, message, "deployment"),
@@ -1490,8 +1498,8 @@ async function getLicenseDataFromThirdPartyExtra(path, discoveredDependencies) {
14901498
return result;
14911499
}
14921500

1493-
// Resursively check the workspaces
1494-
for (const workspace of packageJson.workspaces) {
1501+
// Recursively check the workspaces
1502+
for (const workspace of getWorkspaces(true)) {
14951503
const workspacePackageJson = require(`./${workspace}/package.json`);
14961504
result = await getLicenseDataFromPackage(
14971505
workspacePackageJson,

index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@
3333
</li>
3434
<li>
3535
<a href="Apps/Sandcastle/index.html">Sandcastle</a>
36-
(<a href="Build/Apps/Sandcastle/index.html">built version</a>)
36+
<ul>
37+
<li>
38+
<a href="Build/Apps/Sandcastle/index.html">Built Sandcastle</a>
39+
</li>
40+
<li><a href="Apps/Sandcastle2/index.html">Sandcastle v2</a></li>
41+
</ul>
3742
</li>
3843
<li>
3944
<a href="Apps/CesiumViewer/index.html?inspector=true"

0 commit comments

Comments
 (0)