Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subpackages #21

Merged
merged 6 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}]
],
"plugins": [
["module-resolver", { "root": ["./src"] } ],
["module-resolver", { "root": ["./packages/Main/src"] } ],
["babel-plugin-inline-import", {
"extensions": [
".json",
Expand Down
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
examples/libs/
examples/layers/
src/ThreeExtended/
packages/Main/src/ThreeExtended/
test/hooks.js
dist/
node_modules/
Expand Down
4 changes: 3 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('path');

module.exports = {
root: true,
extends: [
Expand All @@ -14,7 +16,7 @@ module.exports = {
settings: {
'import/resolver': {
webpack: {
config: './webpack.config.cjs',
config: path.resolve(__dirname, './webpack.config.cjs'),
},
},
},
Expand Down
70 changes: 53 additions & 17 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@ on:
- master
workflow_dispatch: {}


jobs:

test-repo:
name: test repo name ++
if: ${{ github.repository_owner == 'gchoqueux' }}
runs-on: ubuntu-latest
steps:
# Use specific Node.js version
- uses: actions/checkout@v3
- name: name repo
run: echo 'gchoqueux repository'

# Build bundle, doc and check linter
build:
name: Build bundle, check Linter and generate documentation
runs-on: ubuntu-latest
needs: test-repo
steps:

# Use specific Node.js version
Expand Down Expand Up @@ -55,7 +65,7 @@ jobs:
with:
name: dist-itowns
path: |
dist/**/*.js
packages/Main/dist/**/*.js
examples
buildDocs

Expand All @@ -79,8 +89,15 @@ jobs:
# Unit and coverage tests
unit-and-coverage-tests:
name: Unit and coverage tests
needs: build
needs: [build, check-commit-message]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- package: "@itowns_gc/geodesy"
path: "Geodesy"
- package: "itowns_gc"
path: "Main"
steps:

# Use specific Node.js version
Expand All @@ -95,21 +112,39 @@ jobs:
- name: Install packages
run: npm ci

- name: Run unit tests
run: npm run test-with-coverage_lcov
# Transpile
- name: transpile packages
run: npm run transpile

# Code coverage
- name: Coveralls
if: ${{ success() }}
uses: coverallsapp/github-action@master
- name: Test ${{ matrix.package }}
run: npm run test-with-coverage_lcov --workspace ${{ matrix.package}}
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
format: lcov
base-path: ./packages/${{ matrix.path }}
path-to-lcov: ./packages/${{ matrix.path }}/coverage/lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.package }}
parallel: true

# Final Code coverage
finish-coverage:
name: finish parallel test unit
needs: unit-and-coverage-tests
runs-on: ubuntu-latest
steps:
- name: Close parallel build
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
github-token: ${{ secrets.GITHUB_TOKEN }}


# Functional tests
functional-tests:
name: Functional tests
needs: build
needs: [build, check-commit-message]
runs-on: ubuntu-latest
steps:

Expand Down Expand Up @@ -139,7 +174,7 @@ jobs:
publish:
name: Publish NPM package
if: ${{ github.ref == 'refs/heads/master' }}
needs: [unit-and-coverage-tests, functional-tests, check-commit-message]
needs: [finish-coverage, functional-tests]
runs-on: ubuntu-latest
permissions:
# id-token: write permission is required for npm provenance:
Expand Down Expand Up @@ -183,9 +218,10 @@ jobs:

- name: publish itowns@next npm package
if: ${{ !startsWith(github.event.head_commit.message, 'release v' ) }}
# replace origin/master by origin
run: |
git checkout next
git merge master
git merge origin/master
npm run publish-next
git push
env:
Expand All @@ -196,7 +232,7 @@ jobs:
deploy:
name: Deploy to itowns.github.io
if: ${{ github.ref == 'refs/heads/master' }}
needs: [unit-and-coverage-tests, functional-tests, check-commit-message]
needs: [unit-and-coverage-tests, functional-tests]
runs-on: ubuntu-latest
steps:

Expand All @@ -212,7 +248,7 @@ jobs:
mkdir -p itowns/dist
mkdir -p itowns/potree/build
mkdir -p itowns/potree/libs
cp -R dist/*.js itowns/dist/
cp -R packages/Main/dist/*.js itowns/dist
cp -R examples itowns/
cp -R buildDocs itowns/docs

Expand All @@ -231,7 +267,7 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: iTowns/itowns.github.io
external_repository: gchoqueux/itowns.github.io
publish_dir: ./itowns
destination_dir: ./itowns
publish_branch: master
Expand All @@ -246,7 +282,7 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: iTowns/itowns.github.io
external_repository: gchoqueux/itowns.github.io
publish_dir: ./itowns
destination_dir: ./itowns/dev
publish_branch: master
Expand All @@ -257,7 +293,7 @@ jobs:
release:
name: Release GitHub
if: ${{ github.ref == 'refs/heads/master' && startsWith( github.event.head_commit.message, 'release v' ) }}
needs: [unit-and-coverage-tests, functional-tests, check-commit-message]
needs: [unit-and-coverage-tests, functional-tests]
runs-on: ubuntu-latest
steps:

Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# See https://help.github.com/articles/ignoring-files/ for how to configure your environment.
# See https://github.com/github/gitignore/tree/master/Global for a list of global ignore rules.

/node_modules/
/dist/
**/node_modules/
**/dist/
/potree/
potree
/lib/
**/lib/
/docs/out/
coverage
**/coverage
.nyc_output/
/src/ThreeExtended/
**/src/ThreeExtended/
14 changes: 12 additions & 2 deletions Gruntfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ module.exports = (grunt) => {
pkg: grunt.file.readJSON('package.json'),
bump: {
options: {
files: ['package.json', 'package-lock.json', 'src/Main.js'],
files: ['package.json', 'package-lock.json', 'packages/Main/src/Main.js',
// 'packages/**/package.json'
'packages/Main/package.json',
'packages/Geodesy/package.json',
'packages/Gui/package.json',
],
updateConfigs: [],
commit: true,
commitMessage: 'release v%VERSION%',
commitFiles: ['package.json', 'package-lock.json', 'src/Main.js'],
commitFiles: ['package.json', 'package-lock.json',
// 'packages/**/package.json'
'packages/Main/package.json',
'packages/Geodesy/package.json',
'packages/Gui/package.json',
],
createTag: false,
tagName: 'v%VERSION%',
tagMessage: 'Release %VERSION%.',
Expand Down
12 changes: 12 additions & 0 deletions config/concurrently.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import concurrently from 'concurrently';

import fs from 'fs';

const pck = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const script = process.argv[2];

concurrently(pck.workspaces.map(workspace => ({
command: `npm run ${script} -w ${workspace} --if-present`,
name: `${workspace}`,
})));

12 changes: 0 additions & 12 deletions config/prepare.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import chalk from 'chalk';
import copyfiles from 'copyfiles';
// const chalk = require('chalk');
import { execSync } from 'child_process';
import threeExamples from './threeExamples.mjs';



Expand Down Expand Up @@ -33,12 +30,3 @@ const npmVersion = execSync('npm --version', {
if (npmVersion) {
console.log(chalk.green('Npm version :', npmVersion), '\n');
}



// Copy and patch THREE Examples Files
const paths = threeExamples.filesExamples.map(f => f.replace('./', './node_modules/three/examples/jsm/'));

paths.push(threeExamples.patchedPath);

copyfiles(paths, { up: 4 }, () => {});
5 changes: 3 additions & 2 deletions docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,9 @@
}
},
"source": {
"include": [ "src", "examples/js/plugins" ],
"exclude": [ "src/ThreeExtended" ]
"include": [ "examples/js/plugins", "packages" ],
"exclude": [ "src/ThreeExtended" ],
"excludePattern": "(^|\\/|\\\\)lib"
},
"plugins": ["plugins/markdown"]
}
4 changes: 2 additions & 2 deletions examples/3dtiles_25d.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</head>
<body>
<div id="viewerDiv" class="viewer"></div>
<script src="../dist/itowns.js"></script>
<script src="../packages/Main/dist/itowns.js"></script>
<script src="js/GUI/LoadingScreen.js"></script>
<script src="../dist/debug.js"></script>
<script src="../packages/Main/dist/debug.js"></script>
<script src="js/GUI/GuiTools.js"></script>
<script src="js/3dTilesHelper.js"></script>
<script type="text/javascript">
Expand Down
4 changes: 2 additions & 2 deletions examples/3dtiles_basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<div id="featureInfo"></div>
</div>
<script src="js/GUI/GuiTools.js"></script>
<script src="../dist/itowns.js"></script>
<script src="../packages/Main/dist/itowns.js"></script>
<script src="js/GUI/LoadingScreen.js"></script>
<script src="../dist/debug.js"></script>
<script src="../packages/Main/dist/debug.js"></script>
<script src="js/3dTilesHelper.js"></script>
<script type="text/javascript">
/* global itowns,document,GuiTools*/
Expand Down
4 changes: 2 additions & 2 deletions examples/3dtiles_batch_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<div id="featureInfo"></div>
</div>
<script src="js/GUI/GuiTools.js"></script>
<script src="../dist/itowns.js"></script>
<script src="../packages/Main/dist/itowns.js"></script>
<script src="js/GUI/LoadingScreen.js"></script>
<script src="../dist/debug.js"></script>
<script src="../packages/Main/dist/debug.js"></script>
<script src="js/3dTilesHelper.js"></script>
<script type="text/javascript">
// Note: The following positions and camera parameters have been
Expand Down
2 changes: 1 addition & 1 deletion examples/3dtiles_ion.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div id="viewerDiv"></div>

<!-- Import iTowns source code -->
<script src="../dist/itowns.js"></script>
<script src="../packages/Main/dist/itowns.js"></script>
<!-- Import iTowns LoadingScreen plugin -->
<script src="js/GUI/LoadingScreen.js"></script>

Expand Down
4 changes: 2 additions & 2 deletions examples/3dtiles_pointcloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
</div>
<div id="viewerDiv"></div>
<script src="js/GUI/GuiTools.js"></script>
<script src="../dist/itowns.js"></script>
<script src="../packages/Main/dist/itowns.js"></script>
<script src="js/GUI/LoadingScreen.js"></script>
<script src="../dist/debug.js"></script>
<script src="../packages/Main/dist/debug.js"></script>
<script src="js/3dTilesHelper.js"></script>
<script type="text/javascript">
/* global itowns,document,GuiTools*/
Expand Down
4 changes: 2 additions & 2 deletions examples/customColorLayerEffect.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<body>
<div id="viewerDiv"></div>
<div id="miniDiv"></div>
<script src="../dist/itowns.js"></script>
<script src="../packages/Main/dist/itowns.js"></script>
<script src="js/GUI/LoadingScreen.js"></script>
<script src="../dist/debug.js"></script>
<script src="../packages/Main/dist/debug.js"></script>
<script src="js/GUI/GuiTools.js"></script>
<script type="text/javascript">
// # Orthographic viewer
Expand Down
2 changes: 1 addition & 1 deletion examples/effects_postprocessing.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</head>
<body>
<div id="viewerDiv"></div>
<script src="../dist/itowns.js"></script>
<script src="../packages/Main/dist/itowns.js"></script>
<script src="js/GUI/LoadingScreen.js"></script>
<!-- from https://github.com/mrdoob/three.js/blob/master/examples/js/shaders/DotScreenShader.js -->
<script type="x-shader/x-vertex" id="vertexshader">
Expand Down
4 changes: 2 additions & 2 deletions examples/effects_split.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<div id="viewerDiv"></div>
<div id="splitSlider"></div>
<script src="js/GUI/GuiTools.js"></script>
<script src="../dist/itowns.js"></script>
<script src="../dist/debug.js"></script>
<script src="../packages/Main/dist/itowns.js"></script>
<script src="../packages/Main/dist/debug.js"></script>
<script src="js/GUI/LoadingScreen.js"></script>
<script type="text/javascript">
// # Simple Globe viewer
Expand Down
4 changes: 2 additions & 2 deletions examples/effects_stereo.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
</div>
</div>
<script src="js/GUI/GuiTools.js"></script>
<script src="../dist/itowns.js"></script>
<script src="../packages/Main/dist/itowns.js"></script>
<script src="js/GUI/LoadingScreen.js"></script>
<script src="../dist/debug.js"></script>
<script src="../packages/Main/dist/debug.js"></script>

<script type="importmap">
{
Expand Down
4 changes: 2 additions & 2 deletions examples/entwine_3d_loader.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<div id="viewerDiv">
</div>

<script src="../dist/itowns.js"></script>
<script src="../packages/Main/dist/itowns.js"></script>
<script src="js/GUI/LoadingScreen.js"></script>
<script src="../dist/debug.js"></script>
<script src="../packages/Main/dist/debug.js"></script>
<script type="text/javascript">
var debugGui = new dat.GUI();
var viewerDiv = document.getElementById('viewerDiv');
Expand Down
Loading
Loading