-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Kjetil Sletten <[email protected]>
- Loading branch information
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { build } from "../../esbuild.js"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
import { fileURLToPath } from "url"; | ||
import { createRequire } from "module"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
const require = createRequire(import.meta.url); | ||
|
||
const turfPackageJsonPath = path.join( | ||
path.dirname(require.resolve("@turf/turf/package.json")), | ||
"package.json" | ||
); | ||
const turfPackageJson = JSON.parse(fs.readFileSync(turfPackageJsonPath, "utf8")); | ||
|
||
const turfDependencies = Object.keys(turfPackageJson.dependencies).filter((dep) => | ||
dep.startsWith("@turf/") | ||
); | ||
|
||
turfDependencies.push("@turf/turf"); | ||
|
||
await Promise.all( | ||
turfDependencies.map((submodule) => { | ||
const entryPoint = path.join( | ||
__dirname, | ||
"../../node_modules", | ||
submodule, | ||
"dist", | ||
"esm", | ||
"index.js" | ||
); | ||
|
||
const outfile = path.join("dist", `${submodule.replace("@turf/", "")}.min.js`); | ||
|
||
return build({ | ||
entryPoints: [entryPoint], | ||
outfile, | ||
}); | ||
}) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "turf", | ||
"version": "0.0.0", | ||
"description": "An ESM version of Turf-packages for Finn", | ||
"type": "module", | ||
"scripts": { | ||
"copy": "echo 'noop';", | ||
"build": "node ./esbuild.js", | ||
"eik:login": "eik login", | ||
"eik:publish": "eik publish", | ||
"eik:alias": "eik npm-alias", | ||
"eik:publish:ci": "../../scripts/publish.js turf @turf/turf" | ||
}, | ||
"dependencies": { | ||
"@turf/turf": "7.1.0" | ||
}, | ||
"devDependencies": { | ||
"esbuild": "0.24.0" | ||
}, | ||
"eik": { | ||
"name": "turf", | ||
"server": "https://assets.finn.no", | ||
"type": "npm", | ||
"files": "dist" | ||
} | ||
} |