Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix build.js utils to follow correct order of build steps #1018

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 22 additions & 15 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable powerbi-visuals/non-literal-fs-path */
const fs = require("fs-extra");
const jsyaml = require("js-yaml");
const multirun = require("multirun");
Expand Down Expand Up @@ -96,13 +97,13 @@ const devSequence = [

let COMMANDS = {
// Remove the entire build directory
cleanup: () => { fs.remove("dist"); fs.remove(".tmp") },
cleanup: async () => { await fs.remove("dist"); await fs.remove(".tmp") },

// Create necessary directories
makedirs: [
() => fs.mkdirs("dist/styles"),
() => fs.mkdirs("dist/data"),
() => fs.mkdirs("dist/scripts/core/expression")
async () => fs.mkdirs("dist/styles"),
async () => fs.mkdirs("dist/data"),
async () => fs.mkdirs("dist/scripts/core/expression")
],

dtsBundle: [
Expand All @@ -114,29 +115,35 @@ let COMMANDS = {

// Copy files
copy: [
() =>
fs.copy(
"src/core/expression/parser.d.ts",
"dist/scripts/core/expression/parser.d.ts"
),
async () => {
const parserPath = "src/core/expression/parser.d.ts";
if (await fs.ensureFile(parserPath)) {
await fs.copy(
parserPath,
"dist/scripts/core/expression/parser.d.ts"
)
} else {
console.error(`${parserPath} not found`);
}
},

// Copy all of the public files
isProd
? () => copyFolder("./public", "./dist")
? async () => copyFolder("./public", "./dist")
: [
() => copyFolder("./public", "./dist"),
() => copyFolder("./public_test", "./dist")
async () => copyFolder("./public", "./dist"),
async () => copyFolder("./public_test", "./dist")
],

// Copy all of the extensions
() => copyFolder("./extensions", "./dist/extensions"),
async () => copyFolder("./extensions", "./dist/extensions"),

// Copy all of the datasets
() => copyFolder("./datasets", "./dist/datasets")
async () => copyFolder("./datasets", "./dist/datasets")
],

// Convert the THIRD_PARTY.yml to json
third_party_data: () =>
third_party_data: async () =>
yamlToJSON("THIRD_PARTY.yml", "dist/data/THIRD_PARTY.json"),

// Convert the config.yml to config.js
Expand Down