Include the full build in the ol package

This commit is contained in:
Tim Schaub
2022-08-28 13:02:23 -05:00
parent 96ffd4113f
commit 219fb093c1
5 changed files with 35 additions and 10 deletions

View File

@@ -103,8 +103,8 @@ jobs:
- name: Build the Package - name: Build the Package
run: npm run build-package run: npm run build-package
- name: Generate the Legacy Build - name: Generate the Full Build
run: "npm run build-legacy && npx eslint --rule 'import/no-duplicates: off' --fix build/index.js" run: "npm run build-full"
rendering: rendering:
name: Rendering name: Rendering

View File

@@ -0,0 +1,20 @@
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
export default {
input: 'build/index.js',
output: {
name: 'ol',
format: 'umd',
exports: 'default',
file: 'build/full/ol.js',
globals: {
geotiff: 'geotiff',
},
},
plugins: [
resolve({moduleDirectories: ['build', 'node_modules']}),
commonjs(),
],
external: ['geotiff'],
};

View File

@@ -20,9 +20,9 @@
"start": "npm run serve-examples", "start": "npm run serve-examples",
"serve-examples": "webpack serve --config examples/webpack/config.mjs --mode development", "serve-examples": "webpack serve --config examples/webpack/config.mjs --mode development",
"build-examples": "shx rm -rf build/examples && webpack --config examples/webpack/config.mjs --mode production", "build-examples": "shx rm -rf build/examples && webpack --config examples/webpack/config.mjs --mode production",
"build-package": "npm run transpile && npm run copy-css && npm run generate-types && node tasks/prepare-package.js", "build-package": "npm run build-full && npm run copy-css && npm run generate-types && node tasks/prepare-package.js",
"build-index": "shx rm -f build/index.js && npm run build-package && node tasks/generate-index.js", "build-index": "shx rm -f build/index.js && npm run transpile && node tasks/generate-index.js",
"build-legacy": "shx rm -rf build/legacy && npm run build-index && webpack --config config/webpack-config-legacy-build.mjs && cleancss --source-map src/ol/ol.css -o build/legacy/ol.css", "build-full": "shx rm -rf build/full && npm run build-index && npx rollup --config config/rollup-full-build.js",
"copy-css": "shx cp src/ol/ol.css build/ol/ol.css", "copy-css": "shx cp src/ol/ol.css build/ol/ol.css",
"generate-types": "tsc --project config/tsconfig-build.json --declaration --declarationMap --emitDeclarationOnly --outdir build/ol", "generate-types": "tsc --project config/tsconfig-build.json --declaration --declarationMap --emitDeclarationOnly --outdir build/ol",
"transpile": "shx rm -rf build/ol && shx mkdir -p build/ol && shx cp -rf src/ol build && node tasks/serialize-workers.cjs", "transpile": "shx rm -rf build/ol && shx mkdir -p build/ol && shx cp -rf src/ol build && node tasks/serialize-workers.cjs",

View File

@@ -71,9 +71,9 @@ echo "Building API docs for ${version}"
npm run apidoc npm run apidoc
mv build/apidoc ${build}/en/${version}/ mv build/apidoc ${build}/en/${version}/
echo "Building the legacy build for ${version}" echo "Building the package ${version}"
npm run build-legacy npm run build-package
mv build/legacy ${build}/en/${version}/ mv build/ol ${build}/en/${version}/
if [[ "${latest}" == "${version}" ]] ; then if [[ "${latest}" == "${version}" ]] ; then
echo "Copying to en/latest" echo "Copying to en/latest"
@@ -84,7 +84,7 @@ if [[ "${latest}" == "${version}" ]] ; then
zip -r ${OLDPWD}/build/${version}-site.zip . -x "en/${version}/*" zip -r ${OLDPWD}/build/${version}-site.zip . -x "en/${version}/*"
popd popd
pushd ${build}/en/${version}/legacy pushd ${build}/en/${version}/ol
zip -r ${OLDPWD}/build/${version}-legacy.zip . zip -r ${OLDPWD}/build/${version}-package.zip .
popd popd
fi fi

View File

@@ -5,6 +5,8 @@ import {fileURLToPath} from 'url';
const baseDir = dirname(fileURLToPath(import.meta.url)); const baseDir = dirname(fileURLToPath(import.meta.url));
const buildDir = path.resolve(baseDir, '../build/ol'); const buildDir = path.resolve(baseDir, '../build/ol');
const fullBuildSource = path.resolve(baseDir, '../build/full/ol.js');
const fullBuildDest = path.join(buildDir, 'dist/index.js');
async function main() { async function main() {
const pkg = await fse.readJSON(path.resolve(baseDir, '../package.json')); const pkg = await fse.readJSON(path.resolve(baseDir, '../package.json'));
@@ -37,6 +39,9 @@ async function main() {
path.resolve(baseDir, '../LICENSE.md'), path.resolve(baseDir, '../LICENSE.md'),
path.join(buildDir, 'LICENSE.md') path.join(buildDir, 'LICENSE.md')
); );
await fse.ensureDir(dirname(fullBuildDest));
await fse.copyFile(fullBuildSource, fullBuildDest);
} }
/** /**