forked from qlik-oss/sn-pivot-table
-
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.
chore: update build scripts (qlik-oss#95)
- Loading branch information
Showing
7 changed files
with
108 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ dist/ | |
sn-pivot-table-ext/ | ||
coverage/ | ||
example/ | ||
core/esm/ |
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,8 @@ | ||
{ | ||
"module": "esm/index.js", | ||
"peerDependencies": { | ||
"@nebula.js/stardust": "2.x", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#! /usr/bin/env node | ||
/* eslint-disable no-console */ | ||
|
||
const yargs = require('yargs'); | ||
const fs = require('fs-extra'); | ||
const path = require('path'); | ||
const build = require('@nebula.js/cli-build'); | ||
const sense = require('@nebula.js/cli-sense'); | ||
|
||
const args = yargs(process.argv.slice(2)).argv; | ||
const buildExt = args.ext; | ||
const buildCore = args.core; | ||
const mode = args.mode || 'production'; | ||
const watch = args.w; | ||
const sourcemap = mode !== 'production'; | ||
|
||
// cleanup old build | ||
fs.removeSync(path.resolve(process.cwd(), 'dist')); | ||
fs.removeSync(path.resolve(process.cwd(), 'core/esm')); | ||
if (buildExt) { | ||
fs.removeSync(path.resolve(process.cwd(), 'sn-pivot-table-ext')); | ||
} | ||
|
||
const buildArgs = {}; | ||
|
||
const buildExtension = async () => { | ||
console.log('---> BUILDING EXTENSION'); | ||
await sense({ output: 'sn-pivot-table-ext', sourcemap }); | ||
}; | ||
|
||
if (buildCore) { | ||
buildArgs.core = 'core'; | ||
} | ||
|
||
if (mode === 'production') { | ||
buildArgs.sourcemap = false; | ||
} else { | ||
buildArgs.mode = mode; | ||
} | ||
|
||
if (watch) { | ||
buildArgs.watch = true; | ||
} | ||
|
||
const main = async () => { | ||
console.log('---> BUILDING SUPERNOVA'); | ||
const watcher = await build(buildArgs); | ||
if (buildExt) { | ||
buildExtension(); | ||
if (watch) { | ||
watcher.on('event', (event) => { | ||
if (event.code === 'BUNDLE_END') { | ||
buildExtension(); | ||
} | ||
}); | ||
} | ||
} | ||
}; | ||
|
||
main(); |
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,23 @@ | ||
/* eslint-disable no-console */ | ||
const path = require('path'); | ||
const os = require('os'); | ||
const fs = require('fs-extra'); | ||
|
||
function copyExt() { | ||
const targetPath = [os.homedir(), 'Qlik', 'Sense', 'Extensions', 'sn-pivot-table-ext']; | ||
if (os.platform() === 'win32') { | ||
targetPath.splice(1, 0, 'Documents'); | ||
} | ||
|
||
const target = path.resolve(...targetPath); | ||
|
||
fs.copySync(path.resolve(process.cwd(), 'sn-pivot-table-ext'), target); | ||
console.log('Copied into Extensions folder!'); | ||
} | ||
|
||
if (require.main === module) { | ||
// execute if running directly from CLI | ||
copyExt(); | ||
} | ||
|
||
module.exports = copyExt; |
This file was deleted.
Oops, something went wrong.