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

Fix path issues that prevent Windows build #16156

Merged
merged 3 commits into from
Aug 5, 2023
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions ui/build/build.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,19 +705,19 @@ module.exports.generate = function () {
return new Promise((resolve) => {
const list = []

const plugins = [
...glob.sync(resolvePath('src/plugins/*.json')),
resolvePath('src/Brand.json'),
resolvePath('src/Lang.json')
]
const plugins = glob.sync([
'src/plugins/*.json',
'src/Brand.json',
'src/Lang.json'
], { cwd: root, absolute: true })
.filter(file => !path.basename(file).startsWith('__'))
.map(fillAPI('plugin', list))

const directives = glob.sync(resolvePath('src/directives/*.json'))
const directives = glob.sync('src/directives/*.json', { cwd: root, absolute: true })
.filter(file => !path.basename(file).startsWith('__'))
.map(fillAPI('directive', list))

const components = glob.sync(resolvePath('src/components/**/Q*.json'))
const components = glob.sync('src/components/**/Q*.json', { cwd: root, absolute: true })
.filter(file => !path.basename(file).startsWith('__'))
.map(fillAPI('component', list))

Expand Down
6 changes: 3 additions & 3 deletions ui/build/build.icon-sets.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ const glob = require('fast-glob')

const { writeFile, convertToCjs, logError } = require('./build.utils')

const root = path.resolve(__dirname, '..')
function resolve (_path) {
return path.resolve(__dirname, '..', _path)
return path.resolve(root, _path)
}

const cjsBanner = setName => `/**
Expand Down Expand Up @@ -194,9 +195,8 @@ function generateSvgFile (type) {

function generateCjsCounterparts () {
const promises = []

try {
glob.sync(resolve('icon-set/*.mjs'))
glob.sync(resolve('icon-set/*.mjs'), { cwd: root , absolute:true })
.forEach(file => {
const content = fs.readFileSync(file, 'utf-8')
const cjsFile = file.replace('.mjs', '.js')
Expand Down
3 changes: 1 addition & 2 deletions ui/build/build.lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ function parse (prop, txt) {
module.exports.generate = function () {
const languages = []
const promises = []

try {
glob.sync(resolve('lang/*.mjs'))
glob.sync('lang/*.mjs', { cwd: root, absolute: true })
.forEach(file => {
const content = fs.readFileSync(file, 'utf-8')
const isoName = parse('isoName', content)
Expand Down
10 changes: 5 additions & 5 deletions ui/build/build.transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function lowerCamelCase (name) {
}

function addComponents (map, autoImport) {
glob.sync(resolvePath('src/components/**/Q*.js'))
glob.sync('src/components/**/Q*.js', { cwd: root, absolute: true })
.filter(file => sourceFileSuffixRE.test(file) === false)
.map(relative)
.forEach(file => {
Expand All @@ -42,7 +42,7 @@ function addComponents (map, autoImport) {
}

function addDirectives (map, autoImport) {
glob.sync(resolvePath('src/directives/*.js'))
glob.sync('src/directives/*.js', { cwd: root, absolute: true })
.filter(file => sourceFileSuffixRE.test(file) === false)
.map(relative)
.forEach(file => {
Expand All @@ -58,7 +58,7 @@ function addDirectives (map, autoImport) {
}

function addPlugins (map) {
glob.sync(resolvePath('src/plugins/*.js'))
glob.sync('src/plugins/*.js', { cwd: root, absolute: true })
.filter(file => sourceFileSuffixRE.test(file) === false)
.map(relative)
.forEach(file => {
Expand All @@ -68,7 +68,7 @@ function addPlugins (map) {
}

function addComposables (map) {
glob.sync(resolvePath('src/composables/*.js'))
glob.sync('src/composables/*.js', { cwd: root, absolute: true })
.filter(file => sourceFileSuffixRE.test(file) === false)
.map(relative)
.forEach(file => {
Expand All @@ -78,7 +78,7 @@ function addComposables (map) {
}

function addUtils (map) {
glob.sync(resolvePath('src/utils/*.js'))
glob.sync('src/utils/*.js', { cwd: root, absolute: true })
.filter(file => sourceFileSuffixRE.test(file) === false)
.map(relative)
.forEach(file => {
Expand Down
11 changes: 6 additions & 5 deletions ui/build/prepare-diff.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs')
const path = require('path')
const { sync: fastGlob } = require('fast-glob')
const { sync: fastGlob, convertPathToPattern } = require('fast-glob')
const { createPatch } = require('diff')
const { highlight } = require('cli-highlight')

Expand All @@ -21,20 +21,21 @@ function relative (_path) {
* @param {string} locationPath
*/
module.exports = function prepareDiff (locationPath) {
let absolutePath = resolve(locationPath)
const absolutePath = resolve(locationPath)

// If there is no "old" file/folder, then there is no diff (everything will be new)
if (!fs.existsSync(absolutePath)) {
return
}

let pattern = convertPathToPattern(absolutePath)
// If it's a directory, then query all files in it
if (fs.lstatSync(absolutePath).isDirectory()) {
absolutePath += '/*'
pattern += '/*'
}

const originalsMap = new Map()
const originalFiles = fastGlob(absolutePath)
const originalFiles = fastGlob(pattern)

// If no files, then there is no diff (everything will be new)
if (originalFiles.length === 0) {
Expand All @@ -50,7 +51,7 @@ module.exports = function prepareDiff (locationPath) {
process.on('exit', code => {
if (code !== 0) { return }

const currentFiles = fastGlob(absolutePath)
const currentFiles = fastGlob(pattern)
const currentMap = new Map()

let somethingChanged = false
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.14.1",
"fast-glob": "^3.2.7",
"fast-glob": "^3.3.0",
"module-alias": "^2.2.2",
"postcss-rtlcss": "^4.0.6",
"prettier": "^2.8.3",
Expand Down
13 changes: 12 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5243,7 +5243,7 @@ fast-diff@^1.2.0:
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==

[email protected], fast-glob@^3.1.1, fast-glob@^3.2.12, fast-glob@^3.2.7:
[email protected], fast-glob@^3.1.1, fast-glob@^3.2.12:
version "3.2.12"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80"
integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==
Expand All @@ -5254,6 +5254,17 @@ [email protected], fast-glob@^3.1.1, fast-glob@^3.2.12, fast-glob@^3.2.7:
merge2 "^1.3.0"
micromatch "^4.0.4"

fast-glob@^3.3.0:
version "3.3.1"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.1.tgz#784b4e897340f3dbbef17413b3f11acf03c874c4"
integrity sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==
dependencies:
"@nodelib/fs.stat" "^2.0.2"
"@nodelib/fs.walk" "^1.2.3"
glob-parent "^5.1.2"
merge2 "^1.3.0"
micromatch "^4.0.4"

fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
Expand Down
Loading