Skip to content

Commit

Permalink
replace gulp with plain Node fs.cp to avoid gulp/vinyl breakage by No…
Browse files Browse the repository at this point in the history
  • Loading branch information
trusktr committed Apr 28, 2024
1 parent 7dee5cc commit 730f6da
Show file tree
Hide file tree
Showing 6 changed files with 4,667 additions and 32 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.DS_Store
node_modules
package-lock.json

*.log
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

22 changes: 20 additions & 2 deletions bin/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ exports.showName = showName
// on Node.js module lookup algo (calling them directly might fail if they are
// not in PATH)
const tscBin = path.resolve(require.resolve('typescript'), '..', '..', 'bin', 'tsc')
const gulpBin = path.resolve(require.resolve('gulp'), '..', 'bin', 'gulp.js')
const babelBin = path.resolve(require.resolve('@babel/cli'), '..', 'bin', 'babel.js')
const prettierBin = path.resolve(require.resolve('prettier'), '..', 'bin', 'prettier.cjs')
const playwrightBin = path.resolve(require.resolve('playwright'), '..', 'cli.js')
Expand Down Expand Up @@ -75,13 +74,32 @@ async function dev() {
if (opts.verbose) console.log(`===> Done running the "dev" command.\n`)
}

const srcDir = path.join(process.cwd(), 'src')
const distDir = path.join(process.cwd(), 'dist')

exports.copyAssets = copyAssets
async function copyAssets() {
if (opts.verbose) console.log(`===> Running the "copyAssets" command.\n`)
await exec(`node ${gulpBin} --cwd ${process.cwd()} --gulpfile ./node_modules/@lume/cli/config/gulpfile.js copyAssets`)

await fs.promises.cp(srcDir, distDir, {
recursive: true,
filter(src) {
if (src.endsWith('.tsx') || (src.endsWith('.ts') && !src.endsWith('.d.ts'))) return false
return true
}
})

if (opts.verbose) console.log(`===> Done running the "copyAssets" command.\n`)
}

async function mkDist() {
try {
await fs.promises.mkdir(distDir)
} catch (e) {
if (e.code !== 'EEXIST') throw e
}
}

exports.buildTs = buildTs
async function buildTs({noFail = opts.noFail} = {}) {
if (opts.verbose) console.log(`===> Running the "buildTs" command.\n`)
Expand Down
27 changes: 0 additions & 27 deletions config/gulpfile.js

This file was deleted.

Loading

0 comments on commit 730f6da

Please sign in to comment.