-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
458b9d3
commit 0fce8c7
Showing
24 changed files
with
8,154 additions
and
17,506 deletions.
There are no files selected for viewing
100 changes: 0 additions & 100 deletions
100
.yarn/patches/modular-scripts-npm-3.6.0-d967962075.patch
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,45 +1,60 @@ | ||
import fs from "node:fs"; | ||
import path from "node:path"; | ||
import { argv } from "node:process"; | ||
import { fileURLToPath } from "node:url"; | ||
import { deleteSync } from "del"; | ||
import esbuild from "esbuild"; | ||
import fs from "fs-extra"; | ||
|
||
const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
const buildFolder = path.join(__dirname, "../../../dist/salt-ds-ag-grid-theme"); | ||
const FILES_TO_COPY = ["README.md", "LICENSE", "CHANGELOG.md", "package.json"]; | ||
|
||
const cwd = process.cwd(); | ||
const packageJson = ( | ||
await import(path.join("file://", cwd, "package.json"), { | ||
with: { type: "json" }, | ||
}) | ||
).default; | ||
const buildFolder = packageJson.publishConfig.directory; | ||
const packageName = packageJson.name; | ||
|
||
console.log(`Building ${packageName}`); | ||
|
||
deleteSync([buildFolder], { force: true }); | ||
|
||
esbuild | ||
.build({ | ||
absWorkingDir: path.resolve(__dirname, ".."), | ||
entryPoints: ["salt-ag-theme.css"], | ||
assetNames: "[dir]/[name]", | ||
outdir: buildFolder, | ||
loader: { | ||
".woff": "file", | ||
}, | ||
write: true, | ||
bundle: true, | ||
logLevel: "info", | ||
watch: argv.includes("--watch"), | ||
}) | ||
.then(() => { | ||
// File destination.txt will be created or overwritten by default. | ||
fs.copyFile( | ||
path.resolve(__dirname, "../package.json"), | ||
path.join(buildFolder, "package.json"), | ||
(err) => { | ||
if (err) throw err; | ||
console.log( | ||
`${path.relative( | ||
process.cwd(), | ||
path.resolve(__dirname, "../package.json"), | ||
)} copied to ${path.relative( | ||
process.cwd(), | ||
path.join(buildFolder, "package.json"), | ||
)}`, | ||
); | ||
}, | ||
const context = await esbuild.context({ | ||
absWorkingDir: cwd, | ||
entryPoints: ["salt-ag-theme.css"], | ||
assetNames: "[dir]/[name]", | ||
outdir: buildFolder, | ||
loader: { | ||
".woff": "file", | ||
}, | ||
write: true, | ||
bundle: true, | ||
logLevel: "info", | ||
}); | ||
|
||
if (argv.includes("--watch")) { | ||
await context.watch(); | ||
} else { | ||
await context.rebuild(); | ||
await context.dispose(); | ||
} | ||
|
||
for (const file of FILES_TO_COPY) { | ||
const from = path.join(cwd, file); | ||
const to = path.join(buildFolder, file); | ||
try { | ||
await fs.copyFile(from, to); | ||
console.log( | ||
`${path.relative(process.cwd(), from)} copied to ${path.relative( | ||
process.cwd(), | ||
to, | ||
)}`, | ||
); | ||
}); | ||
} catch (error) { | ||
if (error.code !== "ENOENT") { | ||
throw error; | ||
} | ||
} | ||
} | ||
|
||
console.log(`Built ${packageName} into ${buildFolder}`); |
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
File renamed without changes.
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
Oops, something went wrong.